Class: OoxmlParser::ChartAxisTitle

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb

Overview

Chart Axis Title ‘title` node

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ ChartAxisTitle

Returns a new instance of ChartAxisTitle.



6
7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 6

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

Instance Attribute Details

#elementsObject

Returns the value of attribute elements.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 4

def elements
  @elements
end

#layoutObject

Returns the value of attribute layout.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 4

def layout
  @layout
end

#overlayObject

Returns the value of attribute overlay.



4
5
6
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 4

def overlay
  @overlay
end

Instance Method Details

#nil?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 11

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

#parse(node) ⇒ ChartAxisTitle

Parse ChartAxisTitle object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis_title.rb', line 18

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