[Libreoffice-commits] online.git: bundled/include kit/Kit.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Apr 23 01:44:27 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 83a73e24e0c8fb622e721b40fdde273ea003a195
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Thu Jan 24 06:53:37 2019 -0500
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Apr 23 03:44:07 2019 +0200
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/67501
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
index f2c8dd40f..62bd3c429 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKit.h
@@ -375,6 +375,9 @@ struct _LibreOfficeKitDocumentClass
int nY,
int nOffset);
+ /// @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 6bebf3661..7027298a1 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 759e78e24..25050e04b 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1571,6 +1571,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)
@@ -1594,10 +1598,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()));
@@ -1666,8 +1666,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