ooodev.adapter.frame.layout_manager_partial module

class ooodev.adapter.frame.layout_manager_partial.LayoutManagerPartial(component, interface=com.sun.star.frame.XLayoutManager)[source]

Bases: object

Partial class for XLayoutManager.

Parameters:
  • component (XLayoutManager) –

  • interface (UnoInterface | None) –

__init__(component, interface=com.sun.star.frame.XLayoutManager)[source]

Constructor

Parameters:
  • component (XLayoutManager) – UNO Component that implements com.sun.star.frame.XLayoutManager interface.

  • interface (UnoInterface, optional) – The interface to be validated. Defaults to XLayoutManager.

Return type:

None

attach_frame(Frame)[source]

attaches a com.sun.star.frame.XFrame to a layout manager.

A layout manager needs a com.sun.star.frame.XFrame to be able to work. Without a it no user interface elements can be created.

Return type:

None

Parameters:

Frame (XFrame) –

create_element(resource_url)[source]

Creates a new user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be created. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

None

destroy_element(resource_url)[source]

Destroys a user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be created. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

None

do_layout()[source]

Forces a complete new layouting of all user interface elements.

Return type:

None

dock_all_windows(element_type)[source]

Docks all windows which are member of the provided user interface element type.

Parameters:

element_type (int | UIElementTypeEnum) – Specifies the user interface element type.

Returns:

Returns True if all user interface elements of the requested type could be docked, otherwise False will be returned.

Return type:

bool

Hint

  • UIElementTypeEnum is an enum and can be imported from ooo.dyn.ui.ui_element_type.

dock_window(resource_url, docking_area, pos)[source]

Docks a window based user interface element to a specified docking area.

Parameters:
  • resource_url (str) – Specifies which user interface element should be docked. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

  • docking_area (DockingArea) – Specifies the docking area where the user interface element should be docked.

  • pos (Point) – Specifies the position inside the docking area. If pos is a GenericUnitPoint object, it will be converted pixels first an then to a Point object.

Returns:

Returns True if the user interface element has been docked, otherwise False will be returned.

Return type:

bool

Hint

  • DockingArea is an enum and can be imported from ooo.dyn.ui.docking_area.

  • Point is a struct and can be imported from ooo.dyn.awt.point.

float_window(resource_url)[source]

Forces a window based user interface element to float.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Returns:

Returns True if the user interface element has been docked, otherwise False will be returned.

Return type:

bool

get_current_docking_area()[source]

Provides the current docking area size of the layout manager.

Returns:

The current docking area size represented as pixels

Return type:

GenericUnitRect[UnitPX, float]

get_docking_area_acceptor()[source]

retrieves the current docking area acceptor that controls the border space of the frame’s container window.

A docking area acceptor retrieved by this method is owned by the layout manager. It is not allowed to dispose this object, it will be destroyed on reference count!

Return type:

XDockingAreaAcceptor

get_element(resource_url)[source]

retrieves a user interface element which has been created before.

The layout manager instance is owner of the returned user interface element. That means that the life time of the user interface element is controlled by the layout manager. It can be disposed at every time!

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

XUIElement

get_element_pos(resource_url)[source]

Retrieves the current pixel position of a window based user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Returns:

The current position of the user interface element represented as pixels.

Return type:

GenericUnitPoint[UnitPX, float]

get_element_size(resource_url)[source]

Retrieves the current size of a window based user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

GenericUnitSize[UnitPX, float]

get_elements()[source]

Retrieves all user interface elements which are currently instantiated.

The layout manager instance is owner of the returned user interface elements. That means that the life time of the user interface elements is controlled by the layout manager. They can be disposed at every time!

Return type:

Tuple[XUIElement, ...]

hide_element(resource_url)[source]

Hides a user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

bool

is_element_docked(resource_url)[source]

Retrieves the current docking state of a window based user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

bool

is_element_floating(resource_url)[source]

Retrieves the current floating state of a window based user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

bool

is_element_locked(resource_url)[source]

Retrieves the current lock state of a window based user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

bool

is_element_visible(resource_url)[source]

Retrieves the current visibility state of a window based user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

bool

is_visible()[source]

Retrieves the visibility state of a layout manager.

A layout manager can be set to invisible state to force it to hide all of its user interface elements. If another component wants to use the window for its own user interface elements it can use this function. This function is normally used to implement inplace editing.

Return type:

bool

lock()[source]

Prohibit all layout updates until unlock is called again.

This call can be used to speed up the creation process of several user interface elements. Otherwise the layout manager would calculate the layout for every creation.

Return type:

None

lock_window(resource_url)[source]

Locks a window based user interface element if it’s in a docked state.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

bool

request_element(resource_url)[source]

Request to make a user interface element visible if it is not in hidden state.

If a user interface element should forced to the visible state XLayoutManager.showElement() should be used. This function can be used for context dependent elements which should respect the current visibility state.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Return type:

bool

reset()[source]

Resets the layout manager and remove all of its internal user interface elements.

This call should be handled with care as all user interface elements will be destroyed and the layout manager is reset to a state after a attach_frame() has been made. That means an attached frame which has been set by attach_frame() is not released. The layout manager itself calls reset after a component has been attached or reattached to a frame.

Return type:

None

set_docking_area_acceptor(docking_area_acceptor)[source]

sets a docking area acceptor that controls the border space of the frame’s container window.

A docking area acceptor decides if the layout manager can use requested border space for docking windows. If the acceptor denies the requested space the layout manager automatically set all docked windows into floating state and will not use this space for docking.After setting a docking area acceptor the object is owned by the layout manager. It is not allowed to dispose this object, it will be destroyed on reference count!

Return type:

None

Parameters:

docking_area_acceptor (com.sun.star.ui.XDockingAreaAcceptor) –

set_element_pos(resource_url, pos)[source]

Sets a new position for a window based user interface element.

It is up to the layout manager to decide if the user interface element can be moved. The new position can be retrieved by calling get_element_pos().

Parameters:
  • resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

  • pos (Point | GenericUnitPoint) – Specifies the new position of the user interface element. If pos is a GenericUnitPoint object, it will be converted pixels first an then to a Point object.

Return type:

None

set_element_pos_size(resource_url, pos, size)[source]

sets a new position and size for a window based user interface element.

It is up to the layout manager to decide if the user interface element can be moved and resized. The new position and size can be retrieved by calling get_element_pos() and get_element_size().

Parameters:
  • resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

  • pos (Point | GenericUnitPoint) – Specifies the new position of the user interface element. If pos is a GenericUnitPoint object, it will be converted pixels first an then to a Point object.

  • size (Size | GenericUnitSize) – Specifies the new size of the user interface element. If pos is a GenericUnitSize object, it will be converted pixels first an then to a Point object.

Return type:

None

set_element_size(resource_url, size)[source]

Sets a new size for a window based user interface element.

It is up to the layout manager to decide if the user interface element can be resized. The new size can be retrieved by calling get_element_size().

Parameters:
  • resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

  • size (Size | GenericUnitSize) – Specifies the new size of the user interface element. If pos is a GenericUnitSize object, it will be converted pixels first an then to a Point object.

Return type:

None

set_visible(visible)[source]

Sets the layout manager to invisible state and hides all user interface elements.

A layout manager can be set to invisible state to force it to hide all of its user interface elements. If another component wants to use the window for its own user interface elements it can use this function. This function is normally used to implement inplace editing.

Return type:

None

Parameters:

visible (bool) –

show_element(resource_url)[source]

Shows a user interface element.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Returns:

Returns True if the user interface element has been shown, otherwise False will be returned.

Return type:

bool

unlock()[source]

Permit layout updates again.

This function should be called to permit layout updates. The layout manager starts to calculate the new layout after this call.

Return type:

None

unlock_window(resource_url)[source]

Unlocks a window based user interface element if it’s in a docked state.

Parameters:

resource_url (str) – Specifies which user interface element should be floated. A resource URL must meet the following syntax: private:resource/$type/$name. It is only allowed to use ASCII characters for type and name.

Returns:

Returns True if the user interface element has been unlocked, otherwise False will be returned.

Return type:

bool

ooodev.adapter.frame.layout_manager_partial.get_builder(component)[source]

Get the builder for the component.

Parameters:

component (Any) – The component.

Returns:

Builder instance.

Return type:

DefaultBuilder