ooxml_parser 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ooxml_parser.rb +1 -0
  3. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +6 -0
  4. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +2 -2
  5. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +0 -2
  6. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +3 -0
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +1 -0
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +4 -1
  9. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +1 -0
  10. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +4 -0
  11. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +0 -2
  12. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +1 -3
  13. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +1 -0
  14. 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 +0 -2
  15. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +1 -0
  16. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +1 -3
  17. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +1 -3
  18. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +1 -3
  19. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +3 -0
  20. data/lib/ooxml_parser/common_parser/common_data/color.rb +36 -4
  21. data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +5 -0
  22. data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +11 -0
  23. data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +1 -0
  24. data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +4 -0
  25. data/lib/ooxml_parser/common_parser/common_data/content_types.rb +2 -0
  26. data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +3 -0
  27. data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +3 -0
  28. data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +7 -0
  29. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +24 -2
  30. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +3 -0
  31. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +0 -8
  32. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +2 -0
  33. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +1 -0
  34. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +16 -13
  35. data/lib/ooxml_parser/common_parser/common_data/table.rb +2 -0
  36. data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +3 -0
  37. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +7 -0
  38. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +1 -0
  39. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +4 -4
  40. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +4 -7
  41. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +6 -0
  42. data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +3 -0
  43. data/lib/ooxml_parser/common_parser/common_data/underline.rb +4 -0
  44. data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +27 -3
  45. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +3 -0
  46. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +2 -0
  47. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +22 -1
  48. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +1 -1
  49. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +1 -0
  50. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +3 -0
  51. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +13 -3
  52. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +4 -1
  53. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +0 -2
  54. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +3 -0
  55. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +2 -0
  56. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +0 -2
  57. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +5 -0
  58. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +3 -0
  59. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +1 -0
  60. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +2 -0
  61. data/lib/ooxml_parser/docx_parser/docx_parser.rb +3 -0
  62. data/lib/ooxml_parser/name.rb +1 -0
  63. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +2 -0
  64. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +3 -0
  65. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +3 -0
  66. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +3 -0
  67. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +3 -0
  68. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +15 -1
  69. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +3 -0
  70. data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +3 -0
  71. data/lib/ooxml_parser/version.rb +2 -1
  72. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +21 -2
  73. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +3 -0
  74. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache.rb +41 -0
  75. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +37 -0
  76. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source.rb +33 -0
  77. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source/worksheet_source.rb +26 -0
  78. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +2 -0
  79. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +5 -0
  80. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +2 -0
  81. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +3 -0
  82. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +5 -0
  83. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +4 -0
  84. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +4 -0
  85. data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +3 -0
  86. metadata +64 -4
@@ -44,6 +44,9 @@ module OoxmlParser
44
44
 
45
45
  alias theme_colors theme
46
46
 
47
+ # Compare this object to other
48
+ # @param other [Object] any other object
49
+ # @return [True, False] result of comparision
47
50
  def ==(other)
48
51
  @elements == other.elements &&
49
52
  @page_properties == other.page_properties &&
@@ -53,6 +56,10 @@ module OoxmlParser
53
56
  @comments == other.comments
54
57
  end
55
58
 
59
+ # Get element by it's type
60
+ # @param location [Symbol] location of object
61
+ # @param type [Symbol] type of object
62
+ # @return [OOXMLDocumentObject]
56
63
  def element_by_description(location: :canvas, type: :docx_paragraph)
57
64
  case location
58
65
  when :canvas
@@ -95,6 +102,9 @@ module OoxmlParser
95
102
  end
96
103
  end
97
104
 
105
+ # Get note by it's description
106
+ # @param type [Symbol] note type
107
+ # @return [Note]
98
108
  def note_by_description(type)
99
109
  notes.each do |note|
100
110
  return note if note.type.to_sym == type
@@ -102,6 +112,11 @@ module OoxmlParser
102
112
  raise 'There isn\'t this type of the note'
103
113
  end
104
114
 
115
+ # Detect numbering type
116
+ # @param location [Symbol] location of object
117
+ # @param type [Symbol] type of object
118
+ # @param paragraph_number [Integer] number of object
119
+ # @return [Array<String,String>] type of numbering
105
120
  def recognize_numbering(location: :canvas, type: :simple, paragraph_number: 0)
106
121
  elements = element_by_description(location: location, type: type)
107
122
  lvl_text = elements[paragraph_number].numbering.abstruct_numbering.level_list[0].text.value
@@ -109,6 +124,11 @@ module OoxmlParser
109
124
  [num_format, lvl_text]
110
125
  end
111
126
 
127
+ # Return outline type
128
+ # @param location [Symbol] location of object
129
+ # @param type [Symbol] type of object
130
+ # @param levels_count [Integer] count of levels to detect
131
+ # @return [Array<String,String>] type of outline
112
132
  def outline(location: :canvas, type: :simple, levels_count: 1)
113
133
  elements = element_by_description(location: location, type: type)
114
134
  set = []
@@ -124,6 +144,8 @@ module OoxmlParser
124
144
  styles.styles
125
145
  end
126
146
 
147
+ # Parse docx file
148
+ # @return [DocumentStructure] parsed structure
127
149
  def self.parse
128
150
  doc_structure = DocumentStructure.new
129
151
  doc_structure.content_types = ContentTypes.new(parent: doc_structure).parse
@@ -181,6 +203,8 @@ module OoxmlParser
181
203
  doc_structure
182
204
  end
183
205
 
206
+ # Parse default style
207
+ # @return [void]
184
208
  def parse_default_style
185
209
  doc = parse_xml(OOXMLDocumentObject.path_to_folder + 'word/styles.xml')
186
210
  doc.search('//w:style').each do |style|
@@ -194,14 +218,14 @@ module OoxmlParser
194
218
  DocumentStructure.default_paragraph_style = DocxParagraph.new.parse_paragraph_style(paragraph_pr_tag, DocumentStructure.default_run_style)
195
219
  end
196
220
  style.xpath('w:rPr').each do |character_pr_tag|
197
- DocumentStructure.default_run_style.parse_properties(character_pr_tag, DocumentStructure.default_run_style)
221
+ DocumentStructure.default_run_style.parse_properties(character_pr_tag)
198
222
  end
199
223
  elsif (style.attribute('default').value == '1' ||
200
224
  style.attribute('default').value == 'on' ||
201
225
  style.attribute('default').value == 'true') &&
202
226
  style.attribute('type').value == 'character'
203
227
  style.xpath('w:rPr').each do |character_pr_tag|
204
- DocumentStructure.default_run_style.parse_properties(character_pr_tag, DocumentStructure.default_run_style)
228
+ DocumentStructure.default_run_style.parse_properties(character_pr_tag)
205
229
  end
206
230
  end
207
231
  end
@@ -216,7 +240,7 @@ module OoxmlParser
216
240
  style.attribute('type').value == 'table'
217
241
 
218
242
  style.xpath('w:rPr').each do |table_character_pr_tag|
219
- DocumentStructure.default_table_run_style.parse_properties(table_character_pr_tag, DocumentStructure.default_run_style)
243
+ DocumentStructure.default_table_run_style.parse_properties(table_character_pr_tag)
220
244
  end
221
245
  end
222
246
  end
@@ -14,6 +14,9 @@ module OoxmlParser
14
14
  @parent = parent
15
15
  end
16
16
 
17
+ # Parse Comment object
18
+ # @param node [Nokogiri::XML:Element] node to parse
19
+ # @return [Comment] result of parsing
17
20
  def parse(node)
18
21
  node.attributes.each do |key, value|
19
22
  case key
@@ -44,10 +44,12 @@ module OoxmlParser
44
44
  @parent = parent
45
45
  end
46
46
 
47
+ # @return [String] result of convert of object to string
47
48
  def to_s
48
49
  "Table style properties list: #{@table_style_properties_list.join(',')}"
49
50
  end
50
51
 
52
+ # @return [String] inspect of object for debug means
51
53
  def inspect
52
54
  to_s
53
55
  end
@@ -57,6 +57,9 @@ module OoxmlParser
57
57
 
58
58
  alias elements character_style_array
59
59
 
60
+ # Constructor for copy of object
61
+ # @param source [DocxParagraph] original object
62
+ # @return [void]
60
63
  def initialize_copy(source)
61
64
  super
62
65
  @bookmark_start = source.bookmark_start.clone
@@ -65,6 +68,7 @@ module OoxmlParser
65
68
  @spacing = source.spacing.clone
66
69
  end
67
70
 
71
+ # @return [Array<OOXMLDocumentObject>] array of child objects that contains data
68
72
  def nonempty_runs
69
73
  @character_style_array.select do |cur_run|
70
74
  if cur_run.is_a?(DocxParagraphRun) || cur_run.is_a?(ParagraphRun)
@@ -87,6 +91,9 @@ module OoxmlParser
87
91
  !nonempty_runs.empty? || paragraph_properties.section_properties
88
92
  end
89
93
 
94
+ # Compare this object to other
95
+ # @param other [Object] any other object
96
+ # @return [True, False] result of comparision
90
97
  def ==(other)
91
98
  ignored_attributes = %i[@number @parent]
92
99
  all_instance_variables = instance_variables
@@ -97,6 +104,12 @@ module OoxmlParser
97
104
  true
98
105
  end
99
106
 
107
+ # Parse object
108
+ # @param node [Nokogiri::XML:Node] node with DocxParagraph
109
+ # @param par_number [Integer] number of paragraph
110
+ # @param default_character [DocxParagraphRun] style for paragraph
111
+ # @param parent [OOXMLDocumentObject] parent of run
112
+ # @return [DocxParagraph] result of parse
100
113
  def parse(node, par_number = 0, default_character = DocxParagraphRun.new, parent: nil)
101
114
  @parent ||= parent
102
115
  default_character_style = default_character.dup
@@ -174,6 +187,10 @@ module OoxmlParser
174
187
  self
175
188
  end
176
189
 
190
+ # Parse style
191
+ # @param node [Nokogiri::XML:Node] node with style
192
+ # @param default_char_style [DocxParagraphRun] style for paragraph
193
+ # @return [DocxParagraph] result of parse
177
194
  def parse_paragraph_style(node, default_char_style = DocxParagraphRun.new(parent: self))
178
195
  node.xpath('*').each do |node_child|
179
196
  case node_child.name
@@ -229,6 +246,10 @@ module OoxmlParser
229
246
  self
230
247
  end
231
248
 
249
+ # Parse style xml
250
+ # @param id [String] id of style to parse
251
+ # @param character_style [DocxParagraphRun] style to parse
252
+ # @return [void]
232
253
  def parse_paragraph_style_xml(id, character_style)
233
254
  doc = parse_xml(OOXMLDocumentObject.path_to_folder + 'word/styles.xml')
234
255
  doc.search('//w:style').each do |style|
@@ -239,7 +260,7 @@ module OoxmlParser
239
260
  @style = StyleParametres.new(parent: self).parse(style)
240
261
  end
241
262
  style.xpath('w:rPr').each do |r_pr|
242
- character_style.parse_properties(r_pr, DocumentStructure.default_run_style)
263
+ character_style.parse_properties(r_pr)
243
264
  end
244
265
  break
245
266
  end
@@ -6,7 +6,7 @@ module OoxmlParser
6
6
  # @return [Integer] id of bookmark
7
7
  attr_reader :id
8
8
 
9
- # Parse BookmarkStart object
9
+ # Parse BookmarkEnd object
10
10
  # @param node [Nokogiri::XML:Element] node to parse
11
11
  # @return [BookmarkEnd] result of parsing
12
12
  def parse(node)
@@ -19,6 +19,7 @@ module OoxmlParser
19
19
  self
20
20
  end
21
21
 
22
+ # @return [Comment] object of current comment range
22
23
  def comment
23
24
  root_object.comments.comments_array.detect { |comment| comment.id == id }
24
25
  end
@@ -12,6 +12,9 @@ module OoxmlParser
12
12
  # @return [DocxFormula] base
13
13
  attr_accessor :base
14
14
 
15
+ # Parse PreSubSuperscript
16
+ # @param [Nokogiri::XML:Node] node with PreSubSuperscript
17
+ # @return [PreSubSuperscript] result of parsing
15
18
  def parse(node)
16
19
  node.xpath('*').each do |node_child|
17
20
  case node_child.name
@@ -41,12 +41,16 @@ module OoxmlParser
41
41
  @parent = parent
42
42
  end
43
43
 
44
+ # Constructor for copy of object
45
+ # @param source [DocxParagraphRun] original object
46
+ # @return [void]
44
47
  def initialize_copy(source)
45
48
  super
46
49
  @drawings = source.drawings.clone
47
50
  @comments = source.comments.clone
48
51
  end
49
52
 
53
+ # @return [Array, nil] Drawings of Run
50
54
  def drawing
51
55
  # TODO: Rewrite all tests without this methos
52
56
  @drawings.empty? ? nil : drawings.first
@@ -64,6 +68,9 @@ module OoxmlParser
64
68
  !@break
65
69
  end
66
70
 
71
+ # Compare this object to other
72
+ # @param other [Object] any other object
73
+ # @return [True, False] result of comparision
67
74
  def ==(other)
68
75
  ignored_attributes = %i[@number @parent]
69
76
  all_instance_variables = instance_variables
@@ -74,12 +81,17 @@ module OoxmlParser
74
81
  true
75
82
  end
76
83
 
84
+ # Parse object
85
+ # @param r_tag [Nokogiri::XML:Node] node with DocxParagraphRun
86
+ # @param char_number [Integer] number of run
87
+ # @param parent [OOXMLDocumentObject] parent of run
88
+ # @return [void]
77
89
  def parse(r_tag, char_number, parent: nil)
78
90
  @parent = parent
79
91
  r_tag.xpath('*').each do |node_child|
80
92
  case node_child.name
81
93
  when 'rPr'
82
- parse_properties(node_child, DocumentStructure.default_run_style)
94
+ parse_properties(node_child)
83
95
  @run_properties = RunProperties.new(parent: self).parse(node_child)
84
96
  when 'instrText'
85
97
  if node_child.text.include?('HYPERLINK')
@@ -121,8 +133,6 @@ module OoxmlParser
121
133
  @shape = Shape.new(parent: self).parse(pict_node_child, :shape)
122
134
  when 'rect'
123
135
  @shape = Shape.new(parent: self).parse(pict_node_child, :rectangle)
124
- when 'oval'
125
- @shape = Shape.new(parent: self).parse(pict_node_child, :oval)
126
136
  end
127
137
  end
128
138
  when 'object'
@@ -3,7 +3,10 @@
3
3
  module OoxmlParser
4
4
  # Module for some helpers for ParagraphRun
5
5
  module DocxParagraphRunHelpers
6
- def parse_properties(node, _default_character = DocumentStructure.default_run_style)
6
+ # Parse other properties
7
+ # @param node [Nokogiri::XML:Element] node to parse
8
+ # @return [DocxParagraphRun] result of parse
9
+ def parse_properties(node)
7
10
  self.font_style = FontStyle.new
8
11
  node.xpath('*').each do |node_child|
9
12
  case node_child.name
@@ -53,8 +53,6 @@ module OoxmlParser
53
53
  @properties.margins.top = property.split(':').last
54
54
  elsif property.include?('margin-left')
55
55
  @properties.margins.left = property.split(':').last
56
- elsif property.include?('margin-right')
57
- @properties.margins.right = property.split(':').last
58
56
  elsif property.include?('width')
59
57
  @properties.size.width = property.split(':').last
60
58
  elsif property.include?('height')
@@ -7,6 +7,9 @@ module OoxmlParser
7
7
  :horizontal_align, :vertical_align, :anchor_lock, :vertical_space, :horizontal_space,
8
8
  :horizontal_position, :vertical_position
9
9
 
10
+ # Parse FrameProperties
11
+ # @param node [Nokogiri::XML:Element] with FrameProperties
12
+ # @return [FrameProperties] parsed result
10
13
  def parse(node)
11
14
  node.attributes.each do |key, value|
12
15
  case key
@@ -22,6 +22,8 @@ module OoxmlParser
22
22
  alias right right_indent
23
23
  alias hanging hanging_indent
24
24
 
25
+ # Convert to string
26
+ # @return [String] result of conversion
25
27
  def to_s
26
28
  "first line indent: #{@first_line_indent}, left indent: #{@left_indent},
27
29
  right indent: #{@right_indent}, hanging indent: #{@hanging_indent}"
@@ -32,8 +32,6 @@ module OoxmlParser
32
32
  when 'endnoteReference'
33
33
  @path_suffix = 'endnote'
34
34
  @type = :footer
35
- else
36
- warn "Unknown HeaderFooter type: #{node.name}"
37
35
  end
38
36
  end
39
37
 
@@ -17,6 +17,9 @@ module OoxmlParser
17
17
  @parent = parent
18
18
  end
19
19
 
20
+ # Get properties by number id
21
+ # @param num_id [Integer] index of number id
22
+ # @return [nil, AbstractNumbering] result of search
20
23
  def properties_by_num_id(num_id)
21
24
  abstract_num_id = nil
22
25
  @numbering_definition_list.each do |num_def|
@@ -32,6 +35,8 @@ module OoxmlParser
32
35
  end
33
36
  end
34
37
 
38
+ # Parse Numbering data
39
+ # @return [Numbering] result of parse
35
40
  def parse
36
41
  numbering_xml = OOXMLDocumentObject.path_to_folder + 'word/numbering.xml'
37
42
  return nil unless File.exist?(numbering_xml)
@@ -9,6 +9,9 @@ module OoxmlParser
9
9
  @elements = []
10
10
  end
11
11
 
12
+ # Parse note data
13
+ # @param params [Hash] data to parse
14
+ # @return [Note] result of parsing
12
15
  def self.parse(params)
13
16
  note = Note.new
14
17
  note.type = params[:type]
@@ -11,6 +11,7 @@ module OoxmlParser
11
11
  @orientation = orientation
12
12
  end
13
13
 
14
+ # @return [String] convert to string
14
15
  def to_s
15
16
  'Height: ' + @height.to_s + ' Width: ' + @width.to_s + ' Orientation: ' + @orientation.to_s
16
17
  end
@@ -14,6 +14,8 @@ module OoxmlParser
14
14
  @parent = parent
15
15
  end
16
16
 
17
+ # Parse styles data
18
+ # @return [Styles] result of parsing
17
19
  def parse
18
20
  doc = parse_xml(OOXMLDocumentObject.path_to_folder + 'word/styles.xml')
19
21
  doc.xpath('w:styles/*').each do |node_child|
@@ -7,6 +7,9 @@ require_relative 'docx_data/document_structure'
7
7
  module OoxmlParser
8
8
  # Basic class for DocxParser
9
9
  class DocxParser
10
+ # Parse docx file
11
+ # @param path_to_file [String] file path
12
+ # @return [DocumentStructure] result of parse
10
13
  def self.parse_docx(path_to_file)
11
14
  Parser.parse_format(path_to_file) do
12
15
  DocumentStructure.parse
@@ -3,6 +3,7 @@
3
3
  module OoxmlParser
4
4
  # This module holds name of product
5
5
  module Name
6
+ # [String] name of the gem
6
7
  STRING = 'ooxml_parser'
7
8
  end
8
9
  end
@@ -27,6 +27,8 @@ module OoxmlParser
27
27
  super
28
28
  end
29
29
 
30
+ # Parse data of presentation
31
+ # @return [Presentation] parsed presentation
30
32
  def parse
31
33
  @content_types = ContentTypes.new(parent: self).parse
32
34
  OOXMLDocumentObject.root_subfolder = 'ppt/'
@@ -14,6 +14,9 @@ module OoxmlParser
14
14
  @color_scheme = color_scheme
15
15
  end
16
16
 
17
+ # Parse PresentationTheme
18
+ # @param file [String] path to file to parse
19
+ # @return [PresentationTheme] result of parsing
17
20
  def self.parse(file)
18
21
  OOXMLDocumentObject.theme = PresentationTheme.new
19
22
  OOXMLDocumentObject.add_to_xmls_stack(file)
@@ -11,6 +11,9 @@ module OoxmlParser
11
11
  @parent = parent
12
12
  end
13
13
 
14
+ # Compare ThemeColor with other object
15
+ # @param other [Object] object to compare
16
+ # @return [True, False] result of comparision
14
17
  def ==(other)
15
18
  if other.is_a?(Color)
16
19
  @color == other
@@ -28,6 +28,7 @@ module OoxmlParser
28
28
  @xml_path = xml_path
29
29
  end
30
30
 
31
+ # @return [True, False] is slide with data
31
32
  def with_data?
32
33
  return true unless background.nil?
33
34
 
@@ -37,10 +38,12 @@ module OoxmlParser
37
38
  false
38
39
  end
39
40
 
41
+ # @return <Array> List of elements on slide
40
42
  def elements
41
43
  @common_slide_data.shape_tree.elements
42
44
  end
43
45
 
46
+ # @return [Background] background of slide
44
47
  def background
45
48
  @common_slide_data.background
46
49
  end