Class: OoxmlParser::DocxShapeProperties

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

Constant Summary

Constants inherited from OOXMLDocumentObject

OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA

Instance Attribute Summary collapse

Class Method Summary collapse

Instance 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

Constructor Details

#initializeDocxShapeProperties

Returns a new instance of DocxShapeProperties.



15
16
17
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 15

def initialize
  @line = DocxShapeLine.new
end

Instance Attribute Details

#custom_geometryObject

Returns the value of attribute custom_geometry.



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 9

def custom_geometry
  @custom_geometry
end

#fill_colorObject Also known as: fill

Returns the value of attribute fill_color.



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 9

def fill_color
  @fill_color
end

#lineObject

Returns the value of attribute line.



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 9

def line
  @line
end

#preset_geometryObject Also known as: preset

Returns the value of attribute preset_geometry.



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 9

def preset_geometry
  @preset_geometry
end

#shape_sizeObject Also known as: transform

Returns the value of attribute shape_size.



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 9

def shape_size
  @shape_size
end

#text_boxObject

Returns the value of attribute text_box.



9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 9

def text_box
  @text_box
end

Class Method Details

.parse(shape_properties_node) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 19

def self.parse(shape_properties_node)
  shape_properties = DocxShapeProperties.new
  shape_properties.fill_color = DocxColor.parse(shape_properties_node)
  shape_properties_node.xpath('*').each do |shape_properties_node_child|
    case shape_properties_node_child.name
    when 'xfrm'
      shape_properties.shape_size = DocxShapeSize.parse(shape_properties_node_child)
    when 'prstGeom'
      shape_properties.preset_geometry = shape_properties_node_child.attribute('prst').value.to_sym
    when 'txbx'
      shape_properties.text_box = TextBox.parse_list(shape_properties_node_child)
    when 'ln'
      shape_properties.line = DocxShapeLine.parse(shape_properties_node_child)
    when 'custGeom'
      shape_properties.preset_geometry = :custom
      shape_properties.custom_geometry = OOXMLCustomGeometry.parse(shape_properties_node_child)
    end
  end
  shape_properties
end