diff options
Diffstat (limited to 'desktop/source/lib/init.cxx')
-rw-r--r-- | desktop/source/lib/init.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 50ae3a5da400..45f059a73d7d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1143,6 +1143,8 @@ static bool doc_renderSearchResult(LibreOfficeKitDocument* pThis, const char* pSearchResult, unsigned char** pBitmapBuffer, int* pWidth, int* pHeight, size_t* pByteSize); +static void doc_sendContentControlEvent(LibreOfficeKitDocument* pThis, const char* pArguments); + } // extern "C" namespace { @@ -1286,6 +1288,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->setBlockedCommandList = doc_setBlockedCommandList; + m_pDocumentClass->sendContentControlEvent = doc_sendContentControlEvent; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -6070,6 +6074,34 @@ static bool doc_renderSearchResult(LibreOfficeKitDocument* pThis, return true; } +static void doc_sendContentControlEvent(LibreOfficeKitDocument* pThis, const char* pArguments) +{ + SolarMutexGuard aGuard; + + // Supported in Writer only + if (doc_getDocumentType(pThis) != LOK_DOCTYPE_TEXT) + { + return; + } + + StringMap aMap(jsdialog::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("selected") == aMap.end()) + { + SetLastExceptionMsg("Wrong arguments for sendContentControlEvent"); + return; + } + + pDoc->executeContentControlEvent(aMap); +} + static char* lo_getError (LibreOfficeKit *pThis) { comphelper::ProfileZone aZone("lo_getError"); |