summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-02 17:32:04 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-02 21:00:35 +0200
commit3093c638db9aa01d231131f80b449a9fb9187b97 (patch)
tree83c3278bbf7af727c7aabd6d984a28017d8e22fa
parent3fd4c40a8706de03a56b152385551a3a9159f563 (diff)
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 <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 1e1eb87f36095acefe73579448ceef8442beba5f)
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx4
-rw-r--r--chart2/source/controller/inc/DrawViewWrapper.hxx2
-rw-r--r--include/svx/svddrgv.hxx2
-rw-r--r--include/svx/svdmrkv.hxx4
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx11
-rw-r--r--sd/source/ui/inc/ViewShellBase.hxx2
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx19
-rw-r--r--svx/source/engine3d/view3d.cxx2
-rw-r--r--svx/source/svdraw/svddrgv.cxx8
-rw-r--r--svx/source/svdraw/svdmrkv.cxx21
-rw-r--r--svx/source/svdraw/svdmrkv1.cxx2
11 files changed, 58 insertions, 19 deletions
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 1166959499cd..a5c59583d44e 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -164,12 +164,12 @@ SdrPageView* DrawViewWrapper::GetPageView() const
return pSdrPageView;
};
-void DrawViewWrapper::SetMarkHandles()
+void DrawViewWrapper::SetMarkHandles(SfxViewShell* pOtherShell)
{
if( m_pMarkHandleProvider && m_pMarkHandleProvider->getMarkHandles( maHdlList ) )
return;
else
- SdrView::SetMarkHandles();
+ SdrView::SetMarkHandles(pOtherShell);
}
SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const
diff --git a/chart2/source/controller/inc/DrawViewWrapper.hxx b/chart2/source/controller/inc/DrawViewWrapper.hxx
index 7e9853abe58e..4cb9274e5b8e 100644
--- a/chart2/source/controller/inc/DrawViewWrapper.hxx
+++ b/chart2/source/controller/inc/DrawViewWrapper.hxx
@@ -56,7 +56,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel );
//fill list of selection handles 'aHdl'
- virtual void SetMarkHandles() override;
+ virtual void SetMarkHandles(SfxViewShell* pOtherShell) override;
SdrPageView* GetPageView() const;
diff --git a/include/svx/svddrgv.hxx b/include/svx/svddrgv.hxx
index 91fd524a6702..0a4dfb628923 100644
--- a/include/svx/svddrgv.hxx
+++ b/include/svx/svddrgv.hxx
@@ -67,7 +67,7 @@ private:
SVX_DLLPRIVATE void ImpClearVars();
protected:
- virtual void SetMarkHandles() override;
+ virtual void SetMarkHandles(SfxViewShell* pOtherShell) override;
void ShowDragObj();
void HideDragObj();
bool ImpBegInsObjPoint(bool bIdxZwang, sal_uInt32 nIdx, const Point& rPnt, bool bNewObj, OutputDevice* pOut);
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 2706f771cee4..d6bc8ebaa42e 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -150,7 +150,7 @@ private:
protected:
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
virtual void ModelHasChanged() override; // Is called by the PaintView
- virtual void SetMarkHandles(); // maHdlList - fill (List of handles)
+ virtual void SetMarkHandles(SfxViewShell* pOtherShell); // maHdlList - fill (List of handles)
void SetMarkRects(); // Rects at the PageViews
void CheckMarked(); // Scan MarkList after Del and Lock Layer ...
void AddDragModeHdl(SdrDragMode eMode);
@@ -417,7 +417,7 @@ public:
// AdjustMarkHdl is just called in case of changes; usually this causes an Invalidate
// At the end of a redraw the handles are drawn automatically.
// The purpose is to avoid unnecessary flickering. -> This does not yet work, that's why sal_True!
- void AdjustMarkHdl(); //HMHBOOL bRestraintPaint=sal_True);
+ void AdjustMarkHdl(SfxViewShell* pOtherShell = nullptr); //HMHBOOL bRestraintPaint=sal_True);
const Rectangle& GetMarkedObjRect() const; // SnapRects of Objects, without line width
Rectangle GetMarkedObjBoundRect() const; // incl. line width, overlapping rags, ...
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 45b1034f5088..e9208a74bad3 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1114,7 +1114,6 @@ void SdTiledRenderingTest::testCreateViewGraphicSelection()
// Load a document and register a callback.
SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
- pXImpressDocument->initializeForTiledRendering({});
ViewCallback aView1;
SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
@@ -1130,10 +1129,20 @@ void SdTiledRenderingTest::testCreateViewGraphicSelection()
// Now create a new view.
aView1.m_bGraphicSelectionInvalidated = false;
SfxLokHelper::createView();
+ pXImpressDocument->initializeForTiledRendering({});
// This failed, creating a new view affected the graphic selection of an
// existing view.
CPPUNIT_ASSERT(!aView1.m_bGraphicSelectionInvalidated);
+ // Check that when the first view has a shape selected and we register a
+ // callback on the second view, then it gets a "graphic view selection".
+ ViewCallback aView2;
+ aView2.m_bGraphicViewSelectionInvalidated = false;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+ // This failed, the created new view had no "view selection" of the first
+ // view's selected shape.
+ CPPUNIT_ASSERT(aView2.m_bGraphicViewSelectionInvalidated);
+
mxComponent->dispose();
mxComponent.clear();
comphelper::LibreOfficeKit::setActive(false);
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
index 22489f114a46..6932e28bb9dd 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -222,6 +222,8 @@ public:
OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) const;
/// See SfxViewShell::getPart().
int getPart() const override;
+ /// See SfxViewShell::NotifyCursor().
+ void NotifyCursor(SfxViewShell* pViewShell) const override;
protected:
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 5f4ba544c104..94a41f82341c 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -88,6 +88,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include "fubullet.hxx"
+#include "drawview.hxx"
using namespace sd;
#define ViewShellBase
@@ -1045,6 +1046,24 @@ int ViewShellBase::getPart() const
return 0;
}
+void ViewShellBase::NotifyCursor(SfxViewShell* pOtherShell) const
+{
+ ViewShell* pThisShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this))->GetViewShell(FrameworkHelper::msCenterPaneURL).get();
+
+ DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pThisShell);
+ if (!pDrawViewShell)
+ return;
+
+ if (this == pOtherShell)
+ return;
+
+ DrawView* pDrawView = pDrawViewShell->GetDrawView();
+ if (!pDrawView)
+ return;
+
+ pDrawView->AdjustMarkHdl(pOtherShell);
+}
+
//===== ViewShellBase::Implementation =========================================
ViewShellBase::Implementation::Implementation (ViewShellBase& rBase)
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index e17bdbfa5a15..64dc1b82efff 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -1416,7 +1416,7 @@ void E3dView::Start3DCreation()
maRef2.Y() = nY2;
// Turn on marks
- SetMarkHandles();
+ SetMarkHandles(nullptr);
//HMHif (bVis) ShowMarkHdl();
if (AreObjectsMarked()) MarkListHasChanged();
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();
}
}