1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_INC_SLIDESHOW_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
23 #include <com/sun/star/presentation/XPresentation2.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <rtl/ref.hxx>
28 #include <tools/link.hxx>
30 #include <cppuhelper/compbase2.hxx>
31 #include <cppuhelper/basemutex.hxx>
33 #include <editeng/unoipset.hxx>
35 #include <boost/shared_ptr.hpp>
37 namespace com
{ namespace sun
{ namespace star
{
42 namespace animations
{
52 namespace vcl
{ class Window
; }
55 class CommandSwipeData
;
56 class CommandLongPressData
;
60 #define PAGE_NO_END 65535
62 /* Definition of SlideShow class */
72 struct PresentationSettingsEx
;
81 typedef ::cppu::WeakComponentImplHelper2
< ::com::sun::star::presentation::XPresentation2
, ::com::sun::star::lang::XServiceInfo
> SlideshowBase
;
83 class SlideShow
: private ::cppu::BaseMutex
, public SlideshowBase
86 /// used by the model to create a slideshow for it
87 static rtl::Reference
< SlideShow
> Create( SdDrawDocument
* pDoc
);
90 static rtl::Reference
< SlideShow
> GetSlideShow( SdDrawDocument
* pDocument
);
91 static rtl::Reference
< SlideShow
> GetSlideShow( SdDrawDocument
& rDocument
);
92 static rtl::Reference
< SlideShow
> GetSlideShow( ViewShellBase
& rBase
);
94 static ::com::sun::star::uno::Reference
< ::com::sun::star::presentation::XSlideShowController
> GetSlideShowController(ViewShellBase
& rBase
);
96 static bool StartPreview( ViewShellBase
& rBase
,
97 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xDrawPage
,
98 const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xAnimationNode
,
99 vcl::Window
* pParent
= 0 );
101 static void Stop( ViewShellBase
& rBase
);
103 /// returns true if there is a running presentation for the given ViewShellBase
104 static bool IsRunning( ViewShellBase
& rBase
);
106 /// returns true if there is a running presentation inside the given ViewShell
107 /// returns false even if there is a running presentation but in another ViewShell
108 static bool IsRunning( ViewShell
& rViewShell
);
113 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xDrawPage
,
114 const ::com::sun::star::uno::Reference
< ::com::sun::star::animations::XAnimationNode
>& xAnimationNode
,
115 vcl::Window
* pParent
= 0 );
119 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
122 virtual OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
131 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
132 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw (::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual void SAL_CALL
start( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
137 virtual void SAL_CALL
end()
138 throw (::com::sun::star::uno::RuntimeException
,
139 std::exception
) SAL_OVERRIDE
;
140 virtual void SAL_CALL
rehearseTimings( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 virtual void SAL_CALL
startWithArguments(const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& Arguments
)
144 throw (::com::sun::star::uno::RuntimeException
,
145 std::exception
) SAL_OVERRIDE
;
146 virtual sal_Bool SAL_CALL
isRunning( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::presentation::XSlideShowController
> SAL_CALL
getController( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 void jumpToPageNumber( sal_Int32 nPage
); // a.k.a. FuSlideShow::JumpToPage()
153 void jumpToPageIndex( sal_Int32 nIndex
);
154 void jumpToBookmark( const OUString
& sBookmark
); // a.k.a. FuSlideShow::JumpToBookmark()
156 /** sets or clears the pause state of the running slideshow.
157 !!!! This should only be called by the SdShowWindow !!!!*/
158 bool pause( bool bPause
);
159 bool swipe(const CommandSwipeData
&rSwipeData
);
160 bool longpress(const CommandLongPressData
& rLongPressData
);
163 bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen()
164 bool isAlwaysOnTop(); // a.k.a. FuSlideShow::IsAlwaysOnTop();
165 OutputDevice
* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow()
166 int getAnimationMode(); // a.k.a. FuSlideShow::GetAnimationMode()
167 sal_Int32
getCurrentPageNumber(); // a.k.a. FuSlideShow::GetCurrentPage()
168 sal_Int32
getFirstPageNumber();
169 sal_Int32
getLastPageNumber();
171 bool isDrawingPossible();
174 void resize( const Size
&rSize
);
175 void activate(ViewShellBase
& rBase
);
176 void deactivate(ViewShellBase
& rBase
);
177 void paint( const Rectangle
& rRect
);
179 bool keyInput(const KeyEvent
& rKEvt
);
181 void receiveRequest(SfxRequest
& rReq
);
183 bool dependsOn( ViewShellBase
* pViewShellBase
);
185 static sal_Int32
GetDisplay();
187 bool IsExitAfterPresenting() const;
188 void SetExitAfterPresenting(bool bExit
);
191 SlideShow( SdDrawDocument
* pDoc
);
193 DECL_LINK( StartInPlacePresentationConfigurationHdl
, void * );
194 void StartInPlacePresentationConfigurationCallback();
196 void StartInPlacePresentation();
197 void StartFullscreenPresentation();
199 void ThrowIfDisposed() const throw (css::uno::RuntimeException
);
201 void CreateController( ViewShell
* pViewSh
, ::sd::View
* pView
, vcl::Window
* pParentWindow
);
202 WorkWindow
*GetWorkWindow();
204 SlideShow(const SlideShow
&) SAL_DELETED_FUNCTION
;
205 SlideShow
& operator=( const SlideShow
& ) SAL_DELETED_FUNCTION
;
207 SvxItemPropertySet maPropSet
;
209 rtl::Reference
< SlideshowImpl
> mxController
;
210 /** This flag is used together with mxController.is() to prevent
211 multiple instances of the slide show for one document. The flag
212 covers the time before mxController is set.
215 SdDrawDocument
* mpDoc
;
217 boost::shared_ptr
< PresentationSettingsEx
> mxCurrentSettings
;
219 ViewShellBase
* mpCurrentViewShellBase
;
220 ViewShellBase
* mpFullScreenViewShellBase
;
221 FrameView
* mpFullScreenFrameView
;
222 ImplSVEvent
* mnInPlaceConfigEvent
;
225 namespace slideshowhelp
227 void ShowSlideShow(SfxRequest
& rReq
, SdDrawDocument
&rDoc
);
232 #endif // INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */