summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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)
Diffstat (limited to 'sd')
-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
3 files changed, 31 insertions, 1 deletions
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)