summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/lib/init.cxx21
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx4
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitGtk.h5
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitInit.h10
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx3
5 files changed, 30 insertions, 13 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b58f23e14691..0f46a04621dc 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1816,7 +1816,7 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit:
}
}
-static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfilePath)
+static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfileUrl)
{
enum {
PRE_INIT, // setup shared data in master process
@@ -1849,8 +1849,23 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
if (eStage != PRE_INIT)
comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib);
- if (eStage != SECOND_INIT && pUserProfilePath)
- rtl::Bootstrap::set("UserInstallation", OUString(pUserProfilePath, strlen(pUserProfilePath), RTL_TEXTENCODING_UTF8));
+ if (eStage != SECOND_INIT && pUserProfileUrl)
+ {
+ OUString url(
+ pUserProfileUrl, strlen(pUserProfileUrl), RTL_TEXTENCODING_UTF8);
+ OUString path;
+ if (url.startsWithIgnoreAsciiCase("vnd.sun.star.pathname:", &path))
+ {
+ OUString url2;
+ osl::FileBase::RC e = osl::FileBase::getFileURLFromSystemPath(
+ path, url2);
+ if (e == osl::FileBase::E_None)
+ url = url2;
+ else
+ SAL_WARN("lok", "resolving <" << url << "> failed with " << +e);
+ }
+ rtl::Bootstrap::set("UserInstallation", url);
+ }
OUString aAppPath;
if (pAppPath)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 9e18df07dbd2..44e321f25419 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -523,9 +523,9 @@ public:
};
/// Factory method to create a lok::Office instance.
-inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfilePath = NULL)
+inline Office* lok_cpp_init(const char* pInstallPath, const char* pUserProfileUrl = NULL)
{
- LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfilePath);
+ LibreOfficeKit* pThis = lok_init_2(pInstallPath, pUserProfileUrl);
if (pThis == NULL || pThis->pClass->nSize == 0)
return NULL;
return new ::lok::Office(pThis);
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 8a64bffd5844..a0082be72e27 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -58,8 +58,9 @@ GtkWidget* lok_doc_view_new (const gchar*
* lok_doc_view_new_from_user_profile:
* @pPath: (nullable): LibreOffice install path. Pass null to set it to default
* path which in most cases would be $libdir/libreoffice/program
- * @pUserProfile: (nullable): User profile URL. Pass non-null to be able to
- * use this widget and LibreOffice itself in parallel.
+ * @pUserProfile: (nullable): User profile URL. Must be either a file URL or a
+ * special vnd.sun.star.pathname URL. Pass non-null to be able to use this
+ * widget and LibreOffice itself in parallel.
* @cancellable: The cancellable object that you can use to cancel this
* operation.
* @error: The error that will be set if the object fails to initialize.
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index f1e513e213fc..bdda6422e05c 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -212,11 +212,11 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib )
typedef LibreOfficeKit *(LokHookFunction)( const char *install_path);
-typedef LibreOfficeKit *(LokHookFunction2)( const char *install_path, const char *user_profile_path );
+typedef LibreOfficeKit *(LokHookFunction2)( const char *install_path, const char *user_profile_url );
-typedef int (LokHookPreInit) ( const char *install_path, const char *user_profile_path );
+typedef int (LokHookPreInit) ( const char *install_path, const char *user_profile_url );
-static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_profile_path )
+static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_profile_url )
{
char *imp_lib;
void *dlhandle;
@@ -230,7 +230,7 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p
pSym2 = (LokHookFunction2 *) lok_dlsym(dlhandle, "libreofficekit_hook_2");
if (!pSym2)
{
- if (user_profile_path != NULL)
+ if (user_profile_url != NULL)
{
fprintf( stderr, "the LibreOffice version in '%s' does not support passing a user profile to the hook function\n",
imp_lib );
@@ -255,7 +255,7 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p
free( imp_lib );
// dlhandle is "leaked"
// coverity[leaked_storage]
- return pSym2( install_path, user_profile_path );
+ return pSym2( install_path, user_profile_url );
}
static
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index b3079a7bbdd4..8a3099ebd8ad 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -535,7 +535,8 @@ static void createModelAndView(const char* pLOPath, const char* pDocPath, const
{
const std::string& rArgument = rArguments[i];
if (rArgument == "--user-profile" && i + 1 < rArguments.size())
- aUserProfile = std::string("file://") + rArguments[i + 1].c_str();
+ aUserProfile = std::string("vnd.sun.star.pathname:")
+ + rArguments[i + 1].c_str();
}
const gchar* pUserProfile = aUserProfile.empty() ? nullptr : aUserProfile.c_str();
GtkWidget* pDocView = lok_doc_view_new_from_user_profile(pLOPath, pUserProfile, nullptr, nullptr);