summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-09 14:17:57 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-07-12 22:06:17 -0400
commit2a0a6d65b53e4863b30c84330a0e8367e52b2609 (patch)
tree6d7946ece4aa1f77ad982b709cfeed92527298cb /desktop
parent8e9799f4fb8bf4e98971c0b45dd5a1aa1b23d7c5 (diff)
desktop lok: implement per-view CallbackFlushHandler
With this, per-view cursor callbacks work again, as they did after commit 32f419fee5f9df4facb7a9b3ec910471d2a20247 (sw: implement per-view LOK_CALLBACK_CURSOR_VISIBLE, 2015-09-18). Change-Id: Ic589276f99164a1a8d46f7a029d1a59ab6e971f3 Reviewed-on: https://gerrit.libreoffice.org/26102 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit d368560882e8a4567f3328ce877b6e5242d18620)
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/lib/init.hxx2
-rw-r--r--desktop/source/lib/init.cxx23
-rw-r--r--desktop/source/lib/lokinteractionhandler.cxx7
3 files changed, 20 insertions, 12 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 3a5c5b7333c9..2f18223793cc 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -54,7 +54,7 @@ namespace desktop {
{
css::uno::Reference<css::lang::XComponent> mxComponent;
std::shared_ptr< LibreOfficeKitDocumentClass > m_pDocumentClass;
- std::shared_ptr<CallbackFlushHandler> mpCallbackFlushHandler;
+ std::map<size_t, std::shared_ptr<CallbackFlushHandler>> mpCallbackFlushHandlers;
explicit LibLODocument_Impl(const css::uno::Reference <css::lang::XComponent> &xComponent);
~LibLODocument_Impl();
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7c1e34ae10b2..95e4e705d776 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1301,7 +1301,8 @@ void doc_paintPartTile(LibreOfficeKitDocument* pThis,
// Disable callbacks while we are painting.
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
- pDocument->mpCallbackFlushHandler->setPartTilePainting(true);
+ std::size_t nView = SfxLokHelper::getView();
+ pDocument->mpCallbackFlushHandlers[nView]->setPartTilePainting(true);
try
{
// Text documents have a single coordinate system; don't change part.
@@ -1328,7 +1329,7 @@ void doc_paintPartTile(LibreOfficeKitDocument* pThis,
// Nothing to do but restore the PartTilePainting flag.
}
- pDocument->mpCallbackFlushHandler->setPartTilePainting(false);
+ pDocument->mpCallbackFlushHandlers[nView]->setPartTilePainting(false);
}
static int doc_getTileMode(LibreOfficeKitDocument* /*pThis*/)
@@ -1370,14 +1371,16 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
LibreOfficeKitCallback pCallback,
void* pData)
{
+ SolarMutexGuard aGuard;
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
- pDocument->mpCallbackFlushHandler.reset(new CallbackFlushHandler(pCallback, pData));
+ std::size_t nView = comphelper::LibreOfficeKit::isViewCallback() ? SfxLokHelper::getView() : 0;
+ pDocument->mpCallbackFlushHandlers[nView].reset(new CallbackFlushHandler(pCallback, pData));
if (comphelper::LibreOfficeKit::isViewCallback())
{
if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell())
- pViewShell->registerLibreOfficeKitViewCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandler.get());
+ pViewShell->registerLibreOfficeKitViewCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandlers[nView].get());
}
else
{
@@ -1388,7 +1391,7 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
return;
}
- pDoc->registerCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandler.get());
+ pDoc->registerCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandlers[nView].get());
}
}
@@ -1469,10 +1472,11 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
bool bResult = false;
- if (bNotifyWhenFinished && pDocument->mpCallbackFlushHandler)
+ std::size_t nView = comphelper::LibreOfficeKit::isViewCallback() ? SfxLokHelper::getView() : 0;
+ if (bNotifyWhenFinished && pDocument->mpCallbackFlushHandlers[nView])
{
bResult = comphelper::dispatchCommand(aCommand, comphelper::containerToSequence(aPropertyValuesVector),
- new DispatchResultListener(pCommand, pDocument->mpCallbackFlushHandler));
+ new DispatchResultListener(pCommand, pDocument->mpCallbackFlushHandlers[nView]));
}
else
bResult = comphelper::dispatchCommand(aCommand, comphelper::containerToSequence(aPropertyValuesVector));
@@ -1504,9 +1508,10 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX,
}
LibLODocument_Impl* pLib = static_cast<LibLODocument_Impl*>(pThis);
- if (pLib->mpCallbackFlushHandler)
+ std::size_t nView = comphelper::LibreOfficeKit::isViewCallback() ? SfxLokHelper::getView() : 0;
+ if (pLib->mpCallbackFlushHandlers[nView])
{
- pLib->mpCallbackFlushHandler->queue(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr());
+ pLib->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr());
}
}
diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx
index a1e55687e188..8857b3fcd830 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -39,6 +39,8 @@
#include <../../inc/lib/init.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <sfx2/lokhelper.hxx>
+#include <comphelper/lok.hxx>
using namespace com::sun::star;
@@ -115,8 +117,9 @@ void LOKInteractionHandler::postError(css::task::InteractionClassification class
std::stringstream aStream;
boost::property_tree::write_json(aStream, aTree);
- if (m_pLOKDocument && m_pLOKDocument->mpCallbackFlushHandler)
- m_pLOKDocument->mpCallbackFlushHandler->queue(LOK_CALLBACK_ERROR, aStream.str().c_str());
+ std::size_t nView = comphelper::LibreOfficeKit::isViewCallback() ? SfxLokHelper::getView() : 0;
+ if (m_pLOKDocument && m_pLOKDocument->mpCallbackFlushHandlers[nView])
+ m_pLOKDocument->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_ERROR, aStream.str().c_str());
else if (m_pLOKit->mpCallback)
m_pLOKit->mpCallback(LOK_CALLBACK_ERROR, aStream.str().c_str(), m_pLOKit->mpCallbackData);
}