ooodev.adapter.frame.frame_partial module

class ooodev.adapter.frame.frame_partial.FramePartial(component, interface=com.sun.star.frame.XFrame)[source]

Bases: ComponentPartial

Partial class for XFrame.

Parameters:
  • component (XFrame) –

  • interface (UnoInterface | None) –

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

Constructor

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

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

Return type:

None

activate()[source]

activates this frame and thus the component within.

At first the frame sets itself as the active frame of its creator by calling XFramesSupplier.setActiveFrame(), then it broadcasts a FrameActionEvent with FrameAction.FRAME_ACTIVATED.

The component within this frame may listen to this event to grab the focus on activation; for simple components this can be done by the FrameLoader.

Finally, most frames may grab the focus to one of its windows or forward the activation to a sub-frame.

Return type:

None

add_frame_action_listener(listener)[source]

Registers an event listener, which will be called when certain things happen to the components within this frame or within sub-frames of this frame.

E.g., it is possible to determine instantiation/destruction and activation/deactivation of components.

Return type:

None

Parameters:

listener (com.sun.star.frame.XFrameActionListener) –

context_changed()[source]

Notifies the frame that the context of the controller within this frame changed (i.e. the selection).

According to a call to this interface, the frame calls XFrameActionListener.frameAction() with FrameAction.CONTEXT_CHANGED to all listeners which are registered using XFrame.addFrameActionListener(). For external controllers this event can be used to re-query dispatches.

Return type:

None

deactivate()[source]

Is called by the creator frame when another sub-frame gets activated.

At first the frame deactivates its active sub-frame, if any. Then broadcasts a FrameActionEvent with FrameAction.FRAME_DEACTIVATING.

Return type:

None

find_frame(target_frame_name, search_flags)[source]

searches for a frame with the specified name.

Frames may contain other frames (e.g., a frameset) and may be contained in other frames. This hierarchy is searched with this method. First some special names are taken into account, i.e. _self, _top, _blank etc. SearchFlags is ignored when comparing these names with TargetFrameName; further steps are controlled by SearchFlags. If allowed, the name of the frame itself is compared with the desired one, and then ( again if allowed ) the method is called for all children of the frame. Finally may be called for the siblings and then for parent frame (if allowed).

List of special target names:

If no frame with the given name is found, a new top frame is created; if this is allowed by a special flag FrameSearchFlag.CREATE. The new frame also gets the desired name.

Return type:

XFrame

Parameters:
  • target_frame_name (str) –

  • search_flags (int) –

get_component_window()[source]

Provides access to the component window

Note

Don’t dispose this window - the frame is the owner of it.

Return type:

XWindow

get_container_window()[source]

Provides access to the container window of the frame.

Normally this is used as the parent window of the component window.

Return type:

XWindow

get_controller()[source]

Provides access to the controller

Note

Don’t dispose it - the frame is the owner of it. Use XController.getFrame() to dispose the frame after you the controller agreed with a XController.suspend() call.

Return type:

XController

get_creator()[source]

Provides access to the creator (parent) of this frame.

Return type:

XFramesSupplier

get_name()[source]

Get the name property of this frame.

Return type:

str

initialize(window)[source]

Is called to initialize the frame within a window - the container window.

This window will be used as parent for the component window and to support some UI relevant features of the frame service. Note: Re-parenting mustn’t supported by a real frame implementation! It’s designed for initializing - not for setting.

This frame will take over ownership of the window referred from xWindow. Thus, the previous owner is not allowed to dispose this window anymore.

Return type:

None

Parameters:

window (com.sun.star.awt.XWindow) –

is_active()[source]

determines if the frame is active.

Return type:

bool

is_top()[source]

determines if the frame is a top frame.

In general a top frame is the frame which is a direct child of a task frame or which does not have a parent. Possible frame searches must stop the search at such a frame unless the flag FrameSearchFlag.TASKS is set.

Return type:

bool

remove_frame_action_listener(listener)[source]

Un-registers an event listener

Return type:

None

Parameters:

listener (com.sun.star.frame.XFrameActionListener) –

set_component(window, controller)[source]

Sets a new component into the frame or release an existing one from a frame.

A valid component window should be a child of the frame container window.

Simple components may implement a com.sun.star.awt.XWindow only. In this case no controller must be given here.

Return type:

bool

Parameters:
  • window (com.sun.star.awt.XWindow) –

  • controller (com.sun.star.frame.XController) –

set_creator(creator)[source]

sets the frame container that created this frame.

Only the creator is allowed to call this method. But creator doesn’t mean the implementation which creates this instance … it means the parent frame of the frame hierarchy. Because; normally a frame should be created by using the API and is necessary for searches inside the tree (e.g. XFrame.findFrame())

Return type:

None

Parameters:

creator (com.sun.star.frame.XFramesSupplier) –

set_name(name)[source]

Sets the name of the frame.

Normally the name of the frame is set initially (e.g. by the creator). The name of a frame will be used for identifying it if a frame search was started. These searches can be forced by:

Note

Special targets like _blank, _self etc. are not allowed. That’s why frame names shouldn’t start with a sign _.

Return type:

None

Parameters:

name (str) –

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

Get the builder for the component.

Parameters:

component (Any) – The component.

Returns:

Builder instance.

Return type:

DefaultBuilder