ooxml_parser 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (343) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ooxml_parser.rb +3 -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 +2 -0
  6. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +2 -0
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +2 -0
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +33 -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 +20 -7
  14. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +5 -3
  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 +2 -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 +11 -8
  35. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +23 -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 +3 -0
  41. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +4 -0
  42. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +2 -0
  43. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +4 -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 +2 -0
  49. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +2 -0
  50. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb +2 -0
  51. 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
  52. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +4 -2
  53. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb +4 -2
  54. 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
  55. 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 -0
  56. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +3 -1
  57. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_color.rb +3 -1
  58. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +5 -2
  59. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +3 -1
  60. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill.rb +2 -0
  61. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/blip_fill/blip.rb +2 -0
  62. 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
  63. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/preset_geometry.rb +2 -0
  64. 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
  65. 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
  66. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties/text_box.rb +12 -11
  67. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +11 -5
  68. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/line/line_end.rb +3 -0
  69. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +3 -1
  70. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_element.rb +3 -1
  71. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group_properties.rb +3 -1
  72. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +2 -0
  73. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape.rb +2 -0
  74. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb +2 -0
  75. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +2 -0
  76. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +22 -9
  77. data/lib/ooxml_parser/common_parser/common_data/color.rb +83 -67
  78. data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +25 -21
  79. data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +7 -3
  80. data/lib/ooxml_parser/common_parser/common_data/colors/color_alpha_channel.rb +4 -1
  81. data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +2 -0
  82. data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +12 -8
  83. data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +3 -0
  84. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill.rb +6 -1
  85. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +3 -1
  86. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop.rb +5 -3
  87. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/linear_gradient.rb +2 -0
  88. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/presentation_pattern.rb +4 -2
  89. data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +5 -1
  90. data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +14 -14
  91. data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +2 -0
  92. data/lib/ooxml_parser/common_parser/common_data/content_types.rb +36 -0
  93. data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +23 -0
  94. data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +23 -0
  95. data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +11 -6
  96. data/lib/ooxml_parser/common_parser/common_data/font_style.rb +3 -2
  97. data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +4 -2
  98. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +19 -2
  99. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_document_object_helper.rb +107 -116
  100. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object/ooxml_object_attribute_helper.rb +31 -0
  101. data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +2 -0
  102. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +3 -0
  103. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +24 -0
  104. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +9 -8
  105. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +2 -0
  106. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/position.rb +2 -0
  107. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_spacing.rb +2 -0
  108. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/run_style.rb +2 -0
  109. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +9 -0
  110. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/size.rb +2 -0
  111. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/text.rb +2 -0
  112. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +2 -0
  113. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +3 -0
  114. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_spacing.rb +5 -3
  115. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +12 -25
  116. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing/line_spacing.rb +33 -0
  117. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +2 -0
  118. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs/tab.rb +3 -0
  119. data/lib/ooxml_parser/common_parser/common_data/paragraph/text_field.rb +2 -0
  120. data/lib/ooxml_parser/common_parser/common_data/relationships.rb +24 -19
  121. data/lib/ooxml_parser/common_parser/common_data/relationships/relationship.rb +2 -0
  122. data/lib/ooxml_parser/common_parser/common_data/table.rb +3 -0
  123. data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +3 -8
  124. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +3 -0
  125. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_element.rb +3 -1
  126. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_layout.rb +2 -0
  127. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +2 -0
  128. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +9 -2
  129. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style.rb +19 -17
  130. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_column_band_size.rb +2 -0
  131. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +2 -0
  132. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +4 -1
  133. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_row_band_size.rb +3 -1
  134. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +4 -0
  135. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +7 -4
  136. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +35 -0
  137. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/border.rb +2 -0
  138. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +21 -39
  139. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +2 -0
  140. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line/line_join.rb +4 -4
  141. data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +5 -2
  142. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties.rb +2 -0
  143. data/lib/ooxml_parser/common_parser/common_data/table/row/row/table_row_properties/table_row_height.rb +2 -0
  144. data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +2 -0
  145. data/lib/ooxml_parser/common_parser/common_data/table/table_grid/grid_column.rb +3 -1
  146. data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +26 -4
  147. data/lib/ooxml_parser/common_parser/common_data/table/table_properties/table_borders.rb +2 -0
  148. data/lib/ooxml_parser/common_parser/common_data/underline.rb +2 -0
  149. data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +2 -0
  150. data/lib/ooxml_parser/common_parser/common_document_structure.rb +17 -0
  151. data/lib/ooxml_parser/common_parser/parser.rb +6 -2
  152. data/lib/ooxml_parser/configuration.rb +3 -0
  153. data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +72 -37
  154. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +36 -0
  155. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +34 -0
  156. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +4 -1
  157. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended/comment_extended.rb +2 -0
  158. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +2 -0
  159. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_properties.rb +3 -1
  160. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +6 -1
  161. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_structure_helpers.rb +2 -1
  162. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +8 -12
  163. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style/document_style_helper.rb +2 -0
  164. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +71 -81
  165. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +22 -0
  166. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_start.rb +26 -0
  167. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_end.rb +22 -0
  168. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +26 -0
  169. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +3 -0
  170. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/accent.rb +2 -0
  171. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties.rb +2 -0
  172. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/argument_properties/argument_size.rb +2 -0
  173. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +2 -0
  174. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +2 -0
  175. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +2 -0
  176. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/fraction.rb +2 -0
  177. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/function.rb +2 -0
  178. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/group_char.rb +2 -0
  179. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/index.rb +2 -0
  180. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +4 -2
  181. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run.rb +2 -0
  182. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +2 -0
  183. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +2 -0
  184. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +2 -0
  185. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary.rb +2 -0
  186. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties.rb +2 -0
  187. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_grow.rb +2 -0
  188. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/nary/nary_properties/nary_limit_location.rb +2 -0
  189. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +2 -0
  190. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +4 -2
  191. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_helper.rb +11 -6
  192. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +17 -20
  193. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +11 -3
  194. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object.rb +2 -0
  195. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/object/ole_object.rb +2 -0
  196. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +39 -6
  197. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties.rb +3 -0
  198. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_margins.rb +3 -0
  199. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/shape_size.rb +3 -0
  200. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape/shape_properties/stroke.rb +3 -0
  201. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_fill.rb +2 -0
  202. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +2 -0
  203. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +41 -0
  204. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +3 -0
  205. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +3 -0
  206. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/inserted.rb +2 -0
  207. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +2 -0
  208. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_properties.rb +2 -0
  209. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/structured_document_tag.rb +2 -0
  210. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +3 -1
  211. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +4 -1
  212. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +7 -1
  213. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +2 -0
  214. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/multilevel_type.rb +2 -0
  215. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +3 -2
  216. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_justification.rb +2 -0
  217. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/level_text.rb +2 -0
  218. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/numbering_format.rb +2 -0
  219. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +2 -0
  220. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition.rb +4 -3
  221. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +6 -2
  222. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns/column.rb +2 -0
  223. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/document_grid.rb +2 -0
  224. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/footnote_properties.rb +2 -0
  225. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +13 -14
  226. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +10 -8
  227. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +3 -0
  228. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +4 -0
  229. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +12 -1
  230. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults.rb +2 -0
  231. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/paragraph_properties_default.rb +2 -0
  232. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles/document_defaults/run_properties_default.rb +2 -0
  233. data/lib/ooxml_parser/docx_parser/docx_parser.rb +3 -0
  234. data/lib/ooxml_parser/helpers/string_helper.rb +3 -1
  235. data/lib/ooxml_parser/name.rb +8 -0
  236. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +30 -37
  237. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +39 -0
  238. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors/comment_author.rb +38 -0
  239. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +33 -0
  240. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments/presentation_comment.rb +39 -0
  241. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_helpers.rb +3 -0
  242. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +9 -3
  243. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme.rb +36 -0
  244. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection.rb +31 -0
  245. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/font_scheme/font_collection/text_font.rb +22 -0
  246. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +11 -8
  247. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +8 -4
  248. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +4 -1
  249. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties.rb +2 -0
  250. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background/background_properties/stretch.rb +2 -0
  251. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data.rb +2 -0
  252. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +2 -0
  253. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/connection_shape.rb +2 -0
  254. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +5 -2
  255. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +2 -4
  256. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_notes.rb +3 -1
  257. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +2 -0
  258. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +2 -0
  259. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +2 -0
  260. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/animation_effect/animation_effect.rb +3 -0
  261. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +3 -0
  262. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +3 -9
  263. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/set_time_node.rb +3 -0
  264. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +4 -4
  265. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing.rb +6 -3
  266. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/{condition.rb → codition_list/condition.rb} +3 -9
  267. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +27 -0
  268. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +4 -0
  269. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +3 -0
  270. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb +5 -5
  271. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +2 -0
  272. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties.rb +8 -2
  273. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition_properties/transition_properties/wheel.rb +22 -0
  274. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide_size.rb +2 -0
  275. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +38 -0
  276. data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +4 -1
  277. data/lib/ooxml_parser/version.rb +3 -1
  278. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +38 -38
  279. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +3 -1
  280. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb +46 -0
  281. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table/string_index.rb +26 -0
  282. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +13 -1
  283. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +37 -0
  284. 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
  285. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +145 -0
  286. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +2 -0
  287. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +2 -0
  288. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill/pattern_fill.rb +2 -0
  289. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +5 -3
  290. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +2 -0
  291. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +2 -5
  292. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats/number_format.rb +2 -0
  293. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +37 -0
  294. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders/xlsx_border.rb +34 -0
  295. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/workbook_helpers.rb +3 -0
  296. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +51 -25
  297. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +28 -29
  298. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/author.rb +16 -0
  299. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +26 -0
  300. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +10 -0
  301. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/ole_objects.rb +2 -0
  302. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/page_setup.rb +105 -0
  303. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_format_properties.rb +2 -0
  304. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +2 -0
  305. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view/pane.rb +2 -0
  306. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part.rb +8 -1
  307. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter.rb +2 -0
  308. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +12 -0
  309. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +42 -0
  310. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters/custom_filter.rb +26 -0
  311. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +2 -0
  312. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension.rb +2 -0
  313. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +3 -1
  314. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group.rb +2 -0
  315. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/x14_table.rb +2 -0
  316. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +42 -0
  317. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns/table_column.rb +34 -0
  318. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_style_info.rb +2 -0
  319. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/worksheet_helper.rb +14 -0
  320. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +8 -1
  321. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing.rb +3 -0
  322. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_drawing/xlsx_drawing_position_parameters.rb +2 -0
  323. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +3 -1
  324. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +60 -27
  325. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb +39 -0
  326. data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +4 -1
  327. metadata +82 -29
  328. data/LICENSE.txt +0 -661
  329. data/README.md +0 -43
  330. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/order.rb +0 -20
  331. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_index.rb +0 -20
  332. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/string_cache/point_count.rb +0 -20
  333. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color/gradient_stop/preset_color.rb +0 -20
  334. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/language.rb +0 -20
  335. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties/vertical_merge.rb +0 -20
  336. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/merge.rb +0 -30
  337. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comment.rb +0 -28
  338. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark.rb +0 -21
  339. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/start.rb +0 -20
  340. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/numbering_definition/abstract_numbering_id.rb +0 -20
  341. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment.rb +0 -31
  342. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comment/presentation_comment_author.rb +0 -26
  343. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/cell_style.rb +0 -128
@@ -1,25 +1,29 @@
1
- # Helper methods for color
2
- module ColorHelper
3
- # Parse string in hex
4
- # @param [String] hex_string with or without alpha-channel
5
- def parse_hex_string(hex_string)
6
- return self if %w[auto null].include?(hex_string)
1
+ # frozen_string_literal: true
7
2
 
8
- char_array = hex_string.split(//)
9
- if char_array.length == 3
10
- @red = char_array[0].hex
11
- @green = char_array[1].hex
12
- @blue = char_array[2].hex
13
- elsif char_array.length == 6
14
- @red = (char_array[0] + char_array[1]).hex
15
- @green = (char_array[2] + char_array[3]).hex
16
- @blue = (char_array[4] + char_array[5]).hex
17
- elsif char_array.length == 8
18
- @alpha_channel = (char_array[0] + char_array[1]).hex
19
- @red = (char_array[2] + char_array[3]).hex
20
- @green = (char_array[4] + char_array[5]).hex
21
- @blue = (char_array[6] + char_array[7]).hex
3
+ module OoxmlParser
4
+ # Helper methods for color
5
+ module ColorHelper
6
+ # Parse string in hex
7
+ # @param [String] hex_string with or without alpha-channel
8
+ def parse_hex_string(hex_string)
9
+ return self if %w[auto null].include?(hex_string)
10
+
11
+ char_array = hex_string.split(//)
12
+ if char_array.length == 3
13
+ @red = char_array[0].hex
14
+ @green = char_array[1].hex
15
+ @blue = char_array[2].hex
16
+ elsif char_array.length == 6
17
+ @red = (char_array[0] + char_array[1]).hex
18
+ @green = (char_array[2] + char_array[3]).hex
19
+ @blue = (char_array[4] + char_array[5]).hex
20
+ elsif char_array.length == 8
21
+ @alpha_channel = (char_array[0] + char_array[1]).hex
22
+ @red = (char_array[2] + char_array[3]).hex
23
+ @green = (char_array[4] + char_array[5]).hex
24
+ @blue = (char_array[6] + char_array[7]).hex
25
+ end
26
+ self
22
27
  end
23
- self
24
28
  end
25
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `color` tag
3
5
  class OoxmlColor < OOXMLDocumentObject
@@ -18,20 +20,22 @@ module OoxmlParser
18
20
 
19
21
  def to_color
20
22
  return Color.get_rgb_by_color_index(indexed) if indexed
21
- return ThemeColors.parse_color_theme(theme, tint) if theme
23
+ return ThemeColors.new(parent: self).parse_color_theme(theme, tint) if theme
22
24
  return rgb if rgb
25
+
23
26
  value
24
27
  end
25
28
 
26
29
  def ==(other)
27
30
  return to_color == other if other.is_a?(Color)
28
31
  return to_color == other if other.is_a?(Symbol)
32
+
29
33
  super
30
34
  end
31
35
 
32
- # Parse Hyperlink object
36
+ # Parse OoxmlColor object
33
37
  # @param node [Nokogiri::XML:Element] node to parse
34
- # @return [Hyperlink] result of parsing
38
+ # @return [OoxmlColor] result of parsing
35
39
  def parse(node)
36
40
  node.attributes.each do |key, value|
37
41
  case key
@@ -1,5 +1,7 @@
1
- # Class for working with AlphaChannel
1
+ # frozen_string_literal: true
2
+
2
3
  module OoxmlParser
4
+ # Class for working with AlphaChannel
3
5
  class ColorAlphaChannel
4
6
  # Parse AlphaChannel value
5
7
  # @param node [Nokogiri::XML::Element] node to parse
@@ -8,6 +10,7 @@ module OoxmlParser
8
10
  alpha_channel_node = node.xpath('a:alpha', 'xmlns:a' => 'http://schemas.openxmlformats.org/drawingml/2006/main').first
9
11
  alpha_channel_node = node.xpath('w14:alpha', 'xmlns:w14' => 'http://schemas.microsoft.com/office/word/2010/wordml').first if alpha_channel_node.nil?
10
12
  return 100.0 if alpha_channel_node.nil?
13
+
11
14
  (alpha_channel_node.attribute('val').value.to_f / 1_000.0).round(0)
12
15
  end
13
16
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for color transformations
3
5
  class ColorProperties < OOXMLDocumentObject
@@ -1,15 +1,19 @@
1
- # HSL is one of the most common cylindrical-coordinate representations of points in an RGB color model.
2
- # HSL stands for hue, saturation, and lightness, and is often also called HLS.
1
+ # frozen_string_literal: true
2
+
3
3
  module OoxmlParser
4
+ # HSL is one of the most common cylindrical-coordinate representations of points in an RGB color model.
5
+ # HSL stands for hue, saturation, and lightness, and is often also called HLS.
4
6
  class HSLColor
5
- attr_accessor :a, :h, :s, :l
7
+ attr_accessor :h, :s, :l
8
+ # @return [Integer] alpha channel value
9
+ attr_accessor :alpha_channel
6
10
 
7
11
  # Hue - The "attribute of a visual sensation according to which an area appears to be similar to one of
8
12
  # the perceived colors: red, yellow, green, and blue, or to a combination of two of them".
9
13
  # Saturation - The "colorfulness of a stimulus relative to its own brightness".
10
14
  # Lightness - The "brightness relative to the brightness of a similarly illuminated white".
11
- def initialize(hue = 0, saturation = 0, lightness = 0, a = nil)
12
- @a = a
15
+ def initialize(hue = 0, saturation = 0, lightness = 0, alpha_channel = nil)
16
+ @alpha_channel = alpha_channel
13
17
  @h = hue
14
18
  @s = saturation
15
19
  @l = lightness
@@ -26,7 +30,7 @@ module OoxmlParser
26
30
 
27
31
  delta = (max - min).to_f
28
32
  hls_color.l = (min + max) / 255.0 / 2.0
29
- hls_color.a = rgb_color.alpha_channel.to_f / 255.0
33
+ hls_color.alpha_channel = rgb_color.alpha_channel.to_f / 255.0
30
34
 
31
35
  unless max == min
32
36
  hls_color.s = delta / (255.0 - (255.0 - max - min).abs)
@@ -53,7 +57,7 @@ module OoxmlParser
53
57
 
54
58
  rgb = if @h.zero?
55
59
  Color.new(0, 0, 0)
56
- elsif @h > 0 && @h < 60
60
+ elsif @h.positive? && @h < 60
57
61
  Color.new(chroma, x, 0)
58
62
  elsif @h > 60 && @h < 120
59
63
  Color.new(x, chroma, 0)
@@ -73,7 +77,7 @@ module OoxmlParser
73
77
  if tint.nil?
74
78
  lum
75
79
  else
76
- tint < 0 ? lum * (1.0 + tint) : lum * (1.0 - tint) + (255 - 255 * (1.0 - tint))
80
+ tint.negative? ? lum * (1.0 + tint) : lum * (1.0 - tint) + (255 - 255 * (1.0 - tint))
77
81
  end
78
82
  end
79
83
 
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'tile'
2
4
  module OoxmlParser
5
+ # Class for working with Image Fill
3
6
  class ImageFill < OOXMLDocumentObject
4
7
  attr_accessor :stretch, :tile, :properties
5
8
  # @return [FileReference] image structure
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'image_fill'
2
4
  require_relative 'presentation_fill/gradient_color'
3
5
  require_relative 'presentation_fill/presentation_pattern'
4
6
  module OoxmlParser
7
+ # Class for working with PresentationFill
5
8
  class PresentationFill < OOXMLDocumentObject
6
9
  attr_accessor :type, :image, :color, :pattern
7
10
 
@@ -10,6 +13,7 @@ module OoxmlParser
10
13
  # @return [PresentationFill] result of parsing
11
14
  def parse(node)
12
15
  return nil if node.xpath('*').empty?
16
+
13
17
  node.xpath('*').each do |node_child|
14
18
  case node_child.name
15
19
  when 'gradFill'
@@ -17,7 +21,7 @@ module OoxmlParser
17
21
  @color = GradientColor.new(parent: self).parse(node_child)
18
22
  when 'solidFill'
19
23
  @type = :solid
20
- @color = Color.parse_color(node_child.xpath('*').first)
24
+ @color = Color.new(parent: self).parse_color(node_child.xpath('*').first)
21
25
  when 'blipFill'
22
26
  @type = :image
23
27
  @image = ImageFill.new(parent: self).parse(node_child)
@@ -30,6 +34,7 @@ module OoxmlParser
30
34
  end
31
35
  end
32
36
  return nil if @type.nil?
37
+
33
38
  self
34
39
  end
35
40
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'gradient_color/gradient_stop'
2
4
  require_relative 'gradient_color/linear_gradient'
3
5
  module OoxmlParser
4
6
  # Class for parsing `gradFill` tags
5
- class GradientColor
7
+ class GradientColor < OOXMLDocumentObject
6
8
  attr_accessor :gradient_stops, :path
7
9
  # @return [LinearGradient] content of Linear Gradient
8
10
  attr_accessor :linear_gradient
@@ -1,5 +1,7 @@
1
- require_relative 'gradient_stop/preset_color'
1
+ # frozen_string_literal: true
2
+
2
3
  module OoxmlParser
4
+ # Class for working with GradientStop
3
5
  class GradientStop < OOXMLDocumentObject
4
6
  attr_accessor :position, :color
5
7
 
@@ -17,9 +19,9 @@ module OoxmlParser
17
19
  node.xpath('*').each do |node_child|
18
20
  @color = case node_child.name
19
21
  when 'prstClr'
20
- PresetColor.new(parent: self).parse(node_child)
22
+ ValuedChild.new(:string, parent: self).parse(node_child)
21
23
  else
22
- Color.parse_color(node_child)
24
+ Color.new(parent: self).parse_color(node_child)
23
25
  end
24
26
  end
25
27
  self
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `lin` tags
3
5
  class LinearGradient < OOXMLDocumentObject
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `pattFill` tag
3
5
  class PresentationPattern < OOXMLDocumentObject
@@ -17,9 +19,9 @@ module OoxmlParser
17
19
  node.xpath('*').each do |color_node|
18
20
  case color_node.name
19
21
  when 'fgClr'
20
- @foreground_color = Color.parse_color(color_node.xpath('*').first)
22
+ @foreground_color = Color.new(parent: self).parse_color(color_node.xpath('*').first)
21
23
  when 'bgClr'
22
- @background_color = Color.parse_color(color_node.xpath('*').first)
24
+ @background_color = Color.new(parent: self).parse_color(color_node.xpath('*').first)
23
25
  end
24
26
  end
25
27
  self
@@ -1,10 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
4
+ # Class for working with SchemeColor
2
5
  class SchemeColor
3
6
  attr_accessor :value, :properties, :converted_color
4
7
 
5
- def initialize(value = nil, converted_color = 0)
8
+ def initialize(value = nil, converted_color = 0, parent: nil)
6
9
  @value = value
7
10
  @converted_color = converted_color
11
+ @parent = parent
8
12
  end
9
13
 
10
14
  def to_s
@@ -1,19 +1,19 @@
1
- # Class for hold ThemeColors list
1
+ # frozen_string_literal: true
2
+
2
3
  module OoxmlParser
3
- class ThemeColors
4
- class << self
5
- # @return [Hash] list of colors
6
- attr_accessor :list
4
+ # Class for hold ThemeColors list
5
+ class ThemeColors < OOXMLDocumentObject
6
+ # @return [Hash] list of colors
7
+ attr_accessor :list
7
8
 
8
- def parse_color_theme(theme, tint)
9
- themes_array = ThemeColors.list.to_a
10
- # TODO: if no swap performed - incorrect color parsing. But don't know why it needed
11
- themes_array[0], themes_array[1] = themes_array[1], themes_array[0]
12
- themes_array[2], themes_array[3] = themes_array[3], themes_array[2]
13
- hls = HSLColor.rgb_to_hsl(themes_array[theme][1])
14
- tint = 0 if tint.nil?
15
- hls.calculate_rgb_with_tint(tint)
16
- end
9
+ def parse_color_theme(theme, tint)
10
+ themes_array = root_object.theme.color_scheme.values
11
+ # TODO: if no swap performed - incorrect color parsing. But don't know why it needed
12
+ themes_array[0], themes_array[1] = themes_array[1], themes_array[0]
13
+ themes_array[2], themes_array[3] = themes_array[3], themes_array[2]
14
+ hls = HSLColor.rgb_to_hsl(themes_array[theme].color)
15
+ tint = 0 if tint.nil?
16
+ hls.calculate_rgb_with_tint(tint)
17
17
  end
18
18
  end
19
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
2
4
  # Class for parsing `tile` tag
3
5
  class Tile < OOXMLDocumentObject
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'content_types/content_type_default'
4
+ require_relative 'content_types/content_type_override'
5
+ module OoxmlParser
6
+ # Class for data from `[Content_Types].xml` file
7
+ class ContentTypes < OOXMLDocumentObject
8
+ # @return [Array] list of content types
9
+ attr_accessor :content_types_list
10
+
11
+ def initialize(parent: nil)
12
+ @parent = parent
13
+ @content_types_list = []
14
+ end
15
+
16
+ # @return [Array] accessor
17
+ def [](key)
18
+ @content_types_list[key]
19
+ end
20
+
21
+ def parse
22
+ doc = Nokogiri::XML.parse(File.open("#{OOXMLDocumentObject.path_to_folder}/[Content_Types].xml"))
23
+ node = doc.xpath('*').first
24
+
25
+ node.xpath('*').each do |node_child|
26
+ case node_child.name
27
+ when 'Default'
28
+ @content_types_list << ContentTypeDefault.new(parent: self).parse(node_child)
29
+ when 'Override'
30
+ @content_types_list << ContentTypeOverride.new(parent: self).parse(node_child)
31
+ end
32
+ end
33
+ self
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class for data from `Default` tag
5
+ class ContentTypeDefault < OOXMLDocumentObject
6
+ # @return [String] content type
7
+ attr_reader :content_type
8
+ # @return [String] extension
9
+ attr_reader :extension
10
+
11
+ def parse(node)
12
+ node.attributes.each do |key, value|
13
+ case key
14
+ when 'ContentType'
15
+ @content_type = value.value.to_s
16
+ when 'Extension'
17
+ @extension = value.value.to_s
18
+ end
19
+ end
20
+ self
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class for data from `Override` tag
5
+ class ContentTypeOverride < OOXMLDocumentObject
6
+ # @return [String] content type
7
+ attr_reader :content_type
8
+ # @return [String] part name
9
+ attr_reader :part_name
10
+
11
+ def parse(node)
12
+ node.attributes.each do |key, value|
13
+ case key
14
+ when 'ContentType'
15
+ @content_type = value.value.to_s
16
+ when 'PartName'
17
+ @part_name = value.value.to_s
18
+ end
19
+ end
20
+ self
21
+ end
22
+ end
23
+ end
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OoxmlParser
4
+ # Class for working with coordinates
2
5
  class Coordinates
3
6
  attr_accessor :row, :column, :list
4
7
 
@@ -30,6 +33,7 @@ module OoxmlParser
30
33
  return parse_coordinates_array(arguments_string) if arguments_string.include?(',')
31
34
  return warn "Formulas with # is unsupported: #{arguments_string}" if arguments_string.include?('#')
32
35
  return warn 'Formulas consists from `!` only' if arguments_string == '!'
36
+
33
37
  sheet_name = 'Sheet1'
34
38
 
35
39
  if arguments_string.include?('!')
@@ -68,8 +72,6 @@ module OoxmlParser
68
72
  end
69
73
  end
70
74
  end
71
- else
72
- raise 'Wrong arguments format'
73
75
  end
74
76
  arguments_array
75
77
  end
@@ -100,20 +102,23 @@ module OoxmlParser
100
102
  # StringHelper.get_column_name('45') #=> "AS"
101
103
  # StringHelper.get_column_name('287') #=> "KA"
102
104
  def get_column_name(number)
103
- (number.to_i > 0 ? ('A'..'Z').to_a[(number.to_i - 1) % 26] + get_column_name((number.to_i - 1) / 26).reverse : '').reverse
105
+ (number.to_i.positive? ? ('A'..'Z').to_a[(number.to_i - 1) % 26] + get_column_name((number.to_i - 1) / 26).reverse : '').reverse
104
106
  end
105
107
  end
106
108
 
107
- # get_column_number -> integer
108
109
  # @return [Integer] number of column
109
110
  # This method takes @column string
110
111
  # and converts into integer
111
- def get_column_number
112
+ def column_number
112
113
  @column.reverse.each_char.reduce(0) do |result, char|
113
114
  result + (char.downcase.ord - 96) * (26**@column.reverse.index(char))
114
115
  end
115
116
  end
116
117
 
118
+ alias get_column_number column_number
119
+ extend Gem::Deprecate
120
+ deprecate :get_column_number, 'column_number', 2020, 1
121
+
117
122
  # Compares rows of two cells
118
123
  # @param [Coordinates] other_cell other cell coordinates
119
124
  # @return [true, false] true, if row greater, than other row
@@ -125,7 +130,7 @@ module OoxmlParser
125
130
  # @param [Coordinates] other_cell other cell coordinates
126
131
  # @return [true, false] true, if column greater, than other row
127
132
  def column_greater_that_other?(other_cell)
128
- get_column_number > other_cell.get_column_number
133
+ column_number > other_cell.column_number
129
134
  end
130
135
 
131
136
  def to_s