Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef PAGE_LIST_WATCHER_HXX
21 : #define PAGE_LIST_WATCHER_HXX
22 :
23 : #include "pres.hxx"
24 : #include <sal/types.h>
25 : #include <vector>
26 :
27 : class SdPage;
28 : class SdrModel;
29 :
30 : /** Maintain a map of page indices to page objects for faster access that
31 : remains valid during deletions and insertions of pages (#109538#).
32 : */
33 : class ImpPageListWatcher
34 : {
35 : protected:
36 : // typedefs for a vector of SdPages
37 : typedef ::std::vector< SdPage* > SdPageVector;
38 :
39 : const SdrModel& mrModel;
40 :
41 : SdPageVector maPageVectorStandard;
42 : SdPageVector maPageVectorNotes;
43 : SdPage* mpHandoutPage;
44 :
45 : sal_Bool mbPageListValid;
46 : sal_uInt32 mnVisiblePageCount;
47 :
48 : void ImpRecreateSortedPageListOnDemand();
49 : virtual sal_uInt32 ImpGetPageCount() const = 0;
50 :
51 : /** Return the page with the given index.
52 : @param nIndex
53 : When given an invalid index then NULL is returned.
54 : */
55 : virtual SdPage* ImpGetPage (sal_uInt32 nIndex) const = 0;
56 :
57 : public:
58 : ImpPageListWatcher(const SdrModel& rModel);
59 : virtual ~ImpPageListWatcher();
60 :
61 1356 : void Invalidate() { mbPageListValid = sal_False; }
62 : SdPage* GetSdPage(PageKind ePgKind, sal_uInt32 nPgNum = 0L);
63 : sal_uInt32 GetSdPageCount(PageKind ePgKind);
64 : sal_uInt32 GetVisibleSdPageCount();
65 : };
66 :
67 : //////////////////////////////////////////////////////////////////////////////
68 :
69 : class ImpDrawPageListWatcher : public ImpPageListWatcher
70 : {
71 : protected:
72 : virtual sal_uInt32 ImpGetPageCount() const;
73 : virtual SdPage* ImpGetPage(sal_uInt32 nIndex) const;
74 :
75 : public:
76 : ImpDrawPageListWatcher(const SdrModel& rModel);
77 : virtual ~ImpDrawPageListWatcher();
78 : };
79 :
80 : //////////////////////////////////////////////////////////////////////////////
81 :
82 : class ImpMasterPageListWatcher : public ImpPageListWatcher
83 : {
84 : protected:
85 : virtual sal_uInt32 ImpGetPageCount() const;
86 : virtual SdPage* ImpGetPage(sal_uInt32 nIndex) const;
87 :
88 : public:
89 : ImpMasterPageListWatcher(const SdrModel& rModel);
90 : virtual ~ImpMasterPageListWatcher();
91 : };
92 :
93 : #endif
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|