ooxml_parser 0.5.1 → 0.6.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 (16) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice.rb +1 -0
  3. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +1 -0
  4. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +1 -0
  5. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +3 -0
  6. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +42 -0
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +35 -0
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +35 -0
  9. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +35 -0
  10. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +35 -0
  11. data/lib/ooxml_parser/common_parser/common_data/color.rb +3 -3
  12. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +1 -0
  13. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +1 -0
  14. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +1 -0
  15. data/lib/ooxml_parser/version.rb +1 -1
  16. metadata +8 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 707812f11e8f53f5f19473a465a41a4b91a5e01792eb6c32463199930e5efb10
4
- data.tar.gz: b37d6875b9f5fded50a7ab16a81b50243d9f6533d23744fd27c865f148b7a3b3
3
+ metadata.gz: af046e45d945d773885e2c8c9c8becef406a7e0c50a1f71161e1252b73295441
4
+ data.tar.gz: 16e54721a7a8c6f066693343ad8950c88d136531b9f6a3a53d7d7154c199c699
5
5
  SHA512:
6
- metadata.gz: dcc58ccf69813588db3a3d1a7d8606d8e433c7754c7854a72e98fd3e75e24aa52567ccd3a10b98668b20357eee584ae2182bcfea8aa4159ba1d13da2f0fb8eee
7
- data.tar.gz: f4ce9b755786df2a9f9f1c6ba8d986660d875c8f5539486e7898be8512b2e69666c0908a3cfefa7ecd62e9285883ac6e897df6edc79fa42198dbb056d48f1e0c
6
+ metadata.gz: 216969571d18f07e04e10c7499628dc59d131a531a7cf1f8abdaf390bba04f04912b5f4f3bc268cd06b45d4853eb9fe3347a1ef136cfa56f2e8f6b88fccde7ab
7
+ data.tar.gz: a14b99b7e06bfd36c38fe2e52774e617cc60f94193314b5bad6200fe5d973cc854a8774aa7a43bdcd556bfec6a2f53c0dee59ff978442f49663bd8e3c43a5d2d
@@ -6,6 +6,7 @@ module OoxmlParser
6
6
  # graphic data
7
7
  class Choice < OOXMLDocumentObject
8
8
  attr_accessor :math_text
9
+
9
10
  # Parse Choice object
10
11
  # @param node [Nokogiri::XML:Element] node to parse
11
12
  # @return [Choice] result of parsing
@@ -5,6 +5,7 @@ module OoxmlParser
5
5
  # Class for storing math text
6
6
  class MathText < OOXMLDocumentObject
7
7
  attr_accessor :math_paragraph
8
+
8
9
  # Parse MathText object
9
10
  # @param node [Nokogiri::XML:Element] node to parse
10
11
  # @return [MathText] result of parsing
@@ -4,6 +4,7 @@ module OoxmlParser
4
4
  # Class for storing math paragraph
5
5
  class MathParagraph < OOXMLDocumentObject
6
6
  attr_accessor :math
7
+
7
8
  # Parse MathParagraph object
8
9
  # @param node [Nokogiri::XML:Element] node to parse
9
10
  # @return [MathParagraph] result of parsing
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative 'docx_shape/ooxml_text_box'
4
4
  require_relative 'docx_shape/non_visual_shape_properties'
5
+ require_relative 'docx_shape/shape_style'
5
6
  require_relative 'docx_shape/text_body'
6
7
  require_relative 'shape_properties/docx_shape_properties'
7
8
  require_relative 'shape_body_properties/ooxml_shape_body_properties'
@@ -32,6 +33,8 @@ module OoxmlParser
32
33
  @non_visual_properties = NonVisualShapeProperties.new(parent: self).parse(node_child)
33
34
  when 'spPr'
34
35
  @properties = DocxShapeProperties.new(parent: self).parse(node_child)
36
+ when 'style'
37
+ @style = ShapeStyle.new(parent: self).parse(node_child)
35
38
  when 'txbx'
36
39
  @text_body = OOXMLTextBox.new(parent: self).parse(node_child)
37
40
  when 'txBody'
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'shape_style/effect_reference'
4
+ require_relative 'shape_style/fill_reference'
5
+ require_relative 'shape_style/font_reference'
6
+ require_relative 'shape_style/line_reference'
7
+ module OoxmlParser
8
+ # Class for parsing `wps:style` tags
9
+ class ShapeStyle < OOXMLDocumentObject
10
+ # @return [FillReference] effect reference
11
+ attr_reader :effect_reference
12
+ # @return [FillReference] fill reference
13
+ attr_reader :fill_reference
14
+ # @return [FontReference] font reference
15
+ attr_reader :font_reference
16
+ # @return [LineReference] line reference
17
+ attr_reader :line_reference
18
+
19
+ def initialize(parent: nil)
20
+ @parent = parent
21
+ end
22
+
23
+ # Parse ShapeStyle object
24
+ # @param node [Nokogiri::XML:Element] node to parse
25
+ # @return [ShapeStyle] result of parsing
26
+ def parse(node)
27
+ node.xpath('*').each do |node_child|
28
+ case node_child.name
29
+ when 'effectRef'
30
+ @effect_reference = EffectReference.new(parent: self).parse(node_child)
31
+ when 'fillRef'
32
+ @fill_reference = FillReference.new(parent: self).parse(node_child)
33
+ when 'fontRef'
34
+ @font_reference = FontReference.new(parent: self).parse(node_child)
35
+ when 'lnRef'
36
+ @line_reference = LineReference.new(parent: self).parse(node_child)
37
+ end
38
+ end
39
+ self
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class for parsing `a:effectRef` tags
5
+ class EffectReference < OOXMLDocumentObject
6
+ # @return [Integer] Style Matrix Index
7
+ attr_reader :index
8
+ # @return [Color] scheme color of EffectReference
9
+ attr_reader :scheme_color
10
+
11
+ def initialize(parent: nil)
12
+ @parent = parent
13
+ end
14
+
15
+ # Parse EffectReference object
16
+ # @param node [Nokogiri::XML:Element] node to parse
17
+ # @return [EffectReference] result of parsing
18
+ def parse(node)
19
+ node.attributes.each do |key, value|
20
+ case key
21
+ when 'idx'
22
+ @index = value.value.to_f
23
+ end
24
+ end
25
+
26
+ node.xpath('*').each do |node_child|
27
+ case node_child.name
28
+ when 'schemeClr'
29
+ @scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
30
+ end
31
+ end
32
+ self
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class for parsing `a:fillRef` tags
5
+ class FillReference < OOXMLDocumentObject
6
+ # @return [Integer] Style Matrix Index
7
+ attr_reader :index
8
+ # @return [Color] scheme color of FillReference
9
+ attr_reader :scheme_color
10
+
11
+ def initialize(parent: nil)
12
+ @parent = parent
13
+ end
14
+
15
+ # Parse FillReference object
16
+ # @param node [Nokogiri::XML:Element] node to parse
17
+ # @return [FillReference] result of parsing
18
+ def parse(node)
19
+ node.attributes.each do |key, value|
20
+ case key
21
+ when 'idx'
22
+ @index = value.value.to_f
23
+ end
24
+ end
25
+
26
+ node.xpath('*').each do |node_child|
27
+ case node_child.name
28
+ when 'schemeClr'
29
+ @scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
30
+ end
31
+ end
32
+ self
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class for parsing `a:fontRef` tags
5
+ class FontReference < OOXMLDocumentObject
6
+ # @return [String] Font Collection Index
7
+ attr_reader :index
8
+ # @return [Color] scheme color of FontReference
9
+ attr_reader :scheme_color
10
+
11
+ def initialize(parent: nil)
12
+ @parent = parent
13
+ end
14
+
15
+ # Parse FontReference object
16
+ # @param node [Nokogiri::XML:Element] node to parse
17
+ # @return [FontReference] result of parsing
18
+ def parse(node)
19
+ node.attributes.each do |key, value|
20
+ case key
21
+ when 'idx'
22
+ @index = value.value.to_s
23
+ end
24
+ end
25
+
26
+ node.xpath('*').each do |node_child|
27
+ case node_child.name
28
+ when 'schemeClr'
29
+ @scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
30
+ end
31
+ end
32
+ self
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OoxmlParser
4
+ # Class for parsing `a:lnRef` tags
5
+ class LineReference < OOXMLDocumentObject
6
+ # @return [Integer] Style Matrix Index
7
+ attr_reader :index
8
+ # @return [Color] scheme color of LineReference
9
+ attr_reader :scheme_color
10
+
11
+ def initialize(parent: nil)
12
+ @parent = parent
13
+ end
14
+
15
+ # Parse LineReference object
16
+ # @param node [Nokogiri::XML:Element] node to parse
17
+ # @return [LineReference] result of parsing
18
+ def parse(node)
19
+ node.attributes.each do |key, value|
20
+ case key
21
+ when 'idx'
22
+ @index = value.value.to_f
23
+ end
24
+ end
25
+
26
+ node.xpath('*').each do |node_child|
27
+ case node_child.name
28
+ when 'schemeClr'
29
+ @scheme_color = Color.new(parent: self).parse_scheme_color(node_child)
30
+ end
31
+ end
32
+ self
33
+ end
34
+ end
35
+ end
@@ -93,12 +93,14 @@ module OoxmlParser
93
93
  attr_accessor :blue
94
94
  # @return [String] Value of Color Style
95
95
  attr_accessor :style
96
+
96
97
  alias set_style style=
97
98
  # @return [String] color scheme of color
98
99
  attr_accessor :scheme
99
100
 
100
101
  # @return [Integer] Value of alpha-channel
101
102
  attr_accessor :alpha_channel
103
+
102
104
  alias set_alpha_channel alpha_channel=
103
105
 
104
106
  attr_accessor :position
@@ -154,9 +156,7 @@ module OoxmlParser
154
156
 
155
157
  def ==(other)
156
158
  if other.is_a?(Color)
157
- if nil?
158
- false
159
- elsif (@red == other.red) && (@green == other.green) && (@blue == other.blue)
159
+ if (@red == other.red) && (@green == other.green) && (@blue == other.blue)
160
160
  true
161
161
  elsif (none? && other.white?) || (white? && other.none?)
162
162
  true
@@ -16,6 +16,7 @@ module OoxmlParser
16
16
  attr_reader :table_row_properties
17
17
  # @return [ParagraphProperties] properties of paragraph
18
18
  attr_accessor :paragraph_properties
19
+
19
20
  alias cell_properties table_cell_properties
20
21
 
21
22
  def initialize(type: nil, parent: nil)
@@ -35,6 +35,7 @@ module OoxmlParser
35
35
  # Used to determine if current style is visible in style list in editors
36
36
  # According to http://www.wordarticles.com/Articles/WordStyles/LatentStyles.php
37
37
  attr_accessor :q_format
38
+
38
39
  alias visible? q_format
39
40
 
40
41
  def initialize(parent: nil)
@@ -6,6 +6,7 @@ module OoxmlParser
6
6
  class Columns < OOXMLDocumentObject
7
7
  attr_accessor :count
8
8
  attr_accessor :equal_width
9
+
9
10
  alias equal_width? equal_width
10
11
  attr_accessor :column_array
11
12
  # @return [Boolean] Draw Line Between Columns
@@ -3,6 +3,6 @@
3
3
  module OoxmlParser
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '0.5.1'
6
+ STRING = '0.6.0'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ooxml_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ONLYOFFICE
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-03-24 00:00:00.000000000 Z
13
+ date: 2020-05-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -129,6 +129,11 @@ files:
129
129
  - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties.rb
130
130
  - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/non_visual_shape_properties/non_visual_properties/shape_placeholder.rb
131
131
  - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb
132
+ - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb
133
+ - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb
134
+ - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb
135
+ - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb
136
+ - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb
132
137
  - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/text_body.rb
133
138
  - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
134
139
  - lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties/preset_text_warp.rb
@@ -431,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
431
436
  - !ruby/object:Gem::Version
432
437
  version: '0'
433
438
  requirements: []
434
- rubygems_version: 3.0.6
439
+ rubygems_version: 3.1.2
435
440
  signing_key:
436
441
  specification_version: 4
437
442
  summary: OoxmlParser Gem