Class DrawDocView
- class ooodev.draw.DrawDocView(owner, component)[source]
Bases:
DrawDocPropPartial
,LoInstPropsPartial
,OfficeDocumentPropPartial
,DrawingDocumentDrawViewComp
,QiPartial
,ServicePartial
,TheDictionaryPartial
Draw Doc Controller View class. This class is used to manage the view of a Draw document. It is usually accessed via
DrawDoc.current_controller.
- Parameters:
owner (DrawDoc) –
component (XComponent) –
- __init__(owner, component)[source]
Constructor
- Parameters:
owner (DrawDoc) – Draw document.
component (XComponent) – UNO Component that supports
com.sun.star.drawing.DrawingDocumentDrawView
service.
- Return type:
None
- add_event_enhanced_mouse_click_events_disposing(cb)
Adds a listener for an event.
Event is invoked when the broadcaster is about to be disposed.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.lang.EventObject
struct.- Return type:
None
- Parameters:
cb (Any) –
- add_event_key_handler_disposing(cb)
Adds a listener for an event.
Event is invoked when the broadcaster is about to be disposed.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.lang.EventObject
struct.- Return type:
None
- Parameters:
cb (Any) –
- add_event_key_handler_pressed(cb)
Adds a listener for an event.
Event is invoked when a key has been pressed.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.awt.KeyEvent
struct.- Return type:
None
- Parameters:
cb (Any) –
- add_event_key_handler_released(cb)
Adds a listener for an event.
Event is invoked when a key has been released.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.awt.KeyEvent
struct.- Return type:
None
- Parameters:
cb (Any) –
- add_event_listener(listener)
Adds an event listener to the component.
- Parameters:
listener (XEventListener) – The event listener to be added.
- Return type:
None
- add_event_mouse_pressed(cb)
Adds a listener for an event.
Event is invoked when a mouse button has been pressed on a window.
The callback
CancelEventArgs.event_data
will contain a UNOcom.sun.star.awt.MouseEvent
struct.Note
The callback event will be
CancelEventArgs
. If theCancelEventArgs.cancel
is set toTrue
then the action will be canceled if theCancelEventArgs.handled
is set toTrue
then the action will be performed.- Return type:
None
- Parameters:
cb (Any) –
- add_event_mouse_released(cb)
Adds a listener for an event.
Event is invoked when a mouse button has been released on a window.
The callback
CancelEventArgs.event_data
will contain a UNOcom.sun.star.awt.MouseEvent
struct.Note
The callback event will be
CancelEventArgs
. If theCancelEventArgs.cancel
is set toTrue
then the action will be canceled if theCancelEventArgs.handled
is set toTrue
then the action will be performed.- Return type:
None
- Parameters:
cb (Any) –
- add_event_property_change(name, cb)
Adds a listener for an event.
Event is invoked when property is changed.
The callback
EventArgs.event_data
will contain acom.sun.star.beans.PropertyChangeEvent
struct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- add_event_property_change_events_disposing(name, cb)
Adds a listener for an event.
Event is invoked when the property listener is about to be disposed.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.lang.EventObject
struct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- add_event_selection_change_events_disposing(cb)
Adds a listener for an event.
Event is invoked when the broadcaster is about to be disposed.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.lang.EventObject
struct.- Return type:
None
- Parameters:
cb (Any) –
- add_event_selection_changed(cb)
Adds a listener for an event.
Event is invoked when the selection changes.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.lang.EventObject
struct.- Return type:
None
- Parameters:
cb (Any) –
- add_event_vetoable_change(name, cb)
Adds a listener for an event.
Event is invoked when property is changed.
The callback
EventArgs.event_data
will contain acom.sun.star.beans.PropertyChangeEvent
struct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- add_event_vetoable_change_events_disposing(name, cb)
Adds a listener for an event.
Event is invoked when the property listener is about to be disposed.
The callback
EventArgs.event_data
will contain a UNOcom.sun.star.lang.EventObject
struct.- Parameters:
name (str) – Property Name
cb (EventArgsCallbackT) – Callback
- Return type:
None
- add_property_change_listener(name, listener)
Adds a listener for property changes.
- Parameters:
name (str) – The name of the property.
listener (Any) – The listener to be added.
- Return type:
None
- add_vetoable_change_listener(name, listener)
Adds a listener for vetoable changes.
- Parameters:
name (str) – The name of the property.
listener (Any) – The listener to be added.
- Return type:
None
- attach_frame(frame)
Attaches the controller with its managing frame.
- Parameters:
frame (XFrame) – The frame to be attached.
- Return type:
None
- attach_model(model)
Attaches the controller to a new model.
- Parameters:
model (XModel) – The model to be attached.
- Return type:
None
- dispose()
Disposes the component.
- Return type:
None
- get_current_page()
Gets the current page.
- Return type:
XDrawPage
- get_frame()
Gets access to owner frame of this controller.
- Returns:
The owner frame of this controller.
- Return type:
XFrame
- get_model()
Gets access to currently attached model.
- Returns:
The currently attached model.
- Return type:
XModel
- get_property_set_info()
Returns the property set info.
- Returns:
The property set info.
- Return type:
XPropertySetInfo
- get_property_value(name)
Returns the value of a property.
- Parameters:
name (str) – The name of the property.
- Returns:
The value of the property.
- Return type:
Any
- get_services()
Gets service names for the instance.
- Returns:
service names
- Return type:
List[str]
- get_view_data()
Gets the view data.
- Returns:
The view data.
- Return type:
Any
- qi(atype, raise_err=False)
Generic method that get an interface instance from an object.
- Parameters:
atype (T) – Interface type to query obj for. Any Uno class that starts with ‘X’ such as XInterface
raise_err (bool, optional) – If True then raises MissingInterfaceError if result is None. Default False
- Raises:
MissingInterfaceError – If ‘raise_err’ is ‘True’ and result is None
- Returns:
instance of interface if supported; Otherwise, None
- Return type:
T | None
Note
When
raise_err=True
return value will never beNone
.
- query_dispatch(url, target_frame_name, search_flags=FrameSearchFlagEnum.AUTO)
Returns a dispatch object for the specified URL.
- Parameters:
url (URL) – Specifies the feature which should be supported by returned dispatch object.
target_frame_name (str) – Specifies the frame which should be the target for this request.
search_flags (int, FrameSearchFlagEnum, optional) – Optional search parameter for finding the frame if no special TargetFrameName was used.
- Returns:
the dispatch object which provides queried functionality or None if no dispatch object is available.
- Return type:
XDispatch
- query_dispatches(requests)
Returns a list of dispatch objects for the specified URLs.
Actually this method is redundant to
query_dispatch()
to avoid multiple remote calls.- Parameters:
requests (Tuple[DispatchDescriptor, ...]) – Tuple of dispatch requests
- Returns:
multiple dispatch interfaces for the specified descriptors at once
- Return type:
Tuple[XDispatch | None, …]
- remove_event_enhanced_mouse_click_events_disposing(cb)
Removes a listener for an event
- Return type:
None
- Parameters:
cb (Any) –
- remove_event_key_handler_events_disposing(cb)
Removes a listener for an event
- Return type:
None
- Parameters:
cb (Any) –
- remove_event_key_handler_pressed(cb)
Removes a listener for an event
- Return type:
None
- Parameters:
cb (Any) –
- remove_event_key_handler_released(cb)
Removes a listener for an event
- Return type:
None
- Parameters:
cb (Any) –
- remove_event_listener(listener)
Removes an event listener from the component.
- Parameters:
listener (XEventListener) – The event listener to be removed.
- Return type:
None
- remove_event_mouse_pressed(cb)
Removes a listener for an event
- Return type:
None
- Parameters:
cb (Any) –
- remove_event_mouse_released(cb)
Removes a listener for an event
- Return type:
None
- Parameters:
cb (Any) –
- remove_event_property_change(name)
Removes a listener for an event
- Parameters:
name (str) – Property Name
- Return type:
None
- remove_event_property_change_events_disposing(name)
Removes a listener for an event
- Parameters:
name (str) – Property Name
- Return type:
None
- remove_event_selection_change_events_disposing(cb)
Removes a listener for an event
- Return type:
None
- Parameters:
cb (Any) –
- remove_event_selection_changed(cb)
Removes a listener for an event
- Return type:
None
- Parameters:
cb (Any) –
- remove_event_vetoable_change(name)
Removes a listener for an event
- Parameters:
name (str) – Property Name
- Return type:
None
- remove_event_vetoable_change_events_disposing(name)
Removes a listener for an event
- Parameters:
name (str) – Property Name
- Return type:
None
- remove_property_change_listener(name, listener)
Removes a listener for property changes.
- Parameters:
name (str) – The name of the property.
listener (Any) – The listener to be removed.
- Return type:
None
- remove_vetoable_change_listener(name, listener)
Removes a listener for vetoable changes.
- Parameters:
name (str) – The name of the property.
listener (Any) – The listener to be removed.
- Return type:
None
- restore_view_data(data)
Restores the view data.
- Parameters:
data (Any) – The view data to be restored.
- Return type:
None
- set_current_page(page)
Sets the current page.
- Return type:
None
- Parameters:
page (XDrawPage) –
- set_property_value(name, value)
Sets the value of a property.
- Parameters:
name (str) – The name of the property.
value (Any) – The value of the property.
- Return type:
None
- support_service(*service)
Gets if instance supports a service.
- Parameters:
*service (str) – Variable length argument list of UNO namespace strings such as
com.sun.star.configuration.GroupAccess
- Returns:
True
if instance supports any passed in service; Otherwise,False
- Return type:
bool
- suspend(suspend)
Is called to prepare the controller for closing the view.
- Parameters:
suspend (bool) –
True
Force the controller to suspend his work,False
Try to reactivate the controller.- Returns:
True
If request was accepted and successfully finished; Otherwise,False
.- Return type:
bool
- property component: com.sun.star.drawing.DrawingDocumentDrawView
DrawingDocumentDrawView Component
- Return type:
DrawingDocumentDrawView
- property events_listener_key_handler: KeyHandler
Returns listener
- Return type:
- property events_listener_mouse_click: MouseClickHandler
Returns listener
- Return type:
- property events_listener_selection_change: SelectionChangeListener
Returns listener
- Return type:
- property extra_data: TheDict
Extra Data Key Value Pair Dictionary.
Properties can be assigned properties and access like a dictionary and with dot notation.
Note
This is a dictionary object that can be used to store key value pairs. Generally speaking this data is not part of the object’s main data structure and is not saved with the object (document).
This property is used to store data that is not part of the object’s main data structure and can be used however the developer sees fit.
- Return type:
- property is_layer_mode: bool
If the view is in layer mode, the user can modify the layer of the model of this view in the user interface.
- Return type:
bool
- property is_master_page_mode: bool
If the view is in master page mode, the view shows the master pages of this model.
- Return type:
bool
- property office_doc: OfficeDocumentT
Office Document.
- Return type:
- property view_offset: GenericUnitPoint[UnitMM100, int]
Gets/Sets the offset from the top left position of the displayed page to the top left position of the view area.
When setting value can be a
Point
or aGenericUnitPoint
.- Returns:
The offset from the top left position of the displayed page to the top left position of the view area.
- Return type:
GenericUnitPoint[UnitMM100, int]
- Hint
Point
can be imported fromooo.dyn.awt.point
- property visible_area: GenericUnitSizePos[UnitMM100, int]
Gets the area that is currently visible.
- Return type:
GenericUnitSizePos
[UnitMM100
,int
]
- property zoom_type: ZoomKind
Gets/Sets the zoom type for the document.
- Returns:
The zoom type.
- Return type:
ZoomKind
Note
After setting to value
ZoomKind.BY_VALUE
, thezoom_value
property should be set to the desired value.Hint
ZoomKind
can be imported fromooodev.utils.kind.zoom_kind
- property zoom_value: int
Gets/Sets the zoom value to use.
When this value is set
zoom_type
is automatically set toZoomKind.BY_VALUE
.- Return type:
int