Class: OoxmlParser::DocxShapeSize
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxShapeSize
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb
Overview
Docx Shape Size
Instance Attribute Summary collapse
-
#child_extent ⇒ OOXMLCoordinates
readonly
Child extent.
-
#child_offset ⇒ OOXMLCoordinates
readonly
Child offset.
-
#extent ⇒ OOXMLCoordinates
(also: #extents)
readonly
Extent info.
-
#flip_horizontal ⇒ True, False
readonly
Is image flipped horizontally.
-
#flip_vertical ⇒ True, False
readonly
Is image flipped vertically.
-
#offset ⇒ OOXMLCoordinates
readonly
Offset info.
-
#rotation ⇒ OoxmlSize
readonly
Rotation info.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ DocxShapeSize
Parse DocxShapeSize object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#child_extent ⇒ OOXMLCoordinates (readonly)
Returns child extent.
15 16 17 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 15 def child_extent @child_extent end |
#child_offset ⇒ OOXMLCoordinates (readonly)
Returns child offset.
13 14 15 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 13 def child_offset @child_offset end |
#extent ⇒ OOXMLCoordinates (readonly) Also known as: extents
Returns extent info.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 11 def extent @extent end |
#flip_horizontal ⇒ True, False (readonly)
Returns is image flipped horizontally.
17 18 19 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 17 def flip_horizontal @flip_horizontal end |
#flip_vertical ⇒ True, False (readonly)
Returns is image flipped vertically.
19 20 21 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 19 def flip_vertical @flip_vertical end |
#offset ⇒ OOXMLCoordinates (readonly)
Returns offset info.
9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 9 def offset @offset end |
#rotation ⇒ OoxmlSize (readonly)
Returns rotation info.
7 8 9 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 7 def rotation @rotation end |
Instance Method Details
#parse(node) ⇒ DocxShapeSize
Parse DocxShapeSize object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/docx_shape_size.rb', line 26 def parse(node) node.attributes.each do |key, value| case key when 'rot' @rotation = OoxmlSize.new(value.value.to_f, :one_60000th_degree) when 'flipH' @flip_horizontal = attribute_enabled?(value) when 'flipV' @flip_vertical = attribute_enabled?(value) end end node.xpath('*').each do |node_child| case node_child.name when 'off' @offset = OOXMLCoordinates.new(parent: self).parse(node_child, unit: :emu) when 'ext' @extent = OOXMLCoordinates.new(parent: self).parse(node_child, x_attr: 'cx', y_attr: 'cy', unit: :emu) when 'chOff' @child_offset = OOXMLCoordinates.new(parent: self).parse(node_child, unit: :emu) when 'chExt' @child_extent = OOXMLCoordinates.new(parent: self).parse(node_child, x_attr: 'cx', y_attr: 'cy', unit: :emu) end end self end |