Sha256: 8dd55e6a8faaeda687c8e310ad49452b749af27d9044988544562ccf3892ffcc

Contents?: true

Size: 1.2 KB

Versions: 41

Compression:

Stored size: 1.2 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 = []
      super
    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

41 entries across 41 versions & 1 rubygems

Version Path
ooxml_parser-0.38.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.37.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.37.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.36.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.36.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.35.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.34.2 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.34.1 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.34.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.33.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.32.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.31.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.30.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.29.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.28.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.27.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.26.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.25.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb