Sha256: 9fbf502ad516f488c76e08c4a3e2d6b12731428734c2aabeb9d220a30bd7c3ce

Contents?: true

Size: 980 Bytes

Versions: 4

Compression:

Stored size: 980 Bytes

Contents

require_relative 'background/background_properties'
module OoxmlParser
  # Class for parsing `bg` tag
  class Background < OOXMLDocumentObject
    attr_accessor :fill, :shade_to_title
    # @return [BackgroundProperties] properties
    attr_accessor :properties

    def initialize(type = nil)
      @type = type
    end

    # Parse Background object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [Background] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'bgPr'
          @properties = BackgroundProperties.new(parent: self).parse(node_child)
        end
      end

      background_properties_node = node.xpath('p:bgPr').first
      if background_properties_node
        @shade_to_title = attribute_enabled?(background_properties_node, 'shadeToTitle')
        @fill = PresentationFill.new(parent: self).parse(background_properties_node)
      end
      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.4.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.3.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.2.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb