From 9f66db9c474f71f43d7a3667230241fd4fa4183f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 21 Jun 2016 11:29:49 +0200 Subject: 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 Tested-by: Jenkins --- sw/source/core/crsr/viscrs.cxx | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'sw/source') 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* 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); } } -- cgit