diff options
author | Henry Castro <hcastro@collabora.com> | 2016-09-20 10:25:05 -0400 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-20 18:40:35 +0000 |
commit | 0b5c4d382185c781ee5161b36bbe21be3db94a47 (patch) | |
tree | 19f5538f21389f78fc1651a5c9d43a4f1d01dc57 /sc/qa | |
parent | 28447258fb6d9b8246f2a96d1a86945ef255d110 (diff) |
sc draw: emit LOK_CALLBACK_GRAPHIC_VIEW_SELECTION when view is created
In multiple view environment, when a new view is created ensure to
notify other views graphic view selections.
Change-Id: If75f9525af6e851e096b6d273957b94882c441cf
Reviewed-on: https://gerrit.libreoffice.org/29094
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 3ff46d09460f..be3e33aa7f78 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -62,6 +62,7 @@ public: void testViewLock(); void testColRowResize(); void testUndoShells(); + void testCreateViewGraphicSelection(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -75,6 +76,7 @@ public: CPPUNIT_TEST(testViewLock); CPPUNIT_TEST(testColRowResize); CPPUNIT_TEST(testUndoShells); + CPPUNIT_TEST(testCreateViewGraphicSelection); CPPUNIT_TEST_SUITE_END(); private: @@ -377,6 +379,8 @@ public: bool m_bOwnCursorInvalidated; bool m_bViewCursorInvalidated; bool m_bTextViewSelectionInvalidated; + bool m_bGraphicSelection; + bool m_bGraphicViewSelection; bool m_bViewLock; ViewCallback() @@ -419,6 +423,16 @@ public: m_bViewLock = aTree.get_child("rectangle").get_value<std::string>() != "EMPTY"; } break; + case LOK_CALLBACK_GRAPHIC_SELECTION: + { + m_bGraphicSelection = true; + } + break; + case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION: + { + m_bGraphicViewSelection = true; + } + break; } } }; @@ -611,6 +625,43 @@ void ScTiledRenderingTest::testUndoShells() comphelper::LibreOfficeKit::setActive(false); } +void ScTiledRenderingTest::testCreateViewGraphicSelection() +{ + // Load a document + comphelper::LibreOfficeKit::setActive(); + + // Load a document that has a shape and create two views. + ScModelObj* pModelObj = createDoc("shape.ods"); + ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); + + // Mark the graphic in the first view. + const ScViewData* pViewData = ScDocShell::GetViewData(); + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + CPPUNIT_ASSERT(pViewShell); + SdrModel* pDrawModel = pViewData->GetDocument()->GetDrawLayer(); + SdrPage* pDrawPage = pDrawModel->GetPage(0); + SdrObject* pObject = pDrawPage->GetObj(0); + SdrView* pView = pViewShell->GetSdrView(); + aView1.m_bGraphicSelection = false; + aView1.m_bGraphicViewSelection = false; + pView->MarkObj(pObject, pView->GetSdrPageView()); + CPPUNIT_ASSERT(aView1.m_bGraphicSelection); + + // Create a second view. + SfxLokHelper::createView(); + ViewCallback aView2; + aView2.m_bGraphicViewSelection = false; + pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2); + CPPUNIT_ASSERT(aView2.m_bGraphicViewSelection); + CPPUNIT_ASSERT(aView1.m_bGraphicViewSelection); + + mxComponent->dispose(); + mxComponent.clear(); + comphelper::LibreOfficeKit::setActive(false); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); |