Class: OoxmlParser::DocxShapeSize

Inherits:
OOXMLDocumentObject 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

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, #initialize, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#child_extentObject

Returns the value of attribute child_extent.



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

def child_extent
  @child_extent
end

#child_offsetObject

Returns the value of attribute child_offset.



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

def child_offset
  @child_offset
end

#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

Instance Method Details

#parse(node) ⇒ DocxShapeSize

Parse DocxShapeSize object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



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

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'rot'
      @rotation = value.value.to_f
    when 'flipH'
      @flip_horizontal = value.value.to_f
    when 'flipV'
      @flip_vertical = value.value.to_f
    end
  end
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'off'
      @offset = OOXMLCoordinates.parse(node_child, unit: :emu)
    when 'ext'
      @extent = OOXMLCoordinates.parse(node_child, x_attr: 'cx', y_attr: 'cy', unit: :emu)
    when 'chOff'
      @child_offset = OOXMLCoordinates.parse(node_child, unit: :emu)
    when 'chExt'
      @child_extent = OOXMLCoordinates.parse(node_child, x_attr: 'cx', y_attr: 'cy', unit: :emu)
    end
  end
  self
end