Class: OoxmlParser::SDTProperties

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb

Overview

Class for parsing ‘w:sdtPr` tags

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#aliasValuedChild (readonly)

Returns alias value.

Returns:



12
13
14
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 12

def alias
  @alias
end

#checkboxCheckBox (readonly)

Returns checkbox.

Returns:



22
23
24
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 22

def checkbox
  @checkbox
end

#comboboxComboBox (readonly)

Returns combobox.

Returns:



18
19
20
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 18

def combobox
  @combobox
end

Returns dropdown list.

Returns:



20
21
22
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 20

def dropdown_list
  @dropdown_list
end

#form_propertiesFormProperties (readonly)

Returns form properties.

Returns:



24
25
26
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 24

def form_properties
  @form_properties
end

#form_text_propertiesFormTextProperties (readonly)

Returns properties of text in form.

Returns:



26
27
28
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 26

def form_text_properties
  @form_text_properties
end

#lockValuedChild (readonly)

Returns Locking Setting.

Returns:



16
17
18
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 16

def lock
  @lock
end

#tagValuedChild (readonly)

Returns tag value.

Returns:



14
15
16
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 14

def tag
  @tag
end

Instance Method Details

#parse(node) ⇒ SDTProperties

Parse SDTProperties object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties.rb', line 31

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'alias'
      @alias = ValuedChild.new(:string, parent: self).parse(node_child)
    when 'tag'
      @tag = ValuedChild.new(:string, parent: self).parse(node_child)
    when 'lock'
      @lock = ValuedChild.new(:symbol, parent: self).parse(node_child)
    when 'comboBox'
      @combobox = ComboBox.new(parent: self).parse(node_child)
    when 'dropDownList'
      @dropdown_list = DropdownList.new(parent: self).parse(node_child)
    when 'checkbox'
      @checkbox = CheckBox.new(parent: self).parse(node_child)
    when 'formPr'
      @form_properties = FormProperties.new(parent: self).parse(node_child)
    when 'textFormPr'
      @form_text_properties = FormTextProperties.new(parent: self).parse(node_child)
    end
  end
  self
end