Sha256: e4920c56aaf39769f13941f97c275ef802899dc630435009d93f5210dfda6b54

Contents?: true

Size: 1.62 KB

Versions: 48

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

require_relative 'ooxml_shape_body_properties/preset_text_warp'

module OoxmlParser
  # Class for parsing `bodyPr`
  class OOXMLShapeBodyProperties < OOXMLDocumentObject
    attr_accessor :margins, :anchor, :wrap, :preset_text_warp
    # @return [Symbol] Vertical Text
    attr_accessor :vertical
    # @return [Symbol] Number of Columns
    attr_reader :number_columns
    # @return [Symbol] Spacing between columns
    attr_reader :space_columns

    alias vertical_align anchor

    # Parse OOXMLShapeBodyProperties
    # @param [Nokogiri::XML:Node] node with OOXMLShapeBodyProperties
    # @return [OOXMLShapeBodyProperties] result of parsing
    def parse(node)
      @margins = ParagraphMargins.new(OoxmlSize.new(0.127, :centimeter),
                                      OoxmlSize.new(0.127, :centimeter),
                                      OoxmlSize.new(0.254, :centimeter),
                                      OoxmlSize.new(0.254, :centimeter)).parse(node)
      node.attributes.each do |key, value|
        case key
        when 'wrap'
          @wrap = value.value.to_sym
        when 'anchor'
          @anchor = value_to_symbol(value)
        when 'vert'
          @vertical = value_to_symbol(value)
        when 'numCol'
          @number_columns = value.value.to_i
        when 'spcCol'
          @space_columns = OoxmlSize.new(value.value.to_f, :emu)
        end
      end
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'prstTxWarp'
          @preset_text_warp = PresetTextWarp.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.37.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.36.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.36.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.35.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.34.2 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.34.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.34.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.33.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.32.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.31.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.30.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.29.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.28.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.27.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.26.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.25.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb
ooxml_parser-0.22.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb