Sha256: 793f270cdcc9942346139cd1c8d3ae284f3a79fa14fe5cce307c1410ab9d535a

Contents?: true

Size: 1.95 KB

Versions: 21

Compression:

Stored size: 1.95 KB

Contents

require 'rubyXL/objects/ooxml_object'
require 'rubyXL/objects/simple_types'

module RubyXL

  class BorderEdge < OOXMLObject
    define_attribute(:style, RubyXL::ST_BorderStyle, :default => 'none')
    define_child_node(RubyXL::Color)

    def ==(other)
      style == other.style
    end
  end

  # http://www.schemacentral.com/sc/ooxml/e-ssml_border-2.html
  class Border < OOXMLObject
    define_attribute(:diagonalUp,   :bool)
    define_attribute(:diagonalDown, :bool)
    define_attribute(:outline,      :bool, :default => true)
    define_child_node(RubyXL::BorderEdge, :node_name => :left)
    define_child_node(RubyXL::BorderEdge, :node_name => :right)
    define_child_node(RubyXL::BorderEdge, :node_name => :top)
    define_child_node(RubyXL::BorderEdge, :node_name => :bottom)
    define_child_node(RubyXL::BorderEdge, :node_name => :diagonal)
    define_child_node(RubyXL::BorderEdge, :node_name => :vertical)
    define_child_node(RubyXL::BorderEdge, :node_name => :horizontal)
    define_element_name 'border'
    set_countable

    def get_edge_style(direction)
      edge = self.send(direction)
      edge && edge.style
    end

    def set_edge_style(direction, style)
      self.send("#{direction}=", RubyXL::BorderEdge.new(:style => style))
    end

    def ==(other)
      (diagonal_up == other.diagonal_up) &&
        (diagonal_down == other.diagonal_down) &&
        (outline == other.outline) &&
        (left == other.left) &&
        (right == other.right) &&
        (top == other.top) &&
        (bottom == other.bottom) &&
        (diagonal == other.diagonal) &&
        (vertical == other.vertical) &&
        (horizontal == other.horizontal)
    end

  end

  # http://www.schemacentral.com/sc/ooxml/e-ssml_borders-1.html
  class Borders < OOXMLContainerObject
    define_child_node(RubyXL::Border, :collection => :with_count)
    define_element_name 'borders'

    def self.defaults
      self.new(:_ => [ RubyXL::Border.new ])
    end

  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rubyXL-3.0.2 lib/rubyXL/objects/border.rb
rubyXL-3.0.1 lib/rubyXL/objects/border.rb
rubyXL-3.0.0 lib/rubyXL/objects/border.rb
rubyXL-2.5.7 lib/rubyXL/objects/border.rb
rubyXL-2.5.6 lib/rubyXL/objects/border.rb
rubyXL-2.5.5 lib/rubyXL/objects/border.rb
rubyXL-2.5.4 lib/rubyXL/objects/border.rb
rubyXL-2.5.3 lib/rubyXL/objects/border.rb
rubyXL-2.5.2 lib/rubyXL/objects/border.rb
rubyXL-2.5.1 lib/rubyXL/objects/border.rb
rubyXL-2.5.0 lib/rubyXL/objects/border.rb
rubyXL-2.4.4 lib/rubyXL/objects/border.rb
rubyXL-2.4.3 lib/rubyXL/objects/border.rb
rubyXL-2.4.2 lib/rubyXL/objects/border.rb
rubyXL-2.4.1 lib/rubyXL/objects/border.rb
rubyXL-2.4.0 lib/rubyXL/objects/border.rb
rubyXL-2.3.4 lib/rubyXL/objects/border.rb
rubyXL-2.3.3 lib/rubyXL/objects/border.rb
rubyXL-2.3.2 lib/rubyXL/objects/border.rb
rubyXL-2.3.1 lib/rubyXL/objects/border.rb