ooxml_parser 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (315) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -5
  3. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +19 -0
  4. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +18 -0
  5. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +19 -0
  6. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +20 -0
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +20 -14
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/order.rb +20 -0
  9. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_index.rb +20 -0
  10. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +15 -0
  11. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +31 -0
  12. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point_count.rb +20 -0
  13. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache.rb +31 -0
  14. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference.rb +25 -0
  15. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +23 -0
  16. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +39 -0
  17. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +32 -0
  18. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +81 -74
  19. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +20 -13
  20. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +15 -14
  21. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +15 -12
  22. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +15 -10
  23. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +22 -11
  24. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +24 -0
  25. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +34 -20
  26. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +9 -10
  27. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +18 -25
  28. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +4 -1
  29. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +23 -20
  30. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +15 -5
  31. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +104 -0
  32. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +17 -0
  33. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +31 -0
  34. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +30 -0
  35. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +17 -16
  36. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +34 -0
  37. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +12 -15
  38. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +15 -10
  39. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb +38 -0
  40. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb +21 -0
  41. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +29 -0
  42. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +22 -0
  43. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +29 -0
  44. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +26 -0
  45. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +27 -10
  46. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb +7 -4
  47. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +20 -11
  48. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +18 -15
  49. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +11 -9
  50. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb +39 -0
  51. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb +15 -27
  52. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +13 -9
  53. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +20 -23
  54. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +27 -22
  55. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip/alpha_mod_fix.rb +19 -0
  56. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +21 -0
  57. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +24 -0
  58. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list/shape_guide.rb +24 -0
  59. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry/shape_adjust_value_list.rb +31 -0
  60. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +24 -0
  61. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +3 -3
  62. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +22 -13
  63. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +20 -12
  64. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +9 -8
  65. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +15 -13
  66. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +14 -12
  67. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +15 -12
  68. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +18 -14
  69. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +12 -11
  70. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +20 -24
  71. data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -0
  72. data/lib/ooxml_parser/common_parser/common_data/color.rb +48 -182
  73. data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +15 -10
  74. data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +1 -63
  75. data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +17 -20
  76. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop/preset_color.rb +20 -0
  77. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +20 -7
  78. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +12 -11
  79. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +17 -17
  80. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +15 -9
  81. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +19 -16
  82. data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +10 -6
  83. data/lib/ooxml_parser/common_parser/common_data/font_style.rb +1 -61
  84. data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +33 -26
  85. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +97 -0
  86. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +23 -37
  87. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +71 -23
  88. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/language.rb +20 -0
  89. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +11 -7
  90. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +20 -0
  91. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +20 -0
  92. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +25 -0
  93. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +38 -0
  94. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +20 -0
  95. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +92 -40
  96. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +12 -8
  97. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +37 -0
  98. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +53 -0
  99. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +36 -0
  100. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +6 -6
  101. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tab_list/presentation_tab.rb +26 -0
  102. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tab_list.rb +36 -0
  103. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/paragraph_tab.rb +26 -0
  104. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +36 -0
  105. data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +11 -8
  106. data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +20 -12
  107. data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +13 -7
  108. data/lib/ooxml_parser/common_parser/common_data/relationships.rb +36 -4
  109. data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +12 -8
  110. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +18 -19
  111. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +9 -8
  112. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +23 -0
  113. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +17 -14
  114. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +16 -23
  115. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +21 -40
  116. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +23 -0
  117. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +42 -0
  118. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +50 -0
  119. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +23 -0
  120. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +28 -23
  121. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties/vertical_merge.rb +20 -0
  122. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +71 -69
  123. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +18 -10
  124. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +19 -17
  125. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +31 -48
  126. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +21 -0
  127. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +25 -19
  128. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +20 -0
  129. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +20 -10
  130. data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +20 -16
  131. data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +20 -0
  132. data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +27 -3
  133. data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +20 -13
  134. data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +54 -37
  135. data/lib/ooxml_parser/common_parser/common_data/table.rb +23 -17
  136. data/lib/ooxml_parser/common_parser/common_data/underline.rb +13 -10
  137. data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +29 -0
  138. data/lib/ooxml_parser/common_parser/parser.rb +32 -4
  139. data/lib/ooxml_parser/configuration.rb +3 -13
  140. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +1 -1
  141. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +16 -16
  142. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +18 -13
  143. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +20 -0
  144. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +18 -0
  145. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +37 -0
  146. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +43 -14
  147. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark.rb +21 -0
  148. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +19 -5
  149. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +20 -0
  150. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +21 -0
  151. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +24 -4
  152. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +14 -5
  153. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +27 -6
  154. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +15 -5
  155. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +14 -5
  156. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +23 -7
  157. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +16 -6
  158. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +20 -6
  159. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +25 -0
  160. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +25 -0
  161. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +4 -3
  162. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +36 -3
  163. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +20 -0
  164. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +20 -0
  165. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +26 -0
  166. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +31 -0
  167. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +27 -0
  168. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +19 -5
  169. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +52 -183
  170. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +89 -0
  171. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +23 -0
  172. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +21 -0
  173. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +24 -17
  174. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +7 -6
  175. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +15 -10
  176. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +43 -245
  177. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +19 -20
  178. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +24 -65
  179. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +41 -0
  180. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +31 -0
  181. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +146 -172
  182. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +45 -26
  183. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +20 -0
  184. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +20 -0
  185. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +20 -0
  186. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +20 -0
  187. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/start.rb +20 -0
  188. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +31 -0
  189. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +65 -0
  190. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +42 -0
  191. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition/abstract_numbering_id.rb +20 -0
  192. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +31 -0
  193. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +45 -0
  194. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +15 -4
  195. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +24 -13
  196. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +6 -12
  197. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +32 -0
  198. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +8 -9
  199. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +31 -24
  200. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +61 -64
  201. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +56 -0
  202. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +20 -0
  203. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +20 -0
  204. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +26 -0
  205. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +19 -0
  206. data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +49 -54
  207. data/lib/ooxml_parser/docx_parser/docx_parser.rb +2 -1
  208. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +1 -1
  209. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +13 -0
  210. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +15 -12
  211. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +1 -1
  212. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +11 -0
  213. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +21 -0
  214. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +19 -6
  215. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +27 -16
  216. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +13 -9
  217. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +11 -8
  218. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +19 -15
  219. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +17 -12
  220. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +15 -14
  221. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +18 -15
  222. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +9 -11
  223. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition.rb +16 -13
  224. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +23 -15
  225. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +21 -19
  226. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +15 -11
  227. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +52 -0
  228. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +13 -7
  229. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +11 -9
  230. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +13 -15
  231. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +9 -14
  232. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +30 -67
  233. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +11 -8
  234. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +6 -3
  235. data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +1 -1
  236. data/lib/ooxml_parser/version.rb +1 -1
  237. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +28 -0
  238. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +33 -0
  239. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +25 -0
  240. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +38 -0
  241. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +35 -0
  242. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +38 -0
  243. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +24 -0
  244. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +47 -0
  245. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +36 -0
  246. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +11 -0
  247. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +11 -10
  248. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +8 -10
  249. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +12 -12
  250. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +12 -10
  251. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +29 -8
  252. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +24 -0
  253. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +21 -0
  254. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +30 -0
  255. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +37 -0
  256. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +29 -10
  257. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +25 -0
  258. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +23 -29
  259. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/alignment.rb +15 -12
  260. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +70 -37
  261. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +16 -12
  262. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +31 -9
  263. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +34 -12
  264. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +20 -9
  265. data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +1 -1
  266. data/lib/ooxml_parser.rb +0 -1
  267. metadata +122 -58
  268. data/lib/ooxml_parser/common_parser/common_data/alingment.rb +0 -56
  269. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2007_chart_style.rb +0 -17
  270. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_style/office_2010_chart_style.rb +0 -17
  271. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_group_element.rb +0 -10
  272. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/group/docx_grouped_drawing.rb +0 -34
  273. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_gradient_color.rb +0 -30
  274. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/gradient_color/docx_single_gradient_color.rb +0 -6
  275. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/solid_color/docx_solid_color.rb +0 -10
  276. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_element.rb +0 -10
  277. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end/line_size.rb +0 -20
  278. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_style/docx_shape_style.rb +0 -5
  279. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/common_non_visual_properties.rb +0 -25
  280. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_properties.rb +0 -19
  281. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/non_visual_shape_properties.rb +0 -20
  282. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb +0 -28
  283. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_placeholder.rb +0 -18
  284. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/ooxml_shift.rb +0 -15
  285. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties/transform_effect.rb +0 -28
  286. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape_properties.rb +0 -13
  287. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/ooxml_text_box.rb +0 -26
  288. data/lib/ooxml_parser/common_parser/common_data/alternate_content/shape/text_body/text_body.rb +0 -23
  289. data/lib/ooxml_parser/common_parser/common_data/colors/image/stretching/fill_rectangle.rb +0 -22
  290. data/lib/ooxml_parser/common_parser/common_data/colors/image/stretching.rb +0 -12
  291. data/lib/ooxml_parser/common_parser/common_data/colors/image_properties.rb +0 -16
  292. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/strikeout.rb +0 -16
  293. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties/numbering_level.rb +0 -25
  294. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering/numbering_properties.rb +0 -69
  295. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering.rb +0 -18
  296. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_cell_margin.rb +0 -20
  297. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_elements.rb +0 -21
  298. data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/line_join.rb +0 -19
  299. data/lib/ooxml_parser/common_parser/common_data/table/properties/whole_table/table_cell_style.rb +0 -20
  300. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/operator.rb +0 -13
  301. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/bookmark.rb +0 -10
  302. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/paragraph_tab.rb +0 -19
  303. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style/style_parametres.rb +0 -35
  304. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/paragraph_style.rb +0 -56
  305. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/image.rb +0 -15
  306. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/size.rb +0 -84
  307. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping/grouping_properties.rb +0 -16
  308. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character/excel_comment_character_properties.rb +0 -27
  309. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment/excel_comment_character.rb +0 -25
  310. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position/xlsx_drawing_position_parameters.rb +0 -22
  311. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position.rb +0 -22
  312. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_shape_grouping.rb +0 -37
  313. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/foreground_color.rb +0 -25
  314. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style/ooxml_font.rb +0 -36
  315. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_table.rb +0 -30
@@ -1,23 +1,27 @@
1
1
  # Class for parsing Run Outline properties
2
2
  module OoxmlParser
3
+ # Class for parsing `w:ln` tags
3
4
  class Outline < OOXMLDocumentObject
4
5
  attr_accessor :width
5
6
  attr_accessor :color_scheme
6
7
 
7
- def initialize
8
- @width = 0
8
+ def initialize(parent: nil)
9
+ @width = OoxmlSize.new(0)
10
+ @parent = parent
9
11
  end
10
12
 
11
- def self.parse(node)
12
- outline = Outline.new
13
+ # Parse Outline object
14
+ # @param node [Nokogiri::XML:Element] node to parse
15
+ # @return [Outline] result of parsing
16
+ def parse(node)
13
17
  node.attributes.each do |key, value|
14
18
  case key
15
19
  when 'w'
16
- outline.width = (value.value.to_f / 12_699.3).round(2)
20
+ @width = OoxmlSize.new(value.value.to_f, :emu)
17
21
  end
18
22
  end
19
- outline.color_scheme = DocxColorScheme.parse(node)
20
- outline
23
+ @color_scheme = DocxColorScheme.new(parent: self).parse(node)
24
+ self
21
25
  end
22
26
  end
23
27
  end
@@ -0,0 +1,20 @@
1
+ module OoxmlParser
2
+ # Class for parsing `w:position` object
3
+ class Position < OOXMLDocumentObject
4
+ # @return [String] value of position
5
+ attr_accessor :value
6
+
7
+ # Parse Position
8
+ # @param [Nokogiri::XML:Node] node with Position
9
+ # @return [Position] result of parsing
10
+ def parse(node)
11
+ node.attributes.each do |key, value|
12
+ case key
13
+ when 'val'
14
+ @value = OoxmlSize.new(value.value.to_f, :half_point)
15
+ end
16
+ end
17
+ self
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module OoxmlParser
2
+ # Class for parsing `w:sz` object
3
+ class RunSpacing < OOXMLDocumentObject
4
+ # @return [Integer] value of size
5
+ attr_accessor :value
6
+
7
+ # Parse RunSpacing
8
+ # @param [Nokogiri::XML:Node] node with RunSpacing
9
+ # @return [RunSpacing] result of parsing
10
+ def parse(node)
11
+ node.attributes.each do |key, value|
12
+ case key
13
+ when 'val'
14
+ @value = OoxmlSize.new(value.value.to_f)
15
+ end
16
+ end
17
+ self
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,25 @@
1
+ module OoxmlParser
2
+ # Class for parsing `w:rStyle` object
3
+ class RunStyle < OOXMLDocumentObject
4
+ # @return [Integer] value of size
5
+ attr_accessor :value
6
+
7
+ # Parse RunStyle
8
+ # @param [Nokogiri::XML:Node] node with RunStyle
9
+ # @return [RunStyle] result of parsing
10
+ def parse(node)
11
+ node.attributes.each do |key, value|
12
+ case key
13
+ when 'val'
14
+ @value = value.value.to_s
15
+ end
16
+ end
17
+ self
18
+ end
19
+
20
+ # @return [DocumentStyle] style which was referenced in RunStyle
21
+ def referenced
22
+ root_object.document_style_by_id(@value)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,38 @@
1
+ module OoxmlParser
2
+ # Class for parsing `w:shd` object
3
+ class Shade < OOXMLDocumentObject
4
+ # @return [Symbol] value of shade
5
+ attr_accessor :value
6
+ # @return [Symbol] color of shade
7
+ attr_accessor :color
8
+ # @return [Color] fill of shade
9
+ attr_accessor :fill
10
+
11
+ def initialize(value: nil,
12
+ color: nil,
13
+ fill: nil,
14
+ parent: nil)
15
+ @value = value
16
+ @color = color
17
+ @fill = fill
18
+ @parent = parent
19
+ end
20
+
21
+ # Parse Shade
22
+ # @param [Nokogiri::XML:Node] node with Shade
23
+ # @return [Shade] result of parsing
24
+ def parse(node)
25
+ node.attributes.each do |key, value|
26
+ case key
27
+ when 'val'
28
+ @value = value.value.to_sym
29
+ when 'color'
30
+ @color = value.value.to_sym
31
+ when 'fill'
32
+ @fill = Color.new(parent: self).parse_hex_string(value.value.to_s)
33
+ end
34
+ end
35
+ self
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,20 @@
1
+ module OoxmlParser
2
+ # Class for parsing `w:sz` object
3
+ class Size < OOXMLDocumentObject
4
+ # @return [Integer] value of size
5
+ attr_accessor :value
6
+
7
+ # Parse Size
8
+ # @param [Nokogiri::XML:Node] node with Size
9
+ # @return [Size] result of parsing
10
+ def parse(node)
11
+ node.attributes.each do |key, value|
12
+ case key
13
+ when 'val'
14
+ @value = value.value.to_f
15
+ end
16
+ end
17
+ self
18
+ end
19
+ end
20
+ end
@@ -1,79 +1,131 @@
1
+ require_relative 'run_properties/language'
1
2
  require_relative 'run_properties/outline'
2
- require_relative 'run_properties/strikeout'
3
+ require_relative 'run_properties/position'
4
+ require_relative 'run_properties/size'
5
+ require_relative 'run_properties/run_spacing'
6
+ require_relative 'run_properties/run_style'
7
+ require_relative 'run_properties/shade'
3
8
  module OoxmlParser
9
+ # Data about `rPr` object
4
10
  class RunProperties < OOXMLDocumentObject
5
11
  attr_accessor :font_style, :font_color, :space, :dirty, :font_name, :font_size, :baseline, :hyperlink, :caps,
6
12
  :vertical_align, :outline
13
+ attr_accessor :shadow
14
+ attr_accessor :emboss
15
+ attr_accessor :vanish
16
+ attr_accessor :rtl
17
+ # @return [Size] get run size
18
+ attr_accessor :size
19
+ # @return [RunSpacing] get run spacing
20
+ attr_accessor :spacing
21
+ # @return [RunSpacing] get color
22
+ attr_accessor :color
23
+ # @return [Language] language property
24
+ attr_accessor :language
25
+ # @return [Position] position property
26
+ attr_accessor :position
27
+ # @return [Shade] shade property
28
+ attr_accessor :shade
29
+ # @return [RunStyle] run style
30
+ attr_accessor :run_style
31
+ # @return [Float]
32
+ # This element specifies the font size which shall be applied to all
33
+ # complex script characters in the contents of this run when displayed
34
+ attr_accessor :font_size_complex
7
35
 
8
- def initialize(font_name = '', font_style = FontStyle.new, font_color = nil, space = nil, baseline = :baseline)
9
- @font_name = font_name
10
- @font_style = font_style
11
- @font_color = font_color
12
- @space = space
13
- @baseline = baseline
36
+ def initialize(parent: nil)
37
+ @font_name = ''
38
+ @font_style = FontStyle.new
39
+ @baseline = :baseline
40
+ @parent = parent
14
41
  end
15
42
 
16
- def self.parse(character_props_node)
17
- character_properties = RunProperties.new
18
- character_properties.font_style = Presentation.current_font_style.dup
19
- character_props_node.attributes.each do |key, value|
43
+ # Parse RunProperties object
44
+ # @param node [Nokogiri::XML:Element] node to parse
45
+ # @return [RunProperties] result of parsing
46
+ def parse(node)
47
+ @font_style = Presentation.current_font_style.dup
48
+ node.attributes.each do |key, value|
20
49
  case key
21
50
  when 'sz'
22
- character_properties.font_size = value.value.to_f / 100.0
51
+ @font_size = value.value.to_f / 100.0
52
+ when 'szCs'
53
+ @font_size_complex = node.attribute('val').value.to_i / 2.0
23
54
  when 'spc'
24
- character_properties.space = (value.value.to_f / 2_834.0).round(2)
55
+ @space = OoxmlSize.new(value.value.to_f, :one_100th_point)
25
56
  when 'b'
26
- character_properties.font_style.bold = OOXMLDocumentObject.option_enabled?(character_props_node, 'b')
57
+ @font_style.bold = option_enabled?(node, 'b')
27
58
  when 'i'
28
- character_properties.font_style.italic = OOXMLDocumentObject.option_enabled?(character_props_node, 'i')
59
+ @font_style.italic = option_enabled?(node, 'i')
29
60
  when 'u'
30
- character_properties.font_style.underlined = Underline.parse(value.value)
61
+ @font_style.underlined = Underline.new(parent: self).parse(value.value)
31
62
  when 'strike'
32
- character_properties.font_style.strike = Strikeout.parse(value)
63
+ @font_style.strike = value_to_symbol(value)
33
64
  when 'baseline'
34
65
  case value.value.to_i
35
66
  when -25_000, -30_000
36
- character_properties.baseline = :subscript
67
+ @baseline = :subscript
37
68
  when 30_000
38
- character_properties.baseline = :superscript
69
+ @baseline = :superscript
39
70
  when 0
40
- character_properties.baseline = :baseline
71
+ @baseline = :baseline
41
72
  end
42
73
  when 'cap'
43
- character_properties.caps = value.value.to_sym
74
+ @caps = value.value.to_sym
44
75
  end
45
76
  end
46
- character_properties.font_color = DocxColorScheme.parse(character_props_node)
47
- character_props_node.xpath('*').each do |properties_element|
48
- case properties_element.name
77
+ node.xpath('*').each do |node_child|
78
+ case node_child.name
79
+ when 'sz'
80
+ @size = Size.new.parse(node_child)
81
+ when 'shadow'
82
+ @shadow = option_enabled?(node_child)
83
+ when 'emboss'
84
+ @emboss = option_enabled?(node_child)
85
+ when 'vanish'
86
+ @vanish = option_enabled?(node_child)
87
+ when 'rtl'
88
+ @rtl = option_enabled?(node_child)
89
+ when 'spacing'
90
+ @spacing = RunSpacing.new(parent: self).parse(node_child)
91
+ when 'color'
92
+ @color = Color.parse_color_tag(node_child)
49
93
  when 'solidFill'
50
- character_properties.font_color = Color.parse_color(properties_element.xpath('*').first)
94
+ @font_color = Color.parse_color(node_child.xpath('*').first)
51
95
  when 'latin'
52
- character_properties.font_name = properties_element.attribute('typeface').value
96
+ @font_name = node_child.attribute('typeface').value
53
97
  when 'b'
54
- character_properties.font_style.bold = OOXMLDocumentObject.option_enabled?(properties_element)
98
+ @font_style.bold = option_enabled?(node_child)
55
99
  when 'i'
56
- character_properties.font_style.italic = OOXMLDocumentObject.option_enabled?(properties_element, 'i')
100
+ @font_style.italic = option_enabled?(node_child, 'i')
57
101
  when 'u'
58
- character_properties.font_style.underlined = Underline.new(:single)
102
+ @font_style.underlined = Underline.new(:single)
59
103
  when 'vertAlign'
60
- character_properties.vertical_align = properties_element.attribute('val').value.to_sym
104
+ @vertical_align = node_child.attribute('val').value.to_sym
61
105
  when 'rFont'
62
- character_properties.font_name = properties_element.attribute('val').value
63
- when 'color'
64
- character_properties.font_color = Color.parse_color_tag(properties_element)
106
+ @font_name = node_child.attribute('val').value
107
+ when 'rFonts'
108
+ @font_name = node_child.attribute('ascii').value if node_child.attribute('ascii')
65
109
  when 'strike'
66
- character_properties.font_style.strike = OOXMLDocumentObject.option_enabled?(properties_element)
110
+ @font_style.strike = option_enabled?(node_child)
67
111
  when 'hlinkClick'
68
- character_properties.hyperlink = Hyperlink.parse(properties_element)
112
+ @hyperlink = Hyperlink.new(parent: self).parse(node_child)
69
113
  when 'ln'
70
- character_properties.outline = Outline.parse(properties_element)
114
+ @outline = Outline.new(parent: self).parse(node_child)
115
+ when 'lang'
116
+ @language = Language.new(parent: self).parse(node_child)
117
+ when 'position'
118
+ @position = Position.new(parent: self).parse(node_child)
119
+ when 'shd'
120
+ @shade = Shade.new(parent: self).parse(node_child)
121
+ when 'rStyle'
122
+ @run_style = RunStyle.new(parent: self).parse(node_child)
71
123
  end
72
124
  end
73
- character_properties.font_color = DocxColorScheme.parse(character_props_node)
74
- character_properties.font_name = Presentation.default_font_typeface if character_properties.font_name.empty?
75
- character_properties.font_size = Presentation.default_font_size if character_properties.font_size.nil?
76
- character_properties
125
+ @font_color = DocxColorScheme.new(parent: self).parse(node)
126
+ @font_name = Presentation.default_font_typeface if @font_name.empty?
127
+ @font_size = Presentation.default_font_size if @font_size.nil?
128
+ self
77
129
  end
78
130
  end
79
131
  end
@@ -1,24 +1,28 @@
1
1
  require_relative 'paragraph_run/run_properties'
2
2
  module OoxmlParser
3
+ # Class for parsing `r` tags
3
4
  class ParagraphRun < OOXMLDocumentObject
4
5
  attr_accessor :properties, :text
5
6
 
6
- def initialize(properties = RunProperties.new, text = '')
7
+ def initialize(properties = RunProperties.new, text = '', parent: nil)
7
8
  @properties = properties
8
9
  @text = text
10
+ @parent = parent
9
11
  end
10
12
 
11
- def self.parse(character_node)
12
- character = ParagraphRun.new
13
- character_node.xpath('*').each do |character_node_child|
14
- case character_node_child.name
13
+ # Parse ParagraphRun object
14
+ # @param node [Nokogiri::XML:Element] node to parse
15
+ # @return [ParagraphRun] result of parsing
16
+ def parse(node)
17
+ node.xpath('*').each do |node_child|
18
+ case node_child.name
15
19
  when 'rPr'
16
- character.properties = RunProperties.parse(character_node_child)
20
+ @properties = RunProperties.new(parent: self).parse(node_child)
17
21
  when 't'
18
- character.text = character_node_child.text
22
+ @text = node_child.text
19
23
  end
20
24
  end
21
- character
25
+ self
22
26
  end
23
27
  end
24
28
  end
@@ -0,0 +1,37 @@
1
+ module OoxmlParser
2
+ # Class for parsing `numPr` tags
3
+ class NumberingProperties < OOXMLDocumentObject
4
+ attr_accessor :size, :font, :symbol, :start_at, :type, :ilvl, :numbering_properties
5
+
6
+ def initialize(ilvl = 0, parent: nil)
7
+ @ilvl = ilvl
8
+ @parent = parent
9
+ end
10
+
11
+ def abstruct_numbering
12
+ root_object.numbering.properties_by_num_id(@numbering_properties)
13
+ end
14
+
15
+ # Parse NumberingProperties
16
+ # @param [Nokogiri::XML:Node] node with NumberingProperties
17
+ # @return [NumberingProperties] result of parsing
18
+ def parse(node)
19
+ node.xpath('*').each do |node_child|
20
+ case node_child.name
21
+ when 'ilvl'
22
+ @ilvl = node_child.attribute('val').value.to_i
23
+ when 'numId'
24
+ @numbering_properties = node_child.attribute('val').value.to_i
25
+ end
26
+ end
27
+ self
28
+ end
29
+
30
+ def numbering_level_current
31
+ abstruct_numbering.level_list.each do |current_ilvl|
32
+ return current_ilvl if current_ilvl.ilvl == @ilvl
33
+ end
34
+ nil
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,53 @@
1
+ module OoxmlParser
2
+ # Class for parsing `w:pBdr` element
3
+ class ParagraphBorders < OOXMLDocumentObject
4
+ # @return [BordersProperties] bottom properties
5
+ attr_accessor :bottom
6
+ # @return [BordersProperties] left properties
7
+ attr_accessor :left
8
+ # @return [BordersProperties] top properties
9
+ attr_accessor :top
10
+ # @return [BordersProperties] right properties
11
+ attr_accessor :right
12
+ # @return [BordersProperties] between properties
13
+ attr_accessor :between
14
+ # @return [BordersProperties] bar properties
15
+ attr_accessor :bar
16
+
17
+ def border_visual_type
18
+ result = []
19
+ result << :left if @left.val == :single
20
+ result << :right if @right.val == :single
21
+ result << :top if @top.val == :single
22
+ result << :bottom if @bottom.val == :single
23
+ result << :inner if @between.val == :single
24
+ return :none if result == []
25
+ return :all if result == [:left, :right, :top, :bottom, :inner]
26
+ return :outer if result == [:left, :right, :top, :bottom]
27
+ result.first if result.size == 1
28
+ end
29
+
30
+ # Parse Paragraph Borders data
31
+ # @param [Nokogiri::XML:Element] node with Paragraph Borders data
32
+ # @return [ParagraphBorders] value of Paragraph Borders data
33
+ def parse(node)
34
+ node.xpath('*').each do |node_child|
35
+ case node_child.name
36
+ when 'bottom'
37
+ @bottom = BordersProperties.new(parent: self).parse(node_child)
38
+ when 'left'
39
+ @left = BordersProperties.new(parent: self).parse(node_child)
40
+ when 'top'
41
+ @top = BordersProperties.new(parent: self).parse(node_child)
42
+ when 'right'
43
+ @right = BordersProperties.new(parent: self).parse(node_child)
44
+ when 'between'
45
+ @between = BordersProperties.new(parent: self).parse(node_child)
46
+ when 'bar'
47
+ @bar = BordersProperties.new(parent: self).parse(node_child)
48
+ end
49
+ end
50
+ self
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,36 @@
1
+ module OoxmlParser
2
+ # Class for parsing Paragraph Spacing in paragraph properties `w:spacing`
3
+ class ParagraphSpacing < OOXMLDocumentObject
4
+ # @return [OoxmlSize] value of before spacing
5
+ attr_accessor :before
6
+ # @return [OoxmlSize] value of after spacing
7
+ attr_accessor :after
8
+ # @return [OoxmlSize] value of line spacing
9
+ attr_accessor :line
10
+ # @return [Symbol] value of line rule style
11
+ attr_accessor :line_rule
12
+
13
+ # Parse Position
14
+ # @param [Nokogiri::XML:Node] node with Position
15
+ # @return [Position] result of parsing
16
+ def parse(node)
17
+ node.attributes.each do |key, value|
18
+ case key
19
+ when 'before'
20
+ @before = OoxmlSize.new(value.value.to_f)
21
+ when 'after'
22
+ @after = OoxmlSize.new(value.value.to_f)
23
+ when 'lineRule'
24
+ @line_rule = value.value.sub('atLeast', 'at_least').to_sym
25
+ when 'line'
26
+ @line = if @line_rule == :auto
27
+ OoxmlSize.new(value.value.to_f, :one_240th_cm)
28
+ else
29
+ OoxmlSize.new(value.value.to_f)
30
+ end
31
+ end
32
+ end
33
+ self
34
+ end
35
+ end
36
+ end
@@ -30,8 +30,10 @@ module OoxmlParser
30
30
  else
31
31
  self.line_rule = line_rule.to_sym if line_rule.instance_of?(String)
32
32
 
33
- if @before.to_f.round(2) == other.before.to_f.round(2) && @after.to_f.round(2) == other.after.to_f.round(2) &&
34
- @line.to_f.round(2) == other.line.to_f.round(2) && @line_rule.to_s == other.line_rule.to_s
33
+ if @before == other.before &&
34
+ @after == other.after &&
35
+ @line == other.line &&
36
+ @line_rule.to_s == other.line_rule.to_s
35
37
  return true
36
38
  else
37
39
  return false
@@ -87,11 +89,9 @@ module OoxmlParser
87
89
  node.xpath('*').each do |spacing_node_child|
88
90
  case spacing_node_child.name
89
91
  when 'spcPct'
90
- return (spacing_node_child.attribute('val').value.to_f / 100_000.0).round(2)
92
+ return OoxmlSize.new(spacing_node_child.attribute('val').value.to_f, :one_1000th_percent)
91
93
  when 'spcPts'
92
- return (spacing_node_child.attribute('val').value.to_f / 2_834.0).round(2)
93
- else
94
- return (spacing_node_child.attribute('val').value.to_f / 1_000.0).round(2)
94
+ return OoxmlSize.new(spacing_node_child.attribute('val').value.to_f, :spacing_point)
95
95
  end
96
96
  end
97
97
  end
@@ -0,0 +1,26 @@
1
+ module OoxmlParser
2
+ # Class for storing `a:tab` data
3
+ class PresentationTab < OOXMLDocumentObject
4
+ # @return [Symbol] Specifies the style of the tab.
5
+ attr_accessor :value
6
+ # @return [OOxmlSize] Specifies the position of the tab stop.
7
+ attr_accessor :position
8
+
9
+ alias align value
10
+
11
+ # Parse ParagraphTab object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [ParagraphTab] result of parsing
14
+ def parse(node)
15
+ node.attributes.each do |key, value|
16
+ case key
17
+ when 'algn'
18
+ @value = value_to_symbol(value)
19
+ when 'pos'
20
+ @position = OoxmlSize.new(value.value.to_f, :emu)
21
+ end
22
+ end
23
+ self
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,36 @@
1
+ require_relative 'tab_list/presentation_tab'
2
+ module OoxmlParser
3
+ # Class for working with `a:tabLst`
4
+ class TabList < OOXMLDocumentObject
5
+ # @return [Array, ParagraphTabs]
6
+ attr_accessor :tabs_array
7
+
8
+ def initialize(parent: nil)
9
+ @tabs_array = []
10
+ @parent = parent
11
+ end
12
+
13
+ # @return [Array, Column] accessor
14
+ def [](key)
15
+ @tabs_array[key]
16
+ end
17
+
18
+ # @return [True, False] if empty
19
+ def empty?
20
+ @tabs_array.empty?
21
+ end
22
+
23
+ # Parse Tabs data
24
+ # @param [Nokogiri::XML:Element] node with Tabs data
25
+ # @return [Tabs] value of Columns data
26
+ def parse(node)
27
+ node.xpath('*').each do |node_child|
28
+ case node_child.name
29
+ when 'tab'
30
+ @tabs_array << PresentationTab.new(parent: self).parse(node_child)
31
+ end
32
+ end
33
+ self
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,26 @@
1
+ module OoxmlParser
2
+ # Class for storing `w:tab` data
3
+ class ParagraphTab < OOXMLDocumentObject
4
+ # @return [Symbol] Specifies the style of the tab.
5
+ attr_accessor :value
6
+ # @return [OOxmlSize] Specifies the position of the tab stop.
7
+ attr_accessor :position
8
+
9
+ alias align value
10
+
11
+ # Parse ParagraphTab object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [ParagraphTab] result of parsing
14
+ def parse(node)
15
+ node.attributes.each do |key, value|
16
+ case key
17
+ when 'val'
18
+ @value = value.value.to_sym
19
+ when 'pos'
20
+ @position = OoxmlSize.new(value.value.to_f)
21
+ end
22
+ end
23
+ self
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,36 @@
1
+ require_relative 'tabs/paragraph_tab'
2
+ module OoxmlParser
3
+ # Class for working with `w:tabs`
4
+ class Tabs < OOXMLDocumentObject
5
+ # @return [Array, ParagraphTabs]
6
+ attr_accessor :tabs_array
7
+
8
+ def initialize(parent: nil)
9
+ @tabs_array = []
10
+ @parent = parent
11
+ end
12
+
13
+ # @return [Array, Column] accessor
14
+ def [](key)
15
+ @tabs_array[key]
16
+ end
17
+
18
+ # @return [True, False] if empty
19
+ def empty?
20
+ @tabs_array.empty?
21
+ end
22
+
23
+ # Parse Tabs data
24
+ # @param [Nokogiri::XML:Element] node with Tabs data
25
+ # @return [Tabs] value of Columns data
26
+ def parse(node)
27
+ node.xpath('*').each do |node_child|
28
+ case node_child.name
29
+ when 'tab'
30
+ @tabs_array << ParagraphTab.new(parent: self).parse(node_child)
31
+ end
32
+ end
33
+ self
34
+ end
35
+ end
36
+ end