summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-01-14 14:20:40 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-14 16:00:08 +0100
commit8cdc1e85f60bdb8340ef7a001222b777b194fab3 (patch)
tree5002999bfb7e7fc590e279918c8153f208fac534 /sd
parent70c946d1682d019e12cd447fdf4d6a523b899ba4 (diff)
editeng: handle SdrModel::isTiledSearching()
Given that the edit/outliner views can come and go, avoid the lifecycle problems with just passing a pointer to the sdr model to editeng, and then it'll always have the up to date "are we searching" information. editeng can't depend on svx, so provide an interface class SdrModel can implement. (cherry picked from commit 7b5d20983dfbfb458898eeab54828ba5fef5841f) Conflicts: editeng/source/editeng/editview.cxx editeng/source/editeng/impedit.cxx include/editeng/outliner.hxx sd/qa/unit/tiledrendering/tiledrendering.cxx svx/source/svdraw/svdedxv.cxx sw/inc/PostItMgr.hxx sw/source/uibase/docvw/PostItMgr.cxx sw/source/uibase/docvw/SidebarWin.cxx Change-Id: I3b98011593b00ac0fab05b6b9c591dd20d94c579
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx27
1 files changed, 26 insertions, 1 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index b7150d58aa7b..264f492f142f 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -35,6 +35,7 @@
#include <ViewShell.hxx>
#include <sdpage.hxx>
#include <unomodel.hxx>
+#include <comphelper/lok.hxx>
using namespace css;
@@ -60,6 +61,7 @@ public:
void testSearch();
void testSearchAll();
void testSearchAllSelections();
+ void testSearchAllNotifications();
#endif
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
@@ -74,6 +76,7 @@ public:
CPPUNIT_TEST(testSearch);
CPPUNIT_TEST(testSearchAll);
//CPPUNIT_TEST(testSearchAllSelections);
+ CPPUNIT_TEST(testSearchAllNotifications);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -92,13 +95,17 @@ private:
sal_Int32 m_nPart;
std::vector<OString> m_aSearchResultSelection;
std::vector<int> m_aSearchResultPart;
+ int m_nSelectionBeforeSearchResult;
+ int m_nSelectionAfterSearchResult;
#endif
};
SdTiledRenderingTest::SdTiledRenderingTest()
#if !defined(WNT) && !defined(MACOSX)
: m_bFound(true),
- m_nPart(0)
+ m_nPart(0),
+ m_nSelectionBeforeSearchResult(0),
+ m_nSelectionAfterSearchResult(0)
#endif
{
}
@@ -183,6 +190,10 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
lcl_convertRectangle(rString, aRectangle);
m_aSelection.push_back(aRectangle);
}
+ if (m_aSearchResultSelection.empty())
+ ++m_nSelectionBeforeSearchResult;
+ else
+ ++m_nSelectionAfterSearchResult;
}
break;
case LOK_CALLBACK_SEARCH_NOT_FOUND:
@@ -456,6 +467,20 @@ void SdTiledRenderingTest::testSearchAllSelections()
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m_aSelection.size());
}
+void SdTiledRenderingTest::testSearchAllNotifications()
+{
+ comphelper::LibreOfficeKit::setActive();
+ SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
+ pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
+
+ lcl_search("third", /*bFindAll=*/true);
+ // Make sure that we get no notifications about selection changes during search.
+ CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult);
+ // But we do get the selection of the first hit.
+ CPPUNIT_ASSERT(m_nSelectionAfterSearchResult > 0);
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
#endif
CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);