Update ooo320-m1
[ooovba.git] / sd / source / ui / slidesorter / cache / SlsCacheConfiguration.hxx
blobf9c6d7ac4e2c079f6bc8f5f14d9a3d7eac127c25
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlsCacheConfiguration.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_SLIDESORTER_CACHE_CONFIGURATION_HXX
32 #define SD_SLIDESORTER_CACHE_CONFIGURATION_HXX
34 #include <com/sun/star/uno/Any.hxx>
35 #include <vcl/timer.hxx>
36 #include <com/sun/star/container/XNameAccess.hpp>
37 #include <boost/shared_ptr.hpp>
38 #include <boost/weak_ptr.hpp>
40 namespace sd { namespace slidesorter { namespace cache {
42 /** A very simple and easy-to-use access to configuration entries regarding
43 the slide sorter cache.
45 class CacheConfiguration
47 public:
48 /** Return an instance to this class. The reference is released after 5
49 seconds. Subsequent calls to this function will create a new
50 instance.
52 static ::boost::shared_ptr<CacheConfiguration> Instance (void);
54 /** Look up the specified value in
55 MultiPaneGUI/SlideSorter/PreviewCache. When the specified value
56 does not exist then an empty Any is returned.
58 ::com::sun::star::uno::Any GetValue (const ::rtl::OUString& rName);
60 private:
61 static ::boost::shared_ptr<CacheConfiguration> mpInstance;
62 /** When a caller holds a reference after we have released ours we use
63 this weak pointer to avoid creating a new instance.
65 static ::boost::weak_ptr<CacheConfiguration> mpWeakInstance;
66 static Timer maReleaseTimer;
67 ::com::sun::star::uno::Reference<
68 ::com::sun::star::container::XNameAccess> mxCacheNode;
70 CacheConfiguration (void);
72 DECL_LINK(TimerCallback, Timer*);
75 } } } // end of namespace ::sd::slidesorter::cache
77 #endif