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,5 +1,6 @@
1
1
  module OoxmlParser
2
- class HyperlinkForHover
2
+ # Class for parsing `hlinkHover` tags
3
+ class HyperlinkForHover < OOXMLDocumentObject
3
4
  attr_accessor :id, :action, :sound
4
5
 
5
6
  def initialize(id = '', action = '')
@@ -7,17 +8,19 @@ module OoxmlParser
7
8
  @action = action
8
9
  end
9
10
 
10
- def self.parse(hyperlink_for_hover_node)
11
- hyperlink_for_hover = HyperlinkForHover.new
12
- hyperlink_for_hover.id = hyperlink_for_hover_node.attribute('id').value
13
- hyperlink_for_hover.action = hyperlink_for_hover_node.attribute('action').value
14
- hyperlink_for_hover_node.xpath('*').each do |hyperlink_for_hover_node_child|
11
+ # Parse HyperlinkForHover
12
+ # @param [Nokogiri::XML:Node] node with NumberingProperties
13
+ # @return [HyperlinkForHover] result of parsing
14
+ def parse(node)
15
+ @id = node.attribute('id').value
16
+ @action = node.attribute('action').value
17
+ node.xpath('*').each do |hyperlink_for_hover_node_child|
15
18
  case hyperlink_for_hover_node_child.name
16
19
  when 'snd'
17
- hyperlink_for_hover.sound = Sound.parse(hyperlink_for_hover_node_child)
20
+ @sound = Sound.new(parent: self).parse(hyperlink_for_hover_node_child)
18
21
  end
19
22
  end
20
- hyperlink_for_hover
23
+ self
21
24
  end
22
25
  end
23
26
  end
@@ -1,30 +1,34 @@
1
- require_relative 'shapes_grouping/grouping_properties'
2
1
  module OoxmlParser
3
- class ShapesGrouping
2
+ # Class for parsing `grpSp`
3
+ class ShapesGrouping < OOXMLDocumentObject
4
4
  attr_accessor :elements, :properties
5
5
 
6
- def initialize(elements = [])
7
- @elements = elements
6
+ def initialize(parent: nil)
7
+ @elements = []
8
+ @parent = parent
8
9
  end
9
10
 
10
- def self.parse(grouping_node)
11
- grouping = ShapesGrouping.new
12
- grouping_node.xpath('*').each do |grouping_node_child|
13
- case grouping_node_child.name
14
- when 'nvGrpSpPr'
11
+ # Parse ShapesGrouping object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [ShapesGrouping] result of parsing
14
+ def parse(node)
15
+ node.xpath('*').each do |child_node|
16
+ case child_node.name
15
17
  when 'grpSpPr'
16
- grouping.properties = GroupingProperties.parse(grouping_node_child)
18
+ @properties = DocxShapeProperties.new(parent: self).parse(child_node)
17
19
  when 'pic'
18
- grouping.elements << DocxPicture.parse(grouping_node_child)
20
+ @elements << DocxPicture.new(parent: self).parse(child_node)
19
21
  when 'sp'
20
- grouping.elements << PresentationShape.parse(grouping_node_child).dup
22
+ @elements << DocxShape.new(parent: self).parse(child_node).dup
21
23
  when 'grpSp'
22
- grouping.elements << parse(grouping_node_child)
24
+ @elements << ShapesGrouping.new(parent: self).parse(child_node)
23
25
  when 'graphicFrame'
24
- grouping.elements << GraphicFrame.parse(grouping_node_child)
26
+ @elements << GraphicFrame.new(parent: self).parse(child_node)
27
+ when 'wsp'
28
+ @elements << DocxShape.new(parent: self).parse(child_node)
25
29
  end
26
30
  end
27
- grouping
31
+ self
28
32
  end
29
33
  end
30
34
  end
@@ -1,22 +1,27 @@
1
1
  module OoxmlParser
2
- class AnimationEffect
2
+ class AnimationEffect < OOXMLDocumentObject
3
3
  attr_accessor :transition, :filter, :behavior
4
4
 
5
- def initialize(behavior = nil)
6
- @behavior = behavior
7
- end
5
+ # Parse AnimationEffect object
6
+ # @param node [Nokogiri::XML:Element] node to parse
7
+ # @return [AnimationEffect] result of parsing
8
+ def parse(node)
9
+ node.attributes.each do |key, value|
10
+ case key
11
+ when 'transition'
12
+ @transition = value.value
13
+ when 'filter'
14
+ @filter = value.value
15
+ end
16
+ end
8
17
 
9
- def self.parse(animation_effect_node)
10
- animation_effect = AnimationEffect.new
11
- animation_effect.transition = animation_effect_node.attribute('transition').value if animation_effect_node.attribute('transition')
12
- animation_effect.filter = animation_effect_node.attribute('filter').value if animation_effect_node.attribute('filter')
13
- animation_effect_node.xpath('*').each do |animation_effect_node_child|
14
- case animation_effect_node_child.name
18
+ node.xpath('*').each do |node_child|
19
+ case node_child.name
15
20
  when 'cBhvr'
16
- animation_effect.behavior = Behavior.parse(animation_effect_node_child)
21
+ @behavior = Behavior.new(parent: self).parse(node_child)
17
22
  end
18
23
  end
19
- animation_effect
24
+ self
20
25
  end
21
26
  end
22
27
  end
@@ -1,29 +1,30 @@
1
1
  require_relative 'target_element'
2
2
  module OoxmlParser
3
- class Behavior
3
+ class Behavior < OOXMLDocumentObject
4
4
  attr_accessor :common_time_node, :attribute_name_list, :target
5
5
 
6
- def initialize(common_time_node = nil, attribute_name_list = [], target = nil)
7
- @common_time_node = common_time_node
8
- @attribute_name_list = attribute_name_list
9
- @target = target
6
+ def initialize(parent: nil)
7
+ @attribute_name_list = []
8
+ @parent = parent
10
9
  end
11
10
 
12
- def self.parse(behavior_node)
13
- behavior = Behavior.new
14
- behavior_node.xpath('*').each do |behavior_node_child|
15
- case behavior_node_child.name
11
+ # Parse Behavior object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [Behavior] result of parsing
14
+ def parse(node)
15
+ node.xpath('*').each do |node_child|
16
+ case node_child.name
16
17
  when 'cTn'
17
- behavior.common_time_node = CommonTiming.parse(behavior_node_child)
18
+ @common_time_node = CommonTiming.new(parent: self).parse(node_child)
18
19
  when 'tgtEl'
19
- behavior.target = TargetElement.parse(behavior_node_child)
20
+ @target = TargetElement.new(parent: self).parse(node_child)
20
21
  when 'attrNameLst'
21
- behavior_node_child.xpath('p:attrName').each do |attribute_name_node|
22
- behavior.attribute_name_list << attribute_name_node.text
22
+ node_child.xpath('p:attrName').each do |attribute_name_node|
23
+ @attribute_name_list << attribute_name_node.text
23
24
  end
24
25
  end
25
26
  end
26
- behavior
27
+ self
27
28
  end
28
29
  end
29
30
  end
@@ -1,31 +1,34 @@
1
1
  module OoxmlParser
2
- class TargetElement
2
+ class TargetElement < OOXMLDocumentObject
3
3
  attr_accessor :type, :id, :name, :built_in
4
4
 
5
- def initialize(type = '', id = '')
5
+ def initialize(type = '', id = '', parent: nil)
6
6
  @type = type
7
7
  @id = id
8
+ @parent = parent
8
9
  end
9
10
 
10
- def self.parse(target_node)
11
- target = TargetElement.new
12
- target_node.xpath('*').each do |target_node_child|
13
- case target_node_child.name
11
+ # Parse TargetElement object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [TargetElement] result of parsing
14
+ def parse(node)
15
+ node.xpath('*').each do |node_child|
16
+ case node_child.name
14
17
  when 'sldTgt'
15
- target.type = :slide
18
+ @type = :slide
16
19
  when 'sndTgt'
17
- target.type = :sound
18
- target.name = target_node_child.attribute('name').value
19
- target.built_in = target_node_child.attribute('builtIn').value ? StringHelper.to_bool(target_node_child.attribute('builtIn').value) : false
20
+ @type = :sound
21
+ @name = node_child.attribute('name').value
22
+ @built_in = node_child.attribute('builtIn').value ? StringHelper.to_bool(node_child.attribute('builtIn').value) : false
20
23
  when 'spTgt'
21
- target.type = :shape
22
- target.id = target_node_child.attribute('spid').value
24
+ @type = :shape
25
+ @id = node_child.attribute('spid').value
23
26
  when 'inkTgt'
24
- target.type = :ink
25
- target.id = target_node_child.attribute('spid').value
27
+ @type = :ink
28
+ @id = node_child.attribute('spid').value
26
29
  end
27
30
  end
28
- target
31
+ self
29
32
  end
30
33
  end
31
34
  end
@@ -1,22 +1,20 @@
1
1
  require_relative 'behavior/behavior'
2
2
 
3
3
  module OoxmlParser
4
- class SetTimeNode
4
+ class SetTimeNode < OOXMLDocumentObject
5
5
  attr_accessor :behavior, :to
6
6
 
7
- def initialize(behavior = nil)
8
- @behavior = behavior
9
- end
10
-
11
- def self.parse(set_time_node)
12
- set_time = SetTimeNode.new
13
- set_time_node.xpath('*').each do |set_time_node_child|
14
- case set_time_node_child.name
7
+ # Parse SetTimeNode object
8
+ # @param node [Nokogiri::XML:Element] node to parse
9
+ # @return [SetTimeNode] result of parsing
10
+ def parse(node)
11
+ node.xpath('*').each do |node_child|
12
+ case node_child.name
15
13
  when 'cBhvr'
16
- set_time.behavior = Behavior.parse(set_time_node_child)
14
+ @behavior = Behavior.new(parent: self).parse(node_child)
17
15
  end
18
16
  end
19
- set_time
17
+ self
20
18
  end
21
19
  end
22
20
  end
@@ -1,24 +1,27 @@
1
1
  module OoxmlParser
2
- class Condition
2
+ # Class for parsing `cond` tags
3
+ class Condition < OOXMLDocumentObject
3
4
  attr_accessor :event, :delay, :duration
4
5
 
5
- def initialize(event = nil, delay = nil, duration = nil)
6
- @event = event
7
- @delay = delay
8
- @duration = duration
9
- end
10
-
11
- def self.parse(condition_node)
12
- condition = Condition.new
13
- condition.event = condition_node.attribute('evt').value if condition_node.attribute('evt')
14
- condition.delay = condition_node.attribute('delay').value if condition_node.attribute('delay')
15
- condition
6
+ # Parse Condition
7
+ # @param node [Nokogiri::XML::Element] node to parse
8
+ # @return [Condition] value of SheetFormatProperties
9
+ def parse(node)
10
+ node.attributes.each do |key, value|
11
+ case key
12
+ when 'evt'
13
+ @event = value.value
14
+ when 'delay'
15
+ @delay = value.value
16
+ end
17
+ end
18
+ self
16
19
  end
17
20
 
18
21
  def self.parse_list(conditions_list_node)
19
22
  conditions = []
20
23
  conditions_list_node.xpath('p:cond').each do |condition_node|
21
- conditions << Condition.parse(condition_node)
24
+ conditions << Condition.new(parent: conditions).parse(condition_node)
22
25
  end
23
26
  conditions
24
27
  end
@@ -3,31 +3,39 @@ module OoxmlParser
3
3
  class CommonTiming
4
4
  attr_accessor :id, :duration, :restart, :children, :start_conditions, :end_conditions
5
5
 
6
- def initialize
7
- @id = nil
8
- @duration = nil
9
- @restart = nil
6
+ def initialize(parent: nil)
10
7
  @children = []
11
8
  @start_conditions = []
12
9
  @end_conditions = []
10
+ @parent = parent
13
11
  end
14
12
 
15
- def self.parse(common_time_node)
16
- common_timing = CommonTiming.new
17
- common_timing.duration = common_time_node.attribute('dur').value unless common_time_node.attribute('dur').nil?
18
- common_timing.restart = common_time_node.attribute('restart').value unless common_time_node.attribute('restart').nil?
19
- common_timing.id = common_time_node.attribute('id').value
20
- common_time_node.xpath('*').each do |common_time_node_child|
21
- case common_time_node_child.name
13
+ # Parse CommonTiming object
14
+ # @param node [Nokogiri::XML:Element] node to parse
15
+ # @return [CommonTiming] result of parsing
16
+ def parse(node)
17
+ node.attributes.each do |key, value|
18
+ case key
19
+ when 'dur'
20
+ @duration = value.value
21
+ when 'restart'
22
+ @restart = value.value
23
+ when 'id'
24
+ @id = value.value
25
+ end
26
+ end
27
+
28
+ node.xpath('*').each do |node_child|
29
+ case node_child.name
22
30
  when 'stCondLst'
23
- common_timing.start_conditions = Condition.parse_list(common_time_node_child)
31
+ @start_conditions = Condition.parse_list(node_child)
24
32
  when 'endCondLst'
25
- common_timing.end_conditions = Condition.parse_list(common_time_node_child)
33
+ @end_conditions = Condition.parse_list(node_child)
26
34
  when 'childTnLst'
27
- common_timing.children = TimeNode.parse_list(common_time_node_child)
35
+ @children = TimeNode.parse_list(node_child)
28
36
  end
29
37
  end
30
- common_timing
38
+ self
31
39
  end
32
40
  end
33
41
  end
@@ -2,28 +2,30 @@ require_relative 'time_node/common_timing'
2
2
  require_relative 'animation_effect/animation_effect'
3
3
  require_relative 'set_time_node/set_time_node'
4
4
  module OoxmlParser
5
- class TimeNode
5
+ # Class for parsing TimeNode tags
6
+ class TimeNode < OOXMLDocumentObject
6
7
  attr_accessor :type, :common_time_node, :previous_conditions_list, :next_conditions_list
7
8
 
8
- def initialize(type = nil, common_time_node = nil, previous_conditions_list = [], next_conditions_list = [])
9
+ def initialize(type = nil, parent: nil)
9
10
  @type = type
10
- @common_time_node = common_time_node
11
- @previous_conditions_list = previous_conditions_list
12
- @next_conditions_list = next_conditions_list
11
+ @previous_conditions_list = []
12
+ @next_conditions_list = []
13
+ @parent = parent
13
14
  end
14
15
 
15
- def self.parse(time_node, type)
16
- time = TimeNode.new
17
- time.type = type
18
- time_node.xpath('*').each do |time_node_child|
19
- case time_node_child.name
16
+ # Parse TimeNode
17
+ # @param node [Nokogiri::XML::Element] node to parse
18
+ # @return [TimeNode] value of SheetFormatProperties
19
+ def parse(node)
20
+ node.xpath('*').each do |node_child|
21
+ case node_child.name
20
22
  when 'cTn'
21
- time.common_time_node = CommonTiming.parse(time_node_child)
23
+ @common_time_node = CommonTiming.new(parent: self).parse(node_child)
22
24
  when 'prevCondLst'
23
- time.previous_conditions_list = Condition.parse_list(time_node_child)
25
+ @previous_conditions_list = Condition.parse_list(node_child)
24
26
  end
25
27
  end
26
- time
28
+ self
27
29
  end
28
30
 
29
31
  def self.parse_list(timing_list_node)
@@ -31,17 +33,17 @@ module OoxmlParser
31
33
  timing_list_node.xpath('*').each do |time_node|
32
34
  case time_node.name
33
35
  when 'par'
34
- timings << TimeNode.parse(time_node, :parallel)
36
+ timings << TimeNode.new(:parallel, parent: timings).parse(time_node)
35
37
  when 'seq'
36
- timings << TimeNode.parse(time_node, :sequence)
38
+ timings << TimeNode.new(:sequence, parent: timings).parse(time_node)
37
39
  when 'excl'
38
- timings << TimeNode.parse(time_node, :exclusive)
40
+ timings << TimeNode.new(:exclusive, parent: timings).parse(time_node)
39
41
  when 'anim'
40
- timings << TimeNode.parse(time_node, :animate)
42
+ timings << TimeNode.new(:animate, parent: timings).parse(time_node)
41
43
  when 'set'
42
- timings << SetTimeNode.parse(time_node)
44
+ timings << SetTimeNode.new(parent: timings).parse(time_node)
43
45
  when 'animEffect'
44
- timings << AnimationEffect.parse(time_node)
46
+ timings << AnimationEffect.new(parent: timings).parse(time_node)
45
47
  when 'video'
46
48
  timings << :video
47
49
  when 'audio'
@@ -1,23 +1,27 @@
1
1
  require_relative 'timing/time_node'
2
2
  module OoxmlParser
3
- class Timing
3
+ # Class for parsing `timing`
4
+ class Timing < OOXMLDocumentObject
4
5
  attr_accessor :time_node_list, :build_list, :extension_list
5
6
 
6
- def initialize(time_node_list = [], build_list = [], extension_list = [])
7
- @time_node_list = time_node_list
8
- @build_list = build_list
9
- @extension_list = extension_list
7
+ def initialize(parent: nil)
8
+ @time_node_list = []
9
+ @build_list = []
10
+ @extension_list = []
11
+ @parent = parent
10
12
  end
11
13
 
12
- def self.parse(timing_node)
13
- timing = Timing.new
14
- timing_node.xpath('*').each do |timing_node_child|
15
- case timing_node_child.name
14
+ # Parse Timing object
15
+ # @param node [Nokogiri::XML:Element] node to parse
16
+ # @return [Timing] result of parsing
17
+ def parse(node)
18
+ node.xpath('*').each do |node_child|
19
+ case node_child.name
16
20
  when 'tnLst'
17
- timing.time_node_list = TimeNode.parse_list(timing_node_child)
21
+ @time_node_list = TimeNode.parse_list(node_child)
18
22
  end
19
23
  end
20
- timing
24
+ self
21
25
  end
22
26
  end
23
27
  end
@@ -0,0 +1,52 @@
1
+ module OoxmlParser
2
+ # Methods to help working with slide data
3
+ module SlideHelper
4
+ def nonempty_elements
5
+ @elements.select { |cur_shape| !cur_shape.text_body.paragraphs.first.characters.empty? }
6
+ end
7
+
8
+ def graphic_frames
9
+ @elements.select { |cur_element| cur_element.is_a?(GraphicFrame) }
10
+ end
11
+
12
+ # Get transform property of object, by object type
13
+ # @param object [Symbol] type of object: :image, :chart, :table, :shape
14
+ # @return [OOXMLDocumentObject] needed object
15
+ def transform_of_object(object)
16
+ case object
17
+ when :image
18
+ elements.find { |e| e.is_a? Picture }.properties.transform
19
+ when :chart
20
+ elements.find { |e| e.is_a? GraphicFrame }.transform
21
+ when :table
22
+ elements.find { |e| e.is_a? GraphicFrame }.transform
23
+ when :shape
24
+ elements.find { |e| !e.shape_properties.preset.nil? }.shape_properties.transform
25
+ else
26
+ raise "Dont know this type object - #{object}"
27
+ end
28
+ end
29
+
30
+ def content_horizontal_align(object, slide_size)
31
+ transform = transform_of_object(object)
32
+ return :left if transform.offset.x.zero?
33
+ return :center if OoxmlSize.new((slide_size.width.value / 2) - (transform.extents.x.value / 2)) == OoxmlSize.new(transform.offset.x.value)
34
+ return :right if OoxmlSize.new((slide_size.width.value - transform.extents.x.value)) == OoxmlSize.new(transform.offset.x.value)
35
+ :unknown
36
+ end
37
+
38
+ def content_vertical_align(object, slide_size)
39
+ transform = transform_of_object(object)
40
+ return :top if transform.offset.y.zero?
41
+ return :middle if OoxmlSize.new((slide_size.height.value / 2) - (transform.extents.y.value / 2)) == OoxmlSize.new(transform.offset.y.value)
42
+ return :bottom if OoxmlSize.new(slide_size.height.value - transform.extents.y.value) == OoxmlSize.new(transform.offset.y.value)
43
+ :unknown
44
+ end
45
+
46
+ def content_distribute(object, slide_size)
47
+ return [:horizontally, :vertically] if content_horizontal_align(object, slide_size) == :center && content_vertical_align(object, slide_size) == :middle
48
+ return [:horizontally] if content_horizontal_align(object, slide_size) == :center
49
+ return [:vertically] if content_vertical_align(object, slide_size) == :middle
50
+ end
51
+ end
52
+ end
@@ -1,17 +1,23 @@
1
1
  module OoxmlParser
2
+ # Class for parsing `snd` tags
2
3
  class Sound < OOXMLDocumentObject
3
- attr_accessor :path, :name
4
+ attr_accessor :name
5
+ # @return [FileReference] image structure
6
+ attr_accessor :file_reference
4
7
 
5
- def initialize(path = '', name = '')
8
+ def initialize(path = '', name = '', parent: nil)
6
9
  @path = path
7
10
  @name = name
11
+ @parent = parent
8
12
  end
9
13
 
10
- def self.parse(sound_node)
11
- sound = Sound.new
12
- sound.path = OOXMLDocumentObject.copy_media_file("#{OOXMLDocumentObject.root_subfolder}/#{get_link_from_rels(sound_node.attribute('embed').value).gsub('..', '')}")
13
- sound.name = sound_node.attribute('name').value
14
- sound
14
+ # Parse Sound
15
+ # @param [Nokogiri::XML:Node] node with NumberingProperties
16
+ # @return [Sound] result of parsing
17
+ def parse(node)
18
+ @file_reference = FileReference.new(parent: self).parse(node)
19
+ @name = node.attribute('name').value
20
+ self
15
21
  end
16
22
  end
17
23
  end
@@ -1,20 +1,22 @@
1
1
  require_relative 'sound_action/sound'
2
2
  module OoxmlParser
3
- class SoundAction
3
+ # Class for parsing SoundAction
4
+ class SoundAction < OOXMLDocumentObject
4
5
  attr_accessor :start_sound, :end_sound
5
6
 
6
- def self.parse(sound_action_node)
7
- return nil unless sound_action_node.name == 'sndAc'
8
- sound_action = SoundAction.new
9
- sound_action_node.xpath('*').each do |sound_action_node_child|
10
- case sound_action_node_child.name
7
+ # Parse HyperlinkForHover
8
+ # @param [Nokogiri::XML:Node] node with NumberingProperties
9
+ # @return [HyperlinkForHover] result of parsing
10
+ def parse(node)
11
+ node.xpath('*').each do |node_child|
12
+ case node_child.name
11
13
  when 'stSnd'
12
- sound_action.start_sound = Sound.parse(sound_action_node_child.xpath('p:snd').first) unless sound_action_node_child.xpath('p:snd').first.nil?
14
+ @start_sound = Sound.new(parent: self).parse(node_child.xpath('p:snd').first) unless node_child.xpath('p:snd').first.nil?
13
15
  when 'endSnd'
14
- sound_action.end_sound = Sound.parse(sound_action_node_child.xpath('p:snd').first) unless sound_action_node_child.xpath('p:snd').first.nil?
16
+ @end_sound = Sound.new(parent: self).parse(node_child.xpath('p:snd').first) unless node_child.xpath('p:snd').first.nil?
15
17
  end
16
18
  end
17
- sound_action
19
+ self
18
20
  end
19
21
  end
20
22
  end
@@ -4,29 +4,27 @@ module OoxmlParser
4
4
  class Transition < OOXMLDocumentObject
5
5
  attr_accessor :speed, :properties, :sound_action, :advance_on_click, :delay, :duration
6
6
 
7
- def initialize(properties = TransitionProperties.new)
8
- @properties = properties
9
- end
10
-
11
- def self.parse(transition_node)
12
- transition = Transition.new
13
- transition_node.xpath('*').each do |transition_node_child|
14
- transition.properties = TransitionProperties.parse(transition_node_child)
15
- transition.sound_action = SoundAction.parse(transition_node_child)
7
+ def parse(node)
8
+ node.xpath('*').each do |node_child|
9
+ @properties = TransitionProperties.new(parent: self).parse(node_child)
10
+ case node_child.name
11
+ when 'sndAc'
12
+ @sound_action = SoundAction.new(parent: self).parse(node_child)
13
+ end
16
14
  end
17
- transition_node.attributes.each do |key, value|
15
+ node.attributes.each do |key, value|
18
16
  case key
19
17
  when 'spd'
20
- transition.speed = value.value.to_sym
18
+ @speed = value.value.to_sym
21
19
  when 'advClick'
22
- transition.advance_on_click = OOXMLDocumentObject.option_enabled?(transition_node, key)
20
+ @advance_on_click = attribute_enabled?(value)
23
21
  when 'advTm'
24
- transition.delay = value.value.to_f / 1_000.0
22
+ @delay = value.value.to_f / 1_000.0
25
23
  when 'dur'
26
- transition.duration = value.value.to_f / 1_000.0
24
+ @duration = value.value.to_f / 1_000.0
27
25
  end
28
26
  end
29
- transition
27
+ self
30
28
  end
31
29
  end
32
30
  end