diff options
author | TheRock Builder <libo@therock> | 2022-04-28 14:19:46 +0000 |
---|---|---|
committer | TheRock Builder <libo@therock> | 2022-04-28 14:42:15 +0000 |
commit | d78960d442ae16d453ef09e000df754a8073e940 (patch) | |
tree | 17a8feb4307bfe284c65bd357875a55ea3100094 | |
parent | fc8d54cd011e17c03f39229c3c2ddf161c874bee (diff) |
Hack lokit API to be useable from JSfeature/wasm
So LOWA users/embeddings can call uno slots
-rw-r--r-- | desktop/source/lib/init.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2086f531b6a8..aa7abbf64d32 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1031,7 +1031,7 @@ static void doc_postWindowGestureEvent(LibreOfficeKitDocument* pThis, int nX, int nY, int nOffset); -static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, +void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished); @@ -4123,7 +4123,7 @@ static void lo_setOption(LibreOfficeKit* /*pThis*/, const char *pOption, const c } } -static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished) +void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished) { comphelper::ProfileZone aZone("doc_postUnoCommand"); @@ -6804,9 +6804,19 @@ LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user } SAL_JNI_EXPORT -LibreOfficeKit *libreofficekit_hook(const char* install_path) +LibreOfficeKitDocument *libreofficekit_hook(const char*) { - return libreofficekit_hook_2(install_path, nullptr); + if (!gImpl) + { + gImpl = new LibLibreOffice_Impl(); + xContext.set( ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW ); + } + + uno::Reference<frame::XDesktop> xDesktop = frame::Desktop::create(xContext); + uno::Reference<lang::XComponent> xComponent = xDesktop->getCurrentComponent(); + LibLODocument_Impl* pDocument = new LibLODocument_Impl(xComponent, 0); + + return pDocument; } SAL_JNI_EXPORT |