bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / presenter / PresenterPreviewCache.hxx
blobfa680c72e0ca637eba207baf7f7a0f1e49f47f59
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_PRESENTER_PRESENTERPREVIEWCACHE_HXX
21 #define INCLUDED_SD_SOURCE_UI_PRESENTER_PRESENTERPREVIEWCACHE_HXX
23 #include <com/sun/star/drawing/XSlidePreviewCache.hpp>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include "cache/SlsPageCache.hxx"
27 #include <cppuhelper/compbase2.hxx>
28 #include <cppuhelper/basemutex.hxx>
29 #include <boost/noncopyable.hpp>
30 #include <boost/shared_ptr.hpp>
32 namespace sd { namespace presenter {
34 namespace {
35 typedef ::cppu::WeakComponentImplHelper2<
36 css::lang::XInitialization,
37 css::drawing::XSlidePreviewCache
38 > PresenterPreviewCacheInterfaceBase;
41 /** Uno API wrapper around the slide preview cache.
43 class PresenterPreviewCache
44 : private ::boost::noncopyable,
45 private ::cppu::BaseMutex,
46 public PresenterPreviewCacheInterfaceBase
48 public:
49 PresenterPreviewCache (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
50 virtual ~PresenterPreviewCache();
52 // XInitialize
54 /** Accepts no arguments. All values that are necessary to set up a
55 preview cache can be provided via methods.
57 virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
58 throw(css::uno::Exception,css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
60 // XSlidePreviewCache
62 virtual void SAL_CALL setDocumentSlides (
63 const css::uno::Reference<css::container::XIndexAccess>& rxSlides,
64 const css::uno::Reference<css::uno::XInterface>& rxDocument)
65 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 virtual void SAL_CALL setVisibleRange (
68 sal_Int32 nFirstVisibleSlideIndex,
69 sal_Int32 nLastVisibleSlideIndex)
70 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 virtual void SAL_CALL setPreviewSize (
73 const css::geometry::IntegerSize2D& rSize)
74 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
76 virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL
77 getSlidePreview (
78 sal_Int32 nSlideIndex,
79 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas)
80 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 virtual void SAL_CALL addPreviewCreationNotifyListener (
83 const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener)
84 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 virtual void SAL_CALL removePreviewCreationNotifyListener (
87 const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener)
88 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 virtual void SAL_CALL pause()
91 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 virtual void SAL_CALL resume()
94 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 private:
97 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
98 class PresenterCacheContext;
99 Size maPreviewSize;
100 ::boost::shared_ptr<PresenterCacheContext> mpCacheContext;
101 ::boost::shared_ptr<sd::slidesorter::cache::PageCache> mpCache;
103 /** This method throws a DisposedException when the object has already been
104 disposed.
106 void ThrowIfDisposed() throw (css::lang::DisposedException);
109 } } // end of namespace ::sd::presenter
111 #endif
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */