[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - bundled/include kit/Kit.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Mar 4 14:37:08 UTC 2019
bundled/include/LibreOfficeKit/LibreOfficeKit.h | 3 +++
bundled/include/LibreOfficeKit/LibreOfficeKit.hxx | 10 +++++++---
kit/Kit.cpp | 12 ++++++------
3 files changed, 16 insertions(+), 9 deletions(-)
New commits:
commit 3763202dff87f27080b77fd3c8504701bf3739d0
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Thu Jan 24 06:53:37 2019 -0500
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 4 15:36:48 2019 +0100
wsd: set the language when creating a new view
This uses the new createViewWithOptions API to
set the language of the user at the point of
creating a new view.
Change-Id: Ibf3e0af1b0cc300126388c1217692d8d969be0f3
Reviewed-on: https://gerrit.libreoffice.org/68288
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
index 2df1cea6d..fe1b25bc3 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
@@ -360,6 +360,9 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::renderShapeSelection
size_t (*renderShapeSelection)(LibreOfficeKitDocument* pThis, char** pOutput);
+ /// @see lok::Document::createViewWithOptions().
+ int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions);
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
index 31e95a09c..72824be0f 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -440,13 +440,17 @@ public:
}
/**
- * Create a new view for an existing document.
+ * Create a new view for an existing document with
+ * options similar to documentLoadWithOptions.
* By default a loaded document has 1 view.
* @return the ID of the new view.
*/
- int createView()
+ int createView(const char* pOptions = nullptr)
{
- return mpDoc->pClass->createView(mpDoc);
+ if (LIBREOFFICEKIT_DOCUMENT_HAS(mpDoc, createViewWithOptions))
+ return mpDoc->pClass->createViewWithOptions(mpDoc, pOptions);
+ else
+ return mpDoc->pClass->createView(mpDoc);
}
/**
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index a91514ed4..23df2bc9e 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1644,6 +1644,10 @@ private:
{
const std::string sessionId = session->getId();
+ std::string options;
+ if (!lang.empty())
+ options = "Language=" + lang;
+
std::unique_lock<std::mutex> lock(_documentMutex);
if (!_loKitDocument)
@@ -1667,10 +1671,6 @@ private:
_jailedUrl = uri;
_isDocPasswordProtected = false;
- std::string options;
- if (!lang.empty())
- options = "Language=" + lang;
-
LOG_DBG("Calling lokit::documentLoad(" << uriAnonym << ", \"" << options << "\").");
Timestamp timestamp;
_loKitDocument.reset(_loKit->documentLoad(uri.c_str(), options.c_str()));
@@ -1735,8 +1735,8 @@ private:
}
}
- LOG_INF("Creating view to url [" << uriAnonym << "] for session [" << sessionId << "].");
- _loKitDocument->createView();
+ LOG_INF("Creating view to url [" << uriAnonym << "] for session [" << sessionId << "] with " << options << '.');
+ _loKitDocument->createView(options.c_str());
LOG_TRC("View to url [" << uriAnonym << "] created.");
}
More information about the Libreoffice-commits
mailing list