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/compbase.hxx>
31 #include <cppuhelper/basemutex.hxx>
33 #include <editeng/unoipset.hxx>
37 namespace com
{ namespace sun
{ namespace star
{
42 namespace animations
{
51 namespace vcl
{ class Window
; }
54 class CommandSwipeData
;
55 class CommandLongPressData
;
59 #define PAGE_NO_END 65535
61 /* Definition of SlideShow class */
70 struct PresentationSettingsEx
;
79 typedef ::cppu::WeakComponentImplHelper
< css::presentation::XPresentation2
, css::lang::XServiceInfo
> SlideshowBase
;
81 class SlideShow
: private ::cppu::BaseMutex
, public SlideshowBase
84 /// used by the model to create a slideshow for it
85 static rtl::Reference
< SlideShow
> Create( SdDrawDocument
* pDoc
);
88 static rtl::Reference
< SlideShow
> GetSlideShow( SdDrawDocument
const * pDocument
);
89 static rtl::Reference
< SlideShow
> GetSlideShow( SdDrawDocument
const & rDocument
);
90 static rtl::Reference
< SlideShow
> GetSlideShow( ViewShellBase
const & rBase
);
92 static css::uno::Reference
< css::presentation::XSlideShowController
> GetSlideShowController(ViewShellBase
const & rBase
);
94 static bool StartPreview( ViewShellBase
const & rBase
,
95 const css::uno::Reference
< css::drawing::XDrawPage
>& xDrawPage
,
96 const css::uno::Reference
< css::animations::XAnimationNode
>& xAnimationNode
);
98 static void Stop( ViewShellBase
const & rBase
);
100 /// returns true if there is a running presentation for the given ViewShellBase
101 static bool IsRunning( ViewShellBase
const & rBase
);
103 /// returns true if there is a running presentation inside the given ViewShell
104 /// returns false even if there is a running presentation but in another ViewShell
105 static bool IsRunning( ViewShell
& rViewShell
);
110 const css::uno::Reference
< css::drawing::XDrawPage
>& xDrawPage
,
111 const css::uno::Reference
< css::animations::XAnimationNode
>& xAnimationNode
);
115 virtual void SAL_CALL
disposing() override
;
118 virtual OUString SAL_CALL
getImplementationName( ) override
;
119 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
120 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
123 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
124 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
125 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
126 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
127 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
128 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
129 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
132 virtual void SAL_CALL
start( ) override
;
133 virtual void SAL_CALL
end() override
;
134 virtual void SAL_CALL
rehearseTimings( ) override
;
137 virtual void SAL_CALL
startWithArguments(const css::uno::Sequence
< css::beans::PropertyValue
>& Arguments
) override
;
138 virtual sal_Bool SAL_CALL
isRunning( ) override
;
139 virtual css::uno::Reference
< css::presentation::XSlideShowController
> SAL_CALL
getController( ) override
;
144 void jumpToPageNumber( sal_Int32 nPage
); // a.k.a. FuSlideShow::JumpToPage()
145 void jumpToPageIndex( sal_Int32 nIndex
);
146 void jumpToBookmark( const OUString
& sBookmark
); // a.k.a. FuSlideShow::JumpToBookmark()
148 /** sets or clears the pause state of the running slideshow.
149 !!!! This should only be called by the SdShowWindow !!!!*/
150 void pause( bool bPause
);
151 bool swipe(const CommandSwipeData
&rSwipeData
);
152 bool longpress(const CommandLongPressData
& rLongPressData
);
155 bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen()
156 OutputDevice
* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow()
157 int getAnimationMode(); // a.k.a. FuSlideShow::GetAnimationMode()
158 sal_Int32
getCurrentPageNumber(); // a.k.a. FuSlideShow::GetCurrentPage()
161 void resize( const Size
&rSize
);
162 void activate(ViewShellBase
& rBase
);
166 bool keyInput(const KeyEvent
& rKEvt
);
168 bool dependsOn( ViewShellBase
const * pViewShellBase
);
170 static sal_Int32
GetDisplay();
172 bool IsExitAfterPresenting() const;
173 void SetExitAfterPresenting(bool bExit
);
176 SlideShow( SdDrawDocument
* pDoc
);
178 DECL_LINK( StartInPlacePresentationConfigurationHdl
, void *, void );
179 void StartInPlacePresentationConfigurationCallback();
181 void StartInPlacePresentation();
182 void StartFullscreenPresentation();
184 /// @throws css::uno::RuntimeException
185 void ThrowIfDisposed() const;
187 void CreateController( ViewShell
* pViewSh
, ::sd::View
* pView
, vcl::Window
* pParentWindow
);
188 WorkWindow
*GetWorkWindow();
190 SlideShow(const SlideShow
&) = delete;
191 SlideShow
& operator=( const SlideShow
& ) = delete;
193 SvxItemPropertySet
const maPropSet
;
195 rtl::Reference
< SlideshowImpl
> mxController
;
196 /** This flag is used together with mxController.is() to prevent
197 multiple instances of the slide show for one document. The flag
198 covers the time before mxController is set.
201 SdDrawDocument
* mpDoc
;
203 std::shared_ptr
< PresentationSettingsEx
> mxCurrentSettings
;
205 ViewShellBase
* mpCurrentViewShellBase
;
206 ViewShellBase
* mpFullScreenViewShellBase
;
207 FrameView
* mpFullScreenFrameView
;
208 ImplSVEvent
* mnInPlaceConfigEvent
;
211 namespace slideshowhelp
213 void ShowSlideShow(SfxRequest
const & rReq
, SdDrawDocument
&rDoc
);
218 #endif // INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */