Sha256: 3379168f4f2b821e3b76004785a667f8a9a03a11cdfc90b08320ee653e5a2c24

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

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, parent: nil)
      @type = type
      @parent = parent
    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

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.8.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.7.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.7.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.7.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.6.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.5.1 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb
ooxml_parser-0.5.0 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/background.rb