Class: OoxmlParser::GraphicFrame

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/pptx_parser/pptx_data/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

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

Returns a new instance of GraphicFrame.



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

def initialize(graphic_data = [])
  @graphic_data = graphic_data
end

Instance Attribute Details

#graphic_dataObject

Returns the value of attribute graphic_data.



4
5
6
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb', line 4

def graphic_data
  @graphic_data
end

#non_visual_propertiesNonVisualShapeProperties

Returns non visual properties.

Returns:



6
7
8
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb', line 6

def non_visual_properties
  @non_visual_properties
end

#propertiesObject

Returns the value of attribute properties.



4
5
6
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb', line 4

def properties
  @properties
end

#transformObject

Returns the value of attribute transform.



4
5
6
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb', line 4

def transform
  @transform
end

Instance Method Details

#parse(node) ⇒ GraphicFrame

Parse GraphicFrame object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



15
16
17
18
19
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
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb', line 15

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'
              OOXMLDocumentObject.add_to_xmls_stack(OOXMLDocumentObject.get_link_from_rels(graphic_node_child.attribute('id').value))
              graphic_data << Chart.parse
              OOXMLDocumentObject.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