summaryrefslogtreecommitdiff
path: root/desktop/source/lib/init.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/lib/init.cxx')
-rw-r--r--desktop/source/lib/init.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6c05f815f008..eed7831eaf54 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -41,6 +41,7 @@
#include <vcl/graphicfilter.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <unotools/mediadescriptor.hxx>
+#include <osl/module.hxx>
using namespace css;
using namespace utl;
@@ -207,7 +208,6 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
m_pOfficeClass->nSize = sizeof(LibreOfficeKitClass);
m_pOfficeClass->destroy = lo_destroy;
- m_pOfficeClass->initialize = lo_initialize;
m_pOfficeClass->documentLoad = lo_documentLoad;
m_pOfficeClass->getError = lo_getError;
@@ -411,7 +411,17 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
if (!pAppPath)
return 0;
- OUString aAppPath(pAppPath, strlen(pAppPath), RTL_TEXTENCODING_UTF8);
+ OUString aAppPath;
+ if (pAppPath)
+ {
+ aAppPath = OUString(pAppPath, strlen(pAppPath), RTL_TEXTENCODING_UTF8);
+ }
+ else
+ {
+ ::osl::Module::getUrlFromAddress( reinterpret_cast< oslGenericFunction >(lo_initialize),
+ aAppPath);
+ }
+
OUString aAppURL;
if (osl::FileBase::getFileURLFromSystemPath(aAppPath, aAppURL) != osl::FileBase::E_None)
return 0;
@@ -440,12 +450,16 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
return bInitialized;
}
-SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(void)
+SAL_DLLPUBLIC_EXPORT LibreOfficeKit *libreofficekit_hook(const char* install_path)
{
if (!gImpl)
{
fprintf(stderr, "create libreoffice object\n");
gImpl = new LibLibreOffice_Impl();
+ if (!lo_initialize(gImpl, install_path))
+ {
+ lo_destroy(gImpl);
+ }
}
return static_cast<LibreOfficeKit*>(gImpl);
}