Class: OoxmlParser::DocxShapeSize

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#extentObject Also known as: extents

Returns the value of attribute extent.



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

def extent
  @extent
end

#flip_horizontalObject

Returns the value of attribute flip_horizontal.



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

def flip_horizontal
  @flip_horizontal
end

#flip_verticalObject

Returns the value of attribute flip_vertical.



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

def flip_vertical
  @flip_vertical
end

#offsetObject

Returns the value of attribute offset.



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

def offset
  @offset
end

#rotationObject

Returns the value of attribute rotation.



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

def rotation
  @rotation
end

Class Method Details

.parse(xfrm_node) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 8

def self.parse(xfrm_node)
  shape_size = DocxShapeSize.new
  xfrm_node.attributes.each do |key, value|
    case key
    when 'rot'
      shape_size.rotation = value.value.to_f
    when 'flipH'
      shape_size.flip_horizontal = value.value.to_f
    when 'flipV'
      shape_size.flip_vertical = value.value.to_f
    end
  end
  xfrm_node.xpath('*').each do |xfrm_node_child|
    case xfrm_node_child.name
    when 'off'
      shape_size.offset = OOXMLCoordinates.parse(xfrm_node_child)
    when 'ext'
      shape_size.extent = OOXMLCoordinates.parse(xfrm_node_child, x_attr: 'cx', y_attr: 'cy')
    end
  end
  shape_size
end