Update git submodules
[LibreOffice.git] / sd / source / ui / slidesorter / inc / cache / SlsCacheContext.hxx
blob12993fdbb0846f3efad6de0552c926558119b5d2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <sal/types.h>
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <memory>
25 #include <vector>
27 namespace com::sun::star::uno
29 class XInterface;
32 class SdrPage;
34 namespace sd::slidesorter::cache
36 typedef const SdrPage* CacheKey;
38 /** This interface allows the individualisation of different instances of
39 the PreviewCache.
41 class CacheContext
43 public:
44 virtual ~CacheContext() {}
46 /** This method is called when the asynchronous creation of a preview
47 has been finished.
48 @param aKey
49 The key of the page for which the preview has been created.
51 virtual void NotifyPreviewCreation(CacheKey aKey) = 0;
53 /** Called to determine whether the system is idle and a preview can be
54 created without annoying the user.
56 virtual bool IsIdle() = 0;
58 /** This method is used to determine whether a page is currently visible
59 or not. It is called when the cache becomes too large and some
60 previews have to be released or scaled down.
62 virtual bool IsVisible(CacheKey aKey) = 0;
64 /** Return the page associated with the given key. Note that different
65 keys may map to a single page (this may be the case with custom
66 slide shows.)
68 virtual const SdrPage* GetPage(CacheKey aKey) = 0;
70 /** This method is used when the request queue is filled. It asks for
71 the list of visible entries and maybe for the list of not visible
72 entries and creates preview creation requests for them.
73 @param bVisible
74 When this is <FALSE/> then the implementation can decide whether
75 to allow rendering of previews that are not visible (ahead of
76 time). When not then return an empty pointer or an empty vector.
78 virtual std::shared_ptr<std::vector<CacheKey>> GetEntryList(bool bVisible) = 0;
80 /** Return the priority that defines the order in which previews are
81 created for different keys/pages. Typically the visible pages come
82 first, then top-down, left-to-right.
84 virtual sal_Int32 GetPriority(CacheKey aKey) = 0;
86 /** Return the model to which the pages belong for which the called
87 cache manages the previews. Different caches that belong to the
88 same model but have different preview sizes may access previews of
89 each other in order to create fast previews of the previews.
91 virtual css::uno::Reference<css::uno::XInterface> GetModel() = 0;
94 typedef std::shared_ptr<CacheContext> SharedCacheContext;
96 } // end of namespace ::sd::slidesorter::cache
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */