Sha256: 8f44306d6c7c774e975709e07445c127296aed96ff94a1c6edc897743ae8c07c

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

module OoxmlParser
  # Chart Axis Title `title` node
  class ChartAxisTitle < OOXMLDocumentObject
    attr_accessor :layout, :overlay, :elements

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

    def nil?
      @layout.nil? && @overlay.nil? && @elements.empty?
    end

    # Parse ChartAxisTitle object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [ChartAxisTitle] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'tx'
          node_child.xpath('c:rich/*').each do |rich_node_child|
            case rich_node_child.name
            when 'p'
              Presentation.current_font_style = FontStyle.new(true) # Default font style for chart title always bold
              @elements << Paragraph.new(parent: self).parse(rich_node_child)
              Presentation.current_font_style = FontStyle.new
            end
          end
        when 'layout'
          @layout = option_enabled?(node_child)
        when 'overlay'
          @overlay = option_enabled?(node_child)
        end
      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/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.4.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.3.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb