Class Forms

Forms

Introduction

This class is used to create create and manage forms and form controls.

Multi-Document Support

Multi-Document support is available in OooDev. The Class DrawForm, Class CalcForm, and Class WriteForm classes all inherit from the FormsPartial class which has multi document support built in.

When creating your own form class it is recommended it inherit from the FormsPartial class.

Methods in the this Forms class are identified if they have multi-document support or not.

For methods that do no have multi-document support you will need to use the Class LoContext context manager before calling them in a multi-document environment.

from ooodev.form import Forms
from ooodev.write import WriteDoc
from ooodev.utils.context.lo_context import LoContext

# create first document
doc1  = WriteDoc.create_doc()

# create a second document
lo_inst = Lo.create_lo_instance()
doc2  = WriteDoc.create_doc(lo_inst=lo_inst)

# ...

with LoContext(lo_inst=lo_inst):
    # in this block all methods will automatically use
    # the lo_inst of the second document.
    # As soon as the LoContext block is exited, the context is
    # restored to the first document.
    # ...
    Forms.add_control(
        doc=doc2.component,
        name=name,
        label="Options",
        comp_kind=FormComponentKind.GROUP_BOX,
        x=col2_x,
        y=y,
        width=box_width,
        height=25,
        styles=[font_colored],
    )
    # ...
    props = Forms.add_list(
        doc=doc2.component,
        name="Fruits",
        entries=fruits,
        x=x,
        y=y,
        width=width,
        height=height,
    )

    # ...

Examples

A few examples can be found on Live LibreOffice Python UNO Examples.

Class Declaration

class ooodev.form.Forms[source]
classmethod add_button(doc, *, name, label, x, y, width, height=6, anchor_type=TextContentAnchorType.AT_PARAGRAPH, parent_form=None, styles=None)[source]

Adds a button control.

By Default the button has no tab stop and does not focus on click.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent, XDrawPage) – Component or Draw Page.

  • name (str) – Button name.

  • label (str | None) – Button Label.

  • x (int) – Button X position.

  • y (int) – Button Y position.

  • height (int) – Button Height.

  • width (int, optional) – Button Height. Defaults to 6.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply.

Returns:

Button Property Set.

Return type:

XPropertySet

Changed in version 0.9.2: Added styles argument.

classmethod add_control(doc, *, label, comp_kind, x, y, width, height, name='', anchor_type=TextContentAnchorType.AT_PARAGRAPH, parent_form=None, styles=None)[source]

Add a control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent, XDrawPage) – Component or Draw Page.

  • name (str) – Control Name.

  • label (str | None) – Label to assign to control.

  • comp_kind (FormComponentKind | str) – Kind of control such as CheckBox.

  • x (int, UnitT) – Control X position.

  • y (int, UnitT) – Control Y Position.

  • width (int, UnitT) – Control width.

  • height (int, UnitT) – control height.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply.

Returns:

Control Property Set

Return type:

XPropertySet

See also

For comp_kind API component Module Namespace

Changed in version 0.9.2: Added styles argument.

classmethod add_database_list(doc, *, name, sql_cmd, x, y, width, height, styles=None)[source]

Add a list with a SQL command as it data source.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent, XDrawPage) – Component or Draw Page.

  • name (str) – List Name.

  • sql_cmd (str) – SQL Command.

  • x (int) – List X position.

  • y (int) – List Y Position.

  • width (int) – List Width.

  • height (int) – List Height.

  • styles (Iterable[StyleT], optional) – One or more styles to apply.

Returns:

List property set.

Return type:

XPropertySet

Changed in version 0.9.2: Added styles argument.

classmethod add_labelled_control(doc: com.sun.star.lang.XComponent, *, label: str, comp_kind: FormComponentKind | str, y: int) com.sun.star.beans.XPropertySet[source]
classmethod add_labelled_control(doc: com.sun.star.lang.XComponent, *, label: str, comp_kind: FormComponentKind | str, y: int | UnitT, lbl_styles: Iterable[ooodev.proto.style_obj.StyleT] = ..., ctl_styles: Iterable[ooodev.proto.style_obj.StyleT] = ...) com.sun.star.beans.XPropertySet
classmethod add_labelled_control(doc: com.sun.star.lang.XComponent, *, label: str, comp_kind: FormComponentKind | str, x: int | UnitT, y: int | UnitT, height: int | UnitT) com.sun.star.beans.XPropertySet
classmethod add_labelled_control(doc, *, label, comp_kind, y, x=2, width=40, height=6, orientation=OrientationKind.HORIZONTAL, spacing=2, lbl_styles=None, ctl_styles=None)

Create a label and data field control, with the label preceding the control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent, XDrawPage) – Component or Draw Page.

  • label (str) – Label to assign to control

  • comp_kind (FormComponentKind | str) – Kind of control such as CheckBox.

  • y (int) – Control Y Position

  • x (int, optional) – Control X position. Defaults to 2.

  • height (int, optional) – control height. Defaults to 6.

  • width (int, optional) – Control width. Defaults to 40.

  • orientation (OrientationKind, optional) – Orientation. Defaults to OrientationKind.HORIZONTAL.

  • spacing (int, optional) – Spacing. Defaults to 26.

  • lbl_styles (Iterable[StyleT], optional) – One or more styles to apply on the label portion of control.

  • ctl_styles (Iterable[StyleT], optional) – One or more styles to apply on the Textbox portion of control.

Returns:

DataField Control Property Set

Return type:

XPropertySet

Changed in version 0.9.2: Added lbl_styles and ctl_styles arguments.

classmethod add_list(doc, name, entries, x, y, width, height, *, styles=None)[source]

Adds a list.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent, XDrawPage) – Component | Draw Page.

  • name (str) – List Name.

  • entries (Iterable[str]) – List Entries.

  • x (int) – List X position.

  • y (int) – List Y Position.

  • width (int) – List Width.

  • height (int) – List Height.

  • styles (Iterable[StyleT], optional) – One or more styles to apply.

Returns:

List property set.

Return type:

XPropertySet

Changed in version 0.9.2: Added styles argument.

classmethod assign_script(ctl_props, 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:
  • ctl_props (XPropertySet) – Properties of control.

  • 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.

Raises:

ScriptError – If there is an error assigning the script.

Return type:

None

Changed in version 0.47.6: added auto_remove_existing parameter.

classmethod belongs_to_form(ctl_model, form_name)[source]

Get if a control belongs to a form.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • ctl_model (XControlModel) – Control Model

  • form_name (str) – Form name

Returns:

True if belongs to form; Otherwise, False

Return type:

bool

static bind_form_to_sql(xform, src_name, cmd)[source]

Bind the form to the database in the src_name URL, and send a SQL cmd.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • xform (XForm) – Form.

  • src_name (str) – Source Name URL.

  • cmd (str) – Command.

Return type:

None

static bind_form_to_table(xform, src_name, tbl_name)[source]

Bind the form to the database in the src_name URL.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • xform (XForm) – Form.

  • src_name (str) – Source Name URL.

  • tbl_name (str) – Table Name.

Return type:

None

static create_grid_column(grid_model, data_field, col_kind, width)[source]

Adds a column to a gird.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • grid_model (XControlModel) – Grid control Model.

  • data_field (str) – the database field to which the column should be bound.

  • col_kind (str) – the column type such as “NumericField”.

  • width (int) – the column width (in mm). If 0, no width is set.

Return type:

None

static create_name(elem_container, name)[source]

Creates a name.

Make a unique string by appending a number to the supplied name

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • elem_container (XNameAccess, None) – container. If None, then a random string is appended to name.

  • name (str) – current name

Returns:

a name not in container.

Return type:

str

classmethod find_cell_with_control(draw_page, ctl)[source]

Find the cell that contains the control.

Parameters:
  • draw_page (XDrawPage) – Draw Page.

  • ctl (FormCtlBase | XControlModel) – Control to find cell for.

Returns:

Cell that contains the control or None if not found.

Return type:

XCell | None

New in version 0.38.0.

static find_shape_for_control(draw_page, ctl)[source]

Find the shape for a control.

Parameters:
  • draw_page (XDrawPage) – draw page.

  • ctl (FormCtlBase | XControlModel) – control to find shape for.

Returns:

Shape for the control or None if not found.

Return type:

XShape | None

New in version 0.38.0.

static get_control(doc, ctl_model)[source]

Gets the control from the specified control model.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • doc (XComponent) – Component.

  • ctl_model (XControlModel) – Control Model.

Raises:

Exception – If unable to get control.

Returns:

Control.

Return type:

XControl

static get_control_index(form, ctl)[source]

Gets control index within the form.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • form (XForm) – Form.

  • ctl (FormCtlBase, XControlModel) – Control object.

Returns:

Control Index within the form or -1 if not found.

Return type:

int

New in version 0.38.0.

classmethod get_control_model(doc, ctl_name)[source]

Gets Control Model by Name.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • doc (XComponent) – Component.

  • ctl_name (str) – Name of control.

Returns:

Control Model if found; Otherwise, None.

Return type:

XControlModel | None

static get_draw_page(doc)[source]

Gets draw page.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

doc (XComponent, XDrawPage) – Component or Draw Page.

Raises:

Exception – If unable to get draw page.

Returns:

Draw Page.

Return type:

XDrawPage

static get_event_control_model(event)[source]

Gets event control model.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

event (EventObject) – event object

Returns:

Event control model

Return type:

XControlModel

classmethod get_event_source_name(event)[source]

Gets event source name.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

event (EventObject) – event object

Returns:

event source name

Return type:

str

classmethod get_form(obj: com.sun.star.lang.XComponent) com.sun.star.container.XNameContainer[source]
classmethod get_form(obj: com.sun.star.lang.XComponent, form_name: str) com.sun.star.form.XForm
classmethod get_form(obj: com.sun.star.drawing.XDrawPage) com.sun.star.container.XNameContainer
classmethod get_form(obj, form_name='')

Gets form as name container.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • obj (XComponent | XDrawPage) – Component or draw page

  • form_name (str, optional) – the name of form to get.

Raises:

Exception – If unable to get form

Returns:

Name container

Return type:

XNameContainer

static get_form_by_name(form_name, named_forms)[source]

Get a form by name.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • form_name (str) – form name.

  • named_forms (XNameContainer) – name container.

Raises:

Exception – If not able to find form.

Returns:

Name Container.

Return type:

XNameContainer

static get_form_name(ctl_model)[source]

Gets form name.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel) – control model

Returns:

form name

Return type:

str

classmethod get_forms(obj: com.sun.star.lang.XComponent) com.sun.star.container.XNameContainer[source]
classmethod get_forms(obj: com.sun.star.drawing.XDrawPage) com.sun.star.container.XNameContainer
classmethod get_forms(obj)

Gets Forms.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

obj (XComponent | XDrawPage) – component or draw page.

Returns:

name container.

Return type:

XNameContainer

static get_id(ctl_model)[source]

Gets class id for a form component.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel | FormCtlBase) – Control Model.

Returns:

Class Id if found, Otherwise -1.

Return type:

int

static get_indexed_forms(draw_page)[source]

Get index forms.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

draw_page (XDrawPage) – Draw page.

Returns:

Index container.

Return type:

XIndexContainer

static get_label(ctl_model)[source]

Gets label of a given form component.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel) – Control Model

Returns:

Label of component

Return type:

str

classmethod get_models(obj: com.sun.star.lang.XComponent) List[com.sun.star.awt.XControlModel][source]
classmethod get_models(obj: com.sun.star.container.XNameAccess) List[com.sun.star.awt.XControlModel]
classmethod get_models(obj)

Gets models from obj.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

obj (XComponent | XNameAccess) – Component or Name Access

Returns:

List of found models

Return type:

List[XControlModel]

See also

get_models2()

classmethod get_models2(doc, form_name)[source]

Gets models from doc.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • doc (XComponent) – Component

  • form_name (str) – form name.

Returns:

List of found models

Return type:

List[XControlModel]

See also

get_models()

static get_name(ctl_model)[source]

Gets name of a given form component.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel) – Control Model.

Returns:

Name of component.

Return type:

str

classmethod get_named_control(doc, ctl_name)[source]

Gets a named control.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • doc (XComponent) – Component.

  • ctl_name (str) – Name of control.

Returns:

Control if found; Otherwise, None.

Return type:

XControl | None

classmethod get_shape(*, label, comp_kind, x, y, width, height, name='')[source]

Add a control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • name (str) – Control Name

  • label (str | None) – Label to assign to control

  • comp_kind (FormComponentKind | str) – Kind of control such as CheckBox.

  • x (int, UnitT) – Control X position

  • y (int, UnitT) – Control Y Position

  • width (int, UnitT) – Control width#

  • height (int, UnitT) – control height

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply.

Returns:

Control Shape

Return type:

XControlShape

See also

For comp_kind API component Module Namespace

classmethod get_type_str(ctl_model)[source]

Gets type as string.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel | FormCtlBase) – Control Model

Returns:

Type as string if found; Otherwise, None

Return type:

str | None

classmethod has_form(doc, form_name)[source]

Gets if component has form by name.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • doc (XComponent) – Component.

  • form_name (str) – Form name.

Returns:

True if has form, Otherwise False.

Return type:

bool

classmethod insert_control_button(doc, *, x, y, width, height=6, label='', anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a button control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

By Default the button has tab stop and does focus on click.

Parameters:
  • doc (XComponent) – Component

  • x (int | UnitT) – X Coordinate

  • y (int | UnitT) – Y Coordinate

  • width (int, UnitT, optional) – Button Width.

  • height (int, UnitT, optional) – Button Height. Defaults to 6 mm.

  • label (str, optional) – Button label (text).

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Button Control

Return type:

FormCtlButton

New in version 0.14.0.

classmethod insert_control_check_box(doc, *, x, y, width, height=6, label='', tri_state=True, state=TriStateKind.NOT_CHECKED, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a check box control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • label (str, optional) – Label (text) to assign to checkbox.

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Checkbox Control.

Return type:

FormCtlCheckBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • TriStateKind can be imported from ooodev.utils.kind.tri_state_kind.

New in version 0.14.0.

classmethod insert_control_combo_box(doc, *, x, y, width, height=6, entries=None, max_text_len=0, drop_down=True, read_only=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a ComboBox control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • entries (Iterable[str], optional) – Combo box entries.

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • max_text_len (int, optional) – Specifies the maximum character count, There’s no limitation, if set to 0. Defaults to 0.

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

ComboBox Control.

Return type:

FormCtlComboBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_currency_field(doc, *, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a currency field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Currency Field Control.

Return type:

FormCtlCurrencyField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_date_field(doc, *, x, y, width, height=6, min_date=datetime.datetime(1900, 1, 1, 0, 0), max_date=datetime.datetime(2200, 12, 31, 0, 0), drop_down=True, date_format=DateFormatKind.SYSTEM_SHORT, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a Date field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • date_value (datetime.datetime | None, optional) – Specifics control datetime. Defaults to None.

  • min_date (datetime.datetime, optional) – Specifics control min datetime. Defaults to datetime(1900, 1, 1, 0, 0, 0, 0).

  • max_date (datetime.datetime, optional) – Specifics control Min datetime. Defaults to datetime(2200, 12, 31, 0, 0, 0, 0).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • date_format (DateFormatKind, optional) – Date format. Defaults to DateFormatKind.SYSTEM_SHORT.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Date Field Control.

Return type:

FormCtlDateField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • DateFormatKind can be imported from ooodev.utils.kind.date_format_kind.

New in version 0.14.0.

classmethod insert_control_file(doc, *, x, y, width, height=6, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a file control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

File Control

Return type:

FormCtlFile

New in version 0.14.0.

classmethod insert_control_formatted_field(doc, *, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a currency field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Currency Field Control.

Return type:

FormCtlFormattedField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_grid(doc, *, x, y, width, height, label='', anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Grid control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • label (str, optional) – Grid label.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Grid Control

Return type:

FormCtlGrid

New in version 0.14.2.

classmethod insert_control_group_box(doc, *, x, y, width, height, label='', anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Groupbox control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • label (str, optional) – Groupbox label.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Groupbox Control

Return type:

FormCtlGroupBox

New in version 0.14.0.

classmethod insert_control_hidden(*, name='', parent_form=None, **kwargs)[source]

Inserts a Hidden control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • kwargs (Any) –

Returns:

Hidden Control.

Return type:

FormCtlHidden

Changed in version 0.43.0: Working

New in version 0.14.0.

classmethod insert_control_image_button(doc, *, x, y, width, height, image_url='', border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts an Image Button control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • image_url (PathOrStr, optional) – Image URL. When setting the value it can be a string or a Path object. If a string is passed it can be a URL or a path to a file. Value such as file:///path/to/image.png and /path/to/image.png are valid. Relative paths are supported.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Image Button Control.

Return type:

FormCtlImageButton

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_label(doc, *, x, y, width, label, height=6, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Label control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • label (str) – Contents of label.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Label Control.

Return type:

FormCtlFixedText

New in version 0.14.0.

classmethod insert_control_list_box(doc, *, x, y, width, height, entries=None, drop_down=True, read_only=False, line_count=5, multi_select=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a ListBox control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • entries (Iterable[str], optional) – Combo box entries

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • line_count (int, optional) – Specifies the number of lines to display. Defaults to 5.

  • multi_select (int, optional) – Specifies if multiple entries can be selected. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

ListBox Control.

Return type:

FormCtlListBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_navigation_toolbar(doc, *, x, y, width, height, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Navigation Toolbar control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Navigation Toolbar Control

Return type:

FormCtlNavigationToolBar

New in version 0.14.0.

classmethod insert_control_numeric_field(doc, *, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a Numeric field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Numeric Field Control.

Return type:

FormCtlNumericField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_pattern_field(doc, *, x, y, width, height=6, edit_mask='', literal_mask='', border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a Pattern field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • edit_mask (str, optional) – Specifies a character code that determines what the user may enter. Defaults to "".

  • literal_mask (str, optional) – Specifies the initial values that are displayed in the pattern field. Defaults to "".

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Pattern Field Control.

Return type:

FormCtlPatternField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_radio_button(doc, *, x, y, width, height=6, label='', state=StateKind.NOT_CHECKED, multiline=False, border=BorderKind.NONE, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a radio button control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • label (str, optional) – Label (text) of control.

  • anchor_type (TextContentAnchorType, optional) – _description_. Defaults to None.

  • state (StateKind, optional) – Specifies the state of the control.Defaults to StateKind.NOT_CHECKED.

  • multiline (bool, optional) – Specifies if the control can display multiple lines of text. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • anchor_type – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Radio Button Control.

Return type:

FormCtlRadioButton

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • StateKind can be imported from ooodev.utils.kind.state_kind.

New in version 0.14.0.

classmethod insert_control_rich_text(doc, *, x, y, width, height, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Rich Text control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Rich Text Control.

Return type:

FormCtlRichText

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_scroll_bar(doc, *, x, y, width, height=6, min_value=0, max_value=100, orientation=OrientationKind.HORIZONTAL, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Scrollbar control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to 0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 100.

  • orientation (OrientationKind, optional) – Orientation. Defaults to OrientationKind.HORIZONTAL.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Scrollbar Control.

Return type:

FormCtlScrollBar

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • OrientationKind can be imported from ooodev.utils.kind.orientation_kind.

New in version 0.14.0.

classmethod insert_control_spin_button(doc, *, x, y, width, height=6, value=0, min_value=-1000000, max_value=1000000, increment=1, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Spin Button control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • value (int, optional) – Specifies the initial value of the control. Defaults to 0.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Spin Button Control.

Return type:

FormCtlSpinButton

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_submit_button(doc, *, x, y, width, height=6, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a submit button control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Submit Button Control.

Return type:

FormCtlSubmitButton

New in version 0.14.0.

classmethod insert_control_text_field(doc, *, x, y, width, height, text='', echo_char='', border=BorderKind.NONE, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a Text field control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height.

  • text (str, optional) – Text value.

  • echo_char (str, optional) – Character used for masking. Must be a single character.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Text Field Control.

Return type:

FormCtlTextField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

New in version 0.14.0.

classmethod insert_control_time_field(doc, *, x, y, width, height=6, time_value=None, min_time=datetime.time(0, 0), max_time=datetime.time(23, 59, 59, 999999), time_format=TimeFormatKind.SHORT_24H, spin_button=True, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a Time field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • time_value (datetime.time | None, optional) – Specifics the control time. Defaults to None.

  • min_time (datetime.time, optional) – Specifics control min time. Defaults to time(0, 0, 0, 0).

  • max_time (datetime.time, optional) – Specifics control min time. Defaults to a time(23, 59, 59, 999_999).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • time_format (TimeFormatKind, optional) – Date format. Defaults to TimeFormatKind.SHORT_24H.

  • pin_button (bool, optional) – When True, a spin button is present. Defaults to True.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • spin_button (bool) –

  • kwargs (Any) –

Returns:

Time Field Control.

Return type:

FormCtlTimeField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • TimeFormatKind can be imported from ooodev.utils.kind.time_format_kind.

New in version 0.14.0.

classmethod insert_db_control_check_box(doc, *, x, y, width, height=6, tri_state=True, state=TriStateKind.CHECKED, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a database check box control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – _description_. Defaults to None.

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database Checkbox Control.

Return type:

FormCtlDbCheckBox

New in version 0.14.0.

classmethod insert_db_control_combo_box(doc, *, x, y, width, height=6, entries=None, max_text_len=0, drop_down=True, read_only=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Database ComboBox control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • entries (Iterable[str], optional) – Combo box entries.

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • max_text_len (int, optional) – Specifies the maximum character count, There’s no limitation, if set to 0. Defaults to 0.

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database ComboBox Control.

Return type:

FormCtlDbComboBox

New in version 0.14.0.

classmethod insert_db_control_currency_field(doc, *, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a database currency field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database Currency Field Control.

Return type:

FormCtlDbCurrencyField

New in version 0.14.0.

classmethod insert_db_control_date_field(doc, *, x, y, width, height=6, min_date=datetime.datetime(1900, 1, 1, 0, 0), max_date=datetime.datetime(2200, 12, 31, 0, 0), drop_down=True, date_format=DateFormatKind.SYSTEM_SHORT, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None, **kwargs)[source]

Inserts a Database Date field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • date_value (datetime.datetime | None, optional) – Specifics control datetime. Defaults to None.

  • min_date (datetime.datetime, optional) – Specifics control min datetime. Defaults to datetime(1900, 1, 1, 0, 0, 0, 0).

  • max_date (datetime.datetime, optional) – Specifics control Min datetime. Defaults to datetime(2200, 12, 31, 0, 0, 0, 0).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • date_format (DateFormatKind, optional) – Date format. Defaults to DateFormatKind.SYSTEM_SHORT.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • kwargs (Any) –

Returns:

Database Date Field Control.

Return type:

FormCtlDbDateField

New in version 0.14.0.

classmethod insert_db_control_formatted_field(doc, *, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Database currency field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database Currency Field Control.

Return type:

FormCtlDbFormattedField

New in version 0.14.0.

classmethod insert_db_control_list_box(doc, *, x, y, width, height, entries=None, drop_down=True, read_only=False, line_count=5, multi_select=False, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Database ListBox control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT) – Height.

  • entries (Iterable[str], optional) – Combo box entries

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • line_count (int, optional) – Specifies the number of lines to display. Defaults to 5.

  • multi_select (int, optional) – Specifies if multiple entries can be selected. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database ListBox Control.

Return type:

FormCtlDbListBox

New in version 0.14.0.

classmethod insert_db_control_numeric_field(doc, *, x, y, width, height=6, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Database Numeric field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database Numeric Field Control.

Return type:

FormCtlDbNumericField

New in version 0.14.0.

classmethod insert_db_control_pattern_field(doc, *, x, y, width, height=6, edit_mask='', literal_mask='', border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Database Pattern field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • edit_mask (str, optional) – Specifies a character code that determines what the user may enter. Defaults to "".

  • literal_mask (str, optional) – Specifies the initial values that are displayed in the pattern field. Defaults to "".

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database Pattern Field Control.

Return type:

FormCtlDbPatternField

New in version 0.14.0.

classmethod insert_db_control_radio_button(doc, *, x, y, width, height=6, state=StateKind.NOT_CHECKED, multiline=False, border=BorderKind.NONE, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Database radio button control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • anchor_type (TextContentAnchorType, optional) – _description_. Defaults to None.

  • tri_state (StateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to StateKind.NOT_CHECKED.

  • multiline (bool, optional) – Specifies if the control can display multiple lines of text. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • anchor_type – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database Radio Button Control.

Return type:

FormCtlDbRadioButton

New in version 0.14.0.

classmethod insert_db_control_text_field(doc, *, x, y, width, height, text='', echo_char='', border=BorderKind.NONE, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Database Text field control.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int, UnitT, optional) – Width.

  • height (int, UnitT, optional) – Height.

  • text (str, optional) – Text value.

  • echo_char (str, optional) – Character used for masking. Must be a single character.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

Returns:

Database Text Field Control.

Return type:

FormCtlDbTextField

New in version 0.14.0.

classmethod insert_db_control_time_field(doc, *, x, y, width, height=6, time_value=None, min_time=datetime.time(0, 0), max_time=datetime.time(23, 59, 59, 999999), time_format=TimeFormatKind.SHORT_24H, spin_button=True, border=BorderKind.BORDER_3D, anchor_type=TextContentAnchorType.AT_PARAGRAPH, name='', parent_form=None, styles=None, draw_page=None)[source]

Inserts a Database Time field control into the form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • doc (XComponent) – Component.

  • x (int | UnitT) – X Coordinate.

  • y (int | UnitT) – Y Coordinate.

  • width (int | UnitT) – Width.

  • height (int, UnitT, optional) – Height. Defaults to 6 mm.

  • time_value (datetime.time | None, optional) – Specifics the control time. Defaults to None.

  • min_time (datetime.time, optional) – Specifics control min time. Defaults to time(0, 0, 0, 0).

  • max_time (datetime.time, optional) – Specifics control min time. Defaults to a time(23, 59, 59, 999_999).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • time_format (TimeFormatKind, optional) – Date format. Defaults to TimeFormatKind.SHORT_24H.

  • pin_button (bool, optional) – When True, a spin button is present. Defaults to True.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • anchor_type (TextContentAnchorType, optional) – Control Anchor Type. Defaults to TextContentAnchorType.AT_PARAGRAPH.

  • name (str, optional) – Name of control. Must be a unique name. If empty, a unique name is generated.

  • parent_form (XNameContainer, optional) – Parent form in which to add control.

  • styles (Iterable[StyleT], optional) – One or more styles to apply to the control shape.

  • draw_page (XDrawPage, optional) – Draw Page in which to add control. If None, then the Draw Page is obtained from the document.

  • spin_button (bool) –

Returns:

Database Time Field Control.

Return type:

FormCtlTimeField

New in version 0.14.0.

classmethod insert_form(doc: com.sun.star.lang.XComponent)[source]
classmethod insert_form(form_name: str, named_forms: com.sun.star.container.XNameContainer)
classmethod insert_form(*args, **kwargs)

Insert form.

Method NOT is Lo Instance Safe. Use Class LoContext when using with multiple document instances.

Parameters:
  • form_name (str) – Form name

  • doc (XComponent) – Component

  • named_forms (XNameContainer) – Name Container

Returns:

Name Container

Return type:

XNameContainer

classmethod is_box(ctl_model)[source]

Gets if component is a box.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel | FormCtlBase) – Control Model.

Returns:

True if is box; Otherwise, False.

Return type:

bool

classmethod is_button(ctl_model)[source]

Gets if component is a command button or a image button.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel | FormCtlBase) – Control Model.

Returns:

True if is button; Otherwise, False.

Return type:

bool

classmethod is_list(ctl_model)[source]

Gets if component is a list.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel | FormCtlBase) – Control Model.

Returns:

True if is list; Otherwise, False.

Return type:

bool

classmethod is_text_field(ctl_model)[source]

Gets if component is a text field.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

ctl_model (XControlModel | FormCtlBase) – Control Model.

Returns:

True if is text field; Otherwise, False.

Return type:

bool

classmethod list_forms(obj, tab_str='  ')[source]

Prints forms information to console.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • obj (XComponent | XNameAccess) – Component or Name Access.

  • tab_str (str, optional) – tab string.

Return type:

None

classmethod remove_script(ctl_props, 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.

classmethod show_form_names(doc)[source]

Prints form names to console.

Method is Lo Instance Safe for use with multiple documents.

Parameters:

doc (XComponent) – Component.

Return type:

None