ooxml_parser 0.5.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) 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/alternate_content/choice.rb +1 -0
  4. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text.rb +1 -0
  5. data/lib/ooxml_parser/common_parser/common_data/alternate_content/alternate_content/choice/math_text/math_paragraph.rb +1 -0
  6. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart.rb +6 -0
  7. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series.rb +2 -2
  8. data/lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart/series/series_text.rb +0 -2
  9. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/docx_drawing.rb +1 -20
  10. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_distance_from_text.rb +3 -0
  11. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb +51 -4
  12. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_coordinates.rb +1 -0
  13. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/ooxml_size.rb +4 -1
  14. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip.rb +1 -0
  15. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_blip/file_reference.rb +4 -0
  16. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/picture/docx_picture.rb +0 -2
  17. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb +3 -0
  18. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/ooxml_text_box.rb +1 -3
  19. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style.rb +42 -0
  20. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/effect_reference.rb +35 -0
  21. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/fill_reference.rb +35 -0
  22. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/font_reference.rb +35 -0
  23. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape/shape_style/line_reference.rb +35 -0
  24. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_color_scheme.rb +1 -0
  25. 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
  26. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_line.rb +1 -0
  27. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb +12 -4
  28. data/lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb +10 -3
  29. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/old_docx_picture.rb +1 -3
  30. data/lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_properties.rb +1 -3
  31. data/lib/ooxml_parser/common_parser/common_data/borders_properties.rb +3 -0
  32. data/lib/ooxml_parser/common_parser/common_data/color.rb +48 -82
  33. data/lib/ooxml_parser/common_parser/common_data/color/color_helper.rb +4 -3
  34. data/lib/ooxml_parser/common_parser/common_data/color/color_indexes.list +66 -0
  35. data/lib/ooxml_parser/common_parser/common_data/color/ooxml_color.rb +5 -0
  36. data/lib/ooxml_parser/common_parser/common_data/colors/color_properties.rb +8 -2
  37. data/lib/ooxml_parser/common_parser/common_data/colors/hsl_color.rb +11 -0
  38. data/lib/ooxml_parser/common_parser/common_data/colors/scheme_color.rb +1 -0
  39. data/lib/ooxml_parser/common_parser/common_data/colors/theme_colors.rb +4 -0
  40. data/lib/ooxml_parser/common_parser/common_data/content_types.rb +2 -0
  41. data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_default.rb +3 -0
  42. data/lib/ooxml_parser/common_parser/common_data/content_types/content_type_override.rb +3 -0
  43. data/lib/ooxml_parser/common_parser/common_data/coordinates.rb +7 -0
  44. data/lib/ooxml_parser/common_parser/common_data/hyperlink.rb +14 -3
  45. data/lib/ooxml_parser/common_parser/common_data/ooxml_document_object.rb +28 -2
  46. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run.rb +3 -0
  47. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties.rb +28 -12
  48. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_run/run_properties/outline.rb +4 -2
  49. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/numbering_properties.rb +2 -0
  50. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb +1 -0
  51. data/lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/spacing.rb +16 -13
  52. data/lib/ooxml_parser/common_parser/common_data/table.rb +2 -0
  53. data/lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb +3 -0
  54. data/lib/ooxml_parser/common_parser/common_data/table/margins/table_margins.rb +7 -0
  55. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_position.rb +1 -0
  56. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties.rb +1 -0
  57. data/lib/ooxml_parser/common_parser/common_data/table/properties/table_style_properties/table_style_properties_helper.rb +4 -4
  58. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/cell_properties.rb +4 -5
  59. data/lib/ooxml_parser/common_parser/common_data/table/row/cell/properties/borders.rb +6 -0
  60. data/lib/ooxml_parser/common_parser/common_data/table/table_grid.rb +3 -0
  61. data/lib/ooxml_parser/common_parser/common_data/underline.rb +7 -2
  62. data/lib/ooxml_parser/docx_parser/docx_data/document_structure.rb +41 -9
  63. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/comments/comment.rb +3 -0
  64. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/document_style.rb +3 -0
  65. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph.rb +25 -8
  66. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/bookmark_end.rb +1 -1
  67. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/comment_range_start.rb +1 -0
  68. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_formula/pre_sub_superscript.rb +3 -0
  69. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run.rb +13 -3
  70. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/docx_paragraph_run_helpers.rb +4 -1
  71. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/docx_paragraph_run/shape.rb +0 -2
  72. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb +3 -0
  73. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/indents.rb +4 -2
  74. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/header_footer.rb +8 -4
  75. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/numbering.rb +5 -0
  76. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/columns.rb +3 -0
  77. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/note.rb +6 -2
  78. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/page_properties/page_size.rb +1 -0
  79. data/lib/ooxml_parser/docx_parser/docx_data/document_structure/styles.rb +2 -0
  80. data/lib/ooxml_parser/docx_parser/docx_parser.rb +3 -0
  81. data/lib/ooxml_parser/name.rb +1 -0
  82. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation.rb +2 -0
  83. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme.rb +3 -0
  84. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/presentation_theme/theme_color.rb +3 -0
  85. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide.rb +5 -2
  86. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/time_node.rb +3 -0
  87. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide_helper.rb +15 -1
  88. data/lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb +3 -0
  89. data/lib/ooxml_parser/pptx_parser/pptx_parser.rb +4 -1
  90. data/lib/ooxml_parser/version.rb +2 -1
  91. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook.rb +21 -2
  92. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/chartsheet.rb +3 -0
  93. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache.rb +41 -0
  94. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb +37 -0
  95. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source.rb +33 -0
  96. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_source/worksheet_source.rb +26 -0
  97. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb +2 -0
  98. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/cell_xfs/xf.rb +5 -0
  99. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fills/fill.rb +2 -0
  100. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet/fonts/font.rb +3 -0
  101. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet.rb +5 -0
  102. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/excel_comments.rb +4 -0
  103. data/lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_column_properties.rb +4 -0
  104. data/lib/ooxml_parser/xlsx_parser/xlsx_parser.rb +3 -0
  105. metadata +70 -4
@@ -0,0 +1,66 @@
1
+ 000000
2
+ FFFFFF
3
+ FF0000
4
+ 00FF00
5
+ 0000FF
6
+ FFFF00
7
+ FF00FF
8
+ 00FFFF
9
+ 000000
10
+ FFFFFF
11
+ FF0000
12
+ 00FF00
13
+ 0000FF
14
+ FFFF00
15
+ FF00FF
16
+ 00FFFF
17
+ 800000
18
+ 008000
19
+ 000080
20
+ 808000
21
+ 800080
22
+ 008080
23
+ C0C0C0
24
+ 808080
25
+ 9999FF
26
+ 993366
27
+ FFFFCC
28
+ CCFFFF
29
+ 660066
30
+ FF8080
31
+ 0066CC
32
+ CCCCFF
33
+ 000080
34
+ FF00FF
35
+ FFFF00
36
+ 00FFFF
37
+ 800080
38
+ 800000
39
+ 008080
40
+ 0000FF
41
+ 00CCFF
42
+ CCFFFF
43
+ CCFFCC
44
+ FFFF99
45
+ 99CCFF
46
+ FF99CC
47
+ CC99FF
48
+ FFCC99
49
+ 3366FF
50
+ 33CCCC
51
+ 99CC00
52
+ FFCC00
53
+ FF9900
54
+ FF6600
55
+ 666699
56
+ 969696
57
+ 003366
58
+ 339966
59
+ 003300
60
+ 333300
61
+ 993300
62
+ 993366
63
+ 333399
64
+ 333333
65
+ n/a
66
+ n/a
@@ -18,6 +18,8 @@ module OoxmlParser
18
18
  # @return [Color] rgb color
19
19
  attr_reader :rgb
20
20
 
21
+ # Convert OoxmlColor to other color type
22
+ # @return [Object] result of conversion
21
23
  def to_color
22
24
  return Color.get_rgb_by_color_index(indexed) if indexed
23
25
  return ThemeColors.new(parent: self).parse_color_theme(theme, tint) if theme
@@ -26,6 +28,9 @@ module OoxmlParser
26
28
  value
27
29
  end
28
30
 
31
+ # Compare this object to other
32
+ # @param other [Object] any other object
33
+ # @return [True, False] result of comparision
29
34
  def ==(other)
30
35
  return to_color == other if other.is_a?(Color)
31
36
  return to_color == other if other.is_a?(Symbol)
@@ -3,8 +3,14 @@
3
3
  module OoxmlParser
4
4
  # Class for color transformations
5
5
  class ColorProperties < OOXMLDocumentObject
6
- attr_accessor :alpha, :luminance_modulation, :luminance_offset
7
- attr_accessor :tint
6
+ # @return [Integer] alpha value of color
7
+ attr_reader :alpha
8
+ # @return [Float] luminance modulation value
9
+ attr_reader :luminance_modulation
10
+ # @return [Float] luminance offset value
11
+ attr_reader :luminance_offset
12
+ # @return [Float] tint value
13
+ attr_reader :tint
8
14
 
9
15
  # Parse ColorProperties object
10
16
  # @param node [Nokogiri::XML:Element] node to parse
@@ -19,6 +19,9 @@ module OoxmlParser
19
19
  @l = lightness
20
20
  end
21
21
 
22
+ # Convert rgb color to hsl
23
+ # @param rgb_color [Color] color to convert
24
+ # @return [HSLColor] result of convert
22
25
  def self.rgb_to_hsl(rgb_color)
23
26
  hls_color = HSLColor.new
24
27
  red = rgb_color.red.to_f # / 255.0
@@ -50,6 +53,7 @@ module OoxmlParser
50
53
  end
51
54
 
52
55
  # Chroma - The "colorfulness relative to the brightness of a similarly illuminated white".
56
+ # @return [Color] result
53
57
  def to_rgb
54
58
  chroma = (1 - (2 * @l - 1).abs) * @s
55
59
  x = chroma * (1 - ((@h / 60.0) % 2.0 - 1).abs)
@@ -73,6 +77,10 @@ module OoxmlParser
73
77
  Color.new(((rgb.red + m) * 255.0).round, ((rgb.green + m) * 255.0).round, ((rgb.blue + m) * 255.0).round)
74
78
  end
75
79
 
80
+ # Get lum value of color
81
+ # @param tint [Integer] tint to apply
82
+ # @param lum [Integer] lum without tint
83
+ # @return [Integer] result
76
84
  def calculate_lum_value(tint, lum)
77
85
  if tint.nil?
78
86
  lum
@@ -81,6 +89,9 @@ module OoxmlParser
81
89
  end
82
90
  end
83
91
 
92
+ # Convert to rgb with applied tint
93
+ # @param tint [Integer] tint to apply
94
+ # @return [Color] result of covert
84
95
  def calculate_rgb_with_tint(tint)
85
96
  self.l = calculate_lum_value(tint, @l * 255.0) / 255.0
86
97
  to_rgb
@@ -11,6 +11,7 @@ module OoxmlParser
11
11
  @parent = parent
12
12
  end
13
13
 
14
+ # @return [String] result of convert of object to string
14
15
  def to_s
15
16
  @converted_color.to_s
16
17
  end
@@ -6,6 +6,10 @@ module OoxmlParser
6
6
  # @return [Hash] list of colors
7
7
  attr_accessor :list
8
8
 
9
+ # Parse color theme
10
+ # @param theme [String] name of theme
11
+ # @param tint [Integer] tint of theme
12
+ # @return [Color] color of theme
9
13
  def parse_color_theme(theme, tint)
10
14
  themes_array = root_object.theme.color_scheme.values
11
15
  # TODO: if no swap performed - incorrect color parsing. But don't know why it needed
@@ -18,6 +18,8 @@ module OoxmlParser
18
18
  @content_types_list[key]
19
19
  end
20
20
 
21
+ # Parse ContentTypes object
22
+ # @return [ContentTypes] result of parsing
21
23
  def parse
22
24
  doc = Nokogiri::XML.parse(File.open("#{OOXMLDocumentObject.path_to_folder}/[Content_Types].xml"))
23
25
  node = doc.xpath('*').first
@@ -8,6 +8,9 @@ module OoxmlParser
8
8
  # @return [String] extension
9
9
  attr_reader :extension
10
10
 
11
+ # Parse ContentTypeDefault object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [ContentTypeDefault] result of parsing
11
14
  def parse(node)
12
15
  node.attributes.each do |key, value|
13
16
  case key
@@ -8,6 +8,9 @@ module OoxmlParser
8
8
  # @return [String] part name
9
9
  attr_reader :part_name
10
10
 
11
+ # Parse ContentTypeOverride object
12
+ # @param node [Nokogiri::XML:Element] node to parse
13
+ # @return [ContentTypeOverride] result of parsing
11
14
  def parse(node)
12
15
  node.attributes.each do |key, value|
13
16
  case key
@@ -29,6 +29,9 @@ module OoxmlParser
29
29
  coordinates
30
30
  end
31
31
 
32
+ # Parse range of coordinates
33
+ # @param arguments_string [String] data to parse
34
+ # @return [Array] result
32
35
  def parser_coordinates_range(arguments_string)
33
36
  return parse_coordinates_array(arguments_string) if arguments_string.include?(',')
34
37
  return warn "Formulas with # is unsupported: #{arguments_string}" if arguments_string.include?('#')
@@ -133,6 +136,7 @@ module OoxmlParser
133
136
  column_number > other_cell.column_number
134
137
  end
135
138
 
139
+ # @return [String] result of convert of object to string
136
140
  def to_s
137
141
  "#{@column}#{@row} #{@list ? "list: #{@list}" : ''}"
138
142
  end
@@ -141,6 +145,9 @@ module OoxmlParser
141
145
  @column.nil? && @list.nil? && @row.nil?
142
146
  end
143
147
 
148
+ # Compare this object to other
149
+ # @param other [Object] any other object
150
+ # @return [True, False] result of comparision
144
151
  def ==(other)
145
152
  other.is_a?(Coordinates) ? (@row == other.row && @column == other.column) : false
146
153
  end
@@ -3,9 +3,20 @@
3
3
  module OoxmlParser
4
4
  # Class for parsing `hlinkClick`, `hyperlink` tags
5
5
  class Hyperlink < OOXMLDocumentObject
6
- attr_accessor :url, :tooltip, :coordinates, :highlight_click, :action
7
- attr_accessor :action_link
8
- attr_accessor :id
6
+ # @return [OOXMLDocumentObject] url of hyperlink
7
+ attr_accessor :url
8
+ # @return [String] tooltip value
9
+ attr_reader :tooltip
10
+ # @return [Coordinates] coordinates of link
11
+ attr_reader :coordinates
12
+ # @return [True, False] should click be highlighted
13
+ attr_reader :highlight_click
14
+ # @return [Symbol] type of action
15
+ attr_reader :action
16
+ # @return [String] value of action link
17
+ attr_reader :action_link
18
+ # @return [String] id of link
19
+ attr_reader :id
9
20
  # @return [Array<ParagraphRun>] run of paragraph
10
21
  attr_reader :runs
11
22
 
@@ -19,7 +19,12 @@ module OoxmlParser
19
19
  @parent = parent
20
20
  end
21
21
 
22
+ # Compare this object to other
23
+ # @param other [Object] any other object
24
+ # @return [True, False] result of comparision
22
25
  def ==(other)
26
+ return false if self.class != other.class
27
+
23
28
  instance_variables.each do |current_attribute|
24
29
  next if current_attribute == :@parent
25
30
  return false unless instance_variable_get(current_attribute) == other.instance_variable_get(current_attribute)
@@ -38,15 +43,21 @@ module OoxmlParser
38
43
  end
39
44
 
40
45
  class << self
46
+ # @return [String] path to root subfolder
41
47
  attr_accessor :root_subfolder
48
+ # @return [PresentationTheme] list of themes
42
49
  attr_accessor :theme
50
+ # @return [Array<String>] stack of xmls
43
51
  attr_accessor :xmls_stack
52
+ # @return [String] path to root folder
44
53
  attr_accessor :path_to_folder
45
54
 
46
55
  # @param path_to_file [String] file
56
+ # @param ignore_system [True, False] should host system be ignored, since
57
+ # this method is OS-dependent
47
58
  # @return [True, False] Check if file is protected by password on open
48
- def encrypted_file?(path_to_file)
49
- if Gem.win_platform?
59
+ def encrypted_file?(path_to_file, ignore_system: false)
60
+ if Gem.win_platform? || ignore_system
50
61
  warn 'FileMagic and checking file for encryption is not supported on Windows'
51
62
  return false
52
63
  end
@@ -63,6 +74,9 @@ module OoxmlParser
63
74
  false
64
75
  end
65
76
 
77
+ # Copy this file and rename to zip
78
+ # @param path [String] path to file
79
+ # @return [String] path to result zip
66
80
  def copy_file_and_rename_to_zip(path)
67
81
  file_name = File.basename(path)
68
82
  tmp_folder = Dir.mktmpdir('ruby-ooxml-parser')
@@ -75,6 +89,10 @@ module OoxmlParser
75
89
  file_path
76
90
  end
77
91
 
92
+ # Unzip specified file
93
+ # @param path_to_file [String] path to zip file
94
+ # @param destination [String] folder to extract
95
+ # @return [void]
78
96
  def unzip_file(path_to_file, destination)
79
97
  Zip.warn_invalid_date = false
80
98
  Zip::File.open(path_to_file) do |zip_file|
@@ -88,14 +106,19 @@ module OoxmlParser
88
106
  end
89
107
  end
90
108
 
109
+ # @return [String] dir to base of file
91
110
  def dir
92
111
  OOXMLDocumentObject.path_to_folder + File.dirname(OOXMLDocumentObject.xmls_stack.last) + '/'
93
112
  end
94
113
 
114
+ # @return [String] path to current xml file
95
115
  def current_xml
96
116
  OOXMLDocumentObject.path_to_folder + OOXMLDocumentObject.xmls_stack.last
97
117
  end
98
118
 
119
+ # Add file to parsing stack
120
+ # @param path [String] path of file to add to stack
121
+ # @return [void]
99
122
  def add_to_xmls_stack(path)
100
123
  OOXMLDocumentObject.xmls_stack << if path.include?('..')
101
124
  "#{File.dirname(OOXMLDocumentObject.xmls_stack.last)}/#{path}"
@@ -106,6 +129,9 @@ module OoxmlParser
106
129
  end
107
130
  end
108
131
 
132
+ # Get link to file from rels file
133
+ # @param id [String] file to get
134
+ # @return [String] result
109
135
  def get_link_from_rels(id)
110
136
  rels_path = dir + "_rels/#{File.basename(OOXMLDocumentObject.xmls_stack.last)}.rels"
111
137
  raise LoadError, "Cannot find .rels file by path: #{rels_path}" unless File.exist?(rels_path)
@@ -40,14 +40,17 @@ module OoxmlParser
40
40
  text.empty?
41
41
  end
42
42
 
43
+ # @return [String] instruction applied to paragraph
43
44
  def instruction
44
45
  parent.instruction
45
46
  end
46
47
 
48
+ # @return [True, False] is page number applyed
47
49
  def page_number
48
50
  parent.page_numbering?
49
51
  end
50
52
 
53
+ # @return [Hyperlink] link of run
51
54
  def link
52
55
  parent.parent.hyperlink
53
56
  end
@@ -9,12 +9,34 @@ require_relative 'run_properties/shade'
9
9
  module OoxmlParser
10
10
  # Data about `rPr` object
11
11
  class RunProperties < OOXMLDocumentObject
12
- attr_accessor :font_style, :font_color, :space, :dirty, :font_name, :font_size, :baseline, :hyperlink, :caps,
13
- :vertical_align, :outline
14
- attr_accessor :shadow
15
- attr_accessor :emboss
16
- attr_accessor :vanish
17
- attr_accessor :rtl
12
+ # @return [FontStyle] font style of run
13
+ attr_accessor :font_style
14
+ # @return [Color, DocxColorScheme] color of run
15
+ attr_reader :font_color
16
+ # @return [OoxmlSize] space size
17
+ attr_reader :space
18
+ # @return [string] name of font
19
+ attr_reader :font_name
20
+ # @return [Float] font size
21
+ attr_reader :font_size
22
+ # @return [Symbol] baseline of run
23
+ attr_reader :baseline
24
+ # @return [Hyperlink] hyperlink of run
25
+ attr_reader :hyperlink
26
+ # @return [Symbol] caps data
27
+ attr_reader :caps
28
+ # @return [Symbol] vertical align data
29
+ attr_reader :vertical_align
30
+ # @return [Outline] outline data
31
+ attr_reader :outline
32
+ # @return [True, False] is text shadow
33
+ attr_reader :shadow
34
+ # @return [True, False] is text emboss
35
+ attr_reader :emboss
36
+ # @return [True, False] is text vanish
37
+ attr_reader :vanish
38
+ # @return [True, False] is text rtl
39
+ attr_reader :rtl
18
40
  # @return [Size] get run size
19
41
  attr_accessor :size
20
42
  # @return [RunSpacing] get run spacing
@@ -29,10 +51,6 @@ module OoxmlParser
29
51
  attr_accessor :shade
30
52
  # @return [RunStyle] run style
31
53
  attr_accessor :run_style
32
- # @return [Float]
33
- # This element specifies the font size which shall be applied to all
34
- # complex script characters in the contents of this run when displayed
35
- attr_accessor :font_size_complex
36
54
 
37
55
  def initialize(parent: nil)
38
56
  @font_name = ''
@@ -50,8 +68,6 @@ module OoxmlParser
50
68
  case key
51
69
  when 'sz'
52
70
  @font_size = value.value.to_f / 100.0
53
- when 'szCs'
54
- @font_size_complex = node.attribute('val').value.to_i / 2.0
55
71
  when 'spc'
56
72
  @space = OoxmlSize.new(value.value.to_f, :one_100th_point)
57
73
  when 'b'
@@ -4,8 +4,10 @@
4
4
  module OoxmlParser
5
5
  # Class for parsing `w:ln` tags
6
6
  class Outline < OOXMLDocumentObject
7
- attr_accessor :width
8
- attr_accessor :color_scheme
7
+ # @return [OoxmlSize] width of outline
8
+ attr_reader :width
9
+ # @return [DocxColorScheme] color of outline
10
+ attr_reader :color_scheme
9
11
 
10
12
  def initialize(parent: nil)
11
13
  @width = OoxmlSize.new(0)
@@ -10,6 +10,7 @@ module OoxmlParser
10
10
  @parent = parent
11
11
  end
12
12
 
13
+ # @return [AbstractNumbering] AbstractNumbering of current properties
13
14
  def abstruct_numbering
14
15
  root_object.numbering.properties_by_num_id(@numbering_properties)
15
16
  end
@@ -29,6 +30,7 @@ module OoxmlParser
29
30
  self
30
31
  end
31
32
 
33
+ # @return [AbstractNumbering] level list of current numbering
32
34
  def numbering_level_current
33
35
  abstruct_numbering.level_list.each do |current_ilvl|
34
36
  return current_ilvl if current_ilvl.ilvl == @ilvl
@@ -16,6 +16,7 @@ module OoxmlParser
16
16
  # @return [BordersProperties] bar properties
17
17
  attr_accessor :bar
18
18
 
19
+ # @return [Symbol] type of border in visual editor
19
20
  def border_visual_type
20
21
  result = []
21
22
  result << :left if @left.val == :single