LibreOffice Module sd (master) 1
SlsPageCache.cxx
Go to the documentation of this file.
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#include <tools/gen.hxx>
23
24using namespace ::com::sun::star;
25
26namespace sd::slidesorter::cache {
27
28//===== PageCache =============================================================
29
31 const Size& rPreviewSize,
32 const bool bDoSuperSampling,
33 const SharedCacheContext& rpCacheContext)
34 : mpImplementation(
36 rPreviewSize,
37 bDoSuperSampling,
38 rpCacheContext))
39{
40}
41
43{
44}
45
47 const Size& rPreviewSize,
48 const bool bDoSuperSampling)
49{
50 mpImplementation->ChangePreviewSize(rPreviewSize, bDoSuperSampling);
51}
52
54 const CacheKey aKey,
55 const bool bResize)
56{
57 return mpImplementation->GetPreviewBitmap(aKey, bResize);
58}
59
61 const CacheKey aKey)
62{
63 return mpImplementation->GetMarkedPreviewBitmap(aKey);
64}
65
67 const CacheKey aKey,
68 const BitmapEx& rMarkedBitmap)
69{
70 mpImplementation->SetMarkedPreviewBitmap(aKey, rMarkedBitmap);
71}
72
74{
75 return mpImplementation->RequestPreviewBitmap(aKey, true);
76}
77
79 const CacheKey aKey)
80{
81 if (mpImplementation->InvalidatePreviewBitmap(aKey))
83}
84
86{
87 mpImplementation->InvalidateCache();
88}
89
91 const CacheKey aKey,
92 const bool bIsPrecious)
93{
94 mpImplementation->SetPreciousFlag(aKey, bIsPrecious);
95}
96
98{
99 mpImplementation->Pause();
100}
101
103{
104 mpImplementation->Resume();
105}
106
107} // end of namespace ::sd::slidesorter::cache
108
109/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This basically is the implementation class for the PageCache class.
BitmapEx GetPreviewBitmap(const CacheKey aKey, const bool bResize)
Request a preview bitmap for the specified page object in the specified size.
PageCache(const Size &rPreviewSize, const bool bDoSuperSampling, const SharedCacheContext &rpCacheContext)
The page cache is created with a reference to the slide sorter so that it has access to both the view...
void InvalidatePreviewBitmap(const CacheKey aKey)
Tell the cache that the bitmap associated with the given request data is not up-to-date anymore.
void SetMarkedPreviewBitmap(const CacheKey aKey, const BitmapEx &rBitmap)
void RequestPreviewBitmap(const CacheKey aKey)
When the requested preview bitmap does not yet exist or is not up-to-date then the rendering of one i...
void InvalidateCache()
Call this method when all preview bitmaps have to be generated anew.
std::unique_ptr< GenericPageCache > mpImplementation
void SetPreciousFlag(const CacheKey aKey, const bool bIsPrecious)
With the precious flag you can control whether a bitmap can be removed or reduced in size to make roo...
void ChangeSize(const Size &rPreviewSize, const bool bDoSuperSampling)
BitmapEx GetMarkedPreviewBitmap(const CacheKey aKey)
std::shared_ptr< CacheContext > SharedCacheContext