25#include <com/sun/star/lang/XMultiServiceFactory.hpp>
26#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
27#include <com/sun/star/container/XNameAccess.hpp>
28#include <com/sun/star/configuration/theDefaultProvider.hpp>
37 typedef std::shared_ptr<CacheConfiguration> CacheConfigSharedPtr;
38 CacheConfigSharedPtr& theInstance()
40 static CacheConfigSharedPtr SINGLETON;
50 CacheConfigSharedPtr &rInstancePtr = theInstance();
55 rInstancePtr = std::shared_ptr<CacheConfiguration>(
mpWeakInstance);
62 rInstancePtr->m_ReleaseTimer.SetInvokeHandler(
64 rInstancePtr->m_ReleaseTimer.SetTimeout(5000 );
65 rInstancePtr->m_ReleaseTimer.Start();
72 : m_ReleaseTimer(
"sd::CacheConfiguration maReleaseTimer")
78 Reference<lang::XMultiServiceFactory> xProvider =
79 configuration::theDefaultProvider::get( ::comphelper::getProcessComponentContext() );
84 {
"nodepath",
Any(OUString(
"/org.openoffice.Office.Impress/"))},
85 {
"depth",
Any(sal_Int32(-1))}
88 Reference<XInterface> xRoot (xProvider->createInstanceWithArguments(
89 "com.sun.star.configuration.ConfigurationAccess",
93 Reference<container::XHierarchicalNameAccess> xHierarchy (xRoot, UNO_QUERY);
94 if ( ! xHierarchy.is())
98 mxCacheNode.set( xHierarchy->getByHierarchicalName(
"MultiPaneGUI/SlideSorter/PreviewCache"), UNO_QUERY);
128 CacheConfigSharedPtr &rInstancePtr = theInstance();
130 rInstancePtr.reset();
137 CacheConfigSharedPtr &rInstancePtr = theInstance();
138 rInstancePtr.reset();
A very simple and easy-to-use access to configuration entries regarding the slide sorter cache.
static std::shared_ptr< CacheConfiguration > Instance()
Return an instance to this class.
css::uno::Any GetValue(const OUString &rName)
Look up the specified value in MultiPaneGUI/SlideSorter/PreviewCache.
static std::weak_ptr< CacheConfiguration > mpWeakInstance
When a caller holds a reference after we have released ours we use this weak pointer to avoid creatin...
css::uno::Reference< css::container::XNameAccess > mxCacheNode
#define LINK(Instance, Class, Member)
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
IMPL_STATIC_LINK_NOARG(CacheConfiguration, TimerCallback, Timer *, void)