Class: Uniword::Wordprocessingml::Style

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/uniword/wordprocessingml/style.rb

Overview

Style definition

Generated from OOXML schema: wordprocessingml.yml Element: <w:style>

Instance Method Summary collapse

Instance Method Details

#alignmentObject



170
171
172
# File 'lib/uniword/wordprocessingml/style.rb', line 170

def alignment
  pPr&.alignment
end

#based_onObject



138
139
140
# File 'lib/uniword/wordprocessingml/style.rb', line 138

def based_on
  basedOn&.val
end

#boldObject



202
203
204
205
206
207
208
209
210
# File 'lib/uniword/wordprocessingml/style.rb', line 202

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

Returns:

  • (Boolean)


236
237
238
# File 'lib/uniword/wordprocessingml/style.rb', line 236

def character_style?
  type == "character"
end

#custom?Boolean

Returns:

  • (Boolean)


228
229
230
# File 'lib/uniword/wordprocessingml/style.rb', line 228

def custom?
  customStyle == true
end

#font_colorObject



216
217
218
# File 'lib/uniword/wordprocessingml/style.rb', line 216

def font_color
  rPr&.color&.value
end

#font_color_themeObject



220
221
222
# File 'lib/uniword/wordprocessingml/style.rb', line 220

def font_color_theme
  rPr&.color&.theme_color
end

#font_color_theme_tintObject



224
225
226
# File 'lib/uniword/wordprocessingml/style.rb', line 224

def font_color_theme_tint
  rPr&.color&.theme_shade || rPr&.color&.theme_tint
end

#font_familyObject



198
199
200
# File 'lib/uniword/wordprocessingml/style.rb', line 198

def font_family
  rPr&.fonts&.ascii || rPr&.font
end

#font_sizeObject



212
213
214
# File 'lib/uniword/wordprocessingml/style.rb', line 212

def font_size
  rPr&.size&.value&.to_i
end

#idObject

Convenience read-only accessors (aliases for lutaml-model attributes)



130
131
132
# File 'lib/uniword/wordprocessingml/style.rb', line 130

def id
  styleId
end

#keep_linesObject



184
185
186
187
188
189
190
191
192
# File 'lib/uniword/wordprocessingml/style.rb', line 184

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_nextObject



174
175
176
177
178
179
180
181
182
# File 'lib/uniword/wordprocessingml/style.rb', line 174

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_styleObject



146
147
148
# File 'lib/uniword/wordprocessingml/style.rb', line 146

def linked_style
  link&.val
end

#next_styleObject



142
143
144
# File 'lib/uniword/wordprocessingml/style.rb', line 142

def next_style
  nextStyle&.val
end

#numbering_style?Boolean

Returns:

  • (Boolean)


244
245
246
# File 'lib/uniword/wordprocessingml/style.rb', line 244

def numbering_style?
  type == "numbering"
end

#outline_levelObject



194
195
196
# File 'lib/uniword/wordprocessingml/style.rb', line 194

def outline_level
  pPr&.outline_level&.value&.to_i
end

#paragraph_propertiesObject



248
249
250
# File 'lib/uniword/wordprocessingml/style.rb', line 248

def paragraph_properties
  pPr
end

#paragraph_style?Boolean

Returns:

  • (Boolean)


232
233
234
# File 'lib/uniword/wordprocessingml/style.rb', line 232

def paragraph_style?
  type == "paragraph"
end

#quick_formatObject



154
155
156
157
158
159
160
# File 'lib/uniword/wordprocessingml/style.rb', line 154

def quick_format
  val = qFormat
  return true if val == true

  val = val.value if val.is_a?(Uniword::Properties::BooleanElement)
  val == true
end

#run_propertiesObject



252
253
254
# File 'lib/uniword/wordprocessingml/style.rb', line 252

def run_properties
  rPr
end

#spacing_afterObject



166
167
168
# File 'lib/uniword/wordprocessingml/style.rb', line 166

def spacing_after
  pPr&.spacing&.after || pPr&.spacing_after
end

#spacing_beforeObject



162
163
164
# File 'lib/uniword/wordprocessingml/style.rb', line 162

def spacing_before
  pPr&.spacing&.before || pPr&.spacing_before
end

#style_nameObject



134
135
136
# File 'lib/uniword/wordprocessingml/style.rb', line 134

def style_name
  @name&.val
end

#table_style?Boolean

Returns:

  • (Boolean)


240
241
242
# File 'lib/uniword/wordprocessingml/style.rb', line 240

def table_style?
  type == "table"
end

#ui_priorityObject



150
151
152
# File 'lib/uniword/wordprocessingml/style.rb', line 150

def ui_priority
  uiPriority&.val&.to_i
end

#yaml_based_on_from(instance, value) ⇒ Object



70
71
72
# File 'lib/uniword/wordprocessingml/style.rb', line 70

def yaml_based_on_from(instance, value)
  instance.basedOn = BasedOn.new(val: value) if value
end

#yaml_based_on_to(instance, _doc) ⇒ Object



74
75
76
# File 'lib/uniword/wordprocessingml/style.rb', line 74

def yaml_based_on_to(instance, _doc)
  instance.basedOn&.val
end

#yaml_linked_style_from(instance, value) ⇒ Object



86
87
88
# File 'lib/uniword/wordprocessingml/style.rb', line 86

def yaml_linked_style_from(instance, value)
  instance.link = Link.new(val: value) if value
end

#yaml_linked_style_to(instance, _doc) ⇒ Object



90
91
92
# File 'lib/uniword/wordprocessingml/style.rb', line 90

def yaml_linked_style_to(instance, _doc)
  instance.link&.val
end

#yaml_name_from(instance, value) ⇒ Object

YAML transform methods (instance methods called by lutaml-model's with: transform mechanism)



54
55
56
# File 'lib/uniword/wordprocessingml/style.rb', line 54

def yaml_name_from(instance, value)
  instance.name = StyleName.new(val: value) if value
end

#yaml_name_to(instance, _doc) ⇒ Object



58
59
60
# File 'lib/uniword/wordprocessingml/style.rb', line 58

def yaml_name_to(instance, _doc)
  instance.name&.val
end

#yaml_next_style_from(instance, value) ⇒ Object



78
79
80
# File 'lib/uniword/wordprocessingml/style.rb', line 78

def yaml_next_style_from(instance, value)
  instance.nextStyle = Next.new(val: value) if value
end

#yaml_next_style_to(instance, _doc) ⇒ Object



82
83
84
# File 'lib/uniword/wordprocessingml/style.rb', line 82

def yaml_next_style_to(instance, _doc)
  instance.nextStyle&.val
end

#yaml_quick_format_from(instance, value) ⇒ Object



62
63
64
# File 'lib/uniword/wordprocessingml/style.rb', line 62

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



66
67
68
# File 'lib/uniword/wordprocessingml/style.rb', line 66

def yaml_quick_format_to(instance, _doc)
  instance.qFormat&.value
end

#yaml_ui_priority_from(instance, value) ⇒ Object



94
95
96
# File 'lib/uniword/wordprocessingml/style.rb', line 94

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



98
99
100
# File 'lib/uniword/wordprocessingml/style.rb', line 98

def yaml_ui_priority_to(instance, _doc)
  instance.uiPriority&.val&.to_i
end