Sha256: 8b4e0976181ef0b1fe955425349b5eb04633fe6d83aafdece4f534f50c35128a

Contents?: true

Size: 1.39 KB

Versions: 24

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Docx Wrap Drawing
  class DocxWrapDrawing < OOXMLDocumentObject
    attr_accessor :wrap_text, :distance_from_text

    def initialize(parent: nil)
      @wrap_text = :none
      super
    end

    # Parse DocxWrapDrawing object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [DocxWrapDrawing] result of parsing
    def parse(node)
      unless node.attribute('behindDoc').nil?
        @wrap_text = :behind if node.attribute('behindDoc').value == '1'
        @wrap_text = :infront if node.attribute('behindDoc').value == '0'
      end
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'wrapSquare'
          @wrap_text = :square
          @distance_from_text = DocxDrawingDistanceFromText.new(parent: self).parse(node_child)
          break
        when 'wrapTight'
          @wrap_text = :tight
          @distance_from_text = DocxDrawingDistanceFromText.new(parent: self).parse(node_child)
          break
        when 'wrapThrough'
          @wrap_text = :through
          @distance_from_text = DocxDrawingDistanceFromText.new(parent: self).parse(node_child)
          break
        when 'wrapTopAndBottom'
          @wrap_text = :topbottom
          @distance_from_text = DocxDrawingDistanceFromText.new(parent: self).parse(node_child)
          break
        end
      end
      self
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ooxml_parser-0.25.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.22.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.21.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.20.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.19.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.18.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.18.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.17.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.16.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.15.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.14.2 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.14.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.14.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.13.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.12.2 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.12.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb
ooxml_parser-0.12.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/drawing_properties/docx_wrap_drawing.rb