summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-03-12 14:59:59 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-16 09:38:09 +0100
commit00b758b40a23d715e4eb1cf8f62c901cd8c41249 (patch)
tree038f9eee73eed2b353f119030cba293800a1b016 /desktop
parenta250e9d3ecf899796e7cfbdd2266e494353580c0 (diff)
LOK: Implement posting of .uno: commands.
Implements also Bold button as an example in the gtktiledviewer. Change-Id: I3b07d51165f28534aadbb4673f964ec10d5fc6ef
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ee986c515722..eff82b64a78f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -27,6 +27,7 @@
#include <rtl/strbuf.hxx>
#include <rtl/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/dispatchcommand.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -213,6 +214,8 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* pThis,
int nX,
int nY,
int nCount);
+static void doc_postUnoCommand(LibreOfficeKitDocument* pThis,
+ const char* pCommand);
static void doc_setTextSelection (LibreOfficeKitDocument* pThis,
int nType,
int nX,
@@ -251,6 +254,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
m_pDocumentClass->registerCallback = doc_registerCallback;
m_pDocumentClass->postKeyEvent = doc_postKeyEvent;
m_pDocumentClass->postMouseEvent = doc_postMouseEvent;
+ m_pDocumentClass->postUnoCommand = doc_postUnoCommand;
m_pDocumentClass->setTextSelection = doc_setTextSelection;
m_pDocumentClass->setGraphicSelection = doc_setGraphicSelection;
m_pDocumentClass->resetSelection = doc_resetSelection;
@@ -723,6 +727,16 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* /*pThis*/, int nType, int n
#endif
}
+static void doc_postUnoCommand(LibreOfficeKitDocument* /*pThis*/, const char* pCommand)
+{
+ OUString aCommand(pCommand, strlen(pCommand), RTL_TEXTENCODING_UTF8);
+
+ if (!comphelper::dispatchCommand(aCommand))
+ {
+ gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command";
+ }
+}
+
static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount)
{
ITiledRenderable* pDoc = getTiledRenderable(pThis);