ooxml_parser 0.8.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +55 -48
  3. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/pivot_formats.rb +1 -1
  4. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/plot_area/common_chart_data.rb +1 -1
  5. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text/string_reference/number_string_cache.rb +1 -1
  6. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb +6 -10
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb +1 -1
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_cells_range.rb +1 -1
  9. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_legend.rb +4 -6
  10. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/display_labels_properties.rb +4 -4
  11. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +1 -1
  12. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb +1 -1
  13. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +1 -1
  14. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/docx_graphic.rb +1 -1
  15. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +1 -1
  16. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +0 -4
  17. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +0 -4
  18. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +0 -4
  19. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +0 -4
  20. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +0 -4
  21. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb +1 -1
  22. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +1 -1
  23. 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 +1 -1
  24. 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 +1 -1
  25. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/ooxml_custom_geometry.rb +1 -1
  26. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +1 -1
  27. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +1 -1
  28. 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 +1 -1
  29. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb +1 -1
  30. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +1 -1
  31. data/lib/ooxml_parser/common_parser/common_data/color.rb +6 -6
  32. data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +29 -0
  33. data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +0 -33
  34. data/lib/ooxml_parser/common_parser/common_data/colors/image_fill.rb +1 -1
  35. data/lib/ooxml_parser/common_parser/common_data/colors/presentation_fill/gradient_color.rb +1 -1
  36. data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +1 -1
  37. data/lib/ooxml_parser/common_parser/common_data/colors/tile.rb +1 -1
  38. data/lib/ooxml_parser/common_parser/common_data/content_types.rb +8 -1
  39. data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +2 -2
  40. data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +2 -2
  41. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +1 -1
  42. data/lib/ooxml_parser/common_parser/common_data/paragraph.rb +1 -1
  43. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties.rb +2 -4
  44. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +1 -1
  45. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +3 -3
  46. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +1 -1
  47. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/shade.rb +1 -1
  48. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +1 -1
  49. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +1 -1
  50. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb +1 -1
  51. data/lib/ooxml_parser/common_parser/common_data/relationships.rb +1 -1
  52. data/lib/ooxml_parser/common_parser/common_data/table.rb +1 -1
  53. data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +1 -5
  54. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +2 -2
  55. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_look.rb +1 -1
  56. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +1 -1
  57. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell.rb +1 -1
  58. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/grid_span.rb +1 -7
  59. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +1 -1
  60. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/table_cell_line.rb +1 -1
  61. data/lib/ooxml_parser/common_parser/common_data/table/row/row.rb +1 -1
  62. data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +1 -1
  63. data/lib/ooxml_parser/common_parser/common_data/table/table_properties.rb +1 -1
  64. data/lib/ooxml_parser/common_parser/common_data/underline.rb +1 -1
  65. data/lib/ooxml_parser/common_parser/common_data/valued_child.rb +1 -1
  66. data/lib/ooxml_parser/common_parser/common_document_structure.rb +1 -0
  67. data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +2 -2
  68. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments.rb +2 -2
  69. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +1 -1
  70. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments_extended.rb +2 -2
  71. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb +1 -1
  72. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb +1 -1
  73. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +1 -1
  74. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +4 -4
  75. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula.rb +1 -1
  76. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/bar.rb +1 -1
  77. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/box.rb +1 -1
  78. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/delimeter.rb +1 -1
  79. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/limit.rb +1 -1
  80. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/math_run/math_run_properties.rb +1 -1
  81. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix.rb +1 -1
  82. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/matrix/matrix_row.rb +1 -1
  83. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/radical.rb +1 -1
  84. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +1 -1
  85. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +38 -21
  86. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +2 -2
  87. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/text_outline.rb +1 -1
  88. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/field_simple.rb +1 -1
  89. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +1 -1
  90. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/sdt/sdt_content.rb +1 -1
  91. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/style_parametres.rb +5 -8
  92. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +1 -1
  93. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +2 -2
  94. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering.rb +1 -1
  95. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level.rb +1 -1
  96. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering/abstract_numbering/numbering_level/suffix.rb +1 -1
  97. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +1 -0
  98. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +1 -0
  99. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_margins.rb +1 -0
  100. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_properties.rb +1 -1
  101. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +2 -1
  102. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +2 -2
  103. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/comment_authors.rb +1 -1
  104. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_comments.rb +1 -1
  105. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +1 -0
  106. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +1 -1
  107. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +1 -1
  108. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb +1 -1
  109. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb +1 -1
  110. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb +2 -2
  111. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/presentation_alternate_content.rb +1 -1
  112. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/shapes_grouping.rb +1 -1
  113. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing.rb +1 -1
  114. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb +1 -1
  115. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/target_element.rb +1 -1
  116. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +1 -1
  117. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node/common_timing/condition_list.rb +1 -1
  118. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +1 -3
  119. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action/sound.rb +1 -1
  120. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/table_styles.rb +1 -1
  121. data/lib/ooxml_parser/version.rb +1 -1
  122. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +17 -3
  123. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +1 -1
  124. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +6 -0
  125. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb +43 -0
  126. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field.rb +37 -0
  127. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field/shared_items.rb +42 -0
  128. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition.rb +114 -0
  129. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items.rb +43 -0
  130. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/column_row_items/column_row_item.rb +22 -0
  131. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/location.rb +34 -0
  132. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields.rb +43 -0
  133. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field.rb +37 -0
  134. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb +43 -0
  135. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items/item.rb +26 -0
  136. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_table_style_info.rb +42 -0
  137. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/shared_string_table.rb +1 -1
  138. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +1 -1
  139. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs.rb +1 -1
  140. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/cell_style/alignment.rb +5 -5
  141. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +1 -1
  142. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills.rb +1 -1
  143. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +1 -1
  144. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts.rb +1 -1
  145. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +1 -1
  146. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/number_formats.rb +1 -1
  147. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/xlsx_borders.rb +1 -1
  148. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +1 -1
  149. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +1 -1
  150. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/comment_list.rb +1 -1
  151. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments/excel_comment.rb +1 -1
  152. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/sheet_view.rb +1 -1
  153. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column.rb +1 -1
  154. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/autofilter/filter_column/custom_filters.rb +1 -1
  155. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list.rb +1 -1
  156. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/sparkline_groups.rb +1 -1
  157. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/table_columns.rb +1 -1
  158. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row.rb +1 -1
  159. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell.rb +1 -1
  160. metadata +110 -35
  161. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/shape/non_visual_shape_properties/hyperlinks/hyperlink_for_hover.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bff9ef732546243f5b751041e9fb41602a4e0ca823f93a83f671975e881cf6fd
4
- data.tar.gz: 3e5bc500fb572b0fa43297f6d85a0f47e1d35365caed9803441b81785808e83d
3
+ metadata.gz: 152de470eb7ecac05ca2d886b7c7113edb6a2c388fe29491b5b0c4341e771237
4
+ data.tar.gz: cf0aa14cc429393d88a2e3a39961242ab740c96a878d149ec74cdaade6fd2587
5
5
  SHA512:
6
- metadata.gz: 93a6648cf7f5ce6a088d3c654c2c50b04afb363507e20ef8f2198ba35265310dfc44205819b32d635b997c589656bb87514fc5ab2007d2b898accf4d8fcb2b4b
7
- data.tar.gz: 3e3f6e9c0a70516a176f5614294f8aecb02be45219c9a9c6799d3b3e75e7a2d7b6ff0a3680e6a8f18d8bbd6d8658740cac1157447b94659bd082a07ec9025a5e
6
+ metadata.gz: 34869710a5435a3d26c6b70dd42b1290cd80a1b7dff16582f3d4abaaa765877b69c58a9af5543b86cdbad78c27dd3849daf14f09e8bf0c8e5c4c5bfd3fdb0b8f
7
+ data.tar.gz: 538f12d23be8b548ef8bbcfd476f93f4c0926cfbe9c71d7101a97ccf040e8c238dece97f7c04d49bef6dd524e296795c3f1ada9b368016bf6864f9262cfd1dcc
@@ -38,7 +38,7 @@ module OoxmlParser
38
38
  @legend = nil
39
39
  @axises = []
40
40
  @series = []
41
- @parent = parent
41
+ super
42
42
  end
43
43
 
44
44
  # Parse properties of Chart
@@ -74,94 +74,101 @@ module OoxmlParser
74
74
  extend Gem::Deprecate
75
75
  deprecate :data, 'series points interface', 2020, 1
76
76
 
77
- # Parse Chart
78
- # @param parent [OOOXMLDocumentObject] parent of chart
77
+ # Parse Chart data
79
78
  # @return [Chart] result of parsing
80
- def self.parse(parent: nil)
81
- chart = Chart.new(parent: parent)
82
- chart_xml = chart.parse_xml(OOXMLDocumentObject.current_xml)
79
+ def parse
80
+ chart_xml = parse_xml(OOXMLDocumentObject.current_xml)
83
81
  chart_xml.xpath('*').each do |chart_node|
84
82
  case chart_node.name
85
83
  when 'chartSpace'
86
84
  chart_node.xpath('*').each do |chart_space_node_child|
87
85
  case chart_space_node_child.name
88
86
  when 'AlternateContent'
89
- chart.alternate_content = AlternateContent.new(parent: chart).parse(chart_space_node_child)
87
+ @alternate_content = AlternateContent.new(parent: self).parse(chart_space_node_child)
90
88
  when 'spPr'
91
- chart.shape_properties = DocxShapeProperties.new(parent: chart).parse(chart_space_node_child)
89
+ @shape_properties = DocxShapeProperties.new(parent: self).parse(chart_space_node_child)
92
90
  when 'chart'
93
91
  chart_space_node_child.xpath('*').each do |chart_node_child|
94
92
  case chart_node_child.name
95
93
  when 'plotArea'
96
94
  chart_node_child.xpath('*').each do |plot_area_node_child|
97
- next unless chart.type.empty?
95
+ next unless type.empty?
98
96
 
99
97
  case plot_area_node_child.name
100
98
  when 'barChart'
101
- chart.type = :bar
99
+ @type = :bar
102
100
  bar_dir_node = plot_area_node_child.xpath('c:barDir')
103
- chart.type = :column if bar_dir_node.first.attribute('val').value == 'col'
104
- chart.parse_properties(plot_area_node_child)
101
+ @type = :column if bar_dir_node.first.attribute('val').value == 'col'
102
+ parse_properties(plot_area_node_child)
105
103
  when 'lineChart'
106
- chart.type = :line
107
- chart.parse_properties(plot_area_node_child)
104
+ @type = :line
105
+ parse_properties(plot_area_node_child)
108
106
  when 'areaChart'
109
- chart.type = :area
110
- chart.parse_properties(plot_area_node_child)
107
+ @type = :area
108
+ parse_properties(plot_area_node_child)
111
109
  when 'bubbleChart'
112
- chart.type = :bubble
113
- chart.parse_properties(plot_area_node_child)
110
+ @type = :bubble
111
+ parse_properties(plot_area_node_child)
114
112
  when 'doughnutChart'
115
- chart.type = :doughnut
116
- chart.parse_properties(plot_area_node_child)
113
+ @type = :doughnut
114
+ parse_properties(plot_area_node_child)
117
115
  when 'pieChart'
118
- chart.type = :pie
119
- chart.parse_properties(plot_area_node_child)
116
+ @type = :pie
117
+ parse_properties(plot_area_node_child)
120
118
  when 'scatterChart'
121
- chart.type = :point
122
- chart.parse_properties(plot_area_node_child)
119
+ @type = :point
120
+ parse_properties(plot_area_node_child)
123
121
  when 'radarChart'
124
- chart.type = :radar
125
- chart.parse_properties(plot_area_node_child)
122
+ @type = :radar
123
+ parse_properties(plot_area_node_child)
126
124
  when 'stockChart'
127
- chart.type = :stock
128
- chart.parse_properties(plot_area_node_child)
125
+ @type = :stock
126
+ parse_properties(plot_area_node_child)
129
127
  when 'surface3DChart'
130
- chart.type = :surface_3d
131
- chart.parse_properties(plot_area_node_child)
128
+ @type = :surface_3d
129
+ parse_properties(plot_area_node_child)
132
130
  when 'line3DChart'
133
- chart.type = :line_3d
134
- chart.parse_properties(plot_area_node_child)
131
+ @type = :line_3d
132
+ parse_properties(plot_area_node_child)
135
133
  when 'bar3DChart'
136
- chart.type = :bar_3d
137
- chart.parse_properties(plot_area_node_child)
134
+ @type = :bar_3d
135
+ parse_properties(plot_area_node_child)
138
136
  when 'pie3DChart'
139
- chart.type = :pie_3d
140
- chart.parse_properties(plot_area_node_child)
137
+ @type = :pie_3d
138
+ parse_properties(plot_area_node_child)
141
139
  end
142
140
  end
143
- chart_node_child.xpath('*').each do |plot_area_node_child|
144
- case plot_area_node_child.name
145
- when 'catAx', 'valAx'
146
- chart.axises << ChartAxis.new(parent: chart).parse(plot_area_node_child)
147
- end
148
- end
149
- chart.plot_area = PlotArea.new(parent: chart).parse(chart_node_child)
141
+ parse_axis(chart_node_child)
142
+ @plot_area = PlotArea.new(parent: self).parse(chart_node_child)
150
143
  when 'title'
151
- chart.title = ChartAxisTitle.new(parent: chart).parse(chart_node_child)
144
+ @title = ChartAxisTitle.new(parent: self).parse(chart_node_child)
152
145
  when 'legend'
153
- chart.legend = ChartLegend.new(parent: chart).parse(chart_node_child)
146
+ @legend = ChartLegend.new(parent: self).parse(chart_node_child)
154
147
  when 'view3D'
155
- chart.view_3d = View3D.new(parent: chart).parse(chart_node_child)
148
+ @view_3d = View3D.new(parent: self).parse(chart_node_child)
156
149
  when 'pivotFmts'
157
- chart.pivot_formats = PivotFormats.new(parent: chart).parse(chart_node_child)
150
+ @pivot_formats = PivotFormats.new(parent: self).parse(chart_node_child)
158
151
  end
159
152
  end
160
153
  end
161
154
  end
162
155
  end
163
156
  end
164
- chart
157
+ self
158
+ end
159
+
160
+ private
161
+
162
+ # Perform parsing of axis info
163
+ # @param node [Nokogiri::XML:Element] node to parse
164
+ # @return [void]
165
+ def parse_axis(node)
166
+ node.xpath('*').each do |node_child|
167
+ case node_child.name
168
+ when 'catAx', 'valAx'
169
+ @axises << ChartAxis.new(parent: self).parse(node_child)
170
+ end
171
+ end
165
172
  end
166
173
  end
167
174
  end
@@ -8,8 +8,8 @@ module OoxmlParser
8
8
  attr_reader :pivot_formats_list
9
9
 
10
10
  def initialize(parent: nil)
11
- @parent = parent
12
11
  @pivot_formats_list = []
12
+ super
13
13
  end
14
14
 
15
15
  # @return [Array, PivotFormat] accessor
@@ -10,7 +10,7 @@ module OoxmlParser
10
10
 
11
11
  def initialize(parent: nil)
12
12
  @series = []
13
- @parent = parent
13
+ super
14
14
  end
15
15
 
16
16
  # Parse CommonChartData object
@@ -13,7 +13,7 @@ module OoxmlParser
13
13
 
14
14
  def initialize(parent: nil)
15
15
  @points = []
16
- @parent = parent
16
+ super
17
17
  end
18
18
 
19
19
  # Parse Order
@@ -11,16 +11,12 @@ module OoxmlParser
11
11
  # @return [ValuedChild] the position of the tick labels
12
12
  attr_reader :tick_label_position
13
13
 
14
- def initialize(title = ChartAxisTitle.new,
15
- display = true,
16
- major_grid_lines = false,
17
- minor_grid_lines = false,
18
- parent: nil)
19
- @title = title
20
- @display = display
21
- @minor_grid_lines = minor_grid_lines
22
- @major_grid_lines = major_grid_lines
23
- @parent = parent
14
+ def initialize(params = {})
15
+ @title = params.fetch(:title, ChartAxisTitle.new)
16
+ @display = params.fetch(:display, true)
17
+ @minor_grid_lines = params.fetch(:minor_grid_lines, false)
18
+ @major_grid_lines = params.fetch(:major_grid_lines, false)
19
+ super(parent: params[:parent])
24
20
  end
25
21
 
26
22
  # Parse ChartAxis object
@@ -7,7 +7,7 @@ module OoxmlParser
7
7
 
8
8
  def initialize(parent: nil)
9
9
  @elements = []
10
- @parent = parent
10
+ super
11
11
  end
12
12
 
13
13
  # @return [Boolean] if chart title is visible
@@ -8,7 +8,7 @@ module OoxmlParser
8
8
  def initialize(parent: nil)
9
9
  @list = ''
10
10
  @points = []
11
- @parent = parent
11
+ super
12
12
  end
13
13
 
14
14
  # Parse ChartCellsRange object
@@ -5,12 +5,10 @@ module OoxmlParser
5
5
  class ChartLegend < OOXMLDocumentObject
6
6
  attr_accessor :position, :overlay
7
7
 
8
- def initialize(position = :right,
9
- overlay = false,
10
- parent: nil)
11
- @position = position
12
- @overlay = overlay
13
- @parent = parent
8
+ def initialize(params = {})
9
+ @position = params.fetch(:position, :right)
10
+ @overlay = params.fetch(:overlay, false)
11
+ super(parent: params[:parent])
14
12
  end
15
13
 
16
14
  # Return combined data from @position and @overlay
@@ -11,10 +11,10 @@ module OoxmlParser
11
11
  # @return [True, False] is label is deleted
12
12
  attr_reader :delete
13
13
 
14
- def initialize(show_legend_key = false, show_values = false, parent: nil)
15
- @show_legend_key = show_legend_key
16
- @show_values = show_values
17
- @parent = parent
14
+ def initialize(params = {})
15
+ @show_legend_key = params.fetch(:show_legend_key, false)
16
+ @show_values = params.fetch(:show_values, false)
17
+ super(parent: params[:parent])
18
18
  end
19
19
 
20
20
  # Parse DisplayLabelsProperties object
@@ -16,7 +16,7 @@ module OoxmlParser
16
16
 
17
17
  def initialize(properties = DocxDrawingProperties.new, parent: nil)
18
18
  @properties = properties
19
- @parent = parent
19
+ super(parent: parent)
20
20
  end
21
21
 
22
22
  # Parse DocxDrawing
@@ -7,7 +7,7 @@ module OoxmlParser
7
7
 
8
8
  def initialize(parent: nil)
9
9
  @wrap_text = :none
10
- @parent = parent
10
+ super
11
11
  end
12
12
 
13
13
  # Parse DocxWrapDrawing object
@@ -20,7 +20,7 @@ module OoxmlParser
20
20
 
21
21
  # @return [String] result of convert of object to string
22
22
  def to_s
23
- '(' + @x.to_s + '; ' + @y.to_s + ')'
23
+ "(#{@x}; #{@y})"
24
24
  end
25
25
 
26
26
  # Compare two OOXMLCoordinates objects
@@ -24,7 +24,7 @@ module OoxmlParser
24
24
  when 'chart'
25
25
  @type = :chart
26
26
  OOXMLDocumentObject.add_to_xmls_stack("#{OOXMLDocumentObject.root_subfolder}/#{OOXMLDocumentObject.get_link_from_rels(node_child.attribute('id').value)}")
27
- @data = Chart.parse(parent: self)
27
+ @data = Chart.new(parent: self).parse
28
28
  OOXMLDocumentObject.xmls_stack.pop
29
29
  when 'wgp'
30
30
  @type = :group
@@ -7,7 +7,7 @@ module OoxmlParser
7
7
 
8
8
  def initialize(parent: nil)
9
9
  @elements = []
10
- @parent = parent
10
+ super
11
11
  end
12
12
 
13
13
  # Parse OOXMLTextBox object
@@ -16,10 +16,6 @@ module OoxmlParser
16
16
  # @return [LineReference] line reference
17
17
  attr_reader :line_reference
18
18
 
19
- def initialize(parent: nil)
20
- @parent = parent
21
- end
22
-
23
19
  # Parse ShapeStyle object
24
20
  # @param node [Nokogiri::XML:Element] node to parse
25
21
  # @return [ShapeStyle] result of parsing
@@ -8,10 +8,6 @@ module OoxmlParser
8
8
  # @return [Color] scheme color of EffectReference
9
9
  attr_reader :scheme_color
10
10
 
11
- def initialize(parent: nil)
12
- @parent = parent
13
- end
14
-
15
11
  # Parse EffectReference object
16
12
  # @param node [Nokogiri::XML:Element] node to parse
17
13
  # @return [EffectReference] result of parsing
@@ -8,10 +8,6 @@ module OoxmlParser
8
8
  # @return [Color] scheme color of FillReference
9
9
  attr_reader :scheme_color
10
10
 
11
- def initialize(parent: nil)
12
- @parent = parent
13
- end
14
-
15
11
  # Parse FillReference object
16
12
  # @param node [Nokogiri::XML:Element] node to parse
17
13
  # @return [FillReference] result of parsing
@@ -8,10 +8,6 @@ module OoxmlParser
8
8
  # @return [Color] scheme color of FontReference
9
9
  attr_reader :scheme_color
10
10
 
11
- def initialize(parent: nil)
12
- @parent = parent
13
- end
14
-
15
11
  # Parse FontReference object
16
12
  # @param node [Nokogiri::XML:Element] node to parse
17
13
  # @return [FontReference] result of parsing
@@ -8,10 +8,6 @@ module OoxmlParser
8
8
  # @return [Color] scheme color of LineReference
9
9
  attr_reader :scheme_color
10
10
 
11
- def initialize(parent: nil)
12
- @parent = parent
13
- end
14
-
15
11
  # Parse LineReference object
16
12
  # @param node [Nokogiri::XML:Element] node to parse
17
13
  # @return [LineReference] result of parsing
@@ -7,7 +7,7 @@ module OoxmlParser
7
7
 
8
8
  def initialize(parent: nil)
9
9
  @paragraphs = []
10
- @parent = parent
10
+ super
11
11
  end
12
12
 
13
13
  # Parse TextBody object
@@ -8,7 +8,7 @@ module OoxmlParser
8
8
  def initialize(parent: nil)
9
9
  @color = Color.new
10
10
  @type = :unknown
11
- @parent = parent
11
+ super
12
12
  end
13
13
 
14
14
  # Parse DocxColorScheme object
@@ -8,7 +8,7 @@ module OoxmlParser
8
8
 
9
9
  def initialize(elements = [], parent: nil)
10
10
  @elements = elements
11
- @parent = parent
11
+ super(parent: parent)
12
12
  end
13
13
 
14
14
  # Parse DocxShapeLinePath object
@@ -7,7 +7,7 @@ module OoxmlParser
7
7
 
8
8
  def initialize(points = [], parent: nil)
9
9
  @points = points
10
- @parent = parent
10
+ super(parent: parent)
11
11
  end
12
12
 
13
13
  # Parse DocxShapeLineElement
@@ -8,7 +8,7 @@ module OoxmlParser
8
8
 
9
9
  def initialize(paths_list = [], parent: nil)
10
10
  @paths_list = paths_list
11
- @parent = parent
11
+ super(parent: parent)
12
12
  end
13
13
 
14
14
  # Parse OOXMLCustomGeometry object
@@ -13,7 +13,7 @@ module OoxmlParser
13
13
 
14
14
  def initialize(parent: nil)
15
15
  @width = OoxmlSize.new(0)
16
- @parent = parent
16
+ super
17
17
  end
18
18
 
19
19
  # @return [Integer] stroke size of object
@@ -29,7 +29,7 @@ module OoxmlParser
29
29
 
30
30
  def initialize(parent: nil)
31
31
  @line = DocxShapeLine.new
32
- @parent = parent
32
+ super
33
33
  end
34
34
 
35
35
  # Parse DocxShapeProperties object