[Libreoffice-commits] online.git: bundled/include kit/ChildSession.cpp kit/Kit.cpp kit/KitHelper.hpp tools/KitClient.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Sat Aug 17 01:38:28 UTC 2019
bundled/include/LibreOfficeKit/LibreOfficeKit.h | 30 +++++
bundled/include/LibreOfficeKit/LibreOfficeKit.hxx | 38 +++++-
bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h | 112 +++++++++++++++++++
kit/ChildSession.cpp | 23 +--
kit/Kit.cpp | 8 -
kit/KitHelper.hpp | 101 -----------------
tools/KitClient.cpp | 54 ---------
7 files changed, 193 insertions(+), 173 deletions(-)
New commits:
commit 32007cbb329f4d2bb1b44d0353ad141996d623f7
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Aug 16 09:24:38 2019 -0400
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Sat Aug 17 03:38:08 2019 +0200
Update LOK headers and reuse callback-type-to-string helper
Also, avoid repeatedly converting INT_MAX to string.
It's an arbitrary large number, so use 1 billion,
which is probably more easily recognizable as an
arbitrary large number.
Change-Id: Ie6f898d6e8978efa29c355f3cb50b60114870f0d
Reviewed-on: https://gerrit.libreoffice.org/77593
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
index e4e96483c..93b430f5d 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
@@ -378,6 +378,36 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::createViewWithOptions().
int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions);
+ /// @see lok::Document::selectPart().
+ void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
+
+ /// @see lok::Document::moveSelectedParts().
+ void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
+
+ /// Resize window with given id.
+ /// @see lok::Document::resizeWindow().
+ void (*resizeWindow) (LibreOfficeKitDocument* pThis, unsigned nWindowId,
+ const int width, const int height);
+
+ /// Pass a nullptr terminated array of mime-type strings
+ /// @see lok::Document::getClipboard for more details
+ int (*getClipboard) (LibreOfficeKitDocument* pThis,
+ const char **pMimeTypes,
+ size_t *pOutCount,
+ char ***pOutMimeTypes,
+ size_t **pOutSizes,
+ char ***pOutStreams);
+
+ /// @see lok::Document::setClipboard
+ int (*setClipboard) (LibreOfficeKitDocument* pThis,
+ const size_t nInCount,
+ const char **pInMimeTypes,
+ const size_t *pInSizes,
+ const char **pInStreams);
+
+ /// @see lok::Document::getSelectionType
+ int (*getSelectionType) (LibreOfficeKitDocument* pThis);
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
index 0d1c6e94d..517a38a50 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -188,7 +188,7 @@ public:
*
* @param nWindowid
*/
- void postWindow(unsigned nWindowId, int nAction, const char* pData)
+ void postWindow(unsigned nWindowId, int nAction, const char* pData = nullptr)
{
return mpDoc->pClass->postWindow(mpDoc, nWindowId, nAction, pData);
}
@@ -436,7 +436,7 @@ public:
/**
* Returns a json mapping of the possible values for the given command
* e.g. {commandName: ".uno:StyleApply", commandValues: {"familyName1" : ["list of style names in the family1"], etc.}}
- * @param pCommand a uno command for which the possible values are requested
+ * @param pCommand a UNO command for which the possible values are requested
* @return {commandName: unoCmd, commandValues: {possible_values}}
*/
char* getCommandValues(const char* pCommand)
@@ -676,7 +676,7 @@ public:
/**
* Gets an image of the selected shapes.
* @param pOutput contains the result; use free to deallocate.
- * @return the size ouf *pOutput in bytes.
+ * @return the size of *pOutput in bytes.
*/
size_t renderShapeSelection(char** pOutput)
{
@@ -698,6 +698,36 @@ public:
{
return mpDoc->pClass->postWindowGestureEvent(mpDoc, nWindowId, pType, nX, nY, nOffset);
}
+
+ /// Set a part's selection mode.
+ /// nSelect is 0 to deselect, 1 to select, and 2 to toggle.
+ void selectPart(int nPart, int nSelect)
+ {
+ mpDoc->pClass->selectPart(mpDoc, nPart, nSelect);
+ }
+
+ /// Moves the selected pages/slides to a new position.
+ /// nPosition is the new position where the selection
+ /// should go. bDuplicate when true will copy instead of move.
+ void moveSelectedParts(int nPosition, bool bDuplicate)
+ {
+ mpDoc->pClass->moveSelectedParts(mpDoc, nPosition, bDuplicate);
+ }
+
+ /**
+ * Resize a window (dialog, popup, etc.) with give id.
+ *
+ * @param nWindowId
+ * @param width The width of the window.
+ * @param height The height of the window.
+ */
+ void resizeWindow(unsigned nWindowId,
+ const int width,
+ const int height)
+ {
+ return mpDoc->pClass->resizeWindow(mpDoc, nWindowId, width, height);
+ }
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
@@ -719,7 +749,7 @@ public:
}
/**
- * Loads a document from an URL.
+ * Loads a document from a URL.
*
* @param pUrl the URL of the document to load
* @param pFilterOptions options for the import filter, e.g. SkipImages.
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 0c8e5938f..44bf83eab 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -10,6 +10,8 @@
#ifndef INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
#define INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITENUMS_H
+#include <assert.h>
+
#ifdef __cplusplus
extern "C"
{
@@ -47,6 +49,15 @@ typedef enum
}
LibreOfficeKitWindowAction;
+typedef enum
+{
+ LOK_SELTYPE_NONE,
+ LOK_SELTYPE_TEXT,
+ LOK_SELTYPE_LARGE_TEXT,
+ LOK_SELTYPE_COMPLEX
+}
+LibreOfficeKitSelectionType;
+
/** Optional features of LibreOfficeKit, in particular callbacks that block
* LibreOfficeKit until the corresponding reply is received, which would
* deadlock if the client does not support the feature.
@@ -697,6 +708,107 @@ typedef enum
}
LibreOfficeKitExtTextInputType;
+/// Returns the string representation of a LibreOfficeKitCallbackType enumeration element.
+static inline const char* lokCallbackTypeToString(int nType)
+{
+ switch (static_cast<LibreOfficeKitCallbackType>(nType))
+ {
+ case LOK_CALLBACK_INVALIDATE_TILES:
+ return "LOK_CALLBACK_INVALIDATE_TILES";
+ case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
+ return "LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR";
+ case LOK_CALLBACK_TEXT_SELECTION:
+ return "LOK_CALLBACK_TEXT_SELECTION";
+ case LOK_CALLBACK_TEXT_SELECTION_START:
+ return "LOK_CALLBACK_TEXT_SELECTION_START";
+ case LOK_CALLBACK_TEXT_SELECTION_END:
+ return "LOK_CALLBACK_TEXT_SELECTION_END";
+ case LOK_CALLBACK_CURSOR_VISIBLE:
+ return "LOK_CALLBACK_CURSOR_VISIBLE";
+ case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
+ return "LOK_CALLBACK_VIEW_CURSOR_VISIBLE";
+ case LOK_CALLBACK_GRAPHIC_SELECTION:
+ return "LOK_CALLBACK_GRAPHIC_SELECTION";
+ case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
+ return "LOK_CALLBACK_GRAPHIC_VIEW_SELECTION";
+ case LOK_CALLBACK_CELL_CURSOR:
+ return "LOK_CALLBACK_CELL_CURSOR";
+ case LOK_CALLBACK_HYPERLINK_CLICKED:
+ return "LOK_CALLBACK_HYPERLINK_CLICKED";
+ case LOK_CALLBACK_MOUSE_POINTER:
+ return "LOK_CALLBACK_MOUSE_POINTER";
+ case LOK_CALLBACK_STATE_CHANGED:
+ return "LOK_CALLBACK_STATE_CHANGED";
+ case LOK_CALLBACK_STATUS_INDICATOR_START:
+ return "LOK_CALLBACK_STATUS_INDICATOR_START";
+ case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
+ return "LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE";
+ case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
+ return "LOK_CALLBACK_STATUS_INDICATOR_FINISH";
+ case LOK_CALLBACK_SEARCH_NOT_FOUND:
+ return "LOK_CALLBACK_SEARCH_NOT_FOUND";
+ case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
+ return "LOK_CALLBACK_DOCUMENT_SIZE_CHANGED";
+ case LOK_CALLBACK_SET_PART:
+ return "LOK_CALLBACK_SET_PART";
+ case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
+ return "LOK_CALLBACK_SEARCH_RESULT_SELECTION";
+ case LOK_CALLBACK_DOCUMENT_PASSWORD:
+ return "LOK_CALLBACK_DOCUMENT_PASSWORD";
+ case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY:
+ return "LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY";
+ case LOK_CALLBACK_CONTEXT_MENU:
+ return "LOK_CALLBACK_CONTEXT_MENU";
+ case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR:
+ return "LOK_CALLBACK_INVALIDATE_VIEW_CURSOR";
+ case LOK_CALLBACK_TEXT_VIEW_SELECTION:
+ return "LOK_CALLBACK_TEXT_VIEW_SELECTION";
+ case LOK_CALLBACK_CELL_VIEW_CURSOR:
+ return "LOK_CALLBACK_CELL_VIEW_CURSOR";
+ case LOK_CALLBACK_CELL_ADDRESS:
+ return "LOK_CALLBACK_CELL_ADDRESS";
+ case LOK_CALLBACK_CELL_FORMULA:
+ return "LOK_CALLBACK_CELL_FORMULA";
+ case LOK_CALLBACK_UNO_COMMAND_RESULT:
+ return "LOK_CALLBACK_UNO_COMMAND_RESULT";
+ case LOK_CALLBACK_ERROR:
+ return "LOK_CALLBACK_ERROR";
+ case LOK_CALLBACK_VIEW_LOCK:
+ return "LOK_CALLBACK_VIEW_LOCK";
+ case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED:
+ return "LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED";
+ case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED:
+ return "LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED";
+ case LOK_CALLBACK_INVALIDATE_HEADER:
+ return "LOK_CALLBACK_INVALIDATE_HEADER";
+ case LOK_CALLBACK_COMMENT:
+ return "LOK_CALLBACK_COMMENT";
+ case LOK_CALLBACK_RULER_UPDATE:
+ return "LOK_CALLBACK_RULER_UPDATE";
+ case LOK_CALLBACK_WINDOW:
+ return "LOK_CALLBACK_WINDOW";
+ case LOK_CALLBACK_VALIDITY_LIST_BUTTON:
+ return "LOK_CALLBACK_VALIDITY_LIST_BUTTON";
+ case LOK_CALLBACK_CLIPBOARD_CHANGED:
+ return "LOK_CALLBACK_CLIPBOARD_CHANGED";
+ case LOK_CALLBACK_CONTEXT_CHANGED:
+ return "LOK_CALLBACK_CONTEXT_CHANGED";
+ case LOK_CALLBACK_SIGNATURE_STATUS:
+ return "LOK_CALLBACK_SIGNATURE_STATUS";
+ case LOK_CALLBACK_PROFILE_FRAME:
+ return "LOK_CALLBACK_PROFILE_FRAME";
+ case LOK_CALLBACK_CELL_SELECTION_AREA:
+ return "LOK_CALLBACK_CELL_SELECTION_AREA";
+ case LOK_CALLBACK_CELL_AUTO_FILL_AREA:
+ return "LOK_CALLBACK_CELL_AUTO_FILL_AREA";
+ case LOK_CALLBACK_TABLE_SELECTED:
+ return "LOK_CALLBACK_TABLE_SELECTED";
+ }
+
+ assert(!"Unknown LibreOfficeKitCallbackType type.");
+ return nullptr;
+}
+
typedef enum
{
/// A pressed gesture has started.
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 62566c7be..c3dd0a3ae 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -148,7 +148,7 @@ bool ChildSession::_handleInput(const char *buffer, int length)
// the rectangle to invalidate; invalidating everything is sub-optimal
if (_stateRecorder.isInvalidate())
{
- std::string payload = "0, 0, " + std::to_string(INT_MAX) + ", " + std::to_string(INT_MAX) + ", " + std::to_string(curPart);
+ const std::string payload = "0, 0, 1000000000, 1000000000, " + std::to_string(curPart);
loKitCallback(LOK_CALLBACK_INVALIDATE_TILES, payload);
}
@@ -157,7 +157,8 @@ bool ChildSession::_handleInput(const char *buffer, int length)
for (const auto& eventPair : viewPair.second)
{
const RecordedEvent& event = eventPair.second;
- LOG_TRC("Replaying missed view event: " << viewPair.first << " " << LOKitHelper::kitCallbackTypeToString(event.getType())
+ LOG_TRC("Replaying missed view event: " << viewPair.first << ' '
+ << lokCallbackTypeToString(event.getType())
<< ": " << event.getPayload());
loKitCallback(event.getType(), event.getPayload());
}
@@ -166,7 +167,8 @@ bool ChildSession::_handleInput(const char *buffer, int length)
for (const auto& eventPair : _stateRecorder.getRecordedEvents())
{
const RecordedEvent& event = eventPair.second;
- LOG_TRC("Replaying missed event: " << LOKitHelper::kitCallbackTypeToString(event.getType()) << ": " << event.getPayload());
+ LOG_TRC("Replaying missed event: " << lokCallbackTypeToString(event.getType()) << ": "
+ << event.getPayload());
loKitCallback(event.getType(), event.getPayload());
}
@@ -178,7 +180,8 @@ bool ChildSession::_handleInput(const char *buffer, int length)
for (const auto& event : _stateRecorder.getRecordedEventsVector())
{
- LOG_TRC("Replaying missed event (part of sequence): " << LOKitHelper::kitCallbackTypeToString(event.getType()) << ": " << event.getPayload());
+ LOG_TRC("Replaying missed event (part of sequence): " <<
+ lokCallbackTypeToString(event.getType()) << ": " << event.getPayload());
loKitCallback(event.getType(), event.getPayload());
}
@@ -2066,7 +2069,7 @@ int ChildSession::getSpeed() {
void ChildSession::loKitCallback(const int type, const std::string& payload)
{
- const std::string typeName = LOKitHelper::kitCallbackTypeToString(type);
+ const char* const typeName = lokCallbackTypeToString(type);
LOG_TRC("ChildSession::loKitCallback [" << getName() << "]: " <<
typeName << " [" << payload << "].");
@@ -2187,12 +2190,8 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
const int parts = getLOKitDocument()->getParts();
for (int i = 0; i < parts; ++i)
{
- sendTextFrame("invalidatetiles:"
- " part=" + std::to_string(i) +
- " x=0" +
- " y=0" +
- " width=" + std::to_string(INT_MAX) +
- " height=" + std::to_string(INT_MAX));
+ sendTextFrame("invalidatetiles: part=" + std::to_string(i) +
+ " x=0 y=0 width=1000000000 height=1000000000");
}
getStatus("", 0);
@@ -2307,7 +2306,7 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
// we want a compilation-time failure in the debug builds; but ERR in the
// log in the release ones
default:
- LOG_ERR("Unknown callback event (" << LOKitHelper::kitCallbackTypeToString(type) << "): " << payload);
+ LOG_ERR("Unknown callback event (" << lokCallbackTypeToString(type) << "): " << payload);
#endif
}
}
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index bd6dc7f8c..c76e4cf50 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1324,7 +1324,7 @@ public:
}
const std::string payload = p ? p : "(nil)";
- LOG_TRC("Document::GlobalCallback " << LOKitHelper::kitCallbackTypeToString(type) <<
+ LOG_TRC("Document::GlobalCallback " << lokCallbackTypeToString(type) <<
" [" << payload << "].");
Document* self = static_cast<Document*>(data);
if (type == LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY ||
@@ -1369,7 +1369,7 @@ public:
const std::string payload = p ? p : "(nil)";
LOG_TRC("Document::ViewCallback [" << descriptor->getViewId() <<
- "] [" << LOKitHelper::kitCallbackTypeToString(type) <<
+ "] [" << lokCallbackTypeToString(type) <<
"] [" << payload << "].");
// when we examine the content of the JSON
@@ -2069,7 +2069,7 @@ public:
else
{
LOG_ERR("Session-thread of session [" << session->getId() << "] for view [" <<
- viewId << "] is not running. Dropping [" << LOKitHelper::kitCallbackTypeToString(type) <<
+ viewId << "] is not running. Dropping [" << lokCallbackTypeToString(type) <<
"] payload [" << payload << "].");
}
@@ -2083,7 +2083,7 @@ public:
if (!isFound)
{
LOG_WRN("Document::ViewCallback. Session [" << viewId <<
- "] is no longer active to process [" << LOKitHelper::kitCallbackTypeToString(type) <<
+ "] is no longer active to process [" << lokCallbackTypeToString(type) <<
"] [" << payload << "] message to Master Session.");
}
}
diff --git a/kit/KitHelper.hpp b/kit/KitHelper.hpp
index 8a32cb2dd..b0962276a 100644
--- a/kit/KitHelper.hpp
+++ b/kit/KitHelper.hpp
@@ -44,107 +44,6 @@ namespace LOKitHelper
return documentTypeToString(type);
}
- inline std::string kitCallbackTypeToString(const int type)
- {
- // Keep in the same order as in LibreOfficeKitEnums.h
- switch (static_cast<LibreOfficeKitCallbackType>(type))
- {
- case LOK_CALLBACK_INVALIDATE_TILES:
- return "INVALIDATE_TILES";
- case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
- return "INVALIDATE_VISIBLE_CURSOR";
- case LOK_CALLBACK_TEXT_SELECTION:
- return "TEXT_SELECTION";
- case LOK_CALLBACK_TEXT_SELECTION_START:
- return "TEXT_SELECTION_START";
- case LOK_CALLBACK_TEXT_SELECTION_END:
- return "TEXT_SELECTION_END";
- case LOK_CALLBACK_CURSOR_VISIBLE:
- return "CURSOR_VISIBLE";
- case LOK_CALLBACK_GRAPHIC_SELECTION:
- return "GRAPHIC_SELECTION";
- case LOK_CALLBACK_HYPERLINK_CLICKED:
- return "HYPERLINK_CLICKED";
- case LOK_CALLBACK_STATE_CHANGED:
- return "STATE_CHANGED";
- case LOK_CALLBACK_STATUS_INDICATOR_START:
- return "STATUS_INDICATOR_START";
- case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
- return "STATUS_INDICATOR_SET_VALUE";
- case LOK_CALLBACK_STATUS_INDICATOR_FINISH:
- return "STATUS_INDICATOR_FINISH";
- case LOK_CALLBACK_SEARCH_NOT_FOUND:
- return "SEARCH_NOT_FOUND";
- case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
- return "DOCUMENT_SIZE_CHANGED";
- case LOK_CALLBACK_SET_PART:
- return "SET_PART";
- case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
- return "SEARCH_RESULT_SELECTION";
- case LOK_CALLBACK_UNO_COMMAND_RESULT:
- return "UNO_COMMAND_RESULT";
- case LOK_CALLBACK_CELL_CURSOR:
- return "CELL_CURSOR";
- case LOK_CALLBACK_MOUSE_POINTER:
- return "MOUSE_POINTER";
- case LOK_CALLBACK_CELL_FORMULA:
- return "CELL_FORMULA";
- case LOK_CALLBACK_DOCUMENT_PASSWORD:
- return "DOCUMENT_PASSWORD";
- case LOK_CALLBACK_DOCUMENT_PASSWORD_TO_MODIFY:
- return "DOCUMENT_PASSWORD_TO_MODIFY";
- case LOK_CALLBACK_ERROR:
- return "ERROR";
- case LOK_CALLBACK_CONTEXT_MENU:
- return "CONTEXT_MENU";
- case LOK_CALLBACK_INVALIDATE_VIEW_CURSOR:
- return "INVALIDATE_VIEW_CURSOR";
- case LOK_CALLBACK_TEXT_VIEW_SELECTION:
- return "TEXT_VIEW_SELECTION";
- case LOK_CALLBACK_CELL_VIEW_CURSOR:
- return "CELL_VIEW_CURSOR";
- case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
- return "GRAPHIC_VIEW_SELECTION";
- case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
- return "VIEW_CURSOR_VISIBLE";
- case LOK_CALLBACK_VIEW_LOCK:
- return "VIEW_LOCK";
- case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED:
- return "REDLINE_TABLE_SIZE_CHANGED";
- case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED:
- return "REDLINE_TABLE_ENTRY_MODIFIED";
- case LOK_CALLBACK_COMMENT:
- return "COMMENT";
- case LOK_CALLBACK_INVALIDATE_HEADER:
- return "INVALIDATE_HEADER";
- case LOK_CALLBACK_CELL_ADDRESS:
- return "CELL_ADDRESS";
- case LOK_CALLBACK_RULER_UPDATE:
- return "RULER_UPDATE";
- case LOK_CALLBACK_WINDOW:
- return "WINDOW";
- case LOK_CALLBACK_VALIDITY_LIST_BUTTON:
- return "VALIDITY_LIST_BUTTON";
- case LOK_CALLBACK_CLIPBOARD_CHANGED:
- return "CLIPBOARD_CHANGED";
- case LOK_CALLBACK_CONTEXT_CHANGED:
- return "CONTEXT_CHANGED";
- case LOK_CALLBACK_SIGNATURE_STATUS:
- return "SIGNATURE_STATUS";
- case LOK_CALLBACK_PROFILE_FRAME:
- return "PROFILE_FRAME";
- case LOK_CALLBACK_CELL_SELECTION_AREA:
- return "CELL_SELECTION_AREA";
- case LOK_CALLBACK_CELL_AUTO_FILL_AREA:
- return "CELL_AUTO_FILL_AREA";
- case LOK_CALLBACK_TABLE_SELECTED:
- return "TABLE_SELECTED";
- }
-
- assert(!"Missing LOK_CALLBACK type");
- return std::to_string(type);
- }
-
inline std::string documentStatus(LibreOfficeKitDocument *loKitDocument)
{
char *ptrValue;
diff --git a/tools/KitClient.cpp b/tools/KitClient.cpp
index a4419a3e3..fdb4ffa84 100644
--- a/tools/KitClient.cpp
+++ b/tools/KitClient.cpp
@@ -39,58 +39,8 @@ extern "C"
{
static void myCallback(int type, const char* payload, void*)
{
- std::cout << "Callback: ";
- switch ((LibreOfficeKitCallbackType) type)
- {
-#define CASE(x) case LOK_CALLBACK_##x: std::cout << #x; break
- CASE(INVALIDATE_TILES);
- CASE(INVALIDATE_VISIBLE_CURSOR);
- CASE(TEXT_SELECTION);
- CASE(TEXT_SELECTION_START);
- CASE(TEXT_SELECTION_END);
- CASE(CURSOR_VISIBLE);
- CASE(GRAPHIC_SELECTION);
- CASE(CELL_CURSOR);
- CASE(CELL_FORMULA);
- CASE(HYPERLINK_CLICKED);
- CASE(MOUSE_POINTER);
- CASE(STATE_CHANGED);
- CASE(STATUS_INDICATOR_START);
- CASE(STATUS_INDICATOR_SET_VALUE);
- CASE(STATUS_INDICATOR_FINISH);
- CASE(SEARCH_NOT_FOUND);
- CASE(SEARCH_RESULT_SELECTION);
- CASE(DOCUMENT_SIZE_CHANGED);
- CASE(SET_PART);
- CASE(UNO_COMMAND_RESULT);
- CASE(DOCUMENT_PASSWORD);
- CASE(DOCUMENT_PASSWORD_TO_MODIFY);
- CASE(ERROR);
- CASE(CONTEXT_MENU);
- CASE(INVALIDATE_VIEW_CURSOR);
- CASE(TEXT_VIEW_SELECTION);
- CASE(CELL_VIEW_CURSOR);
- CASE(GRAPHIC_VIEW_SELECTION);
- CASE(VIEW_CURSOR_VISIBLE);
- CASE(VIEW_LOCK);
- CASE(REDLINE_TABLE_SIZE_CHANGED);
- CASE(REDLINE_TABLE_ENTRY_MODIFIED);
- CASE(COMMENT);
- CASE(INVALIDATE_HEADER);
- CASE(CELL_ADDRESS);
- CASE(RULER_UPDATE);
- CASE(WINDOW);
- CASE(VALIDITY_LIST_BUTTON);
- CASE(CLIPBOARD_CHANGED);
- CASE(CONTEXT_CHANGED);
- CASE(SIGNATURE_STATUS);
- CASE(PROFILE_FRAME);
- CASE(CELL_SELECTION_AREA);
- CASE(CELL_AUTO_FILL_AREA);
- CASE(TABLE_SELECTED);
-#undef CASE
- }
- std::cout << " payload: " << payload << std::endl;
+ std::cout << "Callback: " << lokCallbackTypeToString(type)
+ << " payload: " << payload << std::endl;
}
}
More information about the Libreoffice-commits
mailing list