Sha256: 58c350a94cc2311d9610adeb4dbf13f3151d545a1c698919f492c1eed9ed3c92

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

# Docx Shape Size
module OoxmlParser
  class DocxShapeSize < OOXMLDocumentObject
    attr_accessor :rotation, :flip_horizontal, :flip_vertical, :offset, :extent
    attr_accessor :child_offset
    attr_accessor :child_extent

    alias extents extent

    # Parse DocxShapeSize object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [DocxShapeSize] result of parsing
    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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb
ooxml_parser-0.4.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb
ooxml_parser-0.3.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb