1*c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c45d927aSAndrew Rist * distributed with this work for additional information 6*c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9*c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c45d927aSAndrew Rist * software distributed under the License is distributed on an 15*c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17*c45d927aSAndrew Rist * specific language governing permissions and limitations 18*c45d927aSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*c45d927aSAndrew Rist *************************************************************/ 21*c45d927aSAndrew Rist 22*c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef PAGE_LIST_WATCHER_HXX 25cdf0e10cSrcweir #define PAGE_LIST_WATCHER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "pres.hxx" 28cdf0e10cSrcweir #include <sal/types.h> 29cdf0e10cSrcweir #include <vector> 30cdf0e10cSrcweir 31cdf0e10cSrcweir class SdPage; 32cdf0e10cSrcweir class SdrModel; 33cdf0e10cSrcweir 34cdf0e10cSrcweir /** Maintain a map of page indices to page objects for faster access that 35cdf0e10cSrcweir remains valid during deletions and insertions of pages (#109538#). 36cdf0e10cSrcweir */ 37cdf0e10cSrcweir class ImpPageListWatcher 38cdf0e10cSrcweir { 39cdf0e10cSrcweir protected: 40cdf0e10cSrcweir // typedefs for a vector of SdPages 41cdf0e10cSrcweir typedef ::std::vector< SdPage* > SdPageVector; 42cdf0e10cSrcweir 43cdf0e10cSrcweir const SdrModel& mrModel; 44cdf0e10cSrcweir 45cdf0e10cSrcweir SdPageVector maPageVectorStandard; 46cdf0e10cSrcweir SdPageVector maPageVectorNotes; 47cdf0e10cSrcweir SdPage* mpHandoutPage; 48cdf0e10cSrcweir 49cdf0e10cSrcweir sal_Bool mbPageListValid; 50cdf0e10cSrcweir 51cdf0e10cSrcweir void ImpRecreateSortedPageListOnDemand(); 52cdf0e10cSrcweir virtual sal_uInt32 ImpGetPageCount() const = 0; 53cdf0e10cSrcweir 54cdf0e10cSrcweir /** Return the page with the given index. 55cdf0e10cSrcweir @param nIndex 56cdf0e10cSrcweir When given an invalid index then NULL is returned. 57cdf0e10cSrcweir */ 58cdf0e10cSrcweir virtual SdPage* ImpGetPage (sal_uInt32 nIndex) const = 0; 59cdf0e10cSrcweir 60cdf0e10cSrcweir public: 61cdf0e10cSrcweir ImpPageListWatcher(const SdrModel& rModel); 62cdf0e10cSrcweir virtual ~ImpPageListWatcher(); 63cdf0e10cSrcweir Invalidate()64cdf0e10cSrcweir void Invalidate() { mbPageListValid = sal_False; } 65cdf0e10cSrcweir SdPage* GetSdPage(PageKind ePgKind, sal_uInt32 nPgNum = 0L); 66cdf0e10cSrcweir sal_uInt32 GetSdPageCount(PageKind ePgKind); 67cdf0e10cSrcweir }; 68cdf0e10cSrcweir 69cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 70cdf0e10cSrcweir 71cdf0e10cSrcweir class ImpDrawPageListWatcher : public ImpPageListWatcher 72cdf0e10cSrcweir { 73cdf0e10cSrcweir protected: 74cdf0e10cSrcweir virtual sal_uInt32 ImpGetPageCount() const; 75cdf0e10cSrcweir virtual SdPage* ImpGetPage(sal_uInt32 nIndex) const; 76cdf0e10cSrcweir 77cdf0e10cSrcweir public: 78cdf0e10cSrcweir ImpDrawPageListWatcher(const SdrModel& rModel); 79cdf0e10cSrcweir virtual ~ImpDrawPageListWatcher(); 80cdf0e10cSrcweir }; 81cdf0e10cSrcweir 82cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 83cdf0e10cSrcweir 84cdf0e10cSrcweir class ImpMasterPageListWatcher : public ImpPageListWatcher 85cdf0e10cSrcweir { 86cdf0e10cSrcweir protected: 87cdf0e10cSrcweir virtual sal_uInt32 ImpGetPageCount() const; 88cdf0e10cSrcweir virtual SdPage* ImpGetPage(sal_uInt32 nIndex) const; 89cdf0e10cSrcweir 90cdf0e10cSrcweir public: 91cdf0e10cSrcweir ImpMasterPageListWatcher(const SdrModel& rModel); 92cdf0e10cSrcweir virtual ~ImpMasterPageListWatcher(); 93cdf0e10cSrcweir }; 94cdf0e10cSrcweir 95cdf0e10cSrcweir #endif 96