LibreOffice Module sd (master) 1
SlsGenericPageCache.hxx
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#pragma once
21
22#include "SlsRequestQueue.hxx"
23#include <memory>
24
25#include <vcl/bitmapex.hxx>
26
27namespace sd::slidesorter::cache {
28
29class BitmapCache;
30class QueueProcessor;
31
35{
36public:
47 const Size& rPreviewSize,
48 const bool bDoSuperSampling,
49 const SharedCacheContext& rpCacheContext);
50
52
58 const Size& rPreviewSize,
59 const bool bDoSuperSampling);
60
81 const CacheKey aKey,
82 const bool bResize);
84 const CacheKey aKey);
86 const CacheKey aKey,
87 const BitmapEx& rMarkedBitmap);
88
102 const CacheKey aKey,
103 const bool bMayBeUpToDate);
104
111 bool InvalidatePreviewBitmap (const CacheKey aKey);
112
117 void InvalidateCache ();
118
124 void SetPreciousFlag (const CacheKey aKey, const bool bIsPrecious);
125
126 void Pause();
127 void Resume();
128
129private:
130 std::shared_ptr<BitmapCache> mpBitmapCache;
131
133
134 std::unique_ptr<QueueProcessor> mpQueueProcessor;
135
137
141
143
148};
149
150} // end of namespace ::sd::slidesorter::cache
151
152/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This basically is the implementation class for the PageCache class.
void RequestPreviewBitmap(const CacheKey aKey, const bool bMayBeUpToDate)
When the requested preview bitmap does not yet exist or is not up-to-date then the rendering of one i...
void ProvideCacheAndProcessor()
Both bitmap cache and queue processor are created on demand by this method.
void SetPreciousFlag(const CacheKey aKey, const bool bIsPrecious)
With the precious flag you can control whether a bitmap can be removed from the cache or reduced in s...
void ChangePreviewSize(const Size &rPreviewSize, const bool bDoSuperSampling)
Change the size of the preview bitmaps.
BitmapEx GetMarkedPreviewBitmap(const CacheKey aKey)
BitmapEx GetPreviewBitmap(const CacheKey aKey, const bool bResize)
Request a preview bitmap for the specified page object in the specified size.
GenericPageCache(const Size &rPreviewSize, const bool bDoSuperSampling, const SharedCacheContext &rpCacheContext)
The page cache is created with a reference to the SlideSorter and thus has access to both view and mo...
std::unique_ptr< QueueProcessor > mpQueueProcessor
void InvalidateCache()
Call this method when all preview bitmaps have to be generated anew.
Size maPreviewSize
The current size of preview bitmaps.
std::shared_ptr< BitmapCache > mpBitmapCache
bool InvalidatePreviewBitmap(const CacheKey aKey)
Tell the cache to replace the bitmap associated with the given request data with a new one that refle...
void SetMarkedPreviewBitmap(const CacheKey aKey, const BitmapEx &rMarkedBitmap)
The request queue stores requests that are described by the Request sorted according to priority clas...
std::shared_ptr< CacheContext > SharedCacheContext