[Libreoffice-commits] core.git: desktop/inc desktop/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Jun 9 13:17:45 UTC 2016
desktop/inc/lib/init.hxx | 2 +-
desktop/source/lib/init.cxx | 23 ++++++++++++++---------
desktop/source/lib/lokinteractionhandler.cxx | 7 +++++--
3 files changed, 20 insertions(+), 12 deletions(-)
New commits:
commit d368560882e8a4567f3328ce877b6e5242d18620
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jun 9 14:17:57 2016 +0200
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 at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 3a5c5b7..2f18223 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 caa6cd2..051362d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1264,7 +1264,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.
@@ -1291,7 +1292,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*/)
@@ -1333,14 +1334,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
{
@@ -1351,7 +1354,7 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
return;
}
- pDoc->registerCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandler.get());
+ pDoc->registerCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandlers[nView].get());
}
}
@@ -1433,10 +1436,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));
@@ -1468,9 +1472,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 bb1b495..76a7e84 100644
--- a/desktop/source/lib/lokinteractionhandler.cxx
+++ b/desktop/source/lib/lokinteractionhandler.cxx
@@ -38,6 +38,8 @@
#include <../../inc/lib/init.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <sfx2/lokhelper.hxx>
+#include <comphelper/lok.hxx>
using namespace com::sun::star;
@@ -114,8 +116,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);
}
More information about the Libreoffice-commits
mailing list