class OoxmlParser::DocxDrawingProperties

Docx Drawing Properties

Attributes

distance_from_text[R]

@return [DocxDrawingDistanceFromText] distance from text

horizontal_position[R]

@return [DocxDrawingPosition] horizontal position

object_size[R]

@return [OOXMLCoordinates] size of object

relative_height[R]

@return [Integer] relative height of object

simple_position[R]

@return [OOXMLCoordinates] simple position of object

size_relative_horizontal[R]

@return [SizeRelativeHorizontal] size of drawing relative to horizontal

size_relative_vertical[R]

@return [SizeRelativeVertical] size of drawing relative to vertical

vertical_position[R]

@return [DocxDrawingPosition] vertical position

wrap[R]

@return [DocxWrapDrawing] wrap of drawing

Public Instance Methods

parse(node) click to toggle source

Parse DocxDrawingProperties @param [Nokogiri::XML:Node] node with DocxDrawingProperties @return [DocxDrawingProperties] result of parsing

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_drawing_properties.rb, line 33
def parse(node)
  @distance_from_text = DocxDrawingDistanceFromText.new(parent: self).parse(node)
  @wrap = DocxWrapDrawing.new(parent: self).parse(node)

  node.attributes.each do |key, value|
    case key
    when 'relativeHeight'
      @relative_height = value.value.to_i
    end
  end

  node.xpath('*').each do |content_node_child|
    case content_node_child.name
    when 'simplePos'
      @simple_position = OOXMLCoordinates.new(parent: self).parse(content_node_child)
    when 'extent'
      @object_size = OOXMLCoordinates.new(parent: self)
                                     .parse(content_node_child,
                                            x_attr: 'cx',
                                            y_attr: 'cy',
                                            unit: :emu)
    when 'positionV'
      @vertical_position = DocxDrawingPosition.new(parent: self).parse(content_node_child)
    when 'positionH'
      @horizontal_position = DocxDrawingPosition.new(parent: self).parse(content_node_child)
    when 'sizeRelH'
      @size_relative_horizontal = SizeRelativeHorizontal.new(parent: self).parse(content_node_child)
    when 'sizeRelV'
      @size_relative_vertical = SizeRelativeVertical.new(parent: self).parse(content_node_child)
    end
  end
  self
end