class OoxmlParser::DocxShapeSize

Docx Shape Size

Attributes

child_extent[R]

@return [OOXMLCoordinates] child extent

child_offset[R]

@return [OOXMLCoordinates] child offset

extent[R]

@return [OOXMLCoordinates] extent info

extents[R]

@return [OOXMLCoordinates] extent info

flip_horizontal[R]

@return [True, False] is image flipped horizontally

flip_vertical[R]

@return [True, False] is image flipped vertically

offset[R]

@return [OOXMLCoordinates] offset info

rotation[R]

@return [OoxmlSize] rotation info

Public Instance Methods

parse(node) click to toggle source

Parse DocxShapeSize object @param node [Nokogiri::XML:Element] node to parse @return [DocxShapeSize] result of parsing

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb, line 26
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'rot'
      @rotation = OoxmlSize.new(value.value.to_f, :one_60000th_degree)
    when 'flipH'
      @flip_horizontal = attribute_enabled?(value)
    when 'flipV'
      @flip_vertical = attribute_enabled?(value)
    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