bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / slidesorter / inc / cache / SlsCacheContext.hxx
blobeb4b40520c6befa7595ad6dd6dba2d39e7a2f12f
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 #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/XInterface.hpp>
25 #include <boost/shared_ptr.hpp>
26 #include <vector>
28 class SdrPage;
29 class Bitmap;
31 namespace sd { namespace slidesorter { namespace cache {
33 typedef const SdrPage* CacheKey;
35 /** This interface allows the individualisation of different instances of
36 the PreviewCache.
38 class CacheContext
40 public:
41 virtual ~CacheContext() {}
43 /** This method is called when the asynchronous creation of a preview
44 has been finished.
45 @param aKey
46 The key of the page for which the preview has been created.
47 @param aPreview
48 The newly created preview.
50 virtual void NotifyPreviewCreation (
51 CacheKey aKey,
52 const Bitmap& rPreview) = 0;
54 /** Called to determine whether the system is idle and a preview can be
55 created without annoying the user.
57 virtual bool IsIdle() = 0;
59 /** This method is used to determine whether a page is currently visible
60 or not. It is called when the cache becomes to large and some
61 previews have to be released or scaled down.
63 virtual bool IsVisible (CacheKey aKey) = 0;
65 /** Return the page associdated with the given key. Note that different
66 keys may map to a single page (this may be the case with custom
67 slide shows.)
69 virtual const SdrPage* GetPage (CacheKey aKey) = 0;
71 /** This method is used when the request queue is filled. It asks for
72 the list of visible entries and maybe for the list of not visible
73 entries and creates preview creation requests for them.
74 @param bVisible
75 When this is <FALSE/> then the implementation can decide whether
76 to allow rendering of previews that are not visible (ahead of
77 time). When not then return an empty pointer or an empty vector.
79 virtual ::boost::shared_ptr<std::vector<CacheKey> > GetEntryList (bool bVisible) = 0;
81 /** Return the priority that defines the order in which previews are
82 created for different keys/pages. Typically the visible pages come
83 first, then top-down, left-to-right.
85 virtual sal_Int32 GetPriority (CacheKey aKey) = 0;
87 /** Return the model to which the pages belong for which the called
88 cache manages the previews. Different caches that belong to the
89 same model but have different preview sizes may access previews of
90 each other in order to create fast previews of the previews.
92 virtual ::com::sun::star::uno::Reference<com::sun::star::uno::XInterface> GetModel() = 0;
95 typedef ::boost::shared_ptr<CacheContext> SharedCacheContext;
97 } } } // end of namespace ::sd::slidesorter::cache
99 #endif
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */