Sha256: 8c6d902cc4090cdda2dc3217d06f74d732a10603e3edcfea641e4b3d3e4ba300

Contents?: true

Size: 1.03 KB

Versions: 40

Compression:

Stored size: 1.03 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
      super(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

40 entries across 40 versions & 1 rubygems

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