Class: OoxmlParser::DocxShapeProperties

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

Overview

DOCX Shape Properties

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ DocxShapeProperties

Returns a new instance of DocxShapeProperties.



30
31
32
33
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 30

def initialize(parent: nil)
  @line = DocxShapeLine.new
  super
end

Instance Attribute Details

#blip_fillBlipFill (readonly)

Returns BlipFill data.

Returns:



24
25
26
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 24

def blip_fill
  @blip_fill
end

#custom_geometryPresetGeometry (readonly)

Returns is some geometry custom.

Returns:



22
23
24
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 22

def custom_geometry
  @custom_geometry
end

#fill_colorDocxColor (readonly) Also known as: fill

Returns color of object.

Returns:



18
19
20
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 18

def fill_color
  @fill_color
end

#lineDocxShapeLine (readonly)

Returns line info.

Returns:



20
21
22
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 20

def line
  @line
end

#preset_geometryPresetGeometry (readonly) Also known as: preset

Returns preset geometry of object.

Returns:



16
17
18
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 16

def preset_geometry
  @preset_geometry
end

#shape_sizeDocxShapeSize (readonly) Also known as: transform

Returns size of shape.

Returns:



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

def shape_size
  @shape_size
end

Instance Method Details

#parse(node) ⇒ DocxShapeProperties

Parse DocxShapeProperties object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 38

def parse(node)
  @fill_color = DocxColor.new(parent: self).parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'xfrm'
      @shape_size = DocxShapeSize.new(parent: self).parse(node_child)
    when 'prstGeom'
      @preset_geometry = PresetGeometry.new(parent: self).parse(node_child)
    when 'ln'
      @line = DocxShapeLine.new(parent: self).parse(node_child)
    when 'blipFill'
      @blip_fill = BlipFill.new(parent: self).parse(node_child)
    when 'custGeom'
      @preset_geometry = PresetGeometry.new(parent: self).parse(node_child)
      @preset_geometry.name = :custom
      @custom_geometry = OOXMLCustomGeometry.new(parent: self).parse(node_child)
    end
  end
  self
end