Class: OoxmlParser::OldDocxShapeFill

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb

Constant Summary

Constants inherited from OOXMLDocumentObject

OoxmlParser::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

#opacityObject

Returns the value of attribute opacity.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb', line 4

def opacity
  @opacity
end

#path_to_imageObject

Returns the value of attribute path_to_image.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb', line 4

def path_to_image
  @path_to_image
end

#stretching_typeObject

Returns the value of attribute stretching_type.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb', line 4

def stretching_type
  @stretching_type
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb', line 4

def title
  @title
end

Class Method Details

.parse(fill_node) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/shape/old_docx_shape_fill.rb', line 6

def self.parse(fill_node)
  fill = OldDocxShapeFill.new
  fill_node.attributes.each do |key, value|
    case key
    when 'id'
      fill.path_to_image = OOXMLDocumentObject.copy_media_file(OOXMLDocumentObject.root_subfolder + get_link_from_rels(value.value))
    when 'type'
      fill.stretching_type = case value.value
                             when 'frame'
                               :stretch
                             else
                               value.value.to_sym
                             end
    when 'title'
      fill.title = value.value.to_s
    end
  end
  fill
end