Class CustomPropertiesPartial
- class ooodev.utils.partial.custom_properties_partial.CustomPropertiesPartial(forms, form_name='Form_CustomProperties', ctl_name='CustomProperties')[source]
Partial class to add custom properties to a class that implements XForm.
Allows custom properties to be added to a document via its forms.
Note
The following keys are forbidden:
HiddenValue
,Name
ClassId
,Tag
.Properties are stored in a hidden control on the form and are persisted with the document.
Property value are basically
int
,float
,str
,bool
. A Property value ofNone
is not allowed; However, empty string is allowed.- Parameters:
forms (Any) –
form_name (str) –
ctl_name (str) –
- class ContainerListener(form_name, cp, lo_inst, subscriber=None)[source]
- Parameters:
args (Any) –
kwargs (Any) –
- Return type:
Any
- __init__(form_name, cp, lo_inst, subscriber=None)[source]
- Parameters:
form_name (str) –
cp (CustomPropertiesPartial) –
lo_inst (LoInst) –
subscriber (XContainer | None) –
- Return type:
None
- disposing(event)[source]
Gets called when the broadcaster is about to be disposed.
All listeners and all other objects, which reference the broadcaster should release the reference to the source. No method should be invoked anymore on this object ( including
XComponent.removeEventListener()
).This method is called for every listener registration of derived listener interfaced, not only for registrations at
XComponent
.- Return type:
None
- Parameters:
event (com.sun.star.lang.EventObject) –
- elementInserted(event)[source]
Event is invoked when a container has inserted an element.
- Return type:
None
- Parameters:
event (com.sun.star.container.ContainerEvent) –
- __init__(forms, form_name='Form_CustomProperties', ctl_name='CustomProperties')[source]
Constructor.
- Parameters:
forms (Any) – The component that implements
XForm
.form_name (str, optional) – The name to assign to the form. Defaults to “CustomProperties”.
ctl_name (str, optional) – The name to assign to the hidden control. Defaults to “CustomProperties”.
- get_custom_properties()[source]
Gets custom properties.
- Returns:
custom properties.
- Return type:
DotDict
Hint
DotDict is a class that allows you to access dictionary keys as attributes or keys. DotDict can be imported from
ooodev.utils.helper.dot_dict.DotDict
.
- get_custom_property(name, default=<object object>)[source]
Gets a custom property.
- Parameters:
name (str) – The name of the property.
default (Any, optional) – The default value to return if the property does not exist.
- Raises:
AttributeError – If the property is not found.
- Returns:
The value of the property.
- Return type:
Any
- has_custom_property(name)[source]
Gets if a custom property exists.
- Parameters:
name (str) – The name of the property to check.
- Returns:
True
if the property exists, otherwiseFalse
.- Return type:
bool
- remove_custom_property(name)[source]
Removes a custom property.
- Parameters:
name (str) – The name of the property to remove.
- Raises:
AttributeError – If the property is a forbidden key.
- Return type:
None
- set_custom_properties(properties)[source]
Sets custom properties.
- Parameters:
properties (DotDict) – custom properties to set.
- Return type:
None
Hint
DotDict is a class that allows you to access dictionary keys as attributes or keys. DotDict can be imported from
ooodev.utils.helper.dot_dict.DotDict
.- Return type:
None
- Parameters:
properties (DotDict) –