ooxml_parser 0.4.1 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (352) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ooxml_parser.rb +4 -0
  3. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content.rb +2 -0
  4. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/chart_style.rb +2 -0
  5. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +3 -0
  6. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +3 -0
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +3 -0
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +39 -4
  9. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats.rb +33 -0
  10. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats/pivot_format.rb +26 -0
  11. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area.rb +67 -0
  12. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area/common_chart_data.rb +31 -0
  13. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +22 -9
  14. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +5 -5
  15. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/{string_reference.rb → number_string_reference.rb} +9 -7
  16. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/{string_cache.rb → number_string_cache.rb} +11 -6
  17. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point.rb +9 -2
  18. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point/text_value.rb +2 -0
  19. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/x_y_values.rb +22 -0
  20. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/view_3d.rb +2 -0
  21. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +3 -1
  22. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis/scaling.rb +2 -0
  23. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +7 -4
  24. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +4 -0
  25. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +3 -0
  26. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_point.rb +3 -1
  27. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +6 -0
  28. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +2 -0
  29. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing/doc_properties.rb +2 -0
  30. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +5 -0
  31. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_position.rb +2 -0
  32. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +3 -1
  33. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +2 -0
  34. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +12 -8
  35. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +26 -14
  36. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative/picture_dimension.rb +2 -0
  37. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_horizontal.rb +2 -0
  38. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/size_relative_vertical.rb +2 -0
  39. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +3 -1
  40. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +4 -0
  41. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +8 -0
  42. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +2 -2
  43. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +7 -0
  44. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties.rb +3 -0
  45. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/common_non_visual_properties.rb +3 -1
  46. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb +2 -0
  47. 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 +2 -0
  48. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +3 -3
  49. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +42 -0
  50. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +35 -0
  51. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +35 -0
  52. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +35 -0
  53. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +35 -0
  54. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +2 -0
  55. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +2 -0
  56. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb +2 -0
  57. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +5 -2
  58. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +4 -2
  59. 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 +2 -0
  60. 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 +2 -2
  61. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +3 -1
  62. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +3 -1
  63. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +6 -2
  64. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +4 -4
  65. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +2 -0
  66. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +2 -0
  67. 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 +2 -0
  68. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +2 -0
  69. 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 +2 -0
  70. 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 +2 -0
  71. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +12 -11
  72. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +11 -5
  73. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +3 -0
  74. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +3 -1
  75. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +3 -1
  76. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +3 -1
  77. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +3 -3
  78. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +2 -0
  79. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +2 -0
  80. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +3 -3
  81. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +25 -9
  82. data/lib/ooxml_parser/common_parser/common_data/color.rb +119 -71
  83. data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -21
  84. data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +12 -3
  85. data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +4 -1
  86. data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +2 -0
  87. data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +23 -8
  88. data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +3 -0
  89. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +6 -1
  90. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +3 -1
  91. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +5 -3
  92. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +2 -0
  93. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +4 -2
  94. data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +6 -1
  95. data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +18 -14
  96. data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +2 -0
  97. data/lib/ooxml_parser/common_parser/common_data/content_types.rb +38 -0
  98. data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +26 -0
  99. data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +26 -0
  100. data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +18 -6
  101. data/lib/ooxml_parser/common_parser/common_data/font_style.rb +3 -2
  102. data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +4 -2
  103. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +42 -3
  104. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +107 -116
  105. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb +31 -0
  106. data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +2 -0
  107. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +3 -0
  108. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +27 -0
  109. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +9 -14
  110. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +2 -0
  111. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +2 -0
  112. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +2 -0
  113. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +2 -0
  114. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +9 -0
  115. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +2 -0
  116. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb +2 -0
  117. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +4 -0
  118. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +4 -0
  119. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +5 -3
  120. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +25 -35
  121. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb +33 -0
  122. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +2 -0
  123. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb +3 -0
  124. data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +2 -0
  125. data/lib/ooxml_parser/common_parser/common_data/relationships.rb +24 -19
  126. data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +2 -0
  127. data/lib/ooxml_parser/common_parser/common_data/table.rb +5 -0
  128. data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +6 -8
  129. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +10 -0
  130. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +3 -1
  131. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +2 -0
  132. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +2 -0
  133. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +10 -2
  134. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +19 -17
  135. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +2 -0
  136. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +3 -0
  137. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +8 -5
  138. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +3 -1
  139. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +4 -0
  140. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +11 -11
  141. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +35 -0
  142. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +2 -0
  143. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +27 -39
  144. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +2 -0
  145. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +4 -4
  146. data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +5 -2
  147. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +2 -0
  148. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +2 -0
  149. data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +5 -0
  150. data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +3 -1
  151. data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +26 -4
  152. data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +2 -0
  153. data/lib/ooxml_parser/common_parser/common_data/underline.rb +6 -0
  154. data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +2 -0
  155. data/lib/ooxml_parser/common_parser/common_document_structure.rb +17 -0
  156. data/lib/ooxml_parser/common_parser/parser.rb +6 -2
  157. data/lib/ooxml_parser/configuration.rb +3 -0
  158. data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +99 -40
  159. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +36 -0
  160. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +37 -0
  161. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +4 -1
  162. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended/comment_extended.rb +2 -0
  163. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +2 -0
  164. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +3 -1
  165. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +6 -1
  166. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +2 -1
  167. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +11 -12
  168. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +2 -0
  169. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +93 -82
  170. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +22 -0
  171. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_start.rb +26 -0
  172. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_end.rb +22 -0
  173. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +27 -0
  174. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +3 -0
  175. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +2 -0
  176. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +2 -0
  177. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +2 -0
  178. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +2 -0
  179. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +2 -0
  180. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +2 -0
  181. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +2 -0
  182. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +2 -0
  183. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +2 -0
  184. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +2 -0
  185. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +4 -2
  186. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +2 -0
  187. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +2 -0
  188. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +2 -0
  189. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +2 -0
  190. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +2 -0
  191. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +2 -0
  192. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +2 -0
  193. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +2 -0
  194. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +5 -0
  195. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +4 -2
  196. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +11 -6
  197. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +30 -23
  198. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +15 -4
  199. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +2 -0
  200. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +2 -0
  201. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +39 -8
  202. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +3 -0
  203. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +3 -0
  204. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +3 -0
  205. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +3 -0
  206. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +2 -0
  207. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +2 -0
  208. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +41 -0
  209. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +6 -0
  210. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +5 -0
  211. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +2 -0
  212. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +2 -0
  213. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb +2 -0
  214. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb +2 -0
  215. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +3 -1
  216. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +4 -3
  217. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +12 -1
  218. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +2 -0
  219. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +2 -0
  220. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +3 -2
  221. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +2 -0
  222. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +2 -0
  223. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +2 -0
  224. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +2 -0
  225. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +4 -3
  226. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +7 -2
  227. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +2 -0
  228. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +2 -0
  229. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +2 -0
  230. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +16 -14
  231. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +10 -8
  232. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +3 -0
  233. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +5 -0
  234. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +14 -1
  235. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +2 -0
  236. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +2 -0
  237. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +2 -0
  238. data/lib/ooxml_parser/docx_parser/docx_parser.rb +6 -0
  239. data/lib/ooxml_parser/helpers/string_helper.rb +3 -1
  240. data/lib/ooxml_parser/name.rb +9 -0
  241. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +32 -37
  242. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +39 -0
  243. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors/comment_author.rb +38 -0
  244. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +33 -0
  245. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb +39 -0
  246. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +3 -0
  247. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +12 -3
  248. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme.rb +36 -0
  249. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection.rb +31 -0
  250. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection/text_font.rb +22 -0
  251. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +14 -8
  252. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +11 -4
  253. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +4 -1
  254. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +2 -0
  255. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +2 -0
  256. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb +2 -0
  257. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +2 -0
  258. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/connection_shape.rb +2 -0
  259. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +5 -2
  260. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +2 -4
  261. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_notes.rb +3 -1
  262. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +2 -0
  263. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +2 -0
  264. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +2 -0
  265. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +3 -0
  266. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +3 -0
  267. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +3 -9
  268. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +3 -0
  269. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +7 -4
  270. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +6 -3
  271. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/{condition.rb → codition_list/condition.rb} +3 -9
  272. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +27 -0
  273. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +19 -1
  274. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +6 -0
  275. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +5 -5
  276. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +2 -0
  277. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +8 -2
  278. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties/wheel.rb +22 -0
  279. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +2 -0
  280. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +38 -0
  281. data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +7 -1
  282. data/lib/ooxml_parser/version.rb +4 -1
  283. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +57 -38
  284. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +6 -1
  285. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache.rb +41 -0
  286. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +37 -0
  287. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source.rb +33 -0
  288. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source/worksheet_source.rb +26 -0
  289. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb +46 -0
  290. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb +26 -0
  291. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +15 -1
  292. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +37 -0
  293. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/{worksheet/xlsx_row/xlsx_cell → style_sheet/cell_xfs}/cell_style/alignment.rb +2 -0
  294. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +150 -0
  295. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +2 -0
  296. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +4 -0
  297. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +2 -0
  298. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +5 -3
  299. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +5 -0
  300. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +2 -5
  301. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +2 -0
  302. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +37 -0
  303. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders/xlsx_border.rb +34 -0
  304. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +3 -0
  305. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +56 -25
  306. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +32 -29
  307. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/author.rb +16 -0
  308. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +26 -0
  309. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +10 -0
  310. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb +2 -0
  311. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/page_setup.rb +105 -0
  312. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +2 -0
  313. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +2 -0
  314. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +2 -0
  315. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +8 -1
  316. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb +2 -0
  317. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +12 -0
  318. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +42 -0
  319. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters/custom_filter.rb +26 -0
  320. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +2 -0
  321. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +2 -0
  322. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +3 -1
  323. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb +2 -0
  324. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +2 -0
  325. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +42 -0
  326. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns/table_column.rb +34 -0
  327. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb +2 -0
  328. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/worksheet_helper.rb +14 -0
  329. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +12 -1
  330. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +3 -0
  331. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +2 -0
  332. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +3 -1
  333. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +60 -27
  334. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb +39 -0
  335. data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +7 -1
  336. metadata +147 -29
  337. data/LICENSE.txt +0 -661
  338. data/README.md +0 -43
  339. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/order.rb +0 -20
  340. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_index.rb +0 -20
  341. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point_count.rb +0 -20
  342. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop/preset_color.rb +0 -20
  343. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/language.rb +0 -20
  344. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties/vertical_merge.rb +0 -20
  345. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +0 -30
  346. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +0 -28
  347. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark.rb +0 -21
  348. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/start.rb +0 -20
  349. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition/abstract_numbering_id.rb +0 -20
  350. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +0 -31
  351. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb +0 -26
  352. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +0 -128
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Module for stroing some attribute helpers for objects
5
+ module OoxmlObjectAttributeHelper
6
+ # @param node [Nokogiri::XML:Element] node to parse
7
+ # @param attribute_name [String] name of attribute
8
+ # @return [True, False] is option enabled
9
+ def option_enabled?(node, attribute_name = 'val')
10
+ return true if node.attributes.empty?
11
+ return true if node.to_s == '1'
12
+ return false if node.to_s == '0'
13
+ return false if node.attribute(attribute_name).nil?
14
+
15
+ status = node.attribute(attribute_name).value
16
+ !%w[false off 0].include?(status)
17
+ end
18
+
19
+ # @param node [Nokogiri::XML:Element] node to parse
20
+ # @param attribute_name [String] name of attribute
21
+ # @return [True, False] is attribute enabled
22
+ def attribute_enabled?(node, attribute_name = 'val')
23
+ return true if node.to_s == '1'
24
+ return false if node.to_s == '0'
25
+ return false if node.attribute(attribute_name).nil?
26
+
27
+ status = node.attribute(attribute_name).value
28
+ %w[true on 1].include?(status)
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'paragraph/paragraph_properties'
2
4
  require_relative 'paragraph/paragraph_run'
3
5
  require_relative 'paragraph/text_field'
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'paragrpah_properties/numbering_properties'
2
4
  require_relative 'paragrpah_properties/paragraph_borders'
3
5
  require_relative 'paragrpah_properties/paragraph_spacing'
4
6
  require_relative 'paragrpah_properties/spacing'
5
7
  require_relative 'paragrpah_properties/tabs'
6
8
  module OoxmlParser
9
+ # Class for data for ParagraphProperties
7
10
  class ParagraphProperties < OOXMLDocumentObject
8
11
  attr_accessor :align, :numbering, :level, :spacing, :spacing_before, :spacing_after, :indent, :margin_left, :margin_right
9
12
  # @return [FrameProperties] frame properties
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'paragraph_run/run_properties'
2
4
  require_relative 'paragraph_run/text'
3
5
  module OoxmlParser
@@ -32,5 +34,30 @@ module OoxmlParser
32
34
  end
33
35
  self
34
36
  end
37
+
38
+ # @return [True, False] is current run empty
39
+ def empty?
40
+ text.empty?
41
+ end
42
+
43
+ # @return [String] instruction applied to paragraph
44
+ def instruction
45
+ parent.instruction
46
+ end
47
+
48
+ # @return [True, False] is page number applyed
49
+ def page_number
50
+ parent.page_numbering?
51
+ end
52
+
53
+ # @return [Hyperlink] link of run
54
+ def link
55
+ parent.parent.hyperlink
56
+ end
57
+
58
+ extend Gem::Deprecate
59
+ deprecate :instruction, 'parent.instruction', 2020, 1
60
+ deprecate :page_number, 'parent.page_numbering?', 2020, 1
61
+ deprecate :link, 'parent.parent.hyperlink', 2020, 1
35
62
  end
36
63
  end
@@ -1,4 +1,5 @@
1
- require_relative 'run_properties/language'
1
+ # frozen_string_literal: true
2
+
2
3
  require_relative 'run_properties/outline'
3
4
  require_relative 'run_properties/position'
4
5
  require_relative 'run_properties/size'
@@ -20,18 +21,14 @@ module OoxmlParser
20
21
  attr_accessor :spacing
21
22
  # @return [RunSpacing] get color
22
23
  attr_accessor :color
23
- # @return [Language] language property
24
- attr_accessor :language
24
+ # @return [ValuedChild] language property
25
+ attr_reader :language
25
26
  # @return [Position] position property
26
27
  attr_accessor :position
27
28
  # @return [Shade] shade property
28
29
  attr_accessor :shade
29
30
  # @return [RunStyle] run style
30
31
  attr_accessor :run_style
31
- # @return [Float]
32
- # This element specifies the font size which shall be applied to all
33
- # complex script characters in the contents of this run when displayed
34
- attr_accessor :font_size_complex
35
32
 
36
33
  def initialize(parent: nil)
37
34
  @font_name = ''
@@ -44,13 +41,11 @@ module OoxmlParser
44
41
  # @param node [Nokogiri::XML:Element] node to parse
45
42
  # @return [RunProperties] result of parsing
46
43
  def parse(node)
47
- @font_style = Presentation.current_font_style.dup
44
+ @font_style = root_object.default_font_style.dup
48
45
  node.attributes.each do |key, value|
49
46
  case key
50
47
  when 'sz'
51
48
  @font_size = value.value.to_f / 100.0
52
- when 'szCs'
53
- @font_size_complex = node.attribute('val').value.to_i / 2.0
54
49
  when 'spc'
55
50
  @space = OoxmlSize.new(value.value.to_f, :one_100th_point)
56
51
  when 'b'
@@ -91,7 +86,7 @@ module OoxmlParser
91
86
  when 'color'
92
87
  @color = OoxmlColor.new(parent: self).parse(node_child)
93
88
  when 'solidFill'
94
- @font_color = Color.parse_color(node_child.xpath('*').first)
89
+ @font_color = Color.new(parent: self).parse_color(node_child.xpath('*').first)
95
90
  when 'latin'
96
91
  @font_name = node_child.attribute('typeface').value
97
92
  when 'b'
@@ -113,7 +108,7 @@ module OoxmlParser
113
108
  when 'ln'
114
109
  @outline = Outline.new(parent: self).parse(node_child)
115
110
  when 'lang'
116
- @language = Language.new(parent: self).parse(node_child)
111
+ @language = ValuedChild.new(:string, parent: self).parse(node_child)
117
112
  when 'position'
118
113
  @position = Position.new(parent: self).parse(node_child)
119
114
  when 'shd'
@@ -123,8 +118,8 @@ module OoxmlParser
123
118
  end
124
119
  end
125
120
  @font_color = DocxColorScheme.new(parent: self).parse(node)
126
- @font_name = Presentation.default_font_typeface if @font_name.empty?
127
- @font_size = Presentation.default_font_size if @font_size.nil?
121
+ @font_name = root_object.default_font_typeface if @font_name.empty?
122
+ @font_size ||= root_object.default_font_size
128
123
  self
129
124
  end
130
125
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Class for parsing Run Outline properties
2
4
  module OoxmlParser
3
5
  # Class for parsing `w:ln` tags
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `w:position` object
3
5
  class Position < OOXMLDocumentObject
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `w:sz` object
3
5
  class RunSpacing < OOXMLDocumentObject
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `w:rStyle` object
3
5
  class RunStyle < OOXMLDocumentObject
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `w:shd` object
3
5
  class Shade < OOXMLDocumentObject
@@ -18,6 +20,13 @@ module OoxmlParser
18
20
  @parent = parent
19
21
  end
20
22
 
23
+ # @return [String] text representation
24
+ def to_s
25
+ "Value: `#{value}`, "\
26
+ "Color: `#{color}`, "\
27
+ "Fill: `#{fill}`"
28
+ end
29
+
21
30
  # Parse Shade
22
31
  # @param [Nokogiri::XML:Node] node with Shade
23
32
  # @return [Shade] result of parsing
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `w:sz` object
3
5
  class Size < OOXMLDocumentObject
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `t` tags
3
5
  class Text < OOXMLDocumentObject
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `numPr` tags
3
5
  class NumberingProperties < OOXMLDocumentObject
@@ -8,6 +10,7 @@ module OoxmlParser
8
10
  @parent = parent
9
11
  end
10
12
 
13
+ # @return [AbstractNumbering] AbstractNumbering of current properties
11
14
  def abstruct_numbering
12
15
  root_object.numbering.properties_by_num_id(@numbering_properties)
13
16
  end
@@ -27,6 +30,7 @@ module OoxmlParser
27
30
  self
28
31
  end
29
32
 
33
+ # @return [AbstractNumbering] level list of current numbering
30
34
  def numbering_level_current
31
35
  abstruct_numbering.level_list.each do |current_ilvl|
32
36
  return current_ilvl if current_ilvl.ilvl == @ilvl
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `w:pBdr` element
3
5
  class ParagraphBorders < OOXMLDocumentObject
@@ -14,6 +16,7 @@ module OoxmlParser
14
16
  # @return [BordersProperties] bar properties
15
17
  attr_accessor :bar
16
18
 
19
+ # @return [Symbol] type of border in visual editor
17
20
  def border_visual_type
18
21
  result = []
19
22
  result << :left if @left.val == :single
@@ -24,6 +27,7 @@ module OoxmlParser
24
27
  return :none if result == []
25
28
  return :all if result == %i[left right top bottom inner]
26
29
  return :outer if result == %i[left right top bottom]
30
+
27
31
  result.first if result.size == 1
28
32
  end
29
33
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing Paragraph Spacing in paragraph properties `w:spacing`
3
5
  class ParagraphSpacing < OOXMLDocumentObject
@@ -10,9 +12,9 @@ module OoxmlParser
10
12
  # @return [Symbol] value of line rule style
11
13
  attr_accessor :line_rule
12
14
 
13
- # Parse Position
14
- # @param [Nokogiri::XML:Node] node with Position
15
- # @return [Position] result of parsing
15
+ # Parse ParagraphSpacing
16
+ # @param [Nokogiri::XML:Node] node with ParagraphSpacing
17
+ # @return [ParagraphSpacing] result of parsing
16
18
  def parse(node)
17
19
  node.attributes.each do |key, value|
18
20
  case key
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @author Pavel.Lobashov
2
4
 
3
- # Class to describe spacing
5
+ require_relative 'spacing/line_spacing'
4
6
  module OoxmlParser
7
+ # Class to describe spacing
5
8
  class Spacing
6
9
  # @return [Float] Spacing before paragraph
7
10
  attr_accessor :before
@@ -11,6 +14,8 @@ module OoxmlParser
11
14
  attr_accessor :line
12
15
  # @return [String] Spacing line rule
13
16
  attr_accessor :line_rule
17
+ # @return [LineSpacing] line spacing data
18
+ attr_reader :line_spacing
14
19
 
15
20
  def initialize(before = nil, after = 0.35, line = nil, line_rule = nil)
16
21
  @before = before
@@ -19,27 +24,26 @@ module OoxmlParser
19
24
  @line_rule = line_rule
20
25
  end
21
26
 
27
+ # Compare this object to other
28
+ # @param other [Object] any other object
29
+ # @return [True, False] result of comparision
22
30
  def ==(other)
23
31
  self.line_rule = :at_least if line_rule == 'atLeast'
24
32
  self.line_rule = :multiple if line_rule == :auto
25
33
  other.line_rule = :multiple if other.line_rule == :auto
26
- if self.class == NilClass || other.class == NilClass
27
- return true if self.class == NilClass && other.class == NilClass
28
- return false
29
- else
30
- self.line_rule = line_rule.to_sym if line_rule.instance_of?(String)
34
+ self.line_rule = line_rule.to_sym if line_rule.instance_of?(String)
31
35
 
32
- if @before == other.before &&
33
- @after == other.after &&
34
- @line == other.line &&
35
- @line_rule.to_s == other.line_rule.to_s
36
- return true
37
- else
38
- return false
39
- end
36
+ if @before == other.before &&
37
+ @after == other.after &&
38
+ @line == other.line &&
39
+ @line_rule.to_s == other.line_rule.to_s
40
+ true
41
+ else
42
+ false
40
43
  end
41
44
  end
42
45
 
46
+ # @return [String] result of convert of object to string
43
47
  def to_s
44
48
  result_string = ''
45
49
  variables = instance_variables
@@ -49,14 +53,15 @@ module OoxmlParser
49
53
  result_string
50
54
  end
51
55
 
56
+ # Method to copy object
57
+ # @return [Spacing] copied object
52
58
  def copy
53
59
  Spacing.new(@before, @after, @line, @line_rule)
54
60
  end
55
61
 
56
- def self.default_spacing_canvas(line_spacing = 1.15)
57
- Spacing.new(0.0, 0.35277777777777775, line_spacing)
58
- end
59
-
62
+ # Round value of spacing
63
+ # @param count_of_digits [Integer] how digits to left
64
+ # @return [Spacing] result of round
60
65
  def round(count_of_digits = 1)
61
66
  before = @before.to_f.round(count_of_digits)
62
67
  after = @after.to_f.round(count_of_digits)
@@ -72,7 +77,8 @@ module OoxmlParser
72
77
  case spacing_node_child.name
73
78
  when 'lnSpc'
74
79
  self.line = Spacing.parse_spacing_value(spacing_node_child)
75
- self.line_rule = Spacing.parse_spacing_rule(spacing_node_child)
80
+ @line_spacing = LineSpacing.new(parent: self).parse(spacing_node_child)
81
+ self.line_rule = @line_spacing.rule
76
82
  when 'spcBef'
77
83
  self.before = Spacing.parse_spacing_value(spacing_node_child)
78
84
  when 'spcAft'
@@ -94,21 +100,5 @@ module OoxmlParser
94
100
  end
95
101
  end
96
102
  end
97
-
98
- # Parse spacing rule
99
- # @param [Nokogiri::XML:Element] node with Spacing
100
- # @return [Symbol] type of spacing rule
101
- def self.parse_spacing_rule(node)
102
- node.xpath('*').each do |spacing_node_child|
103
- case spacing_node_child.name
104
- when 'spcPct'
105
- return :multiple
106
- when 'spcPts'
107
- return :exact
108
- else
109
- return :at_least
110
- end
111
- end
112
- end
113
103
  end
114
104
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class to describe spacing
5
+ class LineSpacing < OOXMLDocumentObject
6
+ # @return [ValuedChild] spacing percent
7
+ attr_reader :spacing_percent
8
+ # @return [ValuedChild] spacing point
9
+ attr_reader :spacing_points
10
+
11
+ # Parse LineSpacing object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [LineSpacing] result of parsing
14
+ def parse(node)
15
+ node.xpath('*').each do |node_child|
16
+ case node_child.name
17
+ when 'spcPct'
18
+ @spacing_percent = ValuedChild.new(:integer, parent: self).parse(node_child)
19
+ when 'spcPts'
20
+ @spacing_points = ValuedChild.new(:integer, parent: self).parse(node_child)
21
+ end
22
+ end
23
+ self
24
+ end
25
+
26
+ # @return [Symbol] rule used to determine line spacing
27
+ def rule
28
+ return :multiple if @spacing_percent
29
+
30
+ :exact
31
+ end
32
+ end
33
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'tabs/tab'
2
4
  module OoxmlParser
3
5
  # Class for working with `w:tabs`
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for storing `w:tab`, `a:tab` data
3
5
  class Tab < OOXMLDocumentObject
@@ -33,6 +35,7 @@ module OoxmlParser
33
35
  # @return [Symbol] type of size unit
34
36
  def position_unit(node)
35
37
  return :emu if node.namespace.prefix == 'a'
38
+
36
39
  :dxa
37
40
  end
38
41
  end