Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SD_SLIDESORTER_CACHE_CONTEXT_HXX
30 : : #define SD_SLIDESORTER_CACHE_CONTEXT_HXX
31 : :
32 : : #include <sal/types.h>
33 : : #include <com/sun/star/uno/XInterface.hpp>
34 : : #include <boost/shared_ptr.hpp>
35 : : #include <vector>
36 : :
37 : : class SdrPage;
38 : : class Bitmap;
39 : :
40 : : namespace sd { namespace slidesorter { namespace cache {
41 : :
42 : : typedef const SdrPage* CacheKey;
43 : :
44 : : /** This interface allows the individualisation of different instances of
45 : : the PreviewCache.
46 : : */
47 : 130 : class CacheContext
48 : : {
49 : : public:
50 [ - + ]: 130 : virtual ~CacheContext() {}
51 : :
52 : : /** This method is called when the asynchronous creation of a preview
53 : : has been finished.
54 : : @param aKey
55 : : The key of the page for which the preview has been created.
56 : : @param aPreview
57 : : The newly created preview.
58 : : */
59 : : virtual void NotifyPreviewCreation (
60 : : CacheKey aKey,
61 : : const Bitmap& rPreview) = 0;
62 : :
63 : : /** Called to determine whether the system is idle and a preview can be
64 : : created without annoying the user.
65 : : */
66 : : virtual bool IsIdle (void) = 0;
67 : :
68 : : /** This method is used to determine whether a page is currently visible
69 : : or not. It is called when the cache becomes to large and some
70 : : previews have to be released or scaled down.
71 : : */
72 : : virtual bool IsVisible (CacheKey aKey) = 0;
73 : :
74 : : /** Return the page associdated with the given key. Note that different
75 : : keys may map to a single page (this may be the case with custom
76 : : slide shows.)
77 : : */
78 : : virtual const SdrPage* GetPage (CacheKey aKey) = 0;
79 : :
80 : : /** This method is used when the request queue is filled. It asks for
81 : : the list of visible entries and maybe for the list of not visible
82 : : entries and creates preview creation requests for them.
83 : : @param bVisible
84 : : When this is <FALSE/> then the implementation can decide whether
85 : : to allow rendering of previews that are not visible (ahead of
86 : : time). When not then return an empty pointer or an empty vector.
87 : : */
88 : : virtual ::boost::shared_ptr<std::vector<CacheKey> > GetEntryList (bool bVisible) = 0;
89 : :
90 : : /** Return the priority that defines the order in which previews are
91 : : created for different keys/pages. Typically the visible pages come
92 : : first, then top-down, left-to-right.
93 : : */
94 : : virtual sal_Int32 GetPriority (CacheKey aKey) = 0;
95 : :
96 : : /** Return the model to which the pages belong for which the called
97 : : cache manages the previews. Different caches that belong to the
98 : : same model but have different preview sizes may acces previews of
99 : : each other in order to create fast previews of the previews.
100 : : */
101 : : virtual ::com::sun::star::uno::Reference<com::sun::star::uno::XInterface> GetModel (void) = 0;
102 : : };
103 : :
104 : : typedef ::boost::shared_ptr<CacheContext> SharedCacheContext;
105 : :
106 : : } } } // end of namespace ::sd::slidesorter::cache
107 : :
108 : : #endif
109 : :
110 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|