module ctl_base
- class ooodev.form.controls.form_ctl_base.FormCtlBase(ctl, lo_inst=None)[source]
Bases:
LoInstPropsPartial
,TheDictionaryPartial
,PropPartial
,FocusEvents
,KeyEvents
,MouseEvents
,MouseMotionEvents
,PaintEvents
,WindowEvents
,PropertyChangeImplement
,PropertiesChangeImplement
,VetoableChangeImplement
Base class for all form controls
- Parameters:
ctl (XControl) –
lo_inst (LoInst | None) –
- __init__(ctl, lo_inst=None)[source]
Constructor
- Parameters:
ctl (XControl) – Control.
lo_inst (LoInst, optional) – Lo Instance. Use when creating multiple documents. Defaults to
None
.
- Return type:
None
Note
If the LoContext manager is use before this class is instantiated, then the Lo instance will be set using the current Lo instance. That the context manager has set. Generally speaking this means that there is no need to set
lo_inst
when instantiating this class.See also
- apply_styles(*styles)[source]
Applies styles to control
- Parameters:
*styles (
StyleT
) – Styles to apply- Return type:
None
- assign_script(interface_name, method_name, script_name, loc, language=LanguageKind.PYTHON, auto_remove_existing=True)[source]
Binds a macro to a form control.
Method is Lo Instance Safe for use with multiple documents.
- Parameters:
interface_name (str, XInterface) – Interface Name or a UNO object that implements the
XInterface
.method_name (str) – Method Name.
script_name (str) – Script Name.
loc (str) – can be user, share, document, and extensions.
language (str | LanguageKind, optional) – Language. Defaults to LanguageKind.PYTHON.
auto_remove_existing (bool, optional) – Remove existing script. Defaults to
True
.
- Return type:
None
Changed in version 0.47.6: added auto_remove_existing parameter.
- get_form_name()[source]
Gets form name for the current control
- Parameters:
ctl_model (XControlModel) – control model
- Returns:
form name on success; Otherwise, empty string.
- Return type:
str
- get_id()[source]
Gets class id for this control.
- Returns:
Class Id if found, Otherwise
-1
- Return type:
int
- remove_script(interface_name, method_name, remove_params='')[source]
Removes a script from a form control.
- Parameters:
ctl_props (XPropertySet) – _description_
interface_name (str | XInterface) – _description_
method_name (str) – _description_
remove_params (str, optional) – _description_. Defaults to “”.
- Raises:
RemoveScriptError – if there is an error removing the script.
- Return type:
None
See also
New in version 0.47.6.
- set_design_mode(on)[source]
Sets the design mode for use in a design editor.
Normally the control will be painted directly without a peer.
- Parameters:
on (bool) –
True
to set design mode on; Otherwise,False
.- Return type:
None
New in version 0.47.6.
- Return type:
None
- Parameters:
on (bool) –
- set_property(**kwargs)[source]
Set property value
- Parameters:
**kwargs (
Any
) – Variable length Key value pairs used to set properties.- Return type:
None
New in version 0.39.1.
- Return type:
None
- Parameters:
kwargs (Any) –
- property component_type: int
Gets the form component type.
The return value is a
com.sun.star.form.FormComponentType
constant.- Returns:
Form component type
- Return type:
int
New in version 0.14.1.
- property control_shape: com.sun.star.drawing.ControlShape
Gets the owner of the control
- Return type:
ControlShape
- property name: str
Gets the name for the control model
- Return type:
str
- property position: GenericUnitPoint[UnitMM, float]
Gets the Position of the control in
UnitMM
Values.- Return type:
GenericUnitPoint
[UnitMM
,float
]
- property size: GenericUnitSize[UnitMM, float]
Gets the size of the control in
UnitMM
Values.- Return type:
GenericUnitSize
[UnitMM
,float
]
- property tab_index: int
Gets/Sets the tab index
- Return type:
int
- property tag: str
Gets/Sets the tag
- Return type:
str