Sha256: ba40f5bcc78cd885b8fbec0c36912210031dcf9fcaa332fcfb4880f41cc3312c

Contents?: true

Size: 1015 Bytes

Versions: 40

Compression:

Stored size: 1015 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for parsing `spTree` tag
  class ShapeTree < OOXMLDocumentObject
    # @return [Array] elements of shape tree
    attr_reader :elements

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

    # Parse ShapeTree object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [ShapeTree] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'sp'
          @elements << DocxShape.new(parent: self).parse(node_child).dup
        when 'pic'
          @elements << DocxPicture.new(parent: self).parse(node_child)
        when 'graphicFrame'
          @elements << GraphicFrame.new(parent: self).parse(node_child)
        when 'grpSp'
          @elements << ShapesGrouping.new(parent: self).parse(node_child)
        when 'cxnSp'
          @elements << ConnectionShape.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.37.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.36.1 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.36.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.35.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.34.2 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.34.1 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.34.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.33.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.32.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.31.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.30.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.29.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.28.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.27.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.26.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.25.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.24.0 lib/ooxml_parser/pptx_parser/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.23.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb
ooxml_parser-0.22.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/common_slide_data/shape_tree.rb