kit/Kit.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
New commits: commit a1dd40eaadfaa9e9bbfc023ff96046cb25f80830 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Fri Dec 23 16:18:10 2016 -0500 wsd: cleanup renderopts json creation and merging Change-Id: I84e49938cc390cc9e6421e79903c7a8935f9775e Reviewed-on: https://gerrit.libreoffice.org/32604 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 92a097b..32445bd 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1188,7 +1188,7 @@ private: Util::assertIsLocked(lockLokDoc); - Object::Ptr renderOptsObj = new Object(); + Object::Ptr renderOptsObj; // Fill the object with renderoptions, if any if (!_renderOpts.empty()) @@ -1197,11 +1197,14 @@ private: 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 authorContainer = new Object(); Object::Ptr authorObj = new Object(); authorObj->set("type", "string"); std::string decodedUserName; @@ -1210,15 +1213,24 @@ private: renderOptsObj->set(".uno:Author", authorObj); } - std::ostringstream ossRenderOpts; - renderOptsObj->stringify(ossRenderOpts); + std::string renderParams; + if (renderOptsObj) + { + std::ostringstream ossRenderOpts; + renderOptsObj->stringify(ossRenderOpts); + renderParams = ossRenderOpts.str(); + } + + LOG_INF("Initializing for rendering session [" << sessionId << "] on document url [" << + _url << "] with: [" << renderParams << "]."); // initializeForRendering() should be called before // registerCallback(), as the previous creates a new view in Impress. - _loKitDocument->initializeForRendering(ossRenderOpts.str().c_str()); + _loKitDocument->initializeForRendering(renderParams.c_str()); const int viewId = _loKitDocument->getView(); session->setViewId(viewId); + _viewIdToCallbackDescr.emplace(viewId, std::unique_ptr<CallbackDescriptor>(new CallbackDescriptor({ this, viewId }))); _loKitDocument->registerCallback(ViewCallback, _viewIdToCallbackDescr[viewId].get()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits