summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-20 16:42:34 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-20 15:12:54 +0000
commitc544a8b674dd7ac9dd466a84a440ede030942438 (patch)
tree3da18d0b6717c9f50edc1c157c9f5d77b2d0e0a3 /sw/source
parent55bd0ac154a7118f7cce48ffd1e44a48d9099413 (diff)
sw lok: add LOK_CALLBACK_INVALIDATE_VIEW_CURSOR
So a view can be aware where cursors of other views are. Change-Id: I6133fb55aa2869843c0284b7d76264bab3b3d5da Reviewed-on: https://gerrit.libreoffice.org/26513 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/viscrs.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 30f6f8f60c4e..d4cc5061d80f 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -52,9 +52,11 @@
#include <overlayrangesoutline.hxx>
#include <memory>
+#include <boost/property_tree/json_parser.hpp>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
+#include <sfx2/lokhelper.hxx>
#include <comphelper/string.hxx>
#include <paintfrm.hxx>
@@ -196,6 +198,26 @@ void SwVisibleCursor::SetPosAndShow()
Rectangle aSVRect(aRect.Pos().getX(), aRect.Pos().getY(), aRect.Pos().getX() + aRect.SSize().Width(), aRect.Pos().getY() + aRect.SSize().Height());
OString sRect = aSVRect.toString();
m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr());
+
+ if (SfxLokHelper::getViews() > 1)
+ {
+ // Notify other views about the invalidated cursor.
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ if (pViewShell != m_pCursorShell->GetSfxViewShell())
+ {
+ boost::property_tree::ptree aTree;
+ aTree.put("viewId", SfxLokHelper::getView(m_pCursorShell->GetSfxViewShell()));
+ aTree.put("rectangle", sRect.getStr());
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTree);
+ OString aPayload = aStream.str().c_str();
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, aPayload.getStr());
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
}
if ( !m_pCursorShell->IsCursorReadonly() || m_pCursorShell->GetViewOptions()->IsSelectionInReadonly() )