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

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ DocxShapeProperties

Returns a new instance of DocxShapeProperties.



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

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

Instance Attribute Details

#blip_fillObject

Returns the value of attribute blip_fill.



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

def blip_fill
  @blip_fill
end

#custom_geometryObject

Returns the value of attribute custom_geometry.



11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 11

def custom_geometry
  @custom_geometry
end

#fill_colorObject Also known as: fill

Returns the value of attribute fill_color.



11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 11

def fill_color
  @fill_color
end

#lineObject

Returns the value of attribute line.



11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 11

def line
  @line
end

#preset_geometryObject Also known as: preset

Returns the value of attribute preset_geometry.



11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 11

def preset_geometry
  @preset_geometry
end

#shape_sizeObject Also known as: transform

Returns the value of attribute shape_size.



11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 11

def shape_size
  @shape_size
end

#text_boxObject

Returns the value of attribute text_box.



11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb', line 11

def text_box
  @text_box
end

Instance Method Details

#parse(node) ⇒ DocxShapeProperties

Parse DocxShapeProperties object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



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_properties/docx_shape_properties.rb', line 26

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 'txbx'
      @text_box = TextBox.parse_list(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