Update ooo320-m1
[ooovba.git] / sd / source / ui / presenter / PresenterPreviewCache.hxx
blobfd0fea7cdaa56a60af1dc880ad18e105cf476cf7
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: PresenterPreviewCache.hxx,v $
11 * $Revision: 1.3 $
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_PRESENTER_PRESENTER_PREVIEW_CACHE_HXX
33 #define SD_PRESENTER_PRESENTER_PREVIEW_CACHE_HXX
35 #include <com/sun/star/drawing/XSlidePreviewCache.hpp>
36 #include <com/sun/star/lang/XInitialization.hpp>
37 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include "cache/SlsPageCache.hxx"
39 #include <cppuhelper/compbase2.hxx>
40 #include <cppuhelper/basemutex.hxx>
41 #include <boost/noncopyable.hpp>
42 #include <boost/shared_ptr.hpp>
44 namespace css = ::com::sun::star;
46 namespace sd { namespace presenter {
48 namespace {
49 typedef ::cppu::WeakComponentImplHelper2<
50 css::lang::XInitialization,
51 css::drawing::XSlidePreviewCache
52 > PresenterPreviewCacheInterfaceBase;
55 /** Uno API wrapper around the slide preview cache.
57 class PresenterPreviewCache
58 : private ::boost::noncopyable,
59 private ::cppu::BaseMutex,
60 public PresenterPreviewCacheInterfaceBase
62 public:
63 PresenterPreviewCache (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
64 virtual ~PresenterPreviewCache (void);
66 // XInitialize
68 /** Accepts no arguments. All values that are necessary to set up a
69 preview cache can be provided via methods.
71 virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
72 throw(css::uno::Exception,css::uno::RuntimeException);
75 // XSlidePreviewCache
77 virtual void SAL_CALL setDocumentSlides (
78 const css::uno::Reference<css::container::XIndexAccess>& rxSlides,
79 const css::uno::Reference<css::uno::XInterface>& rxDocument)
80 throw (css::uno::RuntimeException);
82 virtual void SAL_CALL setVisibleRange (
83 sal_Int32 nFirstVisibleSlideIndex,
84 sal_Int32 nLastVisibleSlideIndex)
85 throw (css::uno::RuntimeException);
87 virtual void SAL_CALL setPreviewSize (
88 const css::geometry::IntegerSize2D& rSize)
89 throw (css::uno::RuntimeException);
91 virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL
92 getSlidePreview (
93 sal_Int32 nSlideIndex,
94 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas)
95 throw (css::uno::RuntimeException);
97 virtual void SAL_CALL addPreviewCreationNotifyListener (
98 const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener)
99 throw (css::uno::RuntimeException);
101 virtual void SAL_CALL removePreviewCreationNotifyListener (
102 const css::uno::Reference<css::drawing::XSlidePreviewCacheListener>& rxListener)
103 throw (css::uno::RuntimeException);
105 virtual void SAL_CALL pause (void)
106 throw (css::uno::RuntimeException);
108 virtual void SAL_CALL resume (void)
109 throw (css::uno::RuntimeException);
111 private:
112 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
113 class PresenterCacheContext;
114 Size maPreviewSize;
115 ::boost::shared_ptr<PresenterCacheContext> mpCacheContext;
116 ::boost::shared_ptr<sd::slidesorter::cache::PageCache> mpCache;
118 /** This method throws a DisposedException when the object has already been
119 disposed.
121 void ThrowIfDisposed (void) throw (css::lang::DisposedException);
124 } } // end of namespace ::sd::presenter
126 #endif