summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2020-05-06 14:33:10 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2020-05-08 22:42:35 +0200
commit36508d0110248f6683757602cd1668547dbfb253 (patch)
tree778f624fa5dbab2da79d9762b3f6895024a76a1a /desktop/source
parent4259509aa4f11cbcd63299bd17a4503ebdc22fc0 (diff)
lok: MSForms: Handle event about item selection of a drop-down field.
Change-Id: I095013097348c98361b6614e4ddf1e9029923c7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93659 Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/init.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ccd32a035ff5..c7763b608a28 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1137,6 +1137,10 @@ static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowI
const int nWidth, const int nHeight);
static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex);
+
+
+static void doc_sendFormFieldEvent(LibreOfficeKitDocument* pThis,
+ const char* pArguments);
} // extern "C"
namespace {
@@ -1252,6 +1256,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->createViewWithOptions = doc_createViewWithOptions;
m_pDocumentClass->completeFunction = doc_completeFunction;
+ m_pDocumentClass->sendFormFieldEvent = doc_sendFormFieldEvent;
+
gDocumentClass = m_pDocumentClass;
}
pClass = m_pDocumentClass.get();
@@ -5412,6 +5418,33 @@ static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex)
pDoc->completeFunction(nIndex);
}
+
+static void doc_sendFormFieldEvent(LibreOfficeKitDocument* pThis, const char* pArguments)
+{
+ SolarMutexGuard aGuard;
+
+ // Supported in Writer only
+ if (doc_getDocumentType(pThis) != LOK_DOCTYPE_TEXT)
+ return;
+
+ StringMap aMap(jsonToStringMap(pArguments));
+ ITiledRenderable* pDoc = getTiledRenderable(pThis);
+ if (!pDoc)
+ {
+ SetLastExceptionMsg("Document doesn't support tiled rendering!");
+ return;
+ }
+
+ // Sanity check
+ if (aMap.find("type") == aMap.end() || aMap.find("cmd") == aMap.end())
+ {
+ SetLastExceptionMsg("Wrong arguments for sendFormFieldEvent!");
+ return;
+ }
+
+ pDoc->executeFromFieldEvent(aMap);
+}
+
static char* lo_getError (LibreOfficeKit *pThis)
{
comphelper::ProfileZone aZone("lo_getError");