From c544a8b674dd7ac9dd466a84a440ede030942438 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 20 Jun 2016 16:42:34 +0200 Subject: 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 Tested-by: Jenkins --- sw/source/core/crsr/viscrs.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sw/source') 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 #include +#include #include #include +#include #include #include @@ -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() ) -- cgit