[Libreoffice-commits] online.git: kit/Kit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jan 2 06:00:07 UTC 2017
kit/Kit.cpp | 72 ++++++++++++++++++++++++++++++++----------------------------
1 file changed, 39 insertions(+), 33 deletions(-)
New commits:
commit 9de86cc0aefde0637dea12e78498ae08708076e5
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Dec 24 12:47:29 2016 -0500
wsd: refactor render options handling
Change-Id: I378ed6b76c236d9878c721a579c2b2296ff8144a
Reviewed-on: https://gerrit.libreoffice.org/32608
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index f654b34..c2c674e 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1179,39 +1179,7 @@ private:
LOG_TRC("View to url [" << uri << "] created.");
}
- Object::Ptr renderOptsObj;
-
- // Fill the object with renderoptions, if any
- if (!_renderOpts.empty())
- {
- Parser parser;
- Poco::Dynamic::Var var = parser.parse(_renderOpts);
- renderOptsObj = var.extract<Object::Ptr>();
- }
- else if (!userName.empty())
- {
- renderOptsObj = new Object();
- }
-
- // Append name of the user, if any, who opened the document to rendering options
- if (!userName.empty())
- {
- Object::Ptr authorObj = new Object();
- authorObj->set("type", "string");
- std::string decodedUserName;
- URI::decode(userName, decodedUserName);
- authorObj->set("value", decodedUserName);
- renderOptsObj->set(".uno:Author", authorObj);
- }
-
- std::string renderParams;
- if (renderOptsObj)
- {
- std::ostringstream ossRenderOpts;
- renderOptsObj->stringify(ossRenderOpts);
- renderParams = ossRenderOpts.str();
- }
-
+ const std::string renderParams = makeRenderParams(userName);
LOG_INF("Initializing for rendering session [" << sessionId << "] on document url [" <<
_url << "] with: [" << renderParams << "].");
@@ -1295,6 +1263,44 @@ private:
return false;
}
+ std::string makeRenderParams(const std::string& userName)
+ {
+ Object::Ptr renderOptsObj;
+
+ // Fill the object with renderoptions, if any
+ if (!_renderOpts.empty())
+ {
+ Parser parser;
+ Poco::Dynamic::Var var = parser.parse(_renderOpts);
+ renderOptsObj = var.extract<Object::Ptr>();
+ }
+ else if (!userName.empty())
+ {
+ renderOptsObj = new Object();
+ }
+
+ // Append name of the user, if any, who opened the document to rendering options
+ if (!userName.empty())
+ {
+ Object::Ptr authorObj = new Object();
+ authorObj->set("type", "string");
+ std::string decodedUserName;
+ URI::decode(userName, decodedUserName);
+ authorObj->set("value", decodedUserName);
+ renderOptsObj->set(".uno:Author", authorObj);
+ }
+
+ std::string renderParams;
+ if (renderOptsObj)
+ {
+ std::ostringstream ossRenderOpts;
+ renderOptsObj->stringify(ossRenderOpts);
+ renderParams = ossRenderOpts.str();
+ }
+
+ return renderParams;
+ }
+
void run() override
{
Util::setThreadName("lok_handler");
More information about the Libreoffice-commits
mailing list