ooodev.adapter.frame.component_loader_partial module

class ooodev.adapter.frame.component_loader_partial.ComponentLoaderPartial(component, interface=com.sun.star.frame.XComponentLoader)[source]

Bases: object

Partial class for XComponentLoader.

Parameters:
  • component (XComponentLoader) –

  • interface (UnoInterface | None) –

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

Constructor

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

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

Return type:

None

load_component_from_url(url, target_frame_name, search_flags, args)[source]

Loads a component specified by a URL into the specified new or existing frame.

To create new documents, use private:factory/scalc, private:factory/swriter, etc. Other special protocols (e.g. slot:, .uno) are not allowed and raise a com.sun.star.lang.IllegalArgumentException.

If a frame with the specified name already exists, it is used, otherwise it is created. There exist some special targets which never can be used as real frame names:

Flags are optional ones and will be used for non special target names only.

For example, ReadOnly with a boolean value specifies whether the document is opened read-only. FilterName specifies the component type to create and the filter to use, for example: Text - CSV. For more information see com.sun.star.document.MediaDescriptor.

This interface is a generic one and can be used to start further requests on loaded document or control the lifetime of it (means dispose() it after using). The real document service behind this interface can be one of follow three ones:

Parameters:
  • url (str) – Specifies the URL of the document to load.

  • target_frame_name (str) – Specifies the name of the frame to view the document in.

  • search_flags (int) – Use the values of FrameSearchFlag to specify how to find the specified TargetFrameName

  • args (Tuple[PropertyValue, ...]) – The arguments.

Raises:
  • com.sun.star.io.IOExceptionIOException

  • com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException

Returns:

The loaded component.

Return type:

XComponent

Note

target_frame_name specifies the name of the frame to view the document in.

  • _blank: Always creates a new frame.

  • _default: Special UI functionality/

  • _self: Always uses the same frame.

  • _parent: Address direct parent of frame

  • _top: Indicates top frame of current path in tree.

  • _beamer: Means special sub frame.