diff options
author | TheRock Builder <libo@therock> | 2022-04-28 14:19:46 +0000 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2023-11-19 18:15:50 +0100 |
commit | 664dca306f5d72fa4ca35c74cdaef47947e1b1fe (patch) | |
tree | 3ee11bc652b2cd32cd655469568aff479a4935b7 | |
parent | 2816c35771d2b82f7f774374e440ebef472df911 (diff) |
Hack lokit API to be useable from JS
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 66075e3312d9..b23505845bd5 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1175,7 +1175,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); @@ -5046,7 +5046,7 @@ void LibLibreOffice_Impl::dumpState(rtl::OStringBuffer &rState) vcl::lok::dumpState(rState); } -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"); @@ -8071,9 +8071,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 |