Sha256: 6af2184739acd3ef56f5743213332842dcfdbe765699841d092867db912d0b6d

Contents?: true

Size: 1.98 KB

Versions: 40

Compression:

Stored size: 1.98 KB

Contents

# frozen_string_literal: true

require_relative 'docx_color'
require_relative 'docx_shape_size'
require_relative 'docx_shape_line'
require_relative 'docx_shape_properties/blip_fill'
require_relative 'docx_shape_properties/preset_geometry'
require_relative 'docx_shape_properties/text_box'
require_relative 'custom_geometry/ooxml_custom_geometry'
module OoxmlParser
  # DOCX Shape Properties
  class DocxShapeProperties < OOXMLDocumentObject
    # @return [DocxShapeSize] size of shape
    attr_reader :shape_size
    # @return [PresetGeometry] preset geometry of object
    attr_reader :preset_geometry
    # @return [DocxColor] color of object
    attr_reader :fill_color
    # @return [DocxShapeLine] line info
    attr_reader :line
    # @return [PresetGeometry] is some geometry custom
    attr_reader :custom_geometry
    # @return [BlipFill] BlipFill data
    attr_reader :blip_fill

    alias transform shape_size
    alias fill fill_color
    alias preset preset_geometry

    def initialize(parent: nil)
      @line = DocxShapeLine.new
      super
    end

    # Parse DocxShapeProperties object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [DocxShapeProperties] result of parsing
    def parse(node)
      @fill_color = DocxColor.new(parent: self).parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'xfrm'
          @shape_size = DocxShapeSize.new(parent: self).parse(node_child)
        when 'prstGeom'
          @preset_geometry = PresetGeometry.new(parent: self).parse(node_child)
        when 'ln'
          @line = DocxShapeLine.new(parent: self).parse(node_child)
        when 'blipFill'
          @blip_fill = BlipFill.new(parent: self).parse(node_child)
        when 'custGeom'
          @preset_geometry = PresetGeometry.new(parent: self).parse(node_child)
          @preset_geometry.name = :custom
          @custom_geometry = OOXMLCustomGeometry.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.37.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.36.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.36.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.35.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.34.2 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.34.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.34.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.33.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.32.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.31.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.30.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.29.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.28.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.27.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.26.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.25.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb
ooxml_parser-0.22.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_properties.rb