17.7.3 Toggle Properties
Certain character properties defined in 17.3.2 are specified as toggle properties. [Example: the Bold and Italics properties are toggle properties. end example] As indicated in the previous two sections (17.7.1 and 17.7.2) several styles can affect the formatting applied to a given piece of content within a WordprocessingML
order Application
document. When the same formatting property appears in one or more styles that affect the content applied to a run, the combined effect depends on whether or not the formatting property is a toggle property.
If the property is not a toggle property, then its values shall be applied in the order described in 17.7.1 and 17.7.2, and only its last value in that order shall be used.
If the property is a toggle property, then its values, which are limited to true and false (or the equivalent values 1 and 0) shall be combined as follows:
- If a toggle property is explicitly set in direct formatting applied to a given piece of content, then its value
- in the direct formatting shall be used.
- Otherwise, the instances of that toggle property in the styles that affect the content shall be combined
- in the following manner:
If multiple instances of the toggle property appear at the same level of the style hierarchy, then the first value encountered by the following algorithm shall be used (if no value is encountered, the property takes on its default value).
Attempt to read the value in the style. If it does not exist and the style has a basedOn element with a non-empty value, repeat step 1 using the style specified by the basedOn element. [Example: If a paragraph style sets no value for the bold property to false and the paragraph style specified by its basedOn element specifies that it is true, the result of applying the style definition sets the value of bold to true (the first value in the hierarchy). end example]
If the value of the toggle property appears at multiple levels of the style hierarchy (17.7.2), their effective values shall be combined as follows:
If the value specified by the document defaults is true, the effective value is true. Otherwise, the values are combined by a Boolean XOR as follows: 𝑣𝑎𝑙𝑢𝑒 = 𝑣𝑎𝑙 𝑋𝑂𝑅 𝑣𝑎𝑙 𝑋𝑂𝑅 𝑣𝑎𝑙 𝑒𝑓𝑓𝑒𝑐𝑡𝑖𝑣𝑒 𝑡𝑎𝑏𝑙𝑒 𝑝𝑎𝑟𝑎𝑔𝑟𝑎𝑝ℎ 𝑐ℎ𝑎𝑟𝑎𝑐𝑡𝑒𝑟 i.e., the effective value to be applied to the content shall be true if its effective value is true for an odd number of levels of the style hierarchy.
The following Boolean properties are toggle properties: 17.3.2.1 (Bold), 17.3.2.2 (Complex Script Bold), 17.3.2.5 (Display All Characters as Capital Letters), 17.3.2.13 (Embossing), 17.3.2.16 (Italics), 17.3.2.17 (Complex Script Italics), 17.3.2.18 (Imprinting), 17.3.2.23 (Display Character Outline), 17.3.2.31 (Shadow), 17.3.2.33 (Small Caps), 17.3.2.37 (Single Strikethrough), 17.3.2.41 (Hidden Text).
[Example: Consider a table style with two styles in its basedOn chain. If the resolved value of the bold property (a toggle property) within the basedOn chain of the table style is true, that specifies that this property should be applied to the contents of the table:
If a single paragraph within that table also has a paragraph style applied, with three styles in its basedOn chain that resolve to a value of true, the toggle property logic above would toggle the bold property, resulting in bold not being applied to its contents. Applying this to the paragraph in the first cell below, the resulting table would appear as follows:
The calculation which results in this value for the bold property is displayed below:
end example]