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,17 +1,24 @@
1
1
  # noinspection RubyTooManyInstanceVariablesInspection
2
+ require_relative 'docx_paragraph_run/docx_paragraph_run_helpers'
3
+ require_relative 'docx_paragraph_run/object'
2
4
  require_relative 'docx_paragraph_run/text_outline'
3
5
  require_relative 'docx_paragraph_run/text_fill'
4
6
  require_relative 'docx_paragraph_run/shape'
5
7
 
6
8
  module OoxmlParser
7
9
  class DocxParagraphRun < OOXMLDocumentObject
10
+ include DocxParagraphRunHelpers
8
11
  attr_accessor :number, :font, :vertical_align, :size, :font_color, :background_color, :font_style, :text, :drawings,
9
- :link, :highlight, :shadow, :outline, :imprint, :emboss, :vanish, :effect, :caps, :w,
10
- :position, :rtl, :em, :cs, :spacing, :break, :touch, :shape, :footnote, :endnote, :fld_char, :style,
12
+ :link, :highlight, :effect, :caps, :w,
13
+ :position, :em, :spacing, :break, :touch, :shape, :footnote, :endnote, :fld_char, :style,
11
14
  :comments, :alternate_content, :page_number, :text_outline, :text_fill
12
15
  # @return [String] type of instruction used for upper level of run
13
16
  # http://officeopenxml.com/WPfieldInstructions.php
14
17
  attr_accessor :instruction
18
+ # @return [RunProperties] properties of run
19
+ attr_accessor :run_properties
20
+ # @return [RunObject] object of run
21
+ attr_accessor :object
15
22
 
16
23
  def initialize
17
24
  @number = 0
@@ -25,18 +32,11 @@ module OoxmlParser
25
32
  @drawings = []
26
33
  @link = nil
27
34
  @highlight = nil
28
- @shadow = nil
29
- @outline = nil
30
- @imprint = nil
31
- @emboss = nil
32
- @vanish = nil
33
35
  @effect = nil
34
36
  @caps = nil
35
37
  @w = false
36
38
  @position = 0.0
37
- @rtl = false
38
39
  @em = nil
39
- @cs = false
40
40
  @spacing = 0.0
41
41
  @break = false
42
42
  @touch = nil
@@ -50,6 +50,7 @@ module OoxmlParser
50
50
  @text_outline = nil
51
51
  @text_fill = nil
52
52
  @instruction = nil
53
+ @object = nil
53
54
  end
54
55
 
55
56
  def drawing
@@ -70,20 +71,12 @@ module OoxmlParser
70
71
  character.drawings = @drawings.clone
71
72
  character.link = @link
72
73
  character.highlight = @highlight
73
- character.shadow = @shadow
74
- character.outline = @outline
75
- character.imprint = @imprint
76
- character.emboss = @emboss
77
- character.vanish = @vanish
78
74
  character.effect = @effect
79
75
  character.caps = @caps
80
76
  character.w = @w
81
77
  character.position = @position
82
- character.rtl = @rtl
83
78
  character.em = @em
84
- character.cs = @cs
85
79
  character.spacing = @spacing
86
- character.cs = @cs
87
80
  character.break = @break
88
81
  character.touch = @touch
89
82
  character.footnote = @footnote
@@ -96,6 +89,8 @@ module OoxmlParser
96
89
  character.text_outline = @text_outline
97
90
  character.text_fill = @text_fill
98
91
  character.instruction = @instruction
92
+ character.run_properties = @run_properties
93
+ character.object = @object
99
94
  character
100
95
  end
101
96
 
@@ -111,249 +106,62 @@ module OoxmlParser
111
106
  true
112
107
  end
113
108
 
114
- def self.parse(character_pr_tag, character_style = DocxParagraphRun.new, default_character = @default_character)
115
- character_style.font_style = FontStyle.new
116
- character_pr_tag.xpath('w:rStyle').each do |r_style|
117
- style = get_style_by_id(r_style.attribute('val').value)
118
- break if style.nil?
119
- style.xpath('w:rPr').each do |style_rpr|
120
- character_style = parse(style_rpr, character_style, default_character)
121
- end
122
- end
123
- character_pr_tag.xpath('w:rFonts').each do |r_font|
124
- r_font.attributes.each do |font_attribute, value|
125
- case font_attribute
126
- when 'asciiTheme'
127
- character_style.font = parse_font_by_theme(r_font.attribute('asciiTheme').value)
128
- when 'ascii' # , 'hAnsi', 'eastAsia', 'cs'
129
- character_style.font = value.value
130
- break
131
- end
132
- end
133
- end
134
- character_pr_tag.xpath('w:highlight').each do |highlight|
135
- character_style.highlight = highlight.attribute('val').value
136
- end
137
- character_pr_tag.xpath('w:vertAlign').each do |vertical_align|
138
- character_style.vertical_align = vertical_align.attribute('val').value.to_sym
139
- end
140
- character_pr_tag.xpath('w:szCs').each do |sz|
141
- character_style.size = sz.attribute('val').value.to_i / 2.0
142
- end
143
- character_pr_tag.xpath('w:sz').each do |sz|
144
- character_style.size = sz.attribute('val').value.to_i / 2.0
145
- end
146
- character_pr_tag.xpath('w:color').each do |color|
147
- color.attributes.each do |key, value|
148
- case key
149
- when 'val'
150
- character_style.font_color = Color.from_int16(value.value)
151
- when 'themeColor'
152
- unless ThemeColors.list[value.value.to_sym].nil?
153
- if value.value == 'text2' || value.value == 'background2' || value.value.include?('accent') # Don't know why. Just works
154
- break
155
- else
156
- character_style.font_color = ThemeColors.list[value.value.to_sym].dup
157
- end
158
- end
159
- when 'themeShade'
160
- character_style.font_color.calculate_with_shade!(value.value.hex.to_f / 255.0)
161
- when 'themeTint'
162
- character_style.font_color.calculate_with_tint!(1.0 - (value.value.hex.to_f / 255.0))
163
- end
164
- end
165
- end
166
- character_pr_tag.xpath('w:shd').each do |shd|
167
- character_style.background_color = shd.attribute('fill').value
168
- unless shd.attribute('fill').value == 'auto' || shd.attribute('fill').value == '' || shd.attribute('fill').value == 'null'
169
- character_style.background_color = Color.from_int16(shd.attribute('fill').value)
170
- end
171
- end
172
- character_pr_tag.xpath('w:uCs').each do |u|
173
- character_style.font_style.underlined = Underline.new
174
- if !u.attribute('val').nil? && u.attribute('val').value != 'none' && u.attribute('val').value != false
175
- character_style.font_style.underlined.style = u.attribute('val').value
176
- unless u.attribute('color').nil?
177
- character_style.font_style.underlined.color = Color.from_int16(u.attribute('color').value)
178
- end
179
- else
180
- character_style.font_style.underlined = Underline.new
181
- end
182
- end
183
- character_pr_tag.xpath('w:u').each do |u|
184
- character_style.font_style.underlined = Underline.new
185
- if !u.attribute('val').nil? && u.attribute('val').value != 'none' && u.attribute('val').value != false
186
- character_style.font_style.underlined.style = u.attribute('val').value
187
- unless u.attribute('color').nil?
188
- character_style.font_style.underlined.color = Color.from_int16(u.attribute('color').value)
189
- end
190
- else
191
- character_style.font_style.underlined = Underline.new
192
- end
193
- end
194
- character_pr_tag.xpath('w:bCs').each do |b|
195
- character_style.font_style.bold = if b.attribute('val').nil? || b.attribute('val').value != 'false'
196
- true
197
- else
198
- false
199
- end
200
- end
201
- character_pr_tag.xpath('w:b').each do |b|
202
- character_style.font_style.bold = if b.attribute('val').nil? || b.attribute('val').value != 'false'
203
- true
204
- else
205
- false
206
- end
207
- end
208
- character_pr_tag.xpath('w:iCs').each do |i|
209
- next if i.attribute('val').nil?
210
- character_style.font_style.italic = if i.attribute('val').value != 'false'
211
- true
212
- else
213
- false
214
- end
215
- end
216
- character_pr_tag.xpath('w:i').each do |i|
217
- character_style.font_style.italic = if i.attribute('val').nil? || i.attribute('val').value != 'false'
218
- true
219
- else
220
- false
221
- end
222
- end
223
- character_pr_tag.xpath('w:strike').each do |strike|
224
- character_style.font_style.strike = if strike.attribute('val').nil? || strike.attribute('val').value != 'false' && strike.attribute('val').value != '0'
225
- :single
226
- else
227
- :none
228
- end
229
- end
230
- character_pr_tag.xpath('w:dstrike').each do |dstrike|
231
- if dstrike.attribute('val').nil?
232
- character_style.font_style.strike = :double
233
- elsif dstrike.attribute('val').value == '0' || dstrike.attribute('val').value == 'false'
234
- else
235
- character_style.font_style.strike = :double
236
- end
237
- end
238
- character_pr_tag.xpath('w:shadow').each do
239
- character_style.shadow = true
240
- end
241
- character_pr_tag.xpath('w:outline').each do
242
- character_style.outline = true
243
- end
244
- character_pr_tag.xpath('w:imprint').each do
245
- character_style.imprint = true
246
- end
247
- character_pr_tag.xpath('w:emboss').each do
248
- character_style.emboss = true
249
- end
250
- character_pr_tag.xpath('w:vanish').each do
251
- character_style.vanish = true
252
- end
253
- character_pr_tag.xpath('w:effect').each do |effect|
254
- character_style.effect = effect.attribute('val').value
255
- end
256
- character_pr_tag.xpath('w:caps').each do |caps|
257
- if caps.attribute('val').nil?
258
- character_style.caps = :caps
259
- elsif caps.attribute('val').value == 'false'
260
- else
261
- character_style.caps = :caps
262
- end
263
- end
264
- character_pr_tag.xpath('w:smallCaps').each do |small_caps|
265
- if small_caps.attribute('val').nil?
266
- character_style.caps = :small_caps
267
- elsif small_caps.attribute('val').value == 'false'
268
- else
269
- character_style.caps = :small_caps
270
- end
271
- end
272
- character_pr_tag.xpath('w:position').each do |position|
273
- character_style.position = (position.attribute('val').value.to_f / (28.0 + 1.0 / 3.0) / 2.0).round(1)
274
- end
275
- character_pr_tag.xpath('w:rtl').each do |rtl|
276
- character_style.rtl = OOXMLDocumentObject.option_enabled?(rtl)
277
- end
278
- character_pr_tag.xpath('w:em').each do |em|
279
- character_style.em = em.attribute('val').value
280
- end
281
- character_pr_tag.xpath('w:cs').each do |cs|
282
- character_style.cs = OOXMLDocumentObject.option_enabled?(cs)
283
- end
284
- character_pr_tag.xpath('w:spacing').each do |spacing|
285
- character_style.spacing = (spacing.attribute('val').value.to_f / 566.9).round(1)
286
- end
287
- character_pr_tag.xpath('w14:textOutline', 'xmlns:w14' => 'http://schemas.microsoft.com/office/word/2010/wordml').each do |text_outline|
288
- character_style.text_outline = TextOutline.parse(text_outline)
289
- text_outline.xpath('w14:prstDash', 'xmlns:w14' => 'http://schemas.microsoft.com/office/word/2010/wordml').each do |outline_style|
290
- character_style.touch = outline_style.attribute('val').value
291
- end
292
- end
293
- character_pr_tag.xpath('w14:textFill', 'xmlns:w14' => 'http://schemas.microsoft.com/office/word/2010/wordml').each do |text_fill|
294
- character_style.text_fill = TextFill.parse(text_fill)
295
- end
296
- character_style
297
- end
298
-
299
- def self.parse_character(r_tag, character_style, char_number)
300
- r_tag.xpath('*').each do |r_node_child|
301
- case r_node_child.name
109
+ def parse(r_tag, char_number, parent: nil)
110
+ @parent = parent
111
+ r_tag.xpath('*').each do |node_child|
112
+ case node_child.name
302
113
  when 'rPr'
303
- DocxParagraphRun.parse(r_node_child, character_style, @default_character)
114
+ parse_properties(node_child, DocumentStructure.default_run_style)
115
+ @run_properties = RunProperties.new(parent: self).parse(node_child)
304
116
  when 'instrText'
305
- if r_node_child.text.include?('HYPERLINK')
306
- hyperlink = Hyperlink.new(r_node_child.text.sub('HYPERLINK ', '').split(' \\o ').first, r_node_child.text.sub('HYPERLINK', '').split(' \\o ').last)
307
- character_style.link = hyperlink
308
- elsif r_node_child.text[/PAGE\s+\\\*/]
309
- character_style.text = '*PAGE NUMBER*'
117
+ if node_child.text.include?('HYPERLINK')
118
+ hyperlink = Hyperlink.new(node_child.text.sub('HYPERLINK ', '').split(' \\o ').first, node_child.text.sub('HYPERLINK', '').split(' \\o ').last)
119
+ @link = hyperlink
120
+ elsif node_child.text[/PAGE\s+\\\*/]
121
+ @text = '*PAGE NUMBER*'
310
122
  end
311
123
  when 'fldChar'
312
- character_style.fld_char = r_node_child.attribute('fldCharType').value.to_sym
124
+ @fld_char = node_child.attribute('fldCharType').value.to_sym
313
125
  when 't'
314
- character_style.text += r_node_child.text
126
+ @text += node_child.text
315
127
  when 'noBreakHyphen'
316
- character_style.text += '–'
128
+ @text += '–'
317
129
  when 'tab'
318
- character_style.text += "\t"
130
+ @text += "\t"
319
131
  when 'drawing'
320
- character_style.drawings << DocxDrawing.parse(r_node_child)
132
+ @drawings << DocxDrawing.new(parent: self).parse(node_child)
321
133
  when 'AlternateContent'
322
- character_style.alternate_content = AlternateContent.parse(r_node_child)
134
+ @alternate_content = AlternateContent.new(parent: self).parse(node_child)
323
135
  when 'br'
324
- if r_node_child.attribute('type').nil?
325
- character_style.break = :line
326
- character_style.text += "\r"
136
+ if node_child.attribute('type').nil?
137
+ @break = :line
138
+ @text += "\r"
327
139
  else
328
- case r_node_child.attribute('type').value
140
+ case node_child.attribute('type').value
329
141
  when 'page', 'column'
330
- character_style.break = r_node_child.attribute('type').value.to_sym
142
+ @break = node_child.attribute('type').value.to_sym
331
143
  end
332
144
  end
333
145
  when 'footnoteReference'
334
- character_style.footnote = HeaderFooter.new(:header)
335
- character_style.footnote.id = r_node_child.attribute('id').value.to_i
336
- character_style.footnote.parse('footnote', character_style.footnote.id, @default_paragraph, @default_character)
146
+ @footnote = HeaderFooter.new(parent: self).parse(node_child)
337
147
  when 'endnoteReference'
338
- character_style.endnote = HeaderFooter.new(:footer)
339
- character_style.endnote.id = r_node_child.attribute('id').value.to_i
340
- character_style.endnote.parse('endnote', character_style.endnote.id, @default_paragraph, @default_character)
148
+ @endnote = HeaderFooter.new(parent: self).parse(node_child)
341
149
  when 'pict'
342
- r_node_child.xpath('*').each do |pict_node_child|
150
+ node_child.xpath('*').each do |pict_node_child|
343
151
  case pict_node_child.name
344
152
  when 'shape'
345
- character_style.shape = Shape.parse(pict_node_child, :shape)
153
+ @shape = Shape.new(parent: self).parse(pict_node_child, :shape)
346
154
  when 'rect'
347
- character_style.shape = Shape.parse(pict_node_child, :rectangle)
155
+ @shape = Shape.new(parent: self).parse(pict_node_child, :rectangle)
348
156
  when 'oval'
349
- character_style.shape = Shape.parse(pict_node_child, :oval)
350
- when 'shapetype'
157
+ @shape = Shape.new(parent: self).parse(pict_node_child, :oval)
351
158
  end
352
159
  end
160
+ when 'object'
161
+ @object = RunObject.new(parent: self).parse(node_child)
353
162
  end
354
163
  end
355
- character_style.number = char_number
356
- character_style
164
+ @number = char_number
357
165
  end
358
166
 
359
167
  def self.parse_font_by_theme(theme)
@@ -374,15 +182,5 @@ module OoxmlParser
374
182
  end
375
183
  end
376
184
  end
377
-
378
- def self.get_style_by_id(id)
379
- doc = Nokogiri::XML(File.open("#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/styles.xml"))
380
- doc.search('//w:styles').each do |styles|
381
- styles.xpath('w:style').each do |style|
382
- return style if style.attribute('styleId').value == id
383
- end
384
- end
385
- nil
386
- end
387
185
  end
388
186
  end
@@ -1,46 +1,45 @@
1
1
  module OoxmlParser
2
- class FrameProperties
2
+ class FrameProperties < OOXMLDocumentObject
3
3
  attr_accessor :drop_cap, :lines, :wrap, :vertical_anchor, :horizontal_anchor, :width, :height, :height_rule,
4
4
  :horizontal_align, :vertical_align, :anchor_lock, :vertical_space, :horizontal_space,
5
5
  :horizontal_position, :vertical_position
6
6
 
7
- def self.parse(frame_pr_node)
8
- frame_properties = FrameProperties.new
9
- frame_pr_node.attributes.each do |key, value|
7
+ def parse(node)
8
+ node.attributes.each do |key, value|
10
9
  case key
11
10
  when 'dropCap'
12
- frame_properties.drop_cap = value.value.to_sym
11
+ @drop_cap = value.value.to_sym
13
12
  when 'lines'
14
- frame_properties.lines = value.value.to_i
13
+ @lines = value.value.to_i
15
14
  when 'wrap'
16
- frame_properties.lines = value.value.to_sym
15
+ @lines = value.value.to_sym
17
16
  when 'vAnchor'
18
- frame_properties.vertical_anchor = value.value.to_sym
17
+ @vertical_anchor = value.value.to_sym
19
18
  when 'hAnchor'
20
- frame_properties.horizontal_anchor = value.value.to_sym
19
+ @horizontal_anchor = value.value.to_sym
21
20
  when 'w'
22
- frame_properties.width = (value.value.to_f / 566.9).round(2)
21
+ @width = OoxmlSize.new(value.value.to_f)
23
22
  when 'h'
24
- frame_properties.height = (value.value.to_f / 566.9).round(2)
23
+ @height = OoxmlSize.new(value.value.to_f)
25
24
  when 'hRule'
26
- frame_properties.height_rule = value.value.to_s.sub('atLeast', 'at_least').to_sym
25
+ @height_rule = value.value.to_s.sub('atLeast', 'at_least').to_sym
27
26
  when 'xAlign'
28
- frame_properties.horizontal_align = value.value.to_sym
27
+ @horizontal_align = value.value.to_sym
29
28
  when 'yAlign'
30
- frame_properties.vertical_align = value.value.to_sym
29
+ @vertical_align = value.value.to_sym
31
30
  when 'anchorLock'
32
- frame_properties.anchor_lock = OOXMLDocumentObject.option_enabled?(frame_pr_node, 'anchorLock')
31
+ @anchor_lock = attribute_enabled?(value)
33
32
  when 'vSpace'
34
- frame_properties.vertical_space = (value.value.to_f / 566.9).round(2)
33
+ @vertical_space = OoxmlSize.new(value.value.to_f)
35
34
  when 'hSpace'
36
- frame_properties.horizontal_space = (value.value.to_f / 566.9).round(2)
35
+ @horizontal_space = OoxmlSize.new(value.value.to_f)
37
36
  when 'x'
38
- frame_properties.horizontal_position = (value.value.to_f / 566.9).round(2)
37
+ @horizontal_position = OoxmlSize.new(value.value.to_f)
39
38
  when 'y'
40
- frame_properties.vertical_position = (value.value.to_f / 566.9).round(2)
39
+ @vertical_position = OoxmlSize.new(value.value.to_f)
41
40
  end
42
41
  end
43
- frame_properties
42
+ self
44
43
  end
45
44
  end
46
45
  end
@@ -1,87 +1,46 @@
1
1
  module OoxmlParser
2
- class Indents
2
+ class Indents < OOXMLDocumentObject
3
3
  attr_accessor :first_line_indent, :left_indent, :right_indent, :hanging_indent
4
4
 
5
- def initialize(first_line_indent = 0.0, left_indent = 0.0, right_indent = 0.0, hanging_indent = nil)
5
+ def initialize(first_line_indent = OoxmlSize.new(0),
6
+ left_indent = OoxmlSize.new(0),
7
+ right_indent = OoxmlSize.new(0),
8
+ hanging_indent = OoxmlSize.new(0),
9
+ parent: nil)
6
10
  @first_line_indent = first_line_indent
7
11
  @left_indent = left_indent
8
12
  @right_indent = right_indent
9
13
  @hanging_indent = hanging_indent
14
+ @parent = parent
10
15
  end
11
16
 
12
- def ==(other)
13
- if self.class != NilClass && other.class != NilClass
14
- if @first_line_indent.to_f == other.first_line_indent.to_f &&
15
- @left_indent.to_f.round(2) == other.left_indent.to_f.round(2) &&
16
- @right_indent.to_f.round(1) == other.right_indent.to_f.round(1)
17
- return true if @hanging_indent.nil? || other.hanging_indent.nil?
18
- @hanging_indent.to_f == other.hanging_indent.to_f
19
- else
20
- false
21
- end
22
- else
23
- is_a?(NilClass) && other.is_a?(NilClass)
24
- end
25
- end
26
-
27
- def equal_with_round(other, delta = 0.02)
28
- if is_a?(NilClass) && other.is_a?(NilClass)
29
- true
30
- else
31
- @first_line_indent.to_f.round(2) == other.first_line_indent.to_f.round(2) &&
32
- @left_indent.to_f.round(2) == other.left_indent.to_f.round(2) &&
33
- @right_indent.to_f.round(2) == other.right_indent.to_f.round(2) &&
34
- (@hanging_indent.to_f.round(2) - other.hanging_indent.to_f.round(2)).to_f.abs < delta
35
- end
36
- end
17
+ alias first_line first_line_indent
18
+ alias left left_indent
19
+ alias right right_indent
20
+ alias hanging hanging_indent
37
21
 
38
22
  def to_s
39
23
  "first line indent: #{@first_line_indent}, left indent: #{@left_indent},
40
24
  right indent: #{@right_indent}, hanging indent: #{@hanging_indent}"
41
25
  end
42
26
 
43
- # Parse hash with indents
44
- # @return [Indents] parsed class
45
- def self.parse_indents_hash(hash)
46
- Indents.new(hash['first_line_indent'], hash['left_indent'], hash['right_indent'], hash['hanging_indent'])
47
- end
48
-
49
- # Increases indent, depending on clicks to "increase indent" button in canvas
50
- # @param [Integer] count count of clicks (default = 1)
51
- def increase_indent_by_button(count = 1)
52
- count.times { @left_indent += 1.25 }
53
- end
54
-
55
- # @return [Indents
56
- def copy
57
- Indents.new(@first_line_indent, @left_indent, @right_indent, @hanging_indent)
58
- end
59
-
60
- def round(digits_after_dot = 0)
61
- [:first_line_indent, :left_indent, :right_indent, :hanging_indent].each do |ind|
62
- send("#{ind}=", send(ind).round(digits_after_dot)) unless send(ind).nil?
63
- end
64
- self
65
- end
66
-
67
27
  # Parse Indents
68
28
  # @param [Nokogiri::XML:Element] node with Indents
69
29
  # @return [Indents] value of Indents
70
- def self.parse(node)
71
- indents = Indents.new
72
- unless node.attribute('firstLine').nil?
73
- indents.first_line_indent = (node.attribute('firstLine').value.to_f / 566.9).round(2)
74
- end
75
- unless node.attribute('left').nil?
76
- indents.left_indent = (node.attribute('left').value.to_f / 566.9).round(2)
77
- end
78
- unless node.attribute('right').nil?
79
- indents.right_indent = (node.attribute('right').value.to_f / 566.9).round(2)
80
- end
81
- unless node.attribute('hanging').nil?
82
- indents.hanging_indent = (node.attribute('hanging').value.to_f / 566.9).round(2)
30
+ def parse(node)
31
+ node.attributes.each do |key, value|
32
+ case key
33
+ when 'firstLine'
34
+ @first_line_indent = OoxmlSize.new(value.value.to_f)
35
+ when 'left'
36
+ @left_indent = OoxmlSize.new(value.value.to_f)
37
+ when 'right'
38
+ @right_indent = OoxmlSize.new(value.value.to_f)
39
+ when 'hanging'
40
+ @hanging_indent = OoxmlSize.new(value.value.to_f)
41
+ end
83
42
  end
84
- indents
43
+ self
85
44
  end
86
45
  end
87
46
  end
@@ -0,0 +1,41 @@
1
+ module OoxmlParser
2
+ # Class for parsing `w:ins` tag - Inserted Run Content
3
+ class Inserted < OOXMLDocumentObject
4
+ # @return [Integer] id of inserted
5
+ attr_accessor :id
6
+ # @return [String] author of insert
7
+ attr_accessor :author
8
+ # @return [Date] date of insert
9
+ attr_accessor :date
10
+ # @return [String] id of user
11
+ attr_accessor :user_id
12
+ # @return [ParagraphRun] inserted run
13
+ attr_accessor :run
14
+
15
+ # Parse Inserted object
16
+ # @param node [Nokogiri::XML:Element] node to parse
17
+ # @return [Inserted] result of parsing
18
+ def parse(node)
19
+ node.attributes.each do |key, value|
20
+ case key
21
+ when 'id'
22
+ @id = value.value.to_i
23
+ when 'author'
24
+ @author = value.value.to_s
25
+ when 'date'
26
+ @date = DateTime.parse(value.value.to_s)
27
+ when 'oouserid'
28
+ @user_id = value.value.to_s
29
+ end
30
+ end
31
+
32
+ node.xpath('*').each do |node_child|
33
+ case node_child.name
34
+ when 'r'
35
+ @run = ParagraphRun.new(parent: self).parse(node_child)
36
+ end
37
+ end
38
+ self
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,31 @@
1
+ # Style Parameter Data
2
+ module OoxmlParser
3
+ class StyleParametres < OOXMLDocumentObject
4
+ attr_accessor :q_format, :hidden, :name
5
+
6
+ def initialize(name = nil,
7
+ q_format = false,
8
+ hidden = false,
9
+ parent: nil)
10
+ @name = name
11
+ @q_format = q_format
12
+ @hidden = hidden
13
+ @parent = parent
14
+ end
15
+
16
+ # Parse StyleParametres data
17
+ # @param [Nokogiri::XML:Element] node with StyleParametres data
18
+ # @return [StyleParametres] value of Columns data
19
+ def parse(node)
20
+ node.xpath('*').each do |node_child|
21
+ case node_child.name
22
+ when 'name'
23
+ @name = node_child.attribute('val').value
24
+ when 'qFormat'
25
+ @q_format = option_enabled?(node_child)
26
+ end
27
+ end
28
+ self
29
+ end
30
+ end
31
+ end