1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
11 #define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
18 #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
22 LOK_DOCTYPE_SPREADSHEET
,
23 LOK_DOCTYPE_PRESENTATION
,
27 LibreOfficeKitDocumentType
;
34 LibreOfficeKitPartMode
;
41 LibreOfficeKitTileMode
;
48 LibreOfficeKitWindowAction
;
50 /** Optional features of LibreOfficeKit, in particular callbacks that block
51 * LibreOfficeKit until the corresponding reply is received, which would
52 * deadlock if the client does not support the feature.
54 * @see lok::Office::setOptionalFeatures().
59 * Handle LOK_CALLBACK_DOCUMENT_PASSWORD by prompting the user
62 * @see lok::Office::setDocumentPassword().
64 LOK_FEATURE_DOCUMENT_PASSWORD
= (1ULL << 0),
67 * Handle LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY by prompting the user
70 * @see lok::Office::setDocumentPassword().
72 LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY
= (1ULL << 1),
75 * Request to have the part number as an 5th value in the
76 * LOK_CALLBACK_INVALIDATE_TILES payload.
78 LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK
= (1ULL << 2),
81 * Turn off tile rendering for annotations
83 LOK_FEATURE_NO_TILED_ANNOTATIONS
= (1ULL << 3),
86 * Enable range based header data
88 LOK_FEATURE_RANGE_HEADERS
= (1ULL << 4),
91 * Request to have the active view's Id as the 1st value in the
92 * LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR payload.
94 LOK_FEATURE_VIEWID_IN_VISCURSOR_INVALIDATION_CALLBACK
= (1ULL << 5)
96 LibreOfficeKitOptionalFeatures
;
98 // This enumerates the types of callbacks emitted to a LibreOfficeKit
99 // object's callback function or to a LibreOfficeKitDocument object's
100 // callback function. No callback type will be emitted to both. It is a
101 // bit unfortunate that the same enum contains both kinds of
104 // TODO: We should really add some indication at the documentation for
105 // each enum value telling which type of callback it is.
110 * Any tiles which are over the rectangle described in the payload are no
113 * Rectangle format: "x, y, width, height", where all numbers are document
114 * coordinates, in twips. When all tiles are supposed to be dropped, the
115 * format is the "EMPTY" string.
117 * @see LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK.
119 LOK_CALLBACK_INVALIDATE_TILES
= 0,
121 * The size and/or the position of the visible cursor changed.
123 * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
125 LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR
= 1,
127 * The list of rectangles representing the current text selection changed.
129 * List format is "rectangle1[; rectangle2[; ...]]" (without quotes and
130 * brackets), where rectangleN has the same format as
131 * LOK_CALLBACK_INVALIDATE_TILES. When there is no selection, an empty
132 * string is provided.
134 LOK_CALLBACK_TEXT_SELECTION
= 2,
136 * The position and size of the cursor rectangle at the text
137 * selection start. It is used to draw the selection handles.
139 * This callback must be called prior to LOK_CALLBACK_TEXT_SELECTION every
140 * time the selection is updated.
142 * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
144 LOK_CALLBACK_TEXT_SELECTION_START
= 3,
146 * The position and size of the cursor rectangle at the text
147 * selection end. It is used to draw the selection handles.
149 * This callback must be called prior to LOK_CALLBACK_TEXT_SELECTION every
150 * time the selection is updated.
152 * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
154 LOK_CALLBACK_TEXT_SELECTION_END
= 4,
156 * The blinking text cursor is now visible or not.
158 * Clients should assume that this is true initially and are expected to
159 * hide the blinking cursor at the rectangle described by
160 * LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR once it becomes false. Payload is
161 * either the "true" or the "false" string.
163 LOK_CALLBACK_CURSOR_VISIBLE
= 5,
165 * The size and/or the position of the graphic selection changed,
166 * the rotation angle of the embedded graphic object, and a property list
167 * which can be used for informing the client about several properties.
169 * Format is "x, y, width, height, angle, { list of properties }",
170 * where angle is in 100th of degree, and the property list is optional.
172 * The "{ list of properties }" part is in JSON format.
173 * Follow some examples of the property list part:
175 * 1) when the selected object is an image inserted in Writer:
177 * { "isWriterGraphic": true }
179 * 2) when the selected object is a chart legend:
181 * { "isDraggable": true, "isResizable": true, "isRotatable": false }
183 * 3) when the selected object is a pie segment in a chart:
186 * "isDraggable": true,
187 * "isResizable": false,
188 * "isRotatable": false,
190 * "dragMethod": "PieSegmentDragging",
191 * "initialOffset": 50,
192 * "dragDirection": [x, y],
197 * where the "svg" property is a string containing an svg document
198 * which is a representation of the pie segment.
200 LOK_CALLBACK_GRAPHIC_SELECTION
= 6,
203 * User clicked on an hyperlink that should be handled by other
204 * applications accordingly.
206 LOK_CALLBACK_HYPERLINK_CLICKED
= 7,
209 * Emit state update to the client.
210 * For example, when cursor is on bold text, this callback is triggered
211 * with payload: ".uno:Bold=true"
213 LOK_CALLBACK_STATE_CHANGED
= 8,
216 * Start a "status indicator" (here restricted to a progress bar type
217 * indicator). The payload is the descriptive text (or empty). Even if
218 * there is no documentation that would promise so, we assume that de facto
219 * for a document being viewed or edited, there will be at most one status
220 * indicator, and its descriptive text will not change.
222 * Note that for the case of the progress indication during loading of a
223 * document, the status indicator callbacks will arrive to the callback
224 * registered for the LibreOfficeKit (singleton) object, not a
225 * LibreOfficeKitDocument one, because we are in the very progress of
226 * loading a document and then constructing a LibreOfficeKitDocument
229 LOK_CALLBACK_STATUS_INDICATOR_START
= 9,
232 * Sets the numeric value of the status indicator.
233 * The payload should be a percentage, an integer between 0 and 100.
235 LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE
= 10,
238 * Ends the status indicator.
240 * Not necessarily ever emitted.
242 LOK_CALLBACK_STATUS_INDICATOR_FINISH
= 11,
245 * No match was found for the search input
247 LOK_CALLBACK_SEARCH_NOT_FOUND
= 12,
250 * Size of the document changed.
252 * Payload format is "width, height", i.e. clients get the new size without
253 * having to do an explicit lok::Document::getDocumentSize() call.
255 LOK_CALLBACK_DOCUMENT_SIZE_CHANGED
= 13,
258 * The current part number is changed.
260 * Payload is a single 0-based integer.
262 LOK_CALLBACK_SET_PART
= 14,
265 * Selection rectangles of the search result when find all is performed.
267 * Payload format example, in case of two matches:
270 * "searchString": "...",
271 * "highlightAll": true|false, // this is a result of 'search all'
272 * "searchResultSelection": [
275 * "rectangles": "..."
279 * "rectangles": "..."
284 * - searchString is the search query
285 * - searchResultSelection is an array of part-number and rectangle list
286 * pairs, in LOK_CALLBACK_SET_PART / LOK_CALLBACK_TEXT_SELECTION format.
288 LOK_CALLBACK_SEARCH_RESULT_SELECTION
= 15,
291 * Result of the UNO command execution when bNotifyWhenFinished was set
292 * to 'true' during the postUnoCommand() call.
294 * The result returns a success / failure state, and potentially
298 * "commandName": "...", // the command for which this is the result
299 * "success": true/false, // when the result is "don't know", this is missing
300 * // TODO "result": "..." // UNO Any converted to JSON (not implemented yet)
303 LOK_CALLBACK_UNO_COMMAND_RESULT
= 16,
306 * The size and/or the position of the cell cursor changed.
308 * Payload format: "x, y, width, height, column, row", where the first
309 * 4 numbers are document coordinates, in twips, and the last 2 are table
310 * coordinates starting from 0.
311 * When the cursor is not shown the payload format is the "EMPTY" string.
313 * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
315 LOK_CALLBACK_CELL_CURSOR
= 17,
318 * The current mouse pointer style.
320 * Payload is a css mouse pointer style.
322 LOK_CALLBACK_MOUSE_POINTER
= 18,
325 * The text content of the formula bar in Calc.
327 LOK_CALLBACK_CELL_FORMULA
= 19,
330 * Loading a document requires a password.
332 * Loading the document is blocked until the password is provided via
333 * lok::Office::setDocumentPassword(). The document cannot be loaded
334 * without the password.
336 LOK_CALLBACK_DOCUMENT_PASSWORD
= 20,
339 * Editing a document requires a password.
341 * Loading the document is blocked until the password is provided via
342 * lok::Office::setDocumentPassword().
344 LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY
= 21,
349 * The payload returns information further identifying the error, like:
352 * "classification": "error" | "warning" | "info"
353 * "kind": "network" etc.
354 * "code": a structured 32-bit error code, the ErrCode from LibreOffice's <tools/errcode.hxx>
355 * "message": freeform description
358 LOK_CALLBACK_ERROR
= 22,
361 * Context menu structure
363 * Returns the structure of context menu. Contains all the separators &
364 * submenus, example of the returned structure:
368 * { "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" },
369 * { "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" },
370 * { "type": "separator" },
371 * { "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] },
376 * The 'command' can additionally have a checkable status, like:
378 * {"text": "label text3", "type": "command", "command": ".uno:Something3", "checktype": "checkmark|radio|auto", "checked": "true|false"}
380 LOK_CALLBACK_CONTEXT_MENU
= 23,
383 * The size and/or the position of the view cursor changed. A view cursor
384 * is a cursor of another view, the current view can't change it.
386 * The payload format:
393 * - viewId is a value returned earlier by lok::Document::createView()
394 * - rectangle uses the format of LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR
396 LOK_CALLBACK_INVALIDATE_VIEW_CURSOR
= 24,
399 * The text selection in one of the other views has changed.
401 * The payload format:
408 * - viewId is a value returned earlier by lok::Document::createView()
409 * - selection uses the format of LOK_CALLBACK_TEXT_SELECTION.
411 LOK_CALLBACK_TEXT_VIEW_SELECTION
= 25,
414 * The cell cursor in one of the other views has changed.
416 * The payload format:
423 * - viewId is a value returned earlier by lok::Document::createView()
424 * - rectangle uses the format of LOK_CALLBACK_CELL_CURSOR.
426 LOK_CALLBACK_CELL_VIEW_CURSOR
= 26,
429 * The size and/or the position of a graphic selection in one of the other
432 * The payload format:
439 * - viewId is a value returned earlier by lok::Document::createView()
440 * - selection uses the format of LOK_CALLBACK_INVALIDATE_TILES.
442 LOK_CALLBACK_GRAPHIC_VIEW_SELECTION
= 27,
445 * The blinking text cursor in one of the other views is now visible or
448 * The payload format:
455 * - viewId is a value returned earlier by lok::Document::createView()
456 * - visible uses the format of LOK_CALLBACK_CURSOR_VISIBLE.
458 LOK_CALLBACK_VIEW_CURSOR_VISIBLE
= 28,
461 * The size and/or the position of a lock rectangle in one of the other
464 * The payload format:
471 * - viewId is a value returned earlier by lok::Document::createView()
472 * - rectangle uses the format of LOK_CALLBACK_INVALIDATE_TILES.
474 LOK_CALLBACK_VIEW_LOCK
= 29,
477 * The size of the change tracking table has changed.
479 * The payload example:
482 * "action": "Remove",
484 * "author": "Unknown Author",
487 * "description": "Delete 'abc'",
488 * "dateTime": "2016-08-18T12:14:00"
492 * The format is the same as an entry of
493 * lok::Document::getCommandValues('.uno:AcceptTrackedChanges'), extra
496 * - 'action' is either 'Add' or 'Remove', depending on if this is an
497 * insertion into the table or a removal.
499 LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED
= 30,
502 * An entry in the change tracking table has been modified.
504 * The payload example:
507 * "action": "Modify",
509 * "author": "Unknown Author",
512 * "description": "Insert 'abcd'",
513 * "dateTime": "2016-08-18T13:13:00"
517 * The format is the same as an entry of
518 * lok::Document::getCommandValues('.uno:AcceptTrackedChanges'), extra
521 * - 'action' is 'Modify'.
523 LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED
= 31,
526 * There is some change in comments in the document
528 * The payload example:
534 * "author": "Unknown Author",
536 * "dateTime": "2016-08-18T13:13:00",
537 * "anchorPos": "4529, 3906",
538 * "textRange": "1418, 3906, 3111, 919"
542 * The format is the same as an entry of
543 * lok::Document::getCommandValues('.uno:ViewAnnotations'), extra
546 * - 'action' can be 'Add', 'Remove' or 'Modify' depending on whether
547 * comment has been added, removed or modified.
549 LOK_CALLBACK_COMMENT
= 32,
552 * The column/row header is no more valid because of a column/row insertion
553 * or a similar event. Clients must query a new column/row header set.
555 * The payload says if we are invalidating a row or column header. So,
556 * payload values can be: "row", "column", "all".
558 LOK_CALLBACK_INVALIDATE_HEADER
= 33,
560 * The text content of the address field in Calc. Eg: "A7"
562 LOK_CALLBACK_CELL_ADDRESS
= 34,
564 * The key ruler related properties on change are reported by this.
566 * The payload format is:
571 * "leftOffset": "...",
572 * "pageOffset": "...",
573 * "pageWidth": "...",
577 * Here all aproperties are same as described in svxruler.
579 LOK_CALLBACK_RULER_UPDATE
= 35,
581 * Window related callbacks are emitted under this category. It includes
582 * external windows like dialogs, autopopups for now.
584 * The payload format is:
587 * "id": "unique integer id of the dialog",
588 * "action": "<see below>",
589 * "type": "<see below>"
590 * "rectangle": "x, y, width, height"
593 * "type" tells the type of the window the action is associated with
594 * - "dialog" - window is a dialog
595 * - "child" - window is a floating window (combo boxes, etc.)
597 * "action" can take following values:
598 * - "created" - window is created in the backend, client can render it now
599 * - "title_changed" - window's title is changed
600 * - "size_changed" - window's size is changed
601 * - "invalidate" - the area as described by "rectangle" is invalidated
602 * Clients must request the new area
603 * - "cursor_invalidate" - cursor is invalidated. New position is in "rectangle"
604 * - "cursor_visible" - cursor visible status is changed. Status is available
606 * - "close" - window is closed
607 * - "show" - show the window
608 * - "hide" - hide the window
610 LOK_CALLBACK_WINDOW
= 36,
613 * When for the current cell is defined a validity list we need to show
614 * a drop down button in the form of a marker.
616 * The payload format is: "x, y, visible" where x, y are the current
617 * cell cursor coordinates and visible is set to 0 or 1.
619 LOK_CALLBACK_VALIDITY_LIST_BUTTON
= 37,
622 * Notification that the clipboard contents have changed.
623 * Typically fired in response to copying to clipboard.
625 * The payload currently is empty and it's up to the
626 * client to get the contents, if necessary. However,
627 * in the future the contents might be included for
630 LOK_CALLBACK_CLIPBOARD_CHANGED
= 38,
633 * When the (editing) context changes - like the user switches from
634 * editing textbox in Impress to editing a shape there.
636 * Payload is the application ID and context, delimited by space.
637 * Eg. com.sun.star.presentation.PresentationDocument TextObject
639 LOK_CALLBACK_CONTEXT_CHANGED
= 39,
642 * On-load notification of the document signature status.
644 LOK_CALLBACK_SIGNATURE_STATUS
= 40,
647 * Profiling tracing information single string of multiple lines
648 * containing <pid> <timestamp> and zone start/stop information
650 LOK_CALLBACK_PROFILE_FRAME
= 41
652 LibreOfficeKitCallbackType
;
656 /// A key on the keyboard is pressed.
657 LOK_KEYEVENT_KEYINPUT
,
658 /// A key on the keyboard is released.
661 LibreOfficeKitKeyEventType
;
665 /// cf. SalEvent::ExtTextInput
667 /// cf. SalEvent::ExtTextInputPos
668 LOK_EXT_TEXTINPUT_POS
,
669 /// cf. SalEvent::EndExtTextInput
670 LOK_EXT_TEXTINPUT_END
672 LibreOfficeKitExtTextInputType
;
676 /// A pressed gesture has started.
677 LOK_MOUSEEVENT_MOUSEBUTTONDOWN
,
678 /// A pressed gesture has finished.
679 LOK_MOUSEEVENT_MOUSEBUTTONUP
,
680 /// A change has happened during a press gesture.
681 LOK_MOUSEEVENT_MOUSEMOVE
683 LibreOfficeKitMouseEventType
;
687 /// The start of selection is to be adjusted.
688 LOK_SETTEXTSELECTION_START
,
689 /// The end of selection is to be adjusted.
690 LOK_SETTEXTSELECTION_END
,
691 /// Both the start and the end of selection is to be adjusted.
692 LOK_SETTEXTSELECTION_RESET
694 LibreOfficeKitSetTextSelectionType
;
699 * A move or a resize action starts. It is assumed that there is a valid
700 * graphic selection (see LOK_CALLBACK_GRAPHIC_SELECTION) and the supplied
701 * coordinates are the ones the user tapped on.
703 * The type of the action is move by default, unless the coordinates are
704 * the position of a handle (see below), in which case it's a resize.
706 * There are 8 handles for a graphic selection:
707 * - top-left, top-center, top-right
708 * - middle-left, middle-right
709 * - bottom-left, bottom-center, bottom-right
711 LOK_SETGRAPHICSELECTION_START
,
713 * A move or resize action stops. It is assumed that this is always used
714 * only after a LOK_SETTEXTSELECTION_START. The supplied coordinates are
715 * the ones where the user released the screen.
717 LOK_SETGRAPHICSELECTION_END
719 LibreOfficeKitSetGraphicSelectionType
;
721 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
727 #endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
729 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */