summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-21 11:29:49 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-21 11:17:10 +0000
commit9f66db9c474f71f43d7a3667230241fd4fa4183f (patch)
tree858e2948669d573d3c54352ae5dcc3e6c217cb0f /sw/source
parent46bf504e0384d7491b9543604e594228c64318a1 (diff)
sw lok: add LOK_CALLBACK_TEXT_VIEW_SELECTION
So a view can be aware where selections of other views are. Change-Id: I5026b1ff2b99a4eedfd0bde32a05ceb8e2f424bc Reviewed-on: https://gerrit.libreoffice.org/26542 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.cxx23
1 files changed, 3 insertions, 20 deletions
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index d4cc5061d80f..1ba80d929267 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -198,26 +198,7 @@ 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);
- }
- }
+ SfxLokHelper::notifyOtherViews(m_pCursorShell->GetSfxViewShell(), LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", sRect);
}
if ( !m_pCursorShell->IsCursorReadonly() || m_pCursorShell->GetViewOptions()->IsSelectionInReadonly() )
@@ -417,6 +398,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
if (!pSelectionRectangles)
{
GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+ SfxLokHelper::notifyOtherViews(GetShell()->GetSfxViewShell(), LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect);
}
else
pSelectionRectangles->push_back(sRect);
@@ -624,6 +606,7 @@ void SwShellCursor::Show()
}
OString sRect = comphelper::string::join("; ", aRect);
GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+ SfxLokHelper::notifyOtherViews(GetShell()->GetSfxViewShell(), LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect);
}
}