Sha256: 72d42af46c11363387957ec64f6c91715589b9fdc823a1ff9c73f6c35ccfff46

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

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

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

    # @return [Boolean] if chart title is visible
    def visible?
      @layout || @overlay || !@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'
              root_object.default_font_style = FontStyle.new(true) # Default font style for chart title always bold
              @elements << Paragraph.new(parent: self).parse(rich_node_child)
              root_object.default_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

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.7.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.7.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.6.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.5.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.5.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb