MCPcopy Index your code
hub / github.com/python-openxml/python-docx / CT_LatentStyles

Class CT_LatentStyles

src/docx/oxml/styles.py:33–64  ·  view source on GitHub ↗

`w:latentStyles` element, defining behavior defaults for latent styles and containing `w:lsdException` child elements that each override those defaults for a named latent style.

Source from the content-addressed store, hash-verified

31
32
33class CT_LatentStyles(BaseOxmlElement):
34 """`w:latentStyles` element, defining behavior defaults for latent styles and
35 containing `w:lsdException` child elements that each override those defaults for a
36 named latent style."""
37
38 lsdException = ZeroOrMore("w:lsdException", successors=())
39
40 count = OptionalAttribute("w:count", ST_DecimalNumber)
41 defLockedState = OptionalAttribute("w:defLockedState", ST_OnOff)
42 defQFormat = OptionalAttribute("w:defQFormat", ST_OnOff)
43 defSemiHidden = OptionalAttribute("w:defSemiHidden", ST_OnOff)
44 defUIPriority = OptionalAttribute("w:defUIPriority", ST_DecimalNumber)
45 defUnhideWhenUsed = OptionalAttribute("w:defUnhideWhenUsed", ST_OnOff)
46
47 def bool_prop(self, attr_name):
48 """Return the boolean value of the attribute having `attr_name`, or |False| if
49 not present."""
50 value = getattr(self, attr_name)
51 if value is None:
52 return False
53 return value
54
55 def get_by_name(self, name):
56 """Return the `w:lsdException` child having `name`, or |None| if not found."""
57 found = self.xpath('w:lsdException[@w:name="%s"]' % name)
58 if not found:
59 return None
60 return found[0]
61
62 def set_bool_prop(self, attr_name, value):
63 """Set the on/off attribute having `attr_name` to `value`."""
64 setattr(self, attr_name, bool(value))
65
66
67class CT_LsdException(BaseOxmlElement):

Callers

nothing calls this directly

Calls 2

ZeroOrMoreClass · 0.90
OptionalAttributeClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…