[Libreoffice-commits] core.git: chart2/source include/svx sd/qa sd/source svx/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Sep 2 17:22:21 UTC 2016
chart2/source/controller/drawinglayer/DrawViewWrapper.cxx | 4 +-
chart2/source/controller/inc/DrawViewWrapper.hxx | 2 -
include/svx/svddrgv.hxx | 2 -
include/svx/svdmrkv.hxx | 4 +-
sd/qa/unit/tiledrendering/tiledrendering.cxx | 11 ++++++-
sd/source/ui/inc/ViewShellBase.hxx | 2 +
sd/source/ui/view/ViewShellBase.cxx | 19 ++++++++++++
svx/source/engine3d/view3d.cxx | 2 -
svx/source/svdraw/svddrgv.cxx | 8 ++---
svx/source/svdraw/svdmrkv.cxx | 21 ++++++++++----
svx/source/svdraw/svdmrkv1.cxx | 2 -
11 files changed, 58 insertions(+), 19 deletions(-)
New commits:
commit 1e1eb87f36095acefe73579448ceef8442beba5f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Sep 2 17:32:04 2016 +0200
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 at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index f885911..1443415 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 f6d9c88..6bb4057 100644
--- a/chart2/source/controller/inc/DrawViewWrapper.hxx
+++ b/chart2/source/controller/inc/DrawViewWrapper.hxx
@@ -56,7 +56,7 @@ public:
const css::uno::Reference< css::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 8df3f1d..3a84ee6 100644
--- a/include/svx/svddrgv.hxx
+++ b/include/svx/svddrgv.hxx
@@ -61,7 +61,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 1c851ec..ae49ba2 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -142,7 +142,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);
@@ -406,7 +406,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 b5ba3ae..a80a8de 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1118,7 +1118,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);
@@ -1134,10 +1133,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 f47a49a..b2c5e47 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -219,6 +219,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 eb2a8ad..6f718f1 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -90,6 +90,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include "fubullet.hxx"
+#include "drawview.hxx"
using namespace sd;
#define ViewShellBase
@@ -1033,6 +1034,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 82fde6d..b60bf78 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -1409,7 +1409,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 50cead0..9c517a5 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -558,7 +558,7 @@ bool SdrDragView::EndDragObj(bool bCopy)
if (mbInsPolyPoint)
{
- SetMarkHandles();
+ SetMarkHandles(nullptr);
mbInsPolyPoint=false;
if( bUndo )
{
@@ -605,7 +605,7 @@ void SdrDragView::BrkDragObj()
mpInsPointUndo->Undo(); // delete inserted point again
delete mpInsPointUndo;
mpInsPointUndo=nullptr;
- SetMarkHandles();
+ SetMarkHandles(nullptr);
mbInsPolyPoint=false;
}
@@ -874,12 +874,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 a4a7916..526b6e8 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -616,7 +616,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();
@@ -767,8 +767,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);
+ }
}
}
@@ -951,7 +960,7 @@ void SdrMarkView::SetDragMode(SdrDragMode eMode)
if (meDragMode==SdrDragMode::Resize) meDragMode=SdrDragMode::Move;
if (meDragMode!=eMode0) {
ForceRefToMarked();
- SetMarkHandles();
+ SetMarkHandles(nullptr);
{
if (AreObjectsMarked()) MarkListHasChanged();
}
@@ -1993,11 +2002,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 d759506..319d7ed 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();
}
}
More information about the Libreoffice-commits
mailing list