From 3093c638db9aa01d231131f80b449a9fb9187b97 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 2 Sep 2016 17:32:04 +0200 Subject: sd lok: implement SfxViewShell::NotifyCursor() API The same API is already implemented in sw and sc already, the sd implementation allows selecting a shape in one view, then creating a second view, and seeing the selection of the first view in the second view, without de-selecting and re-selecting the shape in question in the first view. Change-Id: Ia36e4772584d132f1ff6a7eb07ca4cadaa384ee9 Reviewed-on: https://gerrit.libreoffice.org/28623 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 1e1eb87f36095acefe73579448ceef8442beba5f) --- svx/source/svdraw/svddrgv.cxx | 8 ++++---- svx/source/svdraw/svdmrkv.cxx | 21 +++++++++++++++------ svx/source/svdraw/svdmrkv1.cxx | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) (limited to 'svx/source/svdraw') diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index acc28ac97c0c..0db93c0fe381 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -564,7 +564,7 @@ bool SdrDragView::EndDragObj(bool bCopy) if (mbInsPolyPoint) { - SetMarkHandles(); + SetMarkHandles(nullptr); mbInsPolyPoint=false; if( bUndo ) { @@ -611,7 +611,7 @@ void SdrDragView::BrkDragObj() mpInsPointUndo->Undo(); // delete inserted point again delete mpInsPointUndo; mpInsPointUndo=nullptr; - SetMarkHandles(); + SetMarkHandles(nullptr); mbInsPolyPoint=false; } @@ -880,12 +880,12 @@ bool SdrDragView::IsOrthoDesired() const return false; } -void SdrDragView::SetMarkHandles() +void SdrDragView::SetMarkHandles(SfxViewShell* pOtherShell) { if( mpDragHdl ) mpDragHdl = nullptr; - SdrExchangeView::SetMarkHandles(); + SdrExchangeView::SetMarkHandles(pOtherShell); } void SdrDragView::SetSolidDragging(bool bOn) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index b5c62272f549..a1533906d3b0 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -625,7 +625,7 @@ bool SdrMarkView::ImpIsFrameHandles() const return bFrmHdl; } -void SdrMarkView::SetMarkHandles() +void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) { // remember old focus handle values to search for it again const SdrHdl* pSaveOldFocusHdl = maHdlList.GetFocusHdl(); @@ -776,8 +776,17 @@ void SdrMarkView::SetMarkHandles() } if(SfxViewShell* pViewShell = GetSfxViewShell()) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelection.getStr()); - SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection); + if (pOtherShell) + // An other shell wants to know about our existing + // selection. + SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection); + else + { + // We have a new selection, so both pViewShell and the + // other views want to know about it. + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelection.getStr()); + SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection); + } } } @@ -960,7 +969,7 @@ void SdrMarkView::SetDragMode(SdrDragMode eMode) if (meDragMode==SDRDRAG_RESIZE) meDragMode=SDRDRAG_MOVE; if (meDragMode!=eMode0) { ForceRefToMarked(); - SetMarkHandles(); + SetMarkHandles(nullptr); { if (AreObjectsMarked()) MarkListHasChanged(); } @@ -2005,11 +2014,11 @@ void SdrMarkView::MarkAllObj(SdrPageView* _pPV) } } -void SdrMarkView::AdjustMarkHdl() +void SdrMarkView::AdjustMarkHdl(SfxViewShell* pOtherShell) { CheckMarked(); SetMarkRects(); - SetMarkHandles(); + SetMarkHandles(pOtherShell); } Rectangle SdrMarkView::GetMarkedObjBoundRect() const diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx index 298a12a1295a..1f8384538615 100644 --- a/svx/source/svdraw/svdmrkv1.cxx +++ b/svx/source/svdraw/svdmrkv1.cxx @@ -271,7 +271,7 @@ void SdrMarkView::SetPlusHandlesAlwaysVisible(bool bOn) ForceUndirtyMrkPnt(); if (bOn!=mbPlusHdlAlways) { mbPlusHdlAlways=bOn; - SetMarkHandles(); + SetMarkHandles(nullptr); MarkListHasChanged(); } } -- cgit v1.2.3