summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-02 14:21:18 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-02 14:58:13 +0200
commit3fd4c40a8706de03a56b152385551a3a9159f563 (patch)
treedf1068803bf973981c8b759f96dbfe5f777ce23b /sd
parentc7e48d8bf23e0fce7af5fa90ac173f0d477d7aac (diff)
svx: move GetSfxViewShell() to SdrMarkView
... from SdrObjEditView. This way SdrMarkView can avoid SfxViewShell::Current() calls, and it can avoid clearing the LOK graphic selection of the old view when constructing a new view. With this, an existing graphic selection in an Impress LOK view is no longer cleared when creating a new view, thanks to the sd::View::GetSfxViewShell() override. Change-Id: I70a287aa9c2265bf59a9fb18e0c3839b8f119bbc Reviewed-on: https://gerrit.libreoffice.org/28618 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit c152008943160fa901ef8a356515a6a074370ff0)
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 77f4ab196a47..45b1034f5088 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -70,6 +70,7 @@ public:
void testCursorViews();
void testViewLock();
void testUndoLimiting();
+ void testCreateViewGraphicSelection();
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -95,6 +96,7 @@ public:
CPPUNIT_TEST(testCursorViews);
CPPUNIT_TEST(testViewLock);
CPPUNIT_TEST(testUndoLimiting);
+ CPPUNIT_TEST(testCreateViewGraphicSelection);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1106,6 +1108,37 @@ void SdTiledRenderingTest::testUndoLimiting()
comphelper::LibreOfficeKit::setActive(false);
}
+void SdTiledRenderingTest::testCreateViewGraphicSelection()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ // Load a document and register a callback.
+ SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
+ pXImpressDocument->initializeForTiledRendering({});
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+
+ // Select the only shape in the document and assert that the graphic selection is changed.
+ sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+ SdPage* pActualPage = pViewShell->GetActualPage();
+ SdrObject* pObject = pActualPage->GetObj(0);
+ SdrView* pView = pViewShell->GetView();
+ aView1.m_bGraphicSelectionInvalidated = false;
+ pView->MarkObj(pObject, pView->GetSdrPageView());
+ CPPUNIT_ASSERT(aView1.m_bGraphicSelectionInvalidated);
+
+ // Now create a new view.
+ aView1.m_bGraphicSelectionInvalidated = false;
+ SfxLokHelper::createView();
+ // This failed, creating a new view affected the graphic selection of an
+ // existing view.
+ CPPUNIT_ASSERT(!aView1.m_bGraphicSelectionInvalidated);
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();