Class: Uniword::Wordprocessingml::Style
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::Wordprocessingml::Style
- Defined in:
- lib/uniword/wordprocessingml/style.rb
Overview
Style definition
Generated from OOXML schema: wordprocessingml.yml Element: <w:style>
Instance Method Summary collapse
- #alignment ⇒ Object
- #based_on ⇒ Object
- #bold ⇒ Object
- #character_style? ⇒ Boolean
- #custom? ⇒ Boolean
- #font_color ⇒ Object
- #font_color_theme ⇒ Object
- #font_color_theme_tint ⇒ Object
- #font_family ⇒ Object
- #font_size ⇒ Object
-
#id ⇒ Object
Convenience read-only accessors (aliases for lutaml-model attributes).
- #keep_lines ⇒ Object
- #keep_next ⇒ Object
- #linked_style ⇒ Object
- #next_style ⇒ Object
- #numbering_style? ⇒ Boolean
- #outline_level ⇒ Object
- #paragraph_properties ⇒ Object
- #paragraph_style? ⇒ Boolean
- #quick_format ⇒ Object
- #run_properties ⇒ Object
- #spacing_after ⇒ Object
- #spacing_before ⇒ Object
- #style_name ⇒ Object
- #table_style? ⇒ Boolean
- #to_xml(options = {}) ⇒ Object
- #ui_priority ⇒ Object
- #yaml_based_on_from(instance, value) ⇒ Object
- #yaml_based_on_to(instance, _doc) ⇒ Object
- #yaml_linked_style_from(instance, value) ⇒ Object
- #yaml_linked_style_to(instance, _doc) ⇒ Object
-
#yaml_name_from(instance, value) ⇒ Object
YAML transform methods (instance methods - called via send on an instance).
- #yaml_name_to(instance, _doc) ⇒ Object
- #yaml_next_style_from(instance, value) ⇒ Object
- #yaml_next_style_to(instance, _doc) ⇒ Object
- #yaml_quick_format_from(instance, value) ⇒ Object
- #yaml_quick_format_to(instance, _doc) ⇒ Object
- #yaml_ui_priority_from(instance, value) ⇒ Object
- #yaml_ui_priority_to(instance, _doc) ⇒ Object
Instance Method Details
#alignment ⇒ Object
169 170 171 |
# File 'lib/uniword/wordprocessingml/style.rb', line 169 def alignment pPr&.alignment end |
#based_on ⇒ Object
137 138 139 |
# File 'lib/uniword/wordprocessingml/style.rb', line 137 def based_on basedOn&.val end |
#bold ⇒ Object
201 202 203 204 205 206 207 208 209 |
# File 'lib/uniword/wordprocessingml/style.rb', line 201 def bold return nil unless rPr val = rPr.bold return nil if val.nil? val = val.value if val.is_a?(Uniword::Properties::BooleanElement) val == true end |
#character_style? ⇒ Boolean
235 236 237 |
# File 'lib/uniword/wordprocessingml/style.rb', line 235 def character_style? type == "character" end |
#custom? ⇒ Boolean
227 228 229 |
# File 'lib/uniword/wordprocessingml/style.rb', line 227 def custom? customStyle == true end |
#font_color ⇒ Object
215 216 217 |
# File 'lib/uniword/wordprocessingml/style.rb', line 215 def font_color rPr&.color&.value end |
#font_color_theme ⇒ Object
219 220 221 |
# File 'lib/uniword/wordprocessingml/style.rb', line 219 def font_color_theme rPr&.color&.theme_color end |
#font_color_theme_tint ⇒ Object
223 224 225 |
# File 'lib/uniword/wordprocessingml/style.rb', line 223 def font_color_theme_tint rPr&.color&.theme_shade || rPr&.color&.theme_tint end |
#font_family ⇒ Object
197 198 199 |
# File 'lib/uniword/wordprocessingml/style.rb', line 197 def font_family rPr&.fonts&.ascii || rPr&.font end |
#font_size ⇒ Object
211 212 213 |
# File 'lib/uniword/wordprocessingml/style.rb', line 211 def font_size rPr&.size&.value&.to_i end |
#id ⇒ Object
Convenience read-only accessors (aliases for lutaml-model attributes)
129 130 131 |
# File 'lib/uniword/wordprocessingml/style.rb', line 129 def id styleId end |
#keep_lines ⇒ Object
183 184 185 186 187 188 189 190 191 |
# File 'lib/uniword/wordprocessingml/style.rb', line 183 def keep_lines return false unless pPr val = pPr.keep_lines_wrapper return false if val.nil? val = val.value if val.is_a?(Uniword::Properties::BooleanElement) val == true end |
#keep_next ⇒ Object
173 174 175 176 177 178 179 180 181 |
# File 'lib/uniword/wordprocessingml/style.rb', line 173 def keep_next return false unless pPr val = pPr.keep_next_wrapper return false if val.nil? val = val.value if val.is_a?(Uniword::Properties::BooleanElement) val == true end |
#linked_style ⇒ Object
145 146 147 |
# File 'lib/uniword/wordprocessingml/style.rb', line 145 def linked_style link&.val end |
#next_style ⇒ Object
141 142 143 |
# File 'lib/uniword/wordprocessingml/style.rb', line 141 def next_style nextStyle&.val end |
#numbering_style? ⇒ Boolean
243 244 245 |
# File 'lib/uniword/wordprocessingml/style.rb', line 243 def numbering_style? type == "numbering" end |
#outline_level ⇒ Object
193 194 195 |
# File 'lib/uniword/wordprocessingml/style.rb', line 193 def outline_level pPr&.outline_level&.value&.to_i end |
#paragraph_properties ⇒ Object
247 248 249 |
# File 'lib/uniword/wordprocessingml/style.rb', line 247 def paragraph_properties pPr end |
#paragraph_style? ⇒ Boolean
231 232 233 |
# File 'lib/uniword/wordprocessingml/style.rb', line 231 def paragraph_style? type == "paragraph" end |
#quick_format ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/uniword/wordprocessingml/style.rb', line 153 def quick_format val = qFormat return true if val == true val = val.value if val.is_a?(Uniword::Properties::BooleanElement) val == true end |
#run_properties ⇒ Object
251 252 253 |
# File 'lib/uniword/wordprocessingml/style.rb', line 251 def run_properties rPr end |
#spacing_after ⇒ Object
165 166 167 |
# File 'lib/uniword/wordprocessingml/style.rb', line 165 def spacing_after pPr&.spacing&.after || pPr&.spacing_after end |
#spacing_before ⇒ Object
161 162 163 |
# File 'lib/uniword/wordprocessingml/style.rb', line 161 def spacing_before pPr&.spacing&.before || pPr&.spacing_before end |
#style_name ⇒ Object
133 134 135 |
# File 'lib/uniword/wordprocessingml/style.rb', line 133 def style_name @name&.val end |
#table_style? ⇒ Boolean
239 240 241 |
# File 'lib/uniword/wordprocessingml/style.rb', line 239 def table_style? type == "table" end |
#to_xml(options = {}) ⇒ Object
255 256 257 |
# File 'lib/uniword/wordprocessingml/style.rb', line 255 def to_xml( = {}) super(.merge(fix_boolean_elements: true)) end |
#ui_priority ⇒ Object
149 150 151 |
# File 'lib/uniword/wordprocessingml/style.rb', line 149 def ui_priority uiPriority&.val&.to_i end |
#yaml_based_on_from(instance, value) ⇒ Object
69 70 71 |
# File 'lib/uniword/wordprocessingml/style.rb', line 69 def yaml_based_on_from(instance, value) instance.basedOn = BasedOn.new(val: value) if value end |
#yaml_based_on_to(instance, _doc) ⇒ Object
73 74 75 |
# File 'lib/uniword/wordprocessingml/style.rb', line 73 def yaml_based_on_to(instance, _doc) instance.basedOn&.val end |
#yaml_linked_style_from(instance, value) ⇒ Object
85 86 87 |
# File 'lib/uniword/wordprocessingml/style.rb', line 85 def yaml_linked_style_from(instance, value) instance.link = Link.new(val: value) if value end |
#yaml_linked_style_to(instance, _doc) ⇒ Object
89 90 91 |
# File 'lib/uniword/wordprocessingml/style.rb', line 89 def yaml_linked_style_to(instance, _doc) instance.link&.val end |
#yaml_name_from(instance, value) ⇒ Object
YAML transform methods (instance methods - called via send on an instance)
53 54 55 |
# File 'lib/uniword/wordprocessingml/style.rb', line 53 def yaml_name_from(instance, value) instance.name = StyleName.new(val: value) if value end |
#yaml_name_to(instance, _doc) ⇒ Object
57 58 59 |
# File 'lib/uniword/wordprocessingml/style.rb', line 57 def yaml_name_to(instance, _doc) instance.name&.val end |
#yaml_next_style_from(instance, value) ⇒ Object
77 78 79 |
# File 'lib/uniword/wordprocessingml/style.rb', line 77 def yaml_next_style_from(instance, value) instance.nextStyle = Next.new(val: value) if value end |
#yaml_next_style_to(instance, _doc) ⇒ Object
81 82 83 |
# File 'lib/uniword/wordprocessingml/style.rb', line 81 def yaml_next_style_to(instance, _doc) instance.nextStyle&.val end |
#yaml_quick_format_from(instance, value) ⇒ Object
61 62 63 |
# File 'lib/uniword/wordprocessingml/style.rb', line 61 def yaml_quick_format_from(instance, value) instance.qFormat = Properties::QuickFormat.new(value: value) unless value.nil? end |
#yaml_quick_format_to(instance, _doc) ⇒ Object
65 66 67 |
# File 'lib/uniword/wordprocessingml/style.rb', line 65 def yaml_quick_format_to(instance, _doc) instance.qFormat&.value end |
#yaml_ui_priority_from(instance, value) ⇒ Object
93 94 95 |
# File 'lib/uniword/wordprocessingml/style.rb', line 93 def yaml_ui_priority_from(instance, value) instance.uiPriority = UiPriority.new(val: value.to_s) if value end |
#yaml_ui_priority_to(instance, _doc) ⇒ Object
97 98 99 |
# File 'lib/uniword/wordprocessingml/style.rb', line 97 def yaml_ui_priority_to(instance, _doc) instance.uiPriority&.val&.to_i end |