loolwsd: correct multiview creation
Change-Id: Id6675f6410793b743aec53182a4b5756b7cffa23 Reviewed-on: https://gerrit.libreoffice.org/27272 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
8054df543a
commit
6536ba2fe2
4 changed files with 25 additions and 23 deletions
|
@ -609,7 +609,6 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, StringT
|
|||
if (_multiView)
|
||||
{
|
||||
_viewId = _loKitDocument->getView();
|
||||
_loKitDocument->initializeForRendering((renderOpts.empty() ? nullptr : renderOpts.c_str()));
|
||||
}
|
||||
|
||||
_docType = LOKitHelper::getDocumentTypeAsString(_loKitDocument->get());
|
||||
|
@ -619,7 +618,7 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, StringT
|
|||
}
|
||||
|
||||
// Respond by the document status, which has no arguments.
|
||||
Log::debug("Sending status after load.");
|
||||
Log::debug("Sending status after loading view " + std::to_string(_viewId) + ".");
|
||||
if (!getStatus(nullptr, 0))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
bool getPartPageRectangles(const char *buffer, int length);
|
||||
virtual void disconnect() override;
|
||||
|
||||
int getViewId() const { return _viewId; }
|
||||
int getViewId() const { return _viewId; }
|
||||
|
||||
const std::string& getDocType() const { return _docType; }
|
||||
|
||||
|
|
|
@ -901,26 +901,9 @@ private:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// initializeForRendering() should be called before
|
||||
// registerCallback(), as the previous creates a new view in
|
||||
// Impress.
|
||||
_loKitDocument->initializeForRendering((renderOpts.empty() ? nullptr : renderOpts.c_str()));
|
||||
|
||||
if (_multiView)
|
||||
{
|
||||
Log::info("Loading view to document from URI: [" + uri + "] for session [" + sessionId + "].");
|
||||
const auto viewId = _loKitDocument->createView();
|
||||
|
||||
_loKitDocument->registerCallback(DocumentCallback, this);
|
||||
|
||||
Log::info() << "Document [" << _url << "] view ["
|
||||
<< viewId << "] loaded, leaving "
|
||||
<< (_clientViews + 1) << " views." << Log::end;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loKitDocument->registerCallback(DocumentCallback, this);
|
||||
}
|
||||
// Only save the options on opening the document.
|
||||
// No support for changing them after opening a document.
|
||||
_renderOpts = renderOpts;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -945,6 +928,22 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
if (_multiView)
|
||||
{
|
||||
Log::info("Loading view to document from URI: [" + uri + "] for session [" + sessionId + "].");
|
||||
const auto viewId = _loKitDocument->createView();
|
||||
|
||||
Log::info() << "Document [" << _url << "] view ["
|
||||
<< viewId << "] loaded, leaving "
|
||||
<< (_clientViews + 1) << " views." << Log::end;
|
||||
}
|
||||
|
||||
// initializeForRendering() should be called before
|
||||
// registerCallback(), as the previous creates a new view in Impress.
|
||||
_loKitDocument->initializeForRendering(_renderOpts.c_str());
|
||||
|
||||
_loKitDocument->registerCallback(DocumentCallback, this);
|
||||
|
||||
return _loKitDocument;
|
||||
}
|
||||
|
||||
|
@ -956,6 +955,7 @@ private:
|
|||
const std::string _docKey;
|
||||
const std::string _url;
|
||||
std::string _jailedUrl;
|
||||
std::string _renderOpts;
|
||||
|
||||
std::shared_ptr<lok::Document> _loKitDocument;
|
||||
|
||||
|
|
|
@ -405,6 +405,7 @@ public:
|
|||
int createView()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(_mutex);
|
||||
Log::trace() << "lok::Document: createView" << Log::end;
|
||||
return _pDoc->pClass->createView(_pDoc);
|
||||
}
|
||||
|
||||
|
@ -415,6 +416,7 @@ public:
|
|||
void destroyView(int nId)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(_mutex);
|
||||
Log::trace() << "lok::Document: destroyView: " << nId << Log::end;
|
||||
_pDoc->pClass->destroyView(_pDoc, nId);
|
||||
}
|
||||
|
||||
|
@ -425,6 +427,7 @@ public:
|
|||
void setView(int nId)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(_mutex);
|
||||
Log::trace() << "lok::Document: setView: " << nId << Log::end;
|
||||
_pDoc->pClass->setView(_pDoc, nId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue