Sha256: fdf886bd03b76d4d7c2ae2204b2d7a43242dc3998debd14058ee0cd114e73b90

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

require 'berkeley_library/util/ods/xml/style/style'
require 'berkeley_library/util/ods/xml/style/table_column_properties'

module BerkeleyLibrary
  module Util
    module ODS
      module XML
        module Style
          class ColumnStyle < Style
            DEFAULT_WIDTH = '1in'.freeze

            attr_reader :width

            # Initializes a new column style. Note that this should not be called
            # directly, but only from {XML::Office::AutomaticStyles#add_column_style}.
            #
            # @param style_name [String] the name of the style
            # @param width [String] the column width
            # @param styles [XML::Office::AutomaticStyles] the document styles
            def initialize(style_name, width = nil, styles:)
              super(style_name, :table_column, doc: styles.doc)
              @width = width || DEFAULT_WIDTH
              add_default_children!
            end

            private

            def add_default_children!
              children << TableColumnProperties.new(width, doc: doc)
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.7.1 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.7.0 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.6.0 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.5.1 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.5.0 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.4.3 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.4.2 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.4.1 lib/berkeley_library/util/ods/xml/style/column_style.rb
berkeley_library-tind-0.4.0 lib/berkeley_library/util/ods/xml/style/column_style.rb