1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlsCacheContext.hxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SD_SLIDESORTER_CACHE_CONTEXT_HXX
33 #define SD_SLIDESORTER_CACHE_CONTEXT_HXX
35 #include <sal/types.h>
36 #include <com/sun/star/uno/XInterface.hpp>
37 #include <boost/shared_ptr.hpp>
43 namespace sd
{ namespace slidesorter
{ namespace cache
{
45 typedef const SdrPage
* CacheKey
;
47 /** This interface allows the individualisation of different instances of
53 /** This method is called when the asynchronous creation of a preview
56 The key of the page for which the preview has been created.
58 The newly created preview.
60 virtual void NotifyPreviewCreation (
62 const ::boost::shared_ptr
<BitmapEx
>& rPreview
) = 0;
64 /** Called to determine whether the system is idle and a preview can be
65 created without annoying the user.
67 virtual bool IsIdle (void) = 0;
69 /** This method is used to determine whether a page is currently visible
70 or not. It is called when the cache becomes to large and some
71 previews have to be released or scaled down.
73 virtual bool IsVisible (CacheKey aKey
) = 0;
75 /** Return the page associdated with the given key. Note that different
76 keys may map to a single page (this may be the case with custom
79 virtual const SdrPage
* GetPage (CacheKey aKey
) = 0;
81 /** This method is used when the request queue is filled. It asks for
82 the list of visible entries and maybe for the list of not visible
83 entries and creates preview creation requests for them.
85 When this is <FALSE/> then the implementation can decide whether
86 to allow rendering of previews that are not visible (ahead of
87 time). When not then return an empty pointer or an empty vector.
89 virtual ::boost::shared_ptr
<std::vector
<CacheKey
> > GetEntryList (bool bVisible
) = 0;
91 /** Return the priority that defines the order in which previews are
92 created for different keys/pages. Typically the visible pages come
93 first, then top-down, left-to-right.
95 virtual sal_Int32
GetPriority (CacheKey aKey
) = 0;
97 /** Return the model to which the pages belong for which the called
98 cache manages the previews. Different caches that belong to the
99 same model but have different preview sizes may acces previews of
100 each other in order to create fast previews of the previews.
102 virtual ::com::sun::star::uno::Reference
<com::sun::star::uno::XInterface
> GetModel (void) = 0;
105 typedef ::boost::shared_ptr
<CacheContext
> SharedCacheContext
;
107 } } } // end of namespace ::sd::slidesorter::cache