Sha256: 9128a2a2aeda849783dd7d925268a64931c1eb08a22f77fb017ea3e088ffacc7

Contents?: true

Size: 1.79 KB

Versions: 28

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for parsing `graphicFrame`
  class GraphicFrame < OOXMLDocumentObject
    attr_accessor :properties, :transform, :graphic_data
    # @return [NonVisualShapeProperties] non visual properties
    attr_accessor :non_visual_properties

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

    # Parse GraphicFrame object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [GraphicFrame] result of parsing
    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.new(parent: self).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
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ooxml_parser-0.29.0 lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.28.0 lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.27.0 lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.26.0 lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.25.0 lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.24.0 lib/ooxml_parser/pptx_parser/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.23.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.22.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.21.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.20.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.19.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.18.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.18.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.17.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.16.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.15.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.14.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.14.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb
ooxml_parser-0.14.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/graphic_frame/graphic_frame.rb