Style Base
StyleBase, base class of all ODF style classes.
Classes:
| Name | Description |
|---|---|
StyleBase |
Base class of all ODF style classes (internal). |
Attributes:
| Name | Type | Description |
|---|---|---|
PropDict |
|
PropDict
module-attribute
PropDict = dict[str, str | bool | tuple | None | "PropDict"]
StyleBase
Bases: Element
Base class of all ODF style classes (internal).
This class provides common functionalities for ODF styles, acting as a foundational element for more specific style implementations.
Methods:
| Name | Description |
|---|---|
__repr__ |
|
__str__ |
|
get_list_style_properties |
Get list style properties as a dictionary. |
get_properties |
Get the mapping of all properties of this style. |
get_text_properties |
Get text properties of style as a dictionary. |
set_properties |
Set the properties of the “area” type of this style. |
Attributes:
| Name | Type | Description |
|---|---|---|
family |
str | None
|
Get the style family. |
Source code in odfdo/style_base.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
_tag
class-attribute
instance-attribute
_tag: str = 'style:_pseudo_style_base_'
family
property
writable
family: str | None
Get the style family.
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: The style family as a string, or None if not set. |
__repr__
__repr__() -> str
Source code in odfdo/style_base.py
43 44 | |
__str__
__str__() -> str
Source code in odfdo/style_base.py
46 47 | |
get_list_style_properties
get_list_style_properties() -> dict[str, str | bool]
Get list style properties as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict[str, str | bool]
|
A dictionary containing list style properties with some |
dict[str, str | bool]
|
enhanced values. |
Source code in odfdo/style_base.py
101 102 103 104 105 106 107 108 | |
get_properties
get_properties(area: str | None = None) -> PropDict | None
Get the mapping of all properties of this style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
area
|
str | None
|
The specific area of properties to retrieve (e.g., ‘text’, ‘paragraph’). If None, all properties are returned. |
None
|
Returns:
| Type | Description |
|---|---|
PropDict | None
|
dict[str, str | dict] | None: A dictionary of properties, or None if no properties are found. |
Source code in odfdo/style_base.py
67 68 69 70 71 72 73 74 75 76 77 | |
get_text_properties
get_text_properties() -> dict[str, str | bool]
Get text properties of style as a dictionary.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict[str, str | bool]
|
A dictionary containing text properties with some |
dict[str, str | bool]
|
enhanced values. |
Source code in odfdo/style_base.py
110 111 112 113 114 115 116 117 | |
set_properties
set_properties(
properties: PropDict | None = None,
style: StyleBase | None = None,
area: str | None = None,
**kwargs: Any,
) -> None
Set the properties of the “area” type of this style.
This method allows setting style properties either from a dictionary,
another StyleBase object, or keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
properties
|
PropDict | None
|
A dictionary of properties to set. |
None
|
style
|
StyleBase | None
|
Another StyleBase object from which to copy properties. |
None
|
area
|
str | None
|
The specific area of properties to set (e.g., ‘text’, ‘paragraph’). |
None
|
**kwargs
|
Any
|
Arbitrary keyword arguments representing properties to set. |
{}
|
Source code in odfdo/style_base.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |