Class: OoxmlParser::GraphicFrame

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb

Overview

Class for parsing ‘graphicFrame`

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(graphic_data = [], parent: nil) ⇒ GraphicFrame

Returns a new instance of GraphicFrame.



12
13
14
15
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb', line 12

def initialize(graphic_data = [], parent: nil)
  @graphic_data = graphic_data
  super(parent: parent)
end

Instance Attribute Details

#graphic_dataObject

Returns the value of attribute graphic_data.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb', line 8

def graphic_data
  @graphic_data
end

#non_visual_propertiesNonVisualShapeProperties

Returns non visual properties.

Returns:



10
11
12
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb', line 10

def non_visual_properties
  @non_visual_properties
end

#propertiesObject

Returns the value of attribute properties.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb', line 8

def properties
  @properties
end

#transformObject

Returns the value of attribute transform.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb', line 8

def transform
  @transform
end

Instance Method Details

#parse(node) ⇒ GraphicFrame

Parse GraphicFrame object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



20
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
48
49
50
51
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb', line 20

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'xfrm'
      @transform = DocxShapeSize.new(parent: self).parse(node_child)
    when 'graphic'
      graphic_data = []
      node_child.xpath('*').each do |node_child_child|
        case node_child_child.name
        when 'graphicData'
          node_child_child.xpath('*').each do |graphic_node_child|
            case graphic_node_child.name
            when 'tbl'
              graphic_data << Table.new(parent: self).parse(graphic_node_child)
            when 'chart'
              @chart_reference = ChartReference.new(parent: self).parse(graphic_node_child)
              root_object.add_to_xmls_stack(root_object.get_link_from_rels(@chart_reference.id))
              graphic_data << Chart.new(parent: self).parse
              root_object.xmls_stack.pop
            when 'oleObj'
              graphic_data << OleObject.new(parent: self).parse(graphic_node_child)
            end
          end
        end
      end
      @graphic_data = graphic_data
    when 'nvGraphicFramePr'
      @non_visual_properties = NonVisualShapeProperties.new(parent: self).parse(node_child)
    end
  end
  self
end