Sha256: b7ce5b4c1361f7a8d56b286a9e5807273483165605be06fa8dc39668c8380748

Contents?: true

Size: 1.62 KB

Versions: 28

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

require_relative 'icon_set/conditional_formatting_icon'
module OoxmlParser
  # Class for `iconSet` data
  class IconSet < OOXMLDocumentObject
    # @return [String] Name of icon set
    attr_reader :set
    # @return [Symbol] Specifies whether icons are shown in reverse order
    attr_reader :reverse
    # @return [Symbol] Specifies whether value is shown in a cell
    attr_reader :show_value
    # @return [Symbol] Specifies whether icon set is custom
    attr_reader :custom
    # @return [Array<ConditionalFormatValueObject>] list of values
    attr_reader :values
    # @return [Array<ConditionalFormattingIcon>] list of icons for custom sets
    attr_reader :icons

    def initialize(parent: nil)
      @values = []
      @icons = []
      @show_value = true
      super
    end

    # Parse IconSet data
    # @param [Nokogiri::XML:Element] node with IconSet data
    # @return [IconSet] value of IconSet data
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'iconSet'
          @set = value.value.to_s
        when 'reverse'
          @reverse = attribute_enabled?(value)
        when 'showValue'
          @show_value = attribute_enabled?(value)
        when 'custom'
          @custom = attribute_enabled?(value)
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'cfvo'
          @values << ConditionalFormatValueObject.new(parent: self).parse(node_child)
        when 'cfIcon'
          @icons << ConditionalFormattingIcon.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ooxml_parser-0.21.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.20.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.19.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.18.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.18.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.17.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.16.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb
ooxml_parser-0.15.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb