diff options
author | Tor Lillqvist <tml@collabora.com> | 2015-04-08 22:44:29 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2015-04-08 23:20:26 +0300 |
commit | 5cc0da153e8516a11bbd3e5809e8dcaf0b0dc7d9 (patch) | |
tree | 8cded50f376884a5e3f3f125e72fc2c4263ec160 /desktop | |
parent | 69b505553331480c0ab97e3776ba31ef11e649a3 (diff) |
Add lok_init_2() that takes also the path to a user profile to use
In some LibreOfficeKit use cases it will be useful to use a separate
(initially empty) user profile each time, instead of whatever the default
might turn out to be. (When using the "instdir" of a LibreOffice build tree,
the user profile is the "instdir/user" directory.)
Also add a corresponding new function to be looked up, libreofficekit_hook_2.
I did not bother with any more descriptive name. After all, "lok_init" already
is quite terse, so calling the new function "lok_init_with_user_profile" or
something similarly verbose would in my humble opinion have been
inconsistent. (And if/when we need to extend the LibreOfficeKit initialisation
function with even more parameters, the name would become really long.) But
feel free to change this if you feel like it...
Make sure to stay backward-compatible with source code calling lok_init() and
with binaries looking for only the libreofficekit_hook entry point.
Change-Id: Ifa9ce8f72c2f60554fb3431d522e5784afa8d8d3
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 94c95edc515e..186f60bf29f3 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -268,7 +268,7 @@ static void doc_destroy(LibreOfficeKitDocument *pThis) } static void lo_destroy (LibreOfficeKit* pThis); -static int lo_initialize (LibreOfficeKit* pThis, const char* pInstallPath); +static int lo_initialize (LibreOfficeKit* pThis, const char* pInstallPath, const char* pUserProfilePath); static LibreOfficeKitDocument* lo_documentLoad (LibreOfficeKit* pThis, const char* pURL); static char * lo_getError (LibreOfficeKit* pThis); static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThis, @@ -839,7 +839,7 @@ static void lo_startmain(void*) static bool bInitialized = false; -static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) +static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfilePath) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); @@ -848,6 +848,9 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) comphelper::LibreOfficeKit::setActive(); + if (pUserProfilePath) + rtl::Bootstrap::set(OUString("UserInstallation"), OUString(pUserProfilePath, strlen(pUserProfilePath), RTL_TEXTENCODING_UTF8)); + OUString aAppPath; if (pAppPath) { @@ -947,14 +950,14 @@ __attribute__ ((visibility("default"))) #else SAL_DLLPUBLIC_EXPORT #endif -LibreOfficeKit *libreofficekit_hook(const char* install_path) +LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user_profile_path) { if (!gImpl) { SAL_INFO("lok", "Create libreoffice object"); gImpl = new LibLibreOffice_Impl(); - if (!lo_initialize(gImpl, install_path)) + if (!lo_initialize(gImpl, install_path, user_profile_path)) { lo_destroy(gImpl); } @@ -962,6 +965,16 @@ LibreOfficeKit *libreofficekit_hook(const char* install_path) return static_cast<LibreOfficeKit*>(gImpl); } +#if defined(__GNUC__) && defined(HAVE_GCC_VISIBILITY_FEATURE) && defined(DISABLE_DYNLOADING) +__attribute__ ((visibility("default"))) +#else +SAL_DLLPUBLIC_EXPORT +#endif +LibreOfficeKit *libreofficekit_hook(const char* install_path) +{ + return libreofficekit_hook_2(install_path, NULL); +} + static void lo_destroy(LibreOfficeKit* pThis) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); |