Class: OoxmlParser::OOXMLShapeBodyProperties

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb

Overview

Class for parsing ‘bodyPr`

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#anchorObject Also known as: vertical_align

Returns the value of attribute anchor.



8
9
10
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb', line 8

def anchor
  @anchor
end

#marginsObject

Returns the value of attribute margins.



8
9
10
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb', line 8

def margins
  @margins
end

#number_columnsSymbol (readonly)

Returns Number of Columns.

Returns:

  • (Symbol)

    Number of Columns



12
13
14
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb', line 12

def number_columns
  @number_columns
end

#preset_text_warpObject

Returns the value of attribute preset_text_warp.



8
9
10
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb', line 8

def preset_text_warp
  @preset_text_warp
end

#space_columnsSymbol (readonly)

Returns Spacing between columns.

Returns:

  • (Symbol)

    Spacing between columns



14
15
16
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb', line 14

def space_columns
  @space_columns
end

#verticalSymbol

Returns Vertical Text.

Returns:

  • (Symbol)

    Vertical Text



10
11
12
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb', line 10

def vertical
  @vertical
end

#wrapObject

Returns the value of attribute wrap.



8
9
10
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb', line 8

def wrap
  @wrap
end

Instance Method Details

#parse(node) ⇒ OOXMLShapeBodyProperties

Parse OOXMLShapeBodyProperties

Parameters:

  • node (Nokogiri::XML:Node)

    with OOXMLShapeBodyProperties

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb', line 21

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