LOKDocView.View¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.DrawingArea (1), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gio.Initable (2)
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gio.Initable (1)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
Whether the view can be zoomed in further |
||
r |
Whether the view can be zoomed out further |
||
r/w |
Height of the document in twips |
||
r/w |
Whether client supports providing document passwords |
||
r/w |
Whether the client supports providing passwords to edit documents |
||
r/w |
Width of the document in twips |
||
r/w |
The URI of the document to open |
||
r/w |
A LibreOfficeKitDocument* from documentLoad() |
||
r/w |
Whether the content is in edit mode or not |
||
r |
Whether the view has completely initialized |
||
r |
Whether the view is loading a document |
||
r |
Shows the progress of the document load operation |
||
r/w/co |
LibreOffice Install Path |
||
r/w/co |
A LibreOfficeKit* from lok_init() |
||
r/w |
Whether the client wants in tile comment rendering |
||
r/w/co |
Whether we use a custom unified polling loop |
||
r/w/co |
LibreOffice user profile path |
||
r/w |
The current zoom level of the content |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The column/row header is no more valid because of a column/row insertion or a similar event. |
|
Password must be provided by calling |
|
The payload format is: { “margin1”: “…”, “margin2”: “…”, “leftOffset”: “…”, “pageOffset”: “…”, “pageWidth”: “…”, “unit”: “…” } |
|
This signal emits information about external windows like dialogs, autopopups for now. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
aDrawingArea |
r |
Class Details¶
- class LOKDocView.View(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(pPath, cancellable)¶
- Parameters:
pPath (
str
orNone
) – LibreOffice install path. Pass null to set it to default path which in most cases would be $libdir/libreoffice/programcancellable (
Gio.Cancellable
orNone
) – The cancellable object that you can use to cancel this operation.
- Raises:
- Returns:
The
LOKDocView.View
widget instance.- Return type:
- classmethod new_from_user_profile(pPath, pUserProfile, cancellable)¶
- Parameters:
pPath (
str
orNone
) – LibreOffice install path. Pass null to set it to default path which in most cases would be $libdir/libreoffice/programpUserProfile (
str
orNone
) – User profile URL. Must be either a file URL or a special vnd.sun.star.pathname URL. Pass non-null to be able to use this widget and LibreOffice itself in parallel.cancellable (
Gio.Cancellable
orNone
) – The cancellable object that you can use to cancel this operation.
- Raises:
- Returns:
The
LOKDocView.View
widget instance.- Return type:
- copy_selection(pMimeType)¶
- Parameters:
pMimeType (
str
) – suggests the return format, for example text/plain;charset=utf-8- Returns:
Selected text. The caller must free the returned buffer after use. Returns null if no document is set.
- pUsedMimeType:
output parameter to inform about the determined format (suggested or plain text).
- Return type:
- find_next(pText, bHighlightAll)¶
- Parameters:
Highlights the next matching text in the view.
search-not-found
signal will be emitted when no search is found
- find_prev(pText, bHighlightAll)¶
- Parameters:
Highlights the previous matching text in the view.
search-not-found
signal will be emitted when no search is found
- get_command_values(pCommand)¶
- Parameters:
pCommand (
str
) – the command to issue to LO core- Returns:
A json mapping of the possible values for the given command
- Return type:
Get a json mapping of the possible values for the given command. In the form of: {commandName: unoCmd, commandValues: {possible_values}}
- get_edit()¶
-
Gets if the viewer is actually an editor or not.
- get_part()¶
- Returns:
Current part number of the document. Returns -1 if no document is set currently.
- Return type:
- get_part_name(nPart)¶
- get_parts()¶
- Returns:
Part refers to either individual sheets in a Calc, or slides in Impress, and has no relevance for Writer. Returns -1 if no document is set currently.
- Return type:
- get_version_info()¶
- Returns:
JSON string containing version information in format: {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
Eg: {“ProductName”: “LibreOffice”, “ProductVersion”: “5.3”, “ProductExtension”: “.0.0.alpha0”, “BuildId”: “<full 40
str
git hash>”}- Return type:
Get version information of the LOKit process
- highlight_all(pText)¶
- Parameters:
pText (
str
) – text to search for
Highlights all matching texts in the view.
search-not-found
signal will be emitted when no search is found
- new_from_widget(pRenderingArguments)¶
- Parameters:
pRenderingArguments (
str
orNone
) – lok::Document:py:func:::initializeForRendering<LOKDocView.View.signals.initializeForRendering>() arguments.- Returns:
The
LOKDocView.View
widget instance.- Return type:
- open_document(pPath, pRenderingArguments, cancellable, callback, *userdata)¶
- Parameters:
pPath (
str
) – The path of the document thatLOKDocView.View
widget should try to openpRenderingArguments (
str
orNone
) – lok::Document:py:func:::initializeForRendering<LOKDocView.View.signals.initializeForRendering>() arguments.cancellable (
Gio.Cancellable
orNone
) –callback (
Gio.AsyncReadyCallback
orNone
) –
- open_document_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) –- Raises:
- Returns:
True
if the document is loaded successfully,False
otherwise- Return type:
- paste(pMimeType, pData, nSize)¶
- Parameters:
- Returns:
if pData was pasted successfully.
- Return type:
Pastes the content at the current cursor position
- pixel_to_twip(fInput)¶
- Parameters:
fInput (
float
) – The value in pixels to convert to twips- Returns:
The corresponding value in twips
- Return type:
Converts the value in pixels to twips according to zoom level.
- post_command(pCommand, pArguments, bNotifyWhenFinished)¶
- Parameters:
Posts the .uno: command to the LibreOfficeKit.
- reset_view()¶
- send_content_control_event(pArguments)¶
- set_document_password(pURL, pPassword)¶
- Parameters:
Set the password for password protected documents
- set_edit(bEdit)¶
-
Sets if the viewer is actually an editor or not.
- set_visible_area(pVisibleArea)¶
- Parameters:
pVisibleArea (
Gdk.Rectangle
) – The new visible area of pDocView in twips.
Sets the new visible area of the widget. This helps e.g. the page down key to jump the correct length, which depends on the amount of visible height of the document.
Signal Details¶
- LOKDocView.View.signals.address_changed(view, aCommand)¶
- Signal Name:
address-changed
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalaCommand (
str
) – formula text content
- LOKDocView.View.signals.command_changed(view, aCommand)¶
- Signal Name:
command-changed
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalaCommand (
str
) – the command that was changed
- LOKDocView.View.signals.command_result(view, aCommand)¶
- Signal Name:
command-result
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalaCommand (
str
) – JSON containing the info about the command that finished, and its success status.
- LOKDocView.View.signals.comment(view, pComment)¶
- Signal Name:
comment
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalpComment (
str
) – the JSON string containing comment notification The has following structure containing the information telling whether the comment has been added, deleted or modified. The example: { “comment”: { “action”: “Add”, “id”: “11”, “parent”: “4”, “author”: “Unknown Author”, “text”: “This is a comment”, “dateTime”: “2016-08-18T13:13:00”, “anchorPos”: “4529, 3906”, “textRange”: “1418, 3906, 3111, 919” } } ‘action’ can be ‘Add’, ‘Remove’ or ‘Modify’ depending on whether comment has been added, removed or modified. ‘parent’ is a non-zero comment id if this comment is a reply comment, otherwise it’s a root comment.
- LOKDocView.View.signals.content_control(view, pPayload)¶
- Signal Name:
content-control
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalpPayload (
str
) – the JSON string containing the information about ruler properties
- LOKDocView.View.signals.cursor_changed(view, nX, nY, nWidth, nHeight)¶
- Signal Name:
cursor-changed
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalnX (
int
) – The new cursor position (X coordinate) in pixelsnY (
int
) – The new cursor position (Y coordinate) in pixelsnWidth (
int
) – The width of new cursornHeight (
int
) – The height of new cursor
- LOKDocView.View.signals.edit_changed(view, bEdit)¶
- Signal Name:
edit-changed
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalbEdit (
bool
) – the new edit value of the view
- LOKDocView.View.signals.formula_changed(view, aCommand)¶
- Signal Name:
formula-changed
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalaCommand (
str
) – formula text content
- LOKDocView.View.signals.hyperlink_clicked(view, object)¶
- Signal Name:
hyperlink-clicked
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalobject (
str
) –
- LOKDocView.View.signals.invalidate_header(view, pPayload)¶
- Signal Name:
invalidate-header
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalpPayload (
str
) – can be either “row”, “column”, or “all”.
The column/row header is no more valid because of a column/row insertion or a similar event. Clients must query a new column/row header set.
The payload says if we are invalidating a row or column header
- LOKDocView.View.signals.load_changed(view, fLoadProgress)¶
- Signal Name:
load-changed
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalfLoadProgress (
float
) – the new progress value
- LOKDocView.View.signals.part_changed(view, aCommand)¶
- Signal Name:
part-changed
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalaCommand (
int
) – the part number which the view changed to
- LOKDocView.View.signals.password_required(view, pUrl, bModify)¶
- Signal Name:
password-required
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalpUrl (
str
) – URL of the document for which password is requiredbModify (
bool
) – whether password id required to modify the document This is true when password is required to edit the document, while it can still be viewed without password. In such cases, provide aNone
password for read-only access to the document. If false, password is required for opening the document, and document cannot be opened without providing a valid password.
Password must be provided by calling
LOKDocView.View.set_document_password
function with pUrl as provided by the callback.Upon entering an invalid password, another
password-required
signal is emitted. Upon entering a valid password, document starts to load. Upon entering aNone
password: if bModify isTrue
, document starts to open in view-only mode, else loading of document is aborted.
- LOKDocView.View.signals.ruler(view, pPayload)¶
- Signal Name:
ruler
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalpPayload (
str
) – the JSON string containing the information about ruler properties
The payload format is:
{ “margin1”: “…”, “margin2”: “…”, “leftOffset”: “…”, “pageOffset”: “…”, “pageWidth”: “…”, “unit”: “…” }
- LOKDocView.View.signals.search_not_found(view, aCommand)¶
- Signal Name:
search-not-found
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalaCommand (
str
) – the string for which the search was not found.
- LOKDocView.View.signals.search_result_count(view, aCommand)¶
- Signal Name:
search-result-count
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalaCommand (
str
) – number of matches.
- LOKDocView.View.signals.size_changed(view, aCommand)¶
- Signal Name:
size-changed
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalaCommand (
int
) –None
, we just notify that want to notify the UI elements that are interested.
- LOKDocView.View.signals.text_selection(view, bIsTextSelected)¶
- Signal Name:
text-selection
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalbIsTextSelected (
bool
) – whether text selected is non-null
- LOKDocView.View.signals.window(view, pPayload)¶
- Signal Name:
window
- Flags:
- Parameters:
view (
LOKDocView.View
) – The object which received the signalpPayload (
str
) – the JSON string containing the information about the window
This signal emits information about external windows like dialogs, autopopups for now.
The payload format of pPayload is:
{ “id”: “unique integer id of the dialog”, “action”: “<see below>”, “type”: “<see below>” “rectangle”: “x, y, width, height” }
“type” tells the type of the window the action is associated with
“dialog” - window is a dialog
“child” - window is a floating window (combo boxes, etc.)
“action” can take following values:
“created” - window is created in the backend, client can render it now
“title_changed” - window’s title is changed
“size_changed” - window’s size is changed
“invalidate” - the area as described by “rectangle” is invalidated Clients must request the new area
“cursor_invalidate” - cursor is invalidated. New position is in “rectangle”
“cursor_visible” - cursor visible status is changed. Status is available in “visible” field
“close” - window is closed
Property Details¶
- LOKDocView.View.props.can_zoom_in¶
-
It tells whether the view can further be zoomed in or not.
- LOKDocView.View.props.can_zoom_out¶
-
It tells whether the view can further be zoomed out or not.
- LOKDocView.View.props.doc_height¶
-
The height of the currently loaded document in
LOKDocView.View
in twips.
- LOKDocView.View.props.doc_password¶
-
Set it to true if client supports providing password for viewing password protected documents
- LOKDocView.View.props.doc_password_to_modify¶
-
Set it to true if client supports providing password for edit-protected documents
- LOKDocView.View.props.doc_width¶
-
The width of the currently loaded document in
LOKDocView.View
in twips.
- LOKDocView.View.props.docpath¶
-
The path of the document that is currently being viewed.
- LOKDocView.View.props.docpointer¶
-
A LibreOfficeKitDocument* in case documentLoad() is already called previously.
- LOKDocView.View.props.editable¶
-
Whether the document loaded inside of
LOKDocView.View
is editable or not.
- LOKDocView.View.props.is_initialized¶
-
Whether the requested document has completely loaded or not.
- LOKDocView.View.props.is_loading¶
-
Whether the requested document is being loaded or not.
True
if it is being loaded, otherwiseFalse
.
- LOKDocView.View.props.load_progress¶
-
The percent completion of the current loading operation of the document. This can be used for progress bars. Note that this is not a very accurate progress indicator, and its value might reset it couple of times to 0 and start again. You should not rely on its numbers.
- LOKDocView.View.props.lopath¶
- Name:
lopath
- Type:
- Default Value:
- Flags:
The absolute path of the LibreOffice install.
- LOKDocView.View.props.lopointer¶
- Name:
lopointer
- Type:
- Default Value:
- Flags:
A LibreOfficeKit* in case lok_init() is already called previously.
- LOKDocView.View.props.tiled_annotations¶
-
Whether the client wants in tile comment rendering
- LOKDocView.View.props.unipoll¶
- Name:
unipoll
- Type:
- Default Value:
- Flags:
Whether we use our own unified polling mainloop in place of glib’s
- LOKDocView.View.props.userprofileurl¶
- Name:
userprofileurl
- Type:
- Default Value:
- Flags:
The absolute path of the LibreOffice user profile.
- LOKDocView.View.props.zoom_level¶
-
The current zoom level of the document loaded inside
LOKDocView.View
. The default value is 1.0.