Class: OoxmlParser::GraphicFrame

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

Constant Summary

Constants inherited from OOXMLDocumentObject

OOXMLDocumentObject::DEFAULT_DIRECTORY_FOR_MEDIA

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, copy_media_file, current_xml, dir, encrypted_file?, get_link_from_rels, media_folder, option_enabled?, unzip_file

Constructor Details

#initialize(graphic_data = []) ⇒ GraphicFrame

Returns a new instance of GraphicFrame.



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

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

Instance Attribute Details

#graphic_dataObject

Returns the value of attribute graphic_data.



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

def graphic_data
  @graphic_data
end

#propertiesObject

Returns the value of attribute properties.



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

def properties
  @properties
end

#transformObject

Returns the value of attribute transform.



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

def transform
  @transform
end

Class Method Details

.parse(graphic_frame_node) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb', line 9

def self.parse(graphic_frame_node)
  graphic_frame = GraphicFrame.new
  graphic_frame_node.xpath('*').each do |graphic_frame_node_child|
    case graphic_frame_node_child.name
    when 'nvGraphicFramePr'
    when 'xfrm'
      graphic_frame.transform = TransformEffect.parse(graphic_frame_node_child)
    when 'graphic'
      graphic_data = []
      graphic_frame_node_child.xpath('a:graphicData/*').each do |graphic_node_child|
        case graphic_node_child.name
        when 'tbl'
          graphic_data << Table.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
        end
      end
      graphic_frame.graphic_data = graphic_data
    end
  end
  graphic_frame
end