xref: /AOO41X/main/sd/source/ui/slidesorter/cache/SlsPageCache.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include "precompiled_sd.hxx"
29 
30 #include "SlsGenericPageCache.hxx"
31 #include "SlsRequestFactory.hxx"
32 #include "cache/SlsPageCache.hxx"
33 #include "model/SlideSorterModel.hxx"
34 #include <boost/bind.hpp>
35 #include <boost/bind/protect.hpp>
36 
37 using namespace ::com::sun::star;
38 
39 
40 namespace sd { namespace slidesorter { namespace cache {
41 
42 
43 //===== PageCache =============================================================
44 
45 PageCache::PageCache (
46     const Size& rPreviewSize,
47     const bool bDoSuperSampling,
48     const SharedCacheContext& rpCacheContext)
49    : mpImplementation(
50         new GenericPageCache(
51             rPreviewSize,
52             bDoSuperSampling,
53             rpCacheContext))
54 {
55 }
56 
57 
58 
59 
60 PageCache::~PageCache (void)
61 {
62 }
63 
64 
65 
66 
67 void PageCache::ChangeSize (
68     const Size& rPreviewSize,
69     const bool bDoSuperSampling)
70 {
71     mpImplementation->ChangePreviewSize(rPreviewSize, bDoSuperSampling);
72 }
73 
74 
75 
76 
77 Bitmap PageCache::GetPreviewBitmap (
78     const CacheKey aKey,
79     const bool bResize)
80 {
81     return mpImplementation->GetPreviewBitmap(aKey, bResize);
82 }
83 
84 
85 
86 
87 Bitmap PageCache::GetMarkedPreviewBitmap (
88     const CacheKey aKey,
89     const bool bResize)
90 {
91     return mpImplementation->GetMarkedPreviewBitmap(aKey, bResize);
92 }
93 
94 
95 
96 
97 void PageCache::SetMarkedPreviewBitmap (
98     const CacheKey aKey,
99     const Bitmap& rMarkedBitmap)
100 {
101     mpImplementation->SetMarkedPreviewBitmap(aKey, rMarkedBitmap);
102 }
103 
104 
105 
106 
107 void PageCache::RequestPreviewBitmap (const CacheKey aKey)
108 {
109     return mpImplementation->RequestPreviewBitmap(aKey);
110 }
111 
112 
113 
114 
115 void PageCache::InvalidatePreviewBitmap (
116     const CacheKey aKey,
117     const bool bRequestPreview)
118 {
119     if (mpImplementation->InvalidatePreviewBitmap(aKey) && bRequestPreview)
120         RequestPreviewBitmap(aKey);
121 }
122 
123 
124 
125 
126 void PageCache::ReleasePreviewBitmap (const CacheKey aKey)
127 {
128     mpImplementation->ReleasePreviewBitmap(aKey);
129 }
130 
131 
132 
133 
134 void PageCache::InvalidateCache (const bool bUpdateCache)
135 {
136     mpImplementation->InvalidateCache(bUpdateCache);
137 }
138 
139 
140 
141 
142 void PageCache::SetPreciousFlag (
143     const CacheKey aKey,
144     const bool bIsPrecious)
145 {
146     mpImplementation->SetPreciousFlag(aKey, bIsPrecious);
147 }
148 
149 
150 
151 
152 void PageCache::Pause (void)
153 {
154     mpImplementation->Pause();
155 }
156 
157 
158 
159 
160 void PageCache::Resume (void)
161 {
162     mpImplementation->Resume();
163 }
164 
165 
166 } } } // end of namespace ::sd::slidesorter::cache
167