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