Class: OoxmlParser::DocxShape
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocxShape
- Defined in:
- lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb
Overview
Class for parsing ‘sp`, `wsp` tags
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body_properties ⇒ Object
Returns the value of attribute body_properties.
-
#locks_text ⇒ True, False
readonly
Specifies if text in shape is locked when sheet is protected.
-
#non_visual_properties ⇒ Object
Returns the value of attribute non_visual_properties.
-
#properties ⇒ Object
(also: #shape_properties)
Returns the value of attribute properties.
-
#style ⇒ Object
Returns the value of attribute style.
-
#text_body ⇒ Object
Returns the value of attribute text_body.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ DocxShape
constructor
A new instance of DocxShape.
-
#parse(node) ⇒ DocxShape
Parse DocxShape object.
-
#with_data? ⇒ True, false
If structure contain any user data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ DocxShape
Returns a new instance of DocxShape.
18 19 20 21 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 18 def initialize(parent: nil) @locks_text = true super end |
Instance Attribute Details
#body_properties ⇒ Object
Returns the value of attribute body_properties.
12 13 14 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 12 def body_properties @body_properties end |
#locks_text ⇒ True, False (readonly)
Returns Specifies if text in shape is locked when sheet is protected.
14 15 16 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 14 def locks_text @locks_text end |
#non_visual_properties ⇒ Object
Returns the value of attribute non_visual_properties.
12 13 14 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 12 def non_visual_properties @non_visual_properties end |
#properties ⇒ Object Also known as: shape_properties
Returns the value of attribute properties.
12 13 14 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 12 def properties @properties end |
#style ⇒ Object
Returns the value of attribute style.
12 13 14 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 12 def style @style end |
#text_body ⇒ Object
Returns the value of attribute text_body.
12 13 14 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 12 def text_body @text_body end |
Instance Method Details
#parse(node) ⇒ DocxShape
Parse DocxShape object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 36 def parse(node) node.attributes.each do |key, value| case key when 'fLocksText' @locks_text = attribute_enabled?(value) end end node.xpath('*').each do |node_child| case node_child.name when 'nvSpPr' @non_visual_properties = NonVisualShapeProperties.new(parent: self).parse(node_child) when 'spPr' @properties = DocxShapeProperties.new(parent: self).parse(node_child) when 'style' @style = ShapeStyle.new(parent: self).parse(node_child) when 'txbx' @text_body = OOXMLTextBox.new(parent: self).parse(node_child) when 'txBody' @text_body = TextBody.new(parent: self).parse(node_child) when 'bodyPr' @body_properties = OOXMLShapeBodyProperties.new(parent: self).parse(node_child) end end self end |
#with_data? ⇒ True, false
Returns if structure contain any user data.
24 25 26 27 28 29 30 31 |
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/docx_shape.rb', line 24 def with_data? return true if @text_body.nil? return true if @text_body.paragraphs.length > 1 return true unless @text_body.paragraphs.first.runs.empty? return true if properties.preset_geometry false end |