Class: OoxmlParser::DocxPatternFill

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb

Constant Summary

Constants inherited from OOXMLDocumentObject

OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file

Instance Attribute Details

#background_colorObject

Returns the value of attribute background_color.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb', line 4

def background_color
  @background_color
end

#foreground_colorObject

Returns the value of attribute foreground_color.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb', line 4

def foreground_color
  @foreground_color
end

#presetObject

Returns the value of attribute preset.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb', line 4

def preset
  @preset
end

Class Method Details

.parse(fill_node) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/color/docx_pattern_fill.rb', line 6

def self.parse(fill_node)
  pattern = DocxPatternFill.new
  pattern.preset = fill_node.attribute('prst').value.to_sym
  fill_node.xpath('*').each do |fill_node_child|
    case fill_node_child.name
    when 'fgClr'
      pattern.foreground_color = Color.parse_color_model(fill_node_child)
    when 'bgClr'
      pattern.background_color = Color.parse_color_model(fill_node_child)
    end
  end
  pattern
end