loolwsd/ChildProcessSession.cpp | 11 +++++------ loolwsd/LOKitHelper.hpp | 9 +++++++++ 2 files changed, 14 insertions(+), 6 deletions(-)
New commits: commit a58ffaef71263166ac0b8f8c9f22efc449f92adb Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Tue May 10 08:52:11 2016 -0400 loolwsd: always get and remember the doc-type on loading Change-Id: I6ba49ecd8343ff6d08ff437d6dc9d664a4becc1d Reviewed-on: https://gerrit.libreoffice.org/24849 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp index 5050dde..5ea3da6 100644 --- a/loolwsd/ChildProcessSession.cpp +++ b/loolwsd/ChildProcessSession.cpp @@ -121,12 +121,10 @@ public: assert(lokitDoc->pClass); assert(lokitDoc->pClass->getPart); - int curPart = lokitDoc->pClass->getPart(lokitDoc); - if (_session.getDocType() == "text") - { - // Text docs have a single coordinate system. - curPart = 0; - } + // Text docs have a single coordinate system. + const auto curPart = (_session.getDocType() == "text") + ? 0 + : lokitDoc->pClass->getPart(lokitDoc); StringTokenizer tokens(rPayload, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); if (tokens.count() == 4) @@ -605,6 +603,7 @@ bool ChildProcessSession::loadDocument(const char * /*buffer*/, int /*length*/, _loKitDocument->pClass->initializeForRendering(_loKitDocument, (renderOpts.empty() ? nullptr : renderOpts.c_str())); } + _docType = LOKitHelper::getDocumentTypeAsString(_loKitDocument); if (_docType != "text" && part != -1) { _loKitDocument->pClass->setPart(_loKitDocument, part); diff --git a/loolwsd/LOKitHelper.hpp b/loolwsd/LOKitHelper.hpp index 62d89e9..cfc3fec 100644 --- a/loolwsd/LOKitHelper.hpp +++ b/loolwsd/LOKitHelper.hpp @@ -38,6 +38,14 @@ namespace LOKitHelper } inline + std::string getDocumentTypeAsString(LibreOfficeKitDocument *loKitDocument) + { + assert(loKitDocument && "null loKitDocument"); + const auto type = static_cast<LibreOfficeKitDocumentType>(loKitDocument->pClass->getDocumentType(loKitDocument)); + return documentTypeToString(type); + } + + inline std::string kitCallbackTypeToString(const int nType) { // Keep in the same order as in LibreOfficeKitEnums.h @@ -99,6 +107,7 @@ namespace LOKitHelper inline std::string documentStatus(LibreOfficeKitDocument *loKitDocument) { + assert(loKitDocument && "null loKitDocument"); const auto type = static_cast<LibreOfficeKitDocumentType>(loKitDocument->pClass->getDocumentType(loKitDocument)); const auto parts = loKitDocument->pClass->getParts(loKitDocument); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits