1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_CACHE_SLSCACHECONTEXT_HXX
21 #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_CACHE_SLSCACHECONTEXT_HXX
23 #include <sal/types.h>
24 #include <com/sun/star/uno/Reference.hxx>
28 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{ class XInterface
; } } } }
32 namespace sd
{ namespace slidesorter
{ namespace cache
{
34 typedef const SdrPage
* CacheKey
;
36 /** This interface allows the individualisation of different instances of
42 virtual ~CacheContext() {}
44 /** This method is called when the asynchronous creation of a preview
47 The key of the page for which the preview has been created.
49 virtual void NotifyPreviewCreation (CacheKey aKey
) = 0;
51 /** Called to determine whether the system is idle and a preview can be
52 created without annoying the user.
54 virtual bool IsIdle() = 0;
56 /** This method is used to determine whether a page is currently visible
57 or not. It is called when the cache becomes to large and some
58 previews have to be released or scaled down.
60 virtual bool IsVisible (CacheKey aKey
) = 0;
62 /** Return the page associated with the given key. Note that different
63 keys may map to a single page (this may be the case with custom
66 virtual const SdrPage
* GetPage (CacheKey aKey
) = 0;
68 /** This method is used when the request queue is filled. It asks for
69 the list of visible entries and maybe for the list of not visible
70 entries and creates preview creation requests for them.
72 When this is <FALSE/> then the implementation can decide whether
73 to allow rendering of previews that are not visible (ahead of
74 time). When not then return an empty pointer or an empty vector.
76 virtual std::shared_ptr
<std::vector
<CacheKey
> > GetEntryList (bool bVisible
) = 0;
78 /** Return the priority that defines the order in which previews are
79 created for different keys/pages. Typically the visible pages come
80 first, then top-down, left-to-right.
82 virtual sal_Int32
GetPriority (CacheKey aKey
) = 0;
84 /** Return the model to which the pages belong for which the called
85 cache manages the previews. Different caches that belong to the
86 same model but have different preview sizes may access previews of
87 each other in order to create fast previews of the previews.
89 virtual css::uno::Reference
<css::uno::XInterface
> GetModel() = 0;
92 typedef std::shared_ptr
<CacheContext
> SharedCacheContext
;
94 } } } // end of namespace ::sd::slidesorter::cache
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */