15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
55b190011SAndrew Rist * distributed with this work for additional information
65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist * "License"); you may not use this file except in compliance
95b190011SAndrew Rist * with the License. You may obtain a copy of the License at
105b190011SAndrew Rist *
115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist *
135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist * software distributed under the License is distributed on an
155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist * KIND, either express or implied. See the License for the
175b190011SAndrew Rist * specific language governing permissions and limitations
185b190011SAndrew Rist * under the License.
195b190011SAndrew Rist *
205b190011SAndrew Rist *************************************************************/
215b190011SAndrew Rist
225b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir //#include <com/sun/star/frame/XController.hpp>
28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
29cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XControllerManager.hpp>
30cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
31cdf0e10cSrcweir #include <comphelper/serviceinfohelper.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx>
34cdf0e10cSrcweir
35cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
36cdf0e10cSrcweir #include <vos/mutex.hxx>
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include <vcl/svapp.hxx>
39cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
40cdf0e10cSrcweir #include <svx/svdpool.hxx>
41cdf0e10cSrcweir #include <svl/itemprop.hxx>
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
44cdf0e10cSrcweir
45cdf0e10cSrcweir #include <toolkit/unohlp.hxx>
46cdf0e10cSrcweir #include <svx/unoprov.hxx>
47cdf0e10cSrcweir
48cdf0e10cSrcweir #include "framework/FrameworkHelper.hxx"
49cdf0e10cSrcweir
50cdf0e10cSrcweir #include "FrameView.hxx"
51cdf0e10cSrcweir #include "unomodel.hxx"
52cdf0e10cSrcweir #include "slideshow.hxx"
53cdf0e10cSrcweir #include "slideshowimpl.hxx"
54cdf0e10cSrcweir #include "sdattr.hrc"
55cdf0e10cSrcweir #include "FactoryIds.hxx"
56cdf0e10cSrcweir #include "ViewShell.hxx"
57cdf0e10cSrcweir #include "SlideShowRestarter.hxx"
58cdf0e10cSrcweir #include "DrawController.hxx"
59cdf0e10cSrcweir #include <boost/bind.hpp>
60cdf0e10cSrcweir
61cdf0e10cSrcweir using ::com::sun::star::presentation::XSlideShowController;
62cdf0e10cSrcweir using ::com::sun::star::container::XIndexAccess;
63cdf0e10cSrcweir using ::sd::framework::FrameworkHelper;
64cdf0e10cSrcweir using ::rtl::OUString;
65cdf0e10cSrcweir using ::com::sun::star::awt::XWindow;
66cdf0e10cSrcweir using namespace ::sd;
67cdf0e10cSrcweir using namespace ::cppu;
68cdf0e10cSrcweir using namespace ::vos;
69cdf0e10cSrcweir using namespace ::com::sun::star::uno;
70cdf0e10cSrcweir using namespace ::com::sun::star::presentation;
71cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
72cdf0e10cSrcweir using namespace ::com::sun::star::beans;
73cdf0e10cSrcweir using namespace ::com::sun::star::lang;
74cdf0e10cSrcweir using namespace ::com::sun::star::animations;
75cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
76cdf0e10cSrcweir
77cdf0e10cSrcweir extern String getUiNameFromPageApiNameImpl( const ::rtl::OUString& rApiName );
78cdf0e10cSrcweir
79cdf0e10cSrcweir #define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
80cdf0e10cSrcweir
81cdf0e10cSrcweir
82cdf0e10cSrcweir namespace {
83cdf0e10cSrcweir /** This local version of the work window overloads DataChanged() so that it
84cdf0e10cSrcweir can restart the slide show when a display is added or removed.
85cdf0e10cSrcweir */
86cdf0e10cSrcweir class FullScreenWorkWindow : public WorkWindow
87cdf0e10cSrcweir {
88cdf0e10cSrcweir public:
FullScreenWorkWindow(const::rtl::Reference<SlideShow> & rpSlideShow,ViewShellBase * pViewShellBase)89cdf0e10cSrcweir FullScreenWorkWindow (
90cdf0e10cSrcweir const ::rtl::Reference<SlideShow>& rpSlideShow,
91cdf0e10cSrcweir ViewShellBase* pViewShellBase)
92cdf0e10cSrcweir : WorkWindow(NULL, WB_HIDE | WB_CLIPCHILDREN),
93cdf0e10cSrcweir mpRestarter(new SlideShowRestarter(rpSlideShow, pViewShellBase))
94cdf0e10cSrcweir {}
95cdf0e10cSrcweir
96cdf0e10cSrcweir
DataChanged(const DataChangedEvent & rEvent)97cdf0e10cSrcweir virtual void DataChanged (const DataChangedEvent& rEvent)
98cdf0e10cSrcweir {
99cdf0e10cSrcweir if (rEvent.GetType() == DATACHANGED_DISPLAY)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir mpRestarter->Restart();
102cdf0e10cSrcweir }
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
105cdf0e10cSrcweir private:
106cdf0e10cSrcweir ::boost::shared_ptr<SlideShowRestarter> mpRestarter;
107cdf0e10cSrcweir };
108cdf0e10cSrcweir
109cdf0e10cSrcweir /** Return the default display id (or -1 when that can not be
110cdf0e10cSrcweir determined.)
111cdf0e10cSrcweir */
GetDefaultDisplay(void)112cdf0e10cSrcweir sal_Int32 GetDefaultDisplay (void)
113cdf0e10cSrcweir {
114cdf0e10cSrcweir try
115cdf0e10cSrcweir {
116cdf0e10cSrcweir Reference< XMultiServiceFactory > xFactory(::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
117cdf0e10cSrcweir Reference< XPropertySet > xMonProps(xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW );
118cdf0e10cSrcweir const OUString sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) );
119cdf0e10cSrcweir sal_Int32 nPrimaryIndex (-1);
120cdf0e10cSrcweir if (xMonProps->getPropertyValue( sPropertyName ) >>= nPrimaryIndex)
121cdf0e10cSrcweir return nPrimaryIndex;
122cdf0e10cSrcweir }
123cdf0e10cSrcweir catch( Exception& )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir }
126cdf0e10cSrcweir return -1;
127cdf0e10cSrcweir }
128cdf0e10cSrcweir }
129cdf0e10cSrcweir
130cdf0e10cSrcweir
131cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
132cdf0e10cSrcweir // --------------------------------------------------------------------
133cdf0e10cSrcweir
ImplGetPresentationPropertyMap()134cdf0e10cSrcweir const SfxItemPropertyMapEntry* ImplGetPresentationPropertyMap()
135cdf0e10cSrcweir {
136cdf0e10cSrcweir // NOTE: First member must be sorted
137cdf0e10cSrcweir static const SfxItemPropertyMapEntry aPresentationPropertyMap_Impl[] =
138cdf0e10cSrcweir {
139cdf0e10cSrcweir { MAP_CHAR_LEN("AllowAnimations"), ATTR_PRESENT_ANIMATION_ALLOWED, &::getBooleanCppuType(), 0, 0 },
140cdf0e10cSrcweir { MAP_CHAR_LEN("CustomShow"), ATTR_PRESENT_CUSTOMSHOW, &::getCppuType((const OUString*)0), 0, 0 },
141cdf0e10cSrcweir { MAP_CHAR_LEN("Display"), ATTR_PRESENT_DISPLAY, &::getCppuType((const sal_Int32*)0), 0, 0 },
142cdf0e10cSrcweir { MAP_CHAR_LEN("FirstPage"), ATTR_PRESENT_DIANAME, &::getCppuType((const OUString*)0), 0, 0 },
143cdf0e10cSrcweir { MAP_CHAR_LEN("IsAlwaysOnTop"), ATTR_PRESENT_ALWAYS_ON_TOP, &::getBooleanCppuType(), 0, 0 },
144cdf0e10cSrcweir { MAP_CHAR_LEN("IsAutomatic"), ATTR_PRESENT_MANUEL, &::getBooleanCppuType(), 0, 0 },
145cdf0e10cSrcweir { MAP_CHAR_LEN("IsEndless"), ATTR_PRESENT_ENDLESS, &::getBooleanCppuType(), 0, 0 },
146cdf0e10cSrcweir { MAP_CHAR_LEN("IsFullScreen"), ATTR_PRESENT_FULLSCREEN, &::getBooleanCppuType(), 0, 0 },
147cdf0e10cSrcweir { MAP_CHAR_LEN("IsShowAll"), ATTR_PRESENT_ALL, &::getBooleanCppuType(), 0, 0 },
148cdf0e10cSrcweir { MAP_CHAR_LEN("IsMouseVisible"), ATTR_PRESENT_MOUSE, &::getBooleanCppuType(), 0, 0 },
149cdf0e10cSrcweir { MAP_CHAR_LEN("IsShowLogo"), ATTR_PRESENT_SHOW_PAUSELOGO, &::getBooleanCppuType(), 0, 0 },
150cdf0e10cSrcweir { MAP_CHAR_LEN("IsTransitionOnClick"), ATTR_PRESENT_CHANGE_PAGE, &::getBooleanCppuType(), 0, 0 },
151cdf0e10cSrcweir { MAP_CHAR_LEN("Pause"), ATTR_PRESENT_PAUSE_TIMEOUT, &::getCppuType((const sal_Int32*)0), 0, 0 },
152cdf0e10cSrcweir { MAP_CHAR_LEN("StartWithNavigator"), ATTR_PRESENT_NAVIGATOR, &::getBooleanCppuType(), 0, 0 },
153cdf0e10cSrcweir { MAP_CHAR_LEN("UsePen"), ATTR_PRESENT_PEN, &::getBooleanCppuType(), 0, 0 },
154cdf0e10cSrcweir { 0,0,0,0,0,0}
155cdf0e10cSrcweir };
156cdf0e10cSrcweir
157cdf0e10cSrcweir return aPresentationPropertyMap_Impl;
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir //SfxItemPropertyMap map_impl[] = { { 0,0,0,0,0,0 } };
161cdf0e10cSrcweir
162cdf0e10cSrcweir // --------------------------------------------------------------------
163cdf0e10cSrcweir // class SlideShow
164cdf0e10cSrcweir // --------------------------------------------------------------------
165cdf0e10cSrcweir
SlideShow(SdDrawDocument * pDoc)166cdf0e10cSrcweir SlideShow::SlideShow( SdDrawDocument* pDoc )
167cdf0e10cSrcweir : SlideshowBase( m_aMutex )
168cdf0e10cSrcweir , maPropSet(ImplGetPresentationPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool())
169cdf0e10cSrcweir , mbIsInStartup(false)
170cdf0e10cSrcweir , mpDoc( pDoc )
171cdf0e10cSrcweir , mpCurrentViewShellBase( 0 )
172cdf0e10cSrcweir , mpFullScreenViewShellBase( 0 )
173cdf0e10cSrcweir , mpFullScreenFrameView( 0 )
174cdf0e10cSrcweir , mnInPlaceConfigEvent( 0 )
175cdf0e10cSrcweir {
176cdf0e10cSrcweir }
177cdf0e10cSrcweir
178cdf0e10cSrcweir // --------------------------------------------------------------------
179cdf0e10cSrcweir
ThrowIfDisposed()180cdf0e10cSrcweir void SlideShow::ThrowIfDisposed() throw (RuntimeException)
181cdf0e10cSrcweir {
182cdf0e10cSrcweir if( mpDoc == 0 )
183cdf0e10cSrcweir throw DisposedException();
184cdf0e10cSrcweir }
185cdf0e10cSrcweir
186cdf0e10cSrcweir // --------------------------------------------------------------------
187cdf0e10cSrcweir
188cdf0e10cSrcweir /// used by the model to create a slideshow for it
Create(SdDrawDocument * pDoc)189cdf0e10cSrcweir rtl::Reference< SlideShow > SlideShow::Create( SdDrawDocument* pDoc )
190cdf0e10cSrcweir {
191cdf0e10cSrcweir return new SlideShow( pDoc );
192cdf0e10cSrcweir }
193cdf0e10cSrcweir
194cdf0e10cSrcweir // --------------------------------------------------------------------
195cdf0e10cSrcweir
GetSlideShow(SdDrawDocument * pDocument)196cdf0e10cSrcweir rtl::Reference< SlideShow > SlideShow::GetSlideShow( SdDrawDocument* pDocument )
197cdf0e10cSrcweir {
198cdf0e10cSrcweir rtl::Reference< SlideShow > xRet;
199cdf0e10cSrcweir
200cdf0e10cSrcweir if( pDocument )
201cdf0e10cSrcweir xRet = rtl::Reference< SlideShow >( dynamic_cast< SlideShow* >( pDocument->getPresentation().get() ) );
202cdf0e10cSrcweir
203cdf0e10cSrcweir return xRet;
204cdf0e10cSrcweir }
205cdf0e10cSrcweir
206cdf0e10cSrcweir // --------------------------------------------------------------------
207cdf0e10cSrcweir
GetSlideShow(ViewShellBase & rBase)208cdf0e10cSrcweir rtl::Reference< SlideShow > SlideShow::GetSlideShow( ViewShellBase& rBase )
209cdf0e10cSrcweir {
210cdf0e10cSrcweir return GetSlideShow( rBase.GetDocument() );
211cdf0e10cSrcweir }
212cdf0e10cSrcweir
213cdf0e10cSrcweir // --------------------------------------------------------------------
214cdf0e10cSrcweir
GetSlideShowController(ViewShellBase & rBase)215cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > SlideShow::GetSlideShowController(ViewShellBase& rBase )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) );
218cdf0e10cSrcweir
219cdf0e10cSrcweir Reference< XSlideShowController > xRet;
220cdf0e10cSrcweir if( xSlideShow.is() )
221cdf0e10cSrcweir xRet = xSlideShow->getController();
222cdf0e10cSrcweir
223cdf0e10cSrcweir return xRet;
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
226cdf0e10cSrcweir // --------------------------------------------------------------------
227cdf0e10cSrcweir
StartPreview(ViewShellBase & rBase,const::com::sun::star::uno::Reference<::com::sun::star::drawing::XDrawPage> & xDrawPage,const::com::sun::star::uno::Reference<::com::sun::star::animations::XAnimationNode> & xAnimationNode,::Window * pParent)228cdf0e10cSrcweir bool SlideShow::StartPreview( ViewShellBase& rBase,
229cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
230cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
231cdf0e10cSrcweir ::Window* pParent /* = 0 */ )
232cdf0e10cSrcweir {
233cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) );
234cdf0e10cSrcweir if( xSlideShow.is() )
235cdf0e10cSrcweir return xSlideShow->startPreview( xDrawPage, xAnimationNode, pParent );
236cdf0e10cSrcweir
237cdf0e10cSrcweir return false;
238cdf0e10cSrcweir }
239cdf0e10cSrcweir
240cdf0e10cSrcweir // --------------------------------------------------------------------
241cdf0e10cSrcweir
Stop(ViewShellBase & rBase)242cdf0e10cSrcweir void SlideShow::Stop( ViewShellBase& rBase )
243cdf0e10cSrcweir {
244cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) );
245cdf0e10cSrcweir if( xSlideShow.is() )
246cdf0e10cSrcweir xSlideShow->end();
247cdf0e10cSrcweir }
248cdf0e10cSrcweir
249cdf0e10cSrcweir // --------------------------------------------------------------------
250cdf0e10cSrcweir
IsRunning(ViewShellBase & rBase)251cdf0e10cSrcweir bool SlideShow::IsRunning( ViewShellBase& rBase )
252cdf0e10cSrcweir {
253cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) );
254cdf0e10cSrcweir return xSlideShow.is() && xSlideShow->isRunning();
255cdf0e10cSrcweir }
256cdf0e10cSrcweir
257cdf0e10cSrcweir // --------------------------------------------------------------------
258cdf0e10cSrcweir
IsRunning(ViewShell & rViewShell)259cdf0e10cSrcweir bool SlideShow::IsRunning( ViewShell& rViewShell )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rViewShell.GetViewShellBase() ) );
262cdf0e10cSrcweir return xSlideShow.is() && xSlideShow->isRunning() && (xSlideShow->mxController->getViewShell() == &rViewShell);
263cdf0e10cSrcweir }
264cdf0e10cSrcweir
265cdf0e10cSrcweir // --------------------------------------------------------------------
266cdf0e10cSrcweir
CreateController(ViewShell * pViewSh,::sd::View * pView,::Window * pParentWindow)267cdf0e10cSrcweir void SlideShow::CreateController( ViewShell* pViewSh, ::sd::View* pView, ::Window* pParentWindow )
268cdf0e10cSrcweir {
269cdf0e10cSrcweir DBG_ASSERT( !mxController.is(), "sd::SlideShow::CreateController(), clean up old controller first!" );
270cdf0e10cSrcweir
271cdf0e10cSrcweir Reference< XPresentation2 > xThis( this );
272cdf0e10cSrcweir
273cdf0e10cSrcweir rtl::Reference<SlideshowImpl> xController (
274cdf0e10cSrcweir new SlideshowImpl(xThis, pViewSh, pView, mpDoc, pParentWindow));
275cdf0e10cSrcweir
276cdf0e10cSrcweir // Reset mbIsInStartup. From here mxController.is() is used to prevent
277cdf0e10cSrcweir // multiple slide show instances for one document.
278cdf0e10cSrcweir mxController = xController;
279cdf0e10cSrcweir mbIsInStartup = false;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
282cdf0e10cSrcweir // --------------------------------------------------------------------
283cdf0e10cSrcweir // XServiceInfo
284cdf0e10cSrcweir // --------------------------------------------------------------------
285cdf0e10cSrcweir
getImplementationName()286cdf0e10cSrcweir OUString SAL_CALL SlideShow::getImplementationName( ) throw(RuntimeException)
287cdf0e10cSrcweir {
288cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SlideShow") );
289cdf0e10cSrcweir }
290cdf0e10cSrcweir
291cdf0e10cSrcweir // --------------------------------------------------------------------
292cdf0e10cSrcweir
supportsService(const OUString & ServiceName)293cdf0e10cSrcweir sal_Bool SAL_CALL SlideShow::supportsService( const OUString& ServiceName ) throw(RuntimeException)
294cdf0e10cSrcweir {
295cdf0e10cSrcweir return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames( ) );
296cdf0e10cSrcweir }
297cdf0e10cSrcweir
298cdf0e10cSrcweir // --------------------------------------------------------------------
299cdf0e10cSrcweir
getSupportedServiceNames()300cdf0e10cSrcweir Sequence< OUString > SAL_CALL SlideShow::getSupportedServiceNames( ) throw(RuntimeException)
301cdf0e10cSrcweir {
302cdf0e10cSrcweir OUString aService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.Presentation") );
303cdf0e10cSrcweir Sequence< OUString > aSeq( &aService, 1 );
304cdf0e10cSrcweir return aSeq;
305cdf0e10cSrcweir }
306cdf0e10cSrcweir
307cdf0e10cSrcweir // --------------------------------------------------------------------
308cdf0e10cSrcweir // XPropertySet
309cdf0e10cSrcweir // --------------------------------------------------------------------
310cdf0e10cSrcweir
getPropertySetInfo()311cdf0e10cSrcweir Reference< XPropertySetInfo > SAL_CALL SlideShow::getPropertySetInfo() throw(RuntimeException)
312cdf0e10cSrcweir {
313cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
314cdf0e10cSrcweir static Reference< XPropertySetInfo > xInfo = maPropSet.getPropertySetInfo();
315cdf0e10cSrcweir return xInfo;
316cdf0e10cSrcweir }
317cdf0e10cSrcweir
318cdf0e10cSrcweir // --------------------------------------------------------------------
319cdf0e10cSrcweir
setPropertyValue(const OUString & aPropertyName,const Any & aValue)320cdf0e10cSrcweir void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
321cdf0e10cSrcweir {
322cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
323cdf0e10cSrcweir ThrowIfDisposed();
324cdf0e10cSrcweir
325cdf0e10cSrcweir sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
326cdf0e10cSrcweir
327cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = maPropSet.getPropertyMapEntry(aPropertyName);
328cdf0e10cSrcweir
329cdf0e10cSrcweir if( pEntry && ((pEntry->nFlags & PropertyAttribute::READONLY) != 0) )
330cdf0e10cSrcweir throw PropertyVetoException();
331cdf0e10cSrcweir
332cdf0e10cSrcweir bool bValuesChanged = false;
333cdf0e10cSrcweir bool bIllegalArgument = true;
334cdf0e10cSrcweir
335cdf0e10cSrcweir switch( pEntry ? pEntry->nWID : -1 )
336cdf0e10cSrcweir {
337cdf0e10cSrcweir case ATTR_PRESENT_ALL:
338cdf0e10cSrcweir {
339cdf0e10cSrcweir sal_Bool bVal = sal_False;
340cdf0e10cSrcweir
341cdf0e10cSrcweir if( aValue >>= bVal )
342cdf0e10cSrcweir {
343cdf0e10cSrcweir bIllegalArgument = false;
344cdf0e10cSrcweir
345cdf0e10cSrcweir if( rPresSettings.mbAll != bVal )
346cdf0e10cSrcweir {
347cdf0e10cSrcweir rPresSettings.mbAll = bVal;
348cdf0e10cSrcweir bValuesChanged = true;
349cdf0e10cSrcweir if( bVal )
350cdf0e10cSrcweir rPresSettings.mbCustomShow = sal_False;
351cdf0e10cSrcweir }
352cdf0e10cSrcweir }
353cdf0e10cSrcweir break;
354cdf0e10cSrcweir }
355cdf0e10cSrcweir case ATTR_PRESENT_CHANGE_PAGE:
356cdf0e10cSrcweir {
357cdf0e10cSrcweir sal_Bool bVal = sal_False;
358cdf0e10cSrcweir
359cdf0e10cSrcweir if( aValue >>= bVal )
360cdf0e10cSrcweir {
361cdf0e10cSrcweir bIllegalArgument = false;
362cdf0e10cSrcweir
363cdf0e10cSrcweir if( bVal == rPresSettings.mbLockedPages )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir bValuesChanged = true;
366cdf0e10cSrcweir rPresSettings.mbLockedPages = !bVal;
367cdf0e10cSrcweir }
368cdf0e10cSrcweir }
369cdf0e10cSrcweir break;
370cdf0e10cSrcweir }
371cdf0e10cSrcweir
372cdf0e10cSrcweir case ATTR_PRESENT_ANIMATION_ALLOWED:
373cdf0e10cSrcweir {
374cdf0e10cSrcweir sal_Bool bVal = sal_False;
375cdf0e10cSrcweir
376cdf0e10cSrcweir if( aValue >>= bVal )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir bIllegalArgument = false;
379cdf0e10cSrcweir
380cdf0e10cSrcweir if(rPresSettings.mbAnimationAllowed != bVal)
381cdf0e10cSrcweir {
382cdf0e10cSrcweir bValuesChanged = true;
383cdf0e10cSrcweir rPresSettings.mbAnimationAllowed = bVal;
384cdf0e10cSrcweir }
385cdf0e10cSrcweir }
386cdf0e10cSrcweir break;
387cdf0e10cSrcweir }
388cdf0e10cSrcweir case ATTR_PRESENT_CUSTOMSHOW:
389cdf0e10cSrcweir {
390cdf0e10cSrcweir OUString aShow;
391cdf0e10cSrcweir if( aValue >>= aShow )
392cdf0e10cSrcweir {
393cdf0e10cSrcweir bIllegalArgument = false;
394cdf0e10cSrcweir
395cdf0e10cSrcweir const String aShowName( aShow );
396cdf0e10cSrcweir
397cdf0e10cSrcweir List* pCustomShowList = mpDoc->GetCustomShowList(sal_False);
398cdf0e10cSrcweir if(pCustomShowList)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir SdCustomShow* pCustomShow;
401cdf0e10cSrcweir for( pCustomShow = (SdCustomShow*) pCustomShowList->First(); pCustomShow != NULL; pCustomShow = (SdCustomShow*) pCustomShowList->Next() )
402cdf0e10cSrcweir {
403cdf0e10cSrcweir if( pCustomShow->GetName() == aShowName )
404cdf0e10cSrcweir break;
405cdf0e10cSrcweir }
406cdf0e10cSrcweir
407cdf0e10cSrcweir rPresSettings.mbCustomShow = sal_True;
408cdf0e10cSrcweir bValuesChanged = true;
409cdf0e10cSrcweir }
410cdf0e10cSrcweir }
411cdf0e10cSrcweir break;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir case ATTR_PRESENT_ENDLESS:
414cdf0e10cSrcweir {
415cdf0e10cSrcweir sal_Bool bVal = sal_False;
416cdf0e10cSrcweir
417cdf0e10cSrcweir if( aValue >>= bVal )
418cdf0e10cSrcweir {
419cdf0e10cSrcweir bIllegalArgument = false;
420cdf0e10cSrcweir
421cdf0e10cSrcweir if( rPresSettings.mbEndless != bVal)
422cdf0e10cSrcweir {
423cdf0e10cSrcweir bValuesChanged = true;
424cdf0e10cSrcweir rPresSettings.mbEndless = bVal;
425cdf0e10cSrcweir }
426cdf0e10cSrcweir }
427cdf0e10cSrcweir break;
428cdf0e10cSrcweir }
429cdf0e10cSrcweir case ATTR_PRESENT_FULLSCREEN:
430cdf0e10cSrcweir {
431cdf0e10cSrcweir sal_Bool bVal = sal_False;
432cdf0e10cSrcweir
433cdf0e10cSrcweir if( aValue >>= bVal )
434cdf0e10cSrcweir {
435cdf0e10cSrcweir bIllegalArgument = false;
436cdf0e10cSrcweir if( rPresSettings.mbFullScreen != bVal)
437cdf0e10cSrcweir {
438cdf0e10cSrcweir bValuesChanged = true;
439cdf0e10cSrcweir rPresSettings.mbFullScreen = bVal;
440cdf0e10cSrcweir }
441cdf0e10cSrcweir }
442cdf0e10cSrcweir break;
443cdf0e10cSrcweir }
444cdf0e10cSrcweir case ATTR_PRESENT_DIANAME:
445cdf0e10cSrcweir {
446cdf0e10cSrcweir OUString aPresPage;
447cdf0e10cSrcweir aValue >>= aPresPage;
448cdf0e10cSrcweir bIllegalArgument = false;
449cdf0e10cSrcweir if( (rPresSettings.maPresPage != aPresPage) || !rPresSettings.mbCustomShow || !rPresSettings.mbAll )
450cdf0e10cSrcweir {
451cdf0e10cSrcweir bValuesChanged = true;
452cdf0e10cSrcweir rPresSettings.maPresPage = getUiNameFromPageApiNameImpl(aPresPage);
453cdf0e10cSrcweir rPresSettings.mbCustomShow = sal_False;
454cdf0e10cSrcweir rPresSettings.mbAll = sal_False;
455cdf0e10cSrcweir }
456cdf0e10cSrcweir break;
457cdf0e10cSrcweir }
458cdf0e10cSrcweir case ATTR_PRESENT_MANUEL:
459cdf0e10cSrcweir {
460cdf0e10cSrcweir sal_Bool bVal = sal_False;
461cdf0e10cSrcweir
462cdf0e10cSrcweir if( aValue >>= bVal )
463cdf0e10cSrcweir {
464cdf0e10cSrcweir bIllegalArgument = false;
465cdf0e10cSrcweir
466cdf0e10cSrcweir if( rPresSettings.mbManual != bVal)
467cdf0e10cSrcweir {
468cdf0e10cSrcweir bValuesChanged = true;
469cdf0e10cSrcweir rPresSettings.mbManual = bVal;
470cdf0e10cSrcweir }
471cdf0e10cSrcweir }
472cdf0e10cSrcweir break;
473cdf0e10cSrcweir }
474cdf0e10cSrcweir case ATTR_PRESENT_MOUSE:
475cdf0e10cSrcweir {
476cdf0e10cSrcweir sal_Bool bVal = sal_False;
477cdf0e10cSrcweir
478cdf0e10cSrcweir if( aValue >>= bVal )
479cdf0e10cSrcweir {
480cdf0e10cSrcweir bIllegalArgument = false;
481cdf0e10cSrcweir if( rPresSettings.mbMouseVisible != bVal)
482cdf0e10cSrcweir {
483cdf0e10cSrcweir bValuesChanged = true;
484cdf0e10cSrcweir rPresSettings.mbMouseVisible = bVal;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir }
487cdf0e10cSrcweir break;
488cdf0e10cSrcweir }
489cdf0e10cSrcweir case ATTR_PRESENT_ALWAYS_ON_TOP:
490cdf0e10cSrcweir {
491cdf0e10cSrcweir sal_Bool bVal = sal_False;
492cdf0e10cSrcweir
493cdf0e10cSrcweir if( aValue >>= bVal )
494cdf0e10cSrcweir {
495cdf0e10cSrcweir bIllegalArgument = false;
496cdf0e10cSrcweir
497cdf0e10cSrcweir if( rPresSettings.mbAlwaysOnTop != bVal)
498cdf0e10cSrcweir {
499cdf0e10cSrcweir bValuesChanged = true;
500cdf0e10cSrcweir rPresSettings.mbAlwaysOnTop = bVal;
501cdf0e10cSrcweir }
502cdf0e10cSrcweir }
503cdf0e10cSrcweir break;
504cdf0e10cSrcweir }
505cdf0e10cSrcweir case ATTR_PRESENT_NAVIGATOR:
506cdf0e10cSrcweir {
507cdf0e10cSrcweir sal_Bool bVal = sal_False;
508cdf0e10cSrcweir
509cdf0e10cSrcweir if( aValue >>= bVal )
510cdf0e10cSrcweir {
511cdf0e10cSrcweir bIllegalArgument = false;
512cdf0e10cSrcweir
513cdf0e10cSrcweir if( rPresSettings.mbStartWithNavigator != bVal)
514cdf0e10cSrcweir {
515cdf0e10cSrcweir bValuesChanged = true;
516cdf0e10cSrcweir rPresSettings.mbStartWithNavigator = bVal;
517cdf0e10cSrcweir }
518cdf0e10cSrcweir }
519cdf0e10cSrcweir break;
520cdf0e10cSrcweir }
521cdf0e10cSrcweir case ATTR_PRESENT_PEN:
522cdf0e10cSrcweir {
523cdf0e10cSrcweir sal_Bool bVal = sal_False;
524cdf0e10cSrcweir
525cdf0e10cSrcweir if( aValue >>= bVal )
526cdf0e10cSrcweir {
527cdf0e10cSrcweir bIllegalArgument = false;
528cdf0e10cSrcweir
529cdf0e10cSrcweir if(rPresSettings.mbMouseAsPen != bVal)
530cdf0e10cSrcweir {
531cdf0e10cSrcweir bValuesChanged = true;
532cdf0e10cSrcweir rPresSettings.mbMouseAsPen = bVal;
533cdf0e10cSrcweir }
534cdf0e10cSrcweir }
535cdf0e10cSrcweir break;
536cdf0e10cSrcweir }
537cdf0e10cSrcweir case ATTR_PRESENT_PAUSE_TIMEOUT:
538cdf0e10cSrcweir {
539cdf0e10cSrcweir sal_Int32 nValue = 0;
540cdf0e10cSrcweir if( (aValue >>= nValue) && (nValue >= 0) )
541cdf0e10cSrcweir {
542cdf0e10cSrcweir bIllegalArgument = false;
543cdf0e10cSrcweir if( rPresSettings.mnPauseTimeout != nValue )
544cdf0e10cSrcweir {
545cdf0e10cSrcweir bValuesChanged = true;
546cdf0e10cSrcweir rPresSettings.mnPauseTimeout = nValue;
547cdf0e10cSrcweir }
548cdf0e10cSrcweir }
549cdf0e10cSrcweir break;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir case ATTR_PRESENT_SHOW_PAUSELOGO:
552cdf0e10cSrcweir {
553cdf0e10cSrcweir sal_Bool bVal = sal_False;
554cdf0e10cSrcweir
555cdf0e10cSrcweir if( aValue >>= bVal )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir bIllegalArgument = false;
558cdf0e10cSrcweir
559cdf0e10cSrcweir if( rPresSettings.mbShowPauseLogo != bVal )
560cdf0e10cSrcweir {
561cdf0e10cSrcweir bValuesChanged = true;
562cdf0e10cSrcweir rPresSettings.mbShowPauseLogo = bVal;
563cdf0e10cSrcweir }
564cdf0e10cSrcweir }
565cdf0e10cSrcweir break;
566cdf0e10cSrcweir }
567cdf0e10cSrcweir case ATTR_PRESENT_DISPLAY:
568cdf0e10cSrcweir {
569cdf0e10cSrcweir sal_Int32 nDisplay = 0;
570cdf0e10cSrcweir if( aValue >>= nDisplay )
571cdf0e10cSrcweir {
572cdf0e10cSrcweir // Convert value to true display id.
573cdf0e10cSrcweir if (nDisplay == 0)
574cdf0e10cSrcweir nDisplay = GetDefaultDisplay();
575cdf0e10cSrcweir else if (nDisplay < 0)
576cdf0e10cSrcweir nDisplay = -1;
577cdf0e10cSrcweir else
578cdf0e10cSrcweir --nDisplay;
579cdf0e10cSrcweir
580cdf0e10cSrcweir bIllegalArgument = false;
581cdf0e10cSrcweir
582cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
583cdf0e10cSrcweir pOptions->SetDisplay( nDisplay );
584cdf0e10cSrcweir }
585cdf0e10cSrcweir break;
586cdf0e10cSrcweir }
587cdf0e10cSrcweir
588cdf0e10cSrcweir default:
589cdf0e10cSrcweir throw UnknownPropertyException();
590cdf0e10cSrcweir }
591cdf0e10cSrcweir
592cdf0e10cSrcweir if( bIllegalArgument )
593cdf0e10cSrcweir throw IllegalArgumentException();
594cdf0e10cSrcweir
595cdf0e10cSrcweir if( bValuesChanged )
596cdf0e10cSrcweir mpDoc->SetChanged( true );
597cdf0e10cSrcweir }
598cdf0e10cSrcweir
599cdf0e10cSrcweir // --------------------------------------------------------------------
600cdf0e10cSrcweir
getPropertyValue(const OUString & PropertyName)601cdf0e10cSrcweir Any SAL_CALL SlideShow::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
602cdf0e10cSrcweir {
603cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
604cdf0e10cSrcweir ThrowIfDisposed();
605cdf0e10cSrcweir
606cdf0e10cSrcweir const sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings();
607cdf0e10cSrcweir
608cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = maPropSet.getPropertyMapEntry(PropertyName);
609cdf0e10cSrcweir
610cdf0e10cSrcweir switch( pEntry ? pEntry->nWID : -1 )
611cdf0e10cSrcweir {
612cdf0e10cSrcweir case ATTR_PRESENT_ALL:
613cdf0e10cSrcweir return Any( (sal_Bool) ( !rPresSettings.mbCustomShow && rPresSettings.mbAll ) );
614cdf0e10cSrcweir case ATTR_PRESENT_CHANGE_PAGE:
615cdf0e10cSrcweir return Any( (sal_Bool) !rPresSettings.mbLockedPages );
616cdf0e10cSrcweir case ATTR_PRESENT_ANIMATION_ALLOWED:
617cdf0e10cSrcweir return Any( rPresSettings.mbAnimationAllowed );
618cdf0e10cSrcweir case ATTR_PRESENT_CUSTOMSHOW:
619cdf0e10cSrcweir {
620cdf0e10cSrcweir List* pList = mpDoc->GetCustomShowList(sal_False);
621cdf0e10cSrcweir SdCustomShow* pShow = (pList && rPresSettings.mbCustomShow)?(SdCustomShow*)pList->GetCurObject():NULL;
622cdf0e10cSrcweir OUString aShowName;
623cdf0e10cSrcweir
624cdf0e10cSrcweir if(pShow)
625cdf0e10cSrcweir aShowName = pShow->GetName();
626cdf0e10cSrcweir
627cdf0e10cSrcweir return Any( aShowName );
628cdf0e10cSrcweir }
629cdf0e10cSrcweir case ATTR_PRESENT_ENDLESS:
630cdf0e10cSrcweir return Any( rPresSettings.mbEndless );
631cdf0e10cSrcweir case ATTR_PRESENT_FULLSCREEN:
632cdf0e10cSrcweir return Any( rPresSettings.mbFullScreen );
633cdf0e10cSrcweir case ATTR_PRESENT_DIANAME:
634cdf0e10cSrcweir {
635cdf0e10cSrcweir OUString aSlideName;
636cdf0e10cSrcweir
637cdf0e10cSrcweir if( !rPresSettings.mbCustomShow && !rPresSettings.mbAll )
638cdf0e10cSrcweir aSlideName = getPageApiNameFromUiName( rPresSettings.maPresPage );
639cdf0e10cSrcweir
640cdf0e10cSrcweir return Any( aSlideName );
641cdf0e10cSrcweir }
642cdf0e10cSrcweir case ATTR_PRESENT_MANUEL:
643cdf0e10cSrcweir return Any( rPresSettings.mbManual );
644cdf0e10cSrcweir case ATTR_PRESENT_MOUSE:
645cdf0e10cSrcweir return Any( rPresSettings.mbMouseVisible );
646cdf0e10cSrcweir case ATTR_PRESENT_ALWAYS_ON_TOP:
647cdf0e10cSrcweir return Any( rPresSettings.mbAlwaysOnTop );
648cdf0e10cSrcweir case ATTR_PRESENT_NAVIGATOR:
649cdf0e10cSrcweir return Any( rPresSettings.mbStartWithNavigator );
650cdf0e10cSrcweir case ATTR_PRESENT_PEN:
651cdf0e10cSrcweir return Any( rPresSettings.mbMouseAsPen );
652cdf0e10cSrcweir case ATTR_PRESENT_PAUSE_TIMEOUT:
653cdf0e10cSrcweir return Any( rPresSettings.mnPauseTimeout );
654cdf0e10cSrcweir case ATTR_PRESENT_SHOW_PAUSELOGO:
655cdf0e10cSrcweir return Any( rPresSettings.mbShowPauseLogo );
656cdf0e10cSrcweir case ATTR_PRESENT_DISPLAY:
657cdf0e10cSrcweir {
658cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
659cdf0e10cSrcweir const sal_Int32 nDisplay (pOptions->GetDisplay());
660cdf0e10cSrcweir // Convert true display id to the previously used schema.
661cdf0e10cSrcweir if (nDisplay == GetDefaultDisplay())
662cdf0e10cSrcweir return Any(sal_Int32(0));
663cdf0e10cSrcweir else if (nDisplay < 0)
664cdf0e10cSrcweir return Any(sal_Int32(-1));
665cdf0e10cSrcweir else
666cdf0e10cSrcweir return Any(nDisplay+1);
667cdf0e10cSrcweir }
668cdf0e10cSrcweir
669cdf0e10cSrcweir default:
670cdf0e10cSrcweir throw UnknownPropertyException();
671cdf0e10cSrcweir }
672cdf0e10cSrcweir }
673cdf0e10cSrcweir
674cdf0e10cSrcweir // --------------------------------------------------------------------
675cdf0e10cSrcweir
addPropertyChangeListener(const OUString &,const Reference<XPropertyChangeListener> &)676cdf0e10cSrcweir void SAL_CALL SlideShow::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
677cdf0e10cSrcweir {
678cdf0e10cSrcweir }
679cdf0e10cSrcweir
680cdf0e10cSrcweir // --------------------------------------------------------------------
681cdf0e10cSrcweir
removePropertyChangeListener(const OUString &,const Reference<XPropertyChangeListener> &)682cdf0e10cSrcweir void SAL_CALL SlideShow::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
683cdf0e10cSrcweir {
684cdf0e10cSrcweir }
685cdf0e10cSrcweir
686cdf0e10cSrcweir // --------------------------------------------------------------------
687cdf0e10cSrcweir
addVetoableChangeListener(const OUString &,const Reference<XVetoableChangeListener> &)688cdf0e10cSrcweir void SAL_CALL SlideShow::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
689cdf0e10cSrcweir {
690cdf0e10cSrcweir }
691cdf0e10cSrcweir
692cdf0e10cSrcweir // --------------------------------------------------------------------
693cdf0e10cSrcweir
removeVetoableChangeListener(const OUString &,const Reference<XVetoableChangeListener> &)694cdf0e10cSrcweir void SAL_CALL SlideShow::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
695cdf0e10cSrcweir {
696cdf0e10cSrcweir }
697cdf0e10cSrcweir
698cdf0e10cSrcweir // --------------------------------------------------------------------
699cdf0e10cSrcweir // XPresentation
700cdf0e10cSrcweir // --------------------------------------------------------------------
701cdf0e10cSrcweir
start()702cdf0e10cSrcweir void SAL_CALL SlideShow::start() throw(RuntimeException)
703cdf0e10cSrcweir {
704cdf0e10cSrcweir const Sequence< PropertyValue > aArguments;
705cdf0e10cSrcweir startWithArguments( aArguments );
706cdf0e10cSrcweir }
707cdf0e10cSrcweir
708cdf0e10cSrcweir // --------------------------------------------------------------------
709cdf0e10cSrcweir
end()710cdf0e10cSrcweir void SAL_CALL SlideShow::end() throw(RuntimeException)
711cdf0e10cSrcweir {
712cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
713cdf0e10cSrcweir
714cdf0e10cSrcweir // The mbIsInStartup flag should have been reset during the start of the
715cdf0e10cSrcweir // slide show. Reset it here just in case that something has horribly
716cdf0e10cSrcweir // gone wrong.
717cdf0e10cSrcweir OSL_ASSERT(!mbIsInStartup);
718cdf0e10cSrcweir mbIsInStartup = false;
719cdf0e10cSrcweir
720cdf0e10cSrcweir rtl::Reference< SlideshowImpl > xController( mxController );
721cdf0e10cSrcweir if( xController.is() )
722cdf0e10cSrcweir {
723cdf0e10cSrcweir mxController.clear();
724cdf0e10cSrcweir
725cdf0e10cSrcweir if( mpFullScreenFrameView )
726cdf0e10cSrcweir {
727cdf0e10cSrcweir delete mpFullScreenFrameView;
728cdf0e10cSrcweir mpFullScreenFrameView = 0;
729cdf0e10cSrcweir }
730cdf0e10cSrcweir
731cdf0e10cSrcweir ViewShellBase* pFullScreenViewShellBase = mpFullScreenViewShellBase;
732cdf0e10cSrcweir mpFullScreenViewShellBase = 0;
733cdf0e10cSrcweir
734297606d3SAndre Fischer // Dispose the controller before calling StartPresentation()
735297606d3SAndre Fischer // on the work window to prevent a crash that is triggered
736297606d3SAndre Fischer // only by the cairo canvas: the work window is shutting down
737297606d3SAndre Fischer // presentation mode. Find details in issue When later asked for information the
738297606d3SAndre Fischer // gtk system functions report an error and we crash.
739297606d3SAndre Fischer xController->dispose();
740297606d3SAndre Fischer
741cdf0e10cSrcweir if( pFullScreenViewShellBase )
742cdf0e10cSrcweir {
743cdf0e10cSrcweir PresentationViewShell* pShell = dynamic_cast<PresentationViewShell*>(pFullScreenViewShellBase->GetMainViewShell().get());
744cdf0e10cSrcweir
745cdf0e10cSrcweir if( pShell && pShell->GetViewFrame() )
746cdf0e10cSrcweir {
747cdf0e10cSrcweir WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pShell->GetViewFrame()->GetTopFrame().GetWindow().GetParent());
748cdf0e10cSrcweir if( pWorkWindow )
749cdf0e10cSrcweir {
750cdf0e10cSrcweir pWorkWindow->StartPresentationMode( sal_False, isAlwaysOnTop() );
751cdf0e10cSrcweir }
752cdf0e10cSrcweir }
753cdf0e10cSrcweir }
754cdf0e10cSrcweir
755cdf0e10cSrcweir if( pFullScreenViewShellBase )
756cdf0e10cSrcweir {
757cdf0e10cSrcweir PresentationViewShell* pShell = NULL;
758cdf0e10cSrcweir {
759cdf0e10cSrcweir // Get the shell pointer in its own scope to be sure that
760cdf0e10cSrcweir // the shared_ptr to the shell is released before DoClose()
761cdf0e10cSrcweir // is called.
762cdf0e10cSrcweir ::boost::shared_ptr<ViewShell> pSharedView (pFullScreenViewShellBase->GetMainViewShell());
763cdf0e10cSrcweir pShell = dynamic_cast<PresentationViewShell*>(pSharedView.get());
764cdf0e10cSrcweir }
765cdf0e10cSrcweir if( pShell && pShell->GetViewFrame() )
766cdf0e10cSrcweir pShell->GetViewFrame()->DoClose();
767cdf0e10cSrcweir }
768cdf0e10cSrcweir else if( mpCurrentViewShellBase )
769cdf0e10cSrcweir {
770cdf0e10cSrcweir ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get();
771cdf0e10cSrcweir
772cdf0e10cSrcweir if( pViewShell )
773cdf0e10cSrcweir {
774cdf0e10cSrcweir FrameView* pFrameView = pViewShell->GetFrameView();
775cdf0e10cSrcweir
776cdf0e10cSrcweir if( pFrameView && (pFrameView->GetPresentationViewShellId() != SID_VIEWSHELL0) )
777cdf0e10cSrcweir {
778cdf0e10cSrcweir ViewShell::ShellType ePreviousType (pFrameView->GetPreviousViewShellType());
779cdf0e10cSrcweir pFrameView->SetPreviousViewShellType(ViewShell::ST_NONE);
780cdf0e10cSrcweir
781cdf0e10cSrcweir pFrameView->SetPresentationViewShellId(SID_VIEWSHELL0);
782cdf0e10cSrcweir pFrameView->SetSlotId(SID_OBJECT_SELECT);
783cdf0e10cSrcweir pFrameView->SetPreviousViewShellType(pViewShell->GetShellType());
784cdf0e10cSrcweir
785cdf0e10cSrcweir framework::FrameworkHelper::Instance(*mpCurrentViewShellBase)->RequestView(
786cdf0e10cSrcweir framework::FrameworkHelper::GetViewURL(ePreviousType),
787cdf0e10cSrcweir framework::FrameworkHelper::msCenterPaneURL);
788cdf0e10cSrcweir
789cdf0e10cSrcweir pViewShell->GetViewFrame()->GetBindings().InvalidateAll( sal_True );
790cdf0e10cSrcweir }
791cdf0e10cSrcweir }
792cdf0e10cSrcweir }
793cdf0e10cSrcweir
794cdf0e10cSrcweir if( mpCurrentViewShellBase )
795cdf0e10cSrcweir {
796cdf0e10cSrcweir ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get();
797cdf0e10cSrcweir if( pViewShell )
798cdf0e10cSrcweir {
799cdf0e10cSrcweir // invalidate the view shell so the presentation slot will be re-enabled
800cdf0e10cSrcweir // and the rehersing will be updated
801cdf0e10cSrcweir pViewShell->Invalidate();
802cdf0e10cSrcweir
803cdf0e10cSrcweir if( xController->meAnimationMode ==ANIMATIONMODE_SHOW )
804cdf0e10cSrcweir {
805cdf0e10cSrcweir // switch to the previously visible Slide
806cdf0e10cSrcweir DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>( pViewShell );
807cdf0e10cSrcweir if( pDrawViewShell )
808cdf0e10cSrcweir pDrawViewShell->SwitchPage( (sal_uInt16)xController->getRestoreSlide() );
809cdf0e10cSrcweir else
810cdf0e10cSrcweir {
811cdf0e10cSrcweir Reference<XDrawView> xDrawView (
812cdf0e10cSrcweir Reference<XWeak>(&mpCurrentViewShellBase->GetDrawController()), UNO_QUERY);
813cdf0e10cSrcweir if (xDrawView.is())
814cdf0e10cSrcweir xDrawView->setCurrentPage(
815cdf0e10cSrcweir Reference<XDrawPage>(
816cdf0e10cSrcweir mpDoc->GetSdPage(xController->getRestoreSlide(), PK_STANDARD)->getUnoPage(),
817cdf0e10cSrcweir UNO_QUERY));
818cdf0e10cSrcweir }
819cdf0e10cSrcweir }
820cdf0e10cSrcweir }
821*0deba7fbSSteve Yin //Fire the acc focus event when focus is switched back. The above method mpCurrentViewShellBase->GetWindow()->GrabFocus() will
822*0deba7fbSSteve Yin //set focus to WorkWindow instead of the sd::window, so here call Shell's method to fire the focus event
823*0deba7fbSSteve Yin if (pViewShell)
824*0deba7fbSSteve Yin pViewShell->SwitchActiveViewFireFocus();
825cdf0e10cSrcweir }
826cdf0e10cSrcweir mpCurrentViewShellBase = 0;
827cdf0e10cSrcweir }
828cdf0e10cSrcweir }
829cdf0e10cSrcweir
830cdf0e10cSrcweir // --------------------------------------------------------------------
831cdf0e10cSrcweir
rehearseTimings()832cdf0e10cSrcweir void SAL_CALL SlideShow::rehearseTimings() throw(RuntimeException)
833cdf0e10cSrcweir {
834cdf0e10cSrcweir Sequence< PropertyValue > aArguments(1);
835cdf0e10cSrcweir aArguments[0].Name = C2U("RehearseTimings");
836cdf0e10cSrcweir aArguments[0].Value <<= sal_True;
837cdf0e10cSrcweir startWithArguments( aArguments );
838cdf0e10cSrcweir }
839cdf0e10cSrcweir
840cdf0e10cSrcweir // --------------------------------------------------------------------
841cdf0e10cSrcweir // XPresentation2
842cdf0e10cSrcweir // --------------------------------------------------------------------
843cdf0e10cSrcweir
startWithArguments(const Sequence<PropertyValue> & rArguments)844cdf0e10cSrcweir void SAL_CALL SlideShow::startWithArguments( const Sequence< PropertyValue >& rArguments ) throw (RuntimeException)
845cdf0e10cSrcweir {
846cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
847cdf0e10cSrcweir ThrowIfDisposed();
848cdf0e10cSrcweir
849cdf0e10cSrcweir // Stop a running show before starting a new one.
850cdf0e10cSrcweir if( mxController.is() )
851cdf0e10cSrcweir {
852cdf0e10cSrcweir OSL_ASSERT(!mbIsInStartup);
853cdf0e10cSrcweir end();
854cdf0e10cSrcweir }
855cdf0e10cSrcweir else if (mbIsInStartup)
856cdf0e10cSrcweir {
857cdf0e10cSrcweir // We are already somewhere in process of starting a slide show but
858cdf0e10cSrcweir // have not yet got to the point where mxController is set. There
859cdf0e10cSrcweir // is not yet a slide show to end so return silently.
860cdf0e10cSrcweir return;
861cdf0e10cSrcweir }
862cdf0e10cSrcweir
863cdf0e10cSrcweir // Prevent multiple instance of the SlideShow class for one document.
864cdf0e10cSrcweir mbIsInStartup = true;
865cdf0e10cSrcweir
866cdf0e10cSrcweir mxCurrentSettings.reset( new PresentationSettingsEx( mpDoc->getPresentationSettings() ) );
867cdf0e10cSrcweir mxCurrentSettings->SetArguments( rArguments );
868cdf0e10cSrcweir
869cdf0e10cSrcweir // if there is no view shell base set, use the current one or the first using this document
870cdf0e10cSrcweir if( mpCurrentViewShellBase == 0 )
871cdf0e10cSrcweir {
872cdf0e10cSrcweir // first check current
873cdf0e10cSrcweir ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( SfxViewFrame::Current() );
874cdf0e10cSrcweir if( pBase && pBase->GetDocument() == mpDoc )
875cdf0e10cSrcweir {
876cdf0e10cSrcweir mpCurrentViewShellBase = pBase;
877cdf0e10cSrcweir }
878cdf0e10cSrcweir else
879cdf0e10cSrcweir {
880cdf0e10cSrcweir // current is not ours, so get first from ours
881cdf0e10cSrcweir mpCurrentViewShellBase = ::sd::ViewShellBase::GetViewShellBase( SfxViewFrame::GetFirst( mpDoc->GetDocSh() ) );
882cdf0e10cSrcweir }
883cdf0e10cSrcweir }
884cdf0e10cSrcweir
88530d43537SHerbert Dürr // #118456# make sure TextEdit changes get pushed to model.
88630d43537SHerbert Dürr // mpDrawView is tested against NULL above already.
88730d43537SHerbert Dürr if(mpCurrentViewShellBase)
88830d43537SHerbert Dürr {
88930d43537SHerbert Dürr ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get();
89030d43537SHerbert Dürr
89130d43537SHerbert Dürr if(pViewShell && pViewShell->GetView())
89230d43537SHerbert Dürr {
89330d43537SHerbert Dürr pViewShell->GetView()->SdrEndTextEdit();
89430d43537SHerbert Dürr }
89530d43537SHerbert Dürr }
89630d43537SHerbert Dürr
897cdf0e10cSrcweir // Start either a full-screen or an in-place show.
898cdf0e10cSrcweir if(mxCurrentSettings->mbFullScreen && !mxCurrentSettings->mbPreview)
899cdf0e10cSrcweir StartFullscreenPresentation();
900cdf0e10cSrcweir else
901cdf0e10cSrcweir StartInPlacePresentation();
902cdf0e10cSrcweir }
903cdf0e10cSrcweir
904cdf0e10cSrcweir // --------------------------------------------------------------------
905cdf0e10cSrcweir
isRunning()906cdf0e10cSrcweir ::sal_Bool SAL_CALL SlideShow::isRunning( ) throw (RuntimeException)
907cdf0e10cSrcweir {
908cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
909cdf0e10cSrcweir return mxController.is() && mxController->isRunning();
910cdf0e10cSrcweir }
911cdf0e10cSrcweir
912cdf0e10cSrcweir // --------------------------------------------------------------------
913cdf0e10cSrcweir
getController()914cdf0e10cSrcweir Reference< XSlideShowController > SAL_CALL SlideShow::getController( ) throw (RuntimeException)
915cdf0e10cSrcweir {
916cdf0e10cSrcweir ThrowIfDisposed();
917cdf0e10cSrcweir
918cdf0e10cSrcweir Reference< XSlideShowController > xController( mxController.get() );
919cdf0e10cSrcweir return xController;
920cdf0e10cSrcweir }
921cdf0e10cSrcweir
922cdf0e10cSrcweir // --------------------------------------------------------------------
923cdf0e10cSrcweir // XComponent
924cdf0e10cSrcweir // --------------------------------------------------------------------
925cdf0e10cSrcweir
disposing(void)926cdf0e10cSrcweir void SAL_CALL SlideShow::disposing (void)
927cdf0e10cSrcweir {
928cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
929cdf0e10cSrcweir
930cdf0e10cSrcweir if( mnInPlaceConfigEvent )
931cdf0e10cSrcweir {
932cdf0e10cSrcweir Application::RemoveUserEvent( mnInPlaceConfigEvent );
933cdf0e10cSrcweir mnInPlaceConfigEvent = 0;
934cdf0e10cSrcweir }
935cdf0e10cSrcweir
936cdf0e10cSrcweir if( mxController.is() )
937cdf0e10cSrcweir {
938cdf0e10cSrcweir mxController->dispose();
939cdf0e10cSrcweir mxController.clear();
940cdf0e10cSrcweir }
941cdf0e10cSrcweir
942cdf0e10cSrcweir mpCurrentViewShellBase = 0;
943cdf0e10cSrcweir mpFullScreenViewShellBase = 0;
944cdf0e10cSrcweir mpDoc = 0;
945cdf0e10cSrcweir }
946cdf0e10cSrcweir
947cdf0e10cSrcweir // ---------------------------------------------------------
948cdf0e10cSrcweir
startPreview(const Reference<XDrawPage> & xDrawPage,const Reference<XAnimationNode> & xAnimationNode,::Window * pParent)949cdf0e10cSrcweir bool SlideShow::startPreview( const Reference< XDrawPage >& xDrawPage, const Reference< XAnimationNode >& xAnimationNode, ::Window* pParent )
950cdf0e10cSrcweir {
951cdf0e10cSrcweir Sequence< PropertyValue > aArguments(4);
952cdf0e10cSrcweir
953cdf0e10cSrcweir aArguments[0].Name = C2U("Preview");
954cdf0e10cSrcweir aArguments[0].Value <<= sal_True;
955cdf0e10cSrcweir
956cdf0e10cSrcweir aArguments[1].Name = C2U("FirstPage");
957cdf0e10cSrcweir aArguments[1].Value <<= xDrawPage;
958cdf0e10cSrcweir
959cdf0e10cSrcweir aArguments[2].Name = C2U("AnimationNode");
960cdf0e10cSrcweir aArguments[2].Value <<= xAnimationNode;
961cdf0e10cSrcweir
962cdf0e10cSrcweir Reference< XWindow > xParentWindow;
963cdf0e10cSrcweir if( pParent )
964cdf0e10cSrcweir xParentWindow = VCLUnoHelper::GetInterface( pParent );
965cdf0e10cSrcweir
966cdf0e10cSrcweir aArguments[3].Name = C2U("ParentWindow");
967cdf0e10cSrcweir aArguments[3].Value <<= xParentWindow;
968cdf0e10cSrcweir
969cdf0e10cSrcweir startWithArguments( aArguments );
970cdf0e10cSrcweir
971cdf0e10cSrcweir return true;
972cdf0e10cSrcweir }
973cdf0e10cSrcweir
974cdf0e10cSrcweir // ---------------------------------------------------------
975cdf0e10cSrcweir
getShowWindow()976cdf0e10cSrcweir ShowWindow* SlideShow::getShowWindow()
977cdf0e10cSrcweir {
978cdf0e10cSrcweir return mxController.is() ? mxController->mpShowWindow : 0;
979cdf0e10cSrcweir }
980cdf0e10cSrcweir
981cdf0e10cSrcweir // ---------------------------------------------------------
982cdf0e10cSrcweir
getAnimationMode()983cdf0e10cSrcweir int SlideShow::getAnimationMode()
984cdf0e10cSrcweir {
985cdf0e10cSrcweir return mxController.is() ? mxController->meAnimationMode : ANIMATIONMODE_SHOW;
986cdf0e10cSrcweir }
987cdf0e10cSrcweir
988cdf0e10cSrcweir // ---------------------------------------------------------
989cdf0e10cSrcweir
jumpToPageIndex(sal_Int32 nPageIndex)990cdf0e10cSrcweir void SlideShow::jumpToPageIndex( sal_Int32 nPageIndex )
991cdf0e10cSrcweir {
992cdf0e10cSrcweir if( mxController.is() )
993cdf0e10cSrcweir mxController->displaySlideIndex( nPageIndex );
994cdf0e10cSrcweir }
995cdf0e10cSrcweir
996cdf0e10cSrcweir // ---------------------------------------------------------
997cdf0e10cSrcweir
jumpToPageNumber(sal_Int32 nPageNumber)998cdf0e10cSrcweir void SlideShow::jumpToPageNumber( sal_Int32 nPageNumber )
999cdf0e10cSrcweir {
1000cdf0e10cSrcweir if( mxController.is() )
1001cdf0e10cSrcweir mxController->displaySlideNumber( nPageNumber );
1002cdf0e10cSrcweir }
1003cdf0e10cSrcweir
1004cdf0e10cSrcweir // ---------------------------------------------------------
1005cdf0e10cSrcweir
getCurrentPageNumber()1006cdf0e10cSrcweir sal_Int32 SlideShow::getCurrentPageNumber()
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir return mxController.is() ? mxController->getCurrentSlideNumber() : 0;
1009cdf0e10cSrcweir }
1010cdf0e10cSrcweir
1011cdf0e10cSrcweir // ---------------------------------------------------------
1012cdf0e10cSrcweir
jumpToBookmark(const OUString & sBookmark)1013cdf0e10cSrcweir void SlideShow::jumpToBookmark( const OUString& sBookmark )
1014cdf0e10cSrcweir {
1015cdf0e10cSrcweir if( mxController.is() )
1016cdf0e10cSrcweir mxController->jumpToBookmark( sBookmark );
1017cdf0e10cSrcweir }
1018cdf0e10cSrcweir
1019cdf0e10cSrcweir // ---------------------------------------------------------
1020cdf0e10cSrcweir
isFullScreen()1021cdf0e10cSrcweir bool SlideShow::isFullScreen()
1022cdf0e10cSrcweir {
1023cdf0e10cSrcweir return mxController.is() ? mxController->maPresSettings.mbFullScreen : false;
1024cdf0e10cSrcweir }
1025cdf0e10cSrcweir
1026cdf0e10cSrcweir // ---------------------------------------------------------
1027cdf0e10cSrcweir
resize(const Size & rSize)1028cdf0e10cSrcweir void SlideShow::resize( const Size &rSize )
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir if( mxController.is() )
1031cdf0e10cSrcweir mxController->resize( rSize );
1032cdf0e10cSrcweir }
1033cdf0e10cSrcweir
1034cdf0e10cSrcweir // ---------------------------------------------------------
1035cdf0e10cSrcweir
activate(ViewShellBase & rBase)1036cdf0e10cSrcweir void SlideShow::activate( ViewShellBase& rBase )
1037cdf0e10cSrcweir {
1038cdf0e10cSrcweir if( (mpFullScreenViewShellBase == &rBase) && !mxController.is() )
1039cdf0e10cSrcweir {
1040cdf0e10cSrcweir ::boost::shared_ptr<PresentationViewShell> pShell = ::boost::dynamic_pointer_cast<PresentationViewShell>(rBase.GetMainViewShell());
1041cdf0e10cSrcweir if(pShell.get() != NULL)
1042cdf0e10cSrcweir {
1043cdf0e10cSrcweir pShell->FinishInitialization( mpFullScreenFrameView );
1044cdf0e10cSrcweir mpFullScreenFrameView = 0;
1045cdf0e10cSrcweir
1046cdf0e10cSrcweir CreateController( pShell.get(), pShell->GetView(), rBase.GetViewWindow() );
1047cdf0e10cSrcweir
1048cdf0e10cSrcweir if( mxController->startShow(mxCurrentSettings.get()) )
1049cdf0e10cSrcweir {
1050cdf0e10cSrcweir pShell->Resize();
1051*0deba7fbSSteve Yin // Defer the sd::ShowWindow's GrabFocus to here. so that the accessible event can be fired correctly.
1052*0deba7fbSSteve Yin pShell->GetActiveWindow()->GrabFocus();
1053cdf0e10cSrcweir }
1054cdf0e10cSrcweir else
1055cdf0e10cSrcweir {
1056cdf0e10cSrcweir end();
1057cdf0e10cSrcweir return;
1058cdf0e10cSrcweir }
1059cdf0e10cSrcweir }
1060cdf0e10cSrcweir }
1061cdf0e10cSrcweir
1062cdf0e10cSrcweir if( mxController.is() )
1063cdf0e10cSrcweir mxController->activate();
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir
1066cdf0e10cSrcweir // ---------------------------------------------------------
1067cdf0e10cSrcweir
deactivate(ViewShellBase &)1068cdf0e10cSrcweir void SlideShow::deactivate( ViewShellBase& /*rBase*/ )
1069cdf0e10cSrcweir {
1070cdf0e10cSrcweir mxController->deactivate();
1071cdf0e10cSrcweir }
1072cdf0e10cSrcweir
1073cdf0e10cSrcweir // ---------------------------------------------------------
1074cdf0e10cSrcweir
keyInput(const KeyEvent & rKEvt)1075cdf0e10cSrcweir bool SlideShow::keyInput(const KeyEvent& rKEvt)
1076cdf0e10cSrcweir {
1077cdf0e10cSrcweir return mxController.is() ? mxController->keyInput(rKEvt) : false;
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir
1080cdf0e10cSrcweir // ---------------------------------------------------------
1081cdf0e10cSrcweir
paint(const Rectangle & rRect)1082cdf0e10cSrcweir void SlideShow::paint( const Rectangle& rRect )
1083cdf0e10cSrcweir {
1084cdf0e10cSrcweir if( mxController.is() )
1085cdf0e10cSrcweir mxController->paint( rRect );
1086cdf0e10cSrcweir }
1087cdf0e10cSrcweir
1088cdf0e10cSrcweir // ---------------------------------------------------------
1089cdf0e10cSrcweir
isAlwaysOnTop()1090cdf0e10cSrcweir bool SlideShow::isAlwaysOnTop()
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir return mxController.is() ? mxController->maPresSettings.mbAlwaysOnTop : false;
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir
1095cdf0e10cSrcweir // ---------------------------------------------------------
1096cdf0e10cSrcweir
pause(bool bPause)1097cdf0e10cSrcweir bool SlideShow::pause( bool bPause )
1098cdf0e10cSrcweir {
1099cdf0e10cSrcweir if( mxController.is() )
1100cdf0e10cSrcweir {
1101cdf0e10cSrcweir if( bPause )
1102cdf0e10cSrcweir mxController->pause();
1103cdf0e10cSrcweir else
1104cdf0e10cSrcweir mxController->resume();
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir return true;
1107cdf0e10cSrcweir }
1108cdf0e10cSrcweir
1109cdf0e10cSrcweir // ---------------------------------------------------------
1110cdf0e10cSrcweir
receiveRequest(SfxRequest & rReq)1111cdf0e10cSrcweir void SlideShow::receiveRequest(SfxRequest& rReq)
1112cdf0e10cSrcweir {
1113cdf0e10cSrcweir if( mxController.is() )
1114cdf0e10cSrcweir mxController->receiveRequest( rReq );
1115cdf0e10cSrcweir }
1116cdf0e10cSrcweir
1117cdf0e10cSrcweir // ---------------------------------------------------------
1118cdf0e10cSrcweir
getFirstPageNumber()1119cdf0e10cSrcweir sal_Int32 SlideShow::getFirstPageNumber()
1120cdf0e10cSrcweir {
1121cdf0e10cSrcweir return mxController.is() ? mxController->getFirstSlideNumber() : 0;
1122cdf0e10cSrcweir }
1123cdf0e10cSrcweir
1124cdf0e10cSrcweir // ---------------------------------------------------------
1125cdf0e10cSrcweir
getLastPageNumber()1126cdf0e10cSrcweir sal_Int32 SlideShow::getLastPageNumber()
1127cdf0e10cSrcweir {
1128cdf0e10cSrcweir return mxController.is() ? mxController->getLastSlideNumber() : 0;
1129cdf0e10cSrcweir }
1130cdf0e10cSrcweir
1131cdf0e10cSrcweir // ---------------------------------------------------------
1132cdf0e10cSrcweir
isEndless()1133cdf0e10cSrcweir bool SlideShow::isEndless()
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir return mxController.is() ? mxController->isEndless() : false;
1136cdf0e10cSrcweir }
1137cdf0e10cSrcweir
1138cdf0e10cSrcweir // ---------------------------------------------------------
1139cdf0e10cSrcweir
isDrawingPossible()1140cdf0e10cSrcweir bool SlideShow::isDrawingPossible()
1141cdf0e10cSrcweir {
1142cdf0e10cSrcweir return mxController.is() ? mxController->getUsePen() : false;
1143cdf0e10cSrcweir }
1144cdf0e10cSrcweir
1145cdf0e10cSrcweir // ---------------------------------------------------------
1146cdf0e10cSrcweir
StartInPlacePresentationConfigurationCallback()1147cdf0e10cSrcweir void SlideShow::StartInPlacePresentationConfigurationCallback()
1148cdf0e10cSrcweir {
1149cdf0e10cSrcweir if( mnInPlaceConfigEvent != 0 )
1150cdf0e10cSrcweir Application::RemoveUserEvent( mnInPlaceConfigEvent );
1151cdf0e10cSrcweir
1152cdf0e10cSrcweir mnInPlaceConfigEvent = Application::PostUserEvent( LINK( this, SlideShow, StartInPlacePresentationConfigurationHdl ) );
1153cdf0e10cSrcweir }
1154cdf0e10cSrcweir
1155cdf0e10cSrcweir // ---------------------------------------------------------
1156cdf0e10cSrcweir
IMPL_LINK(SlideShow,StartInPlacePresentationConfigurationHdl,void *,EMPTYARG)1157cdf0e10cSrcweir IMPL_LINK( SlideShow, StartInPlacePresentationConfigurationHdl, void *, EMPTYARG )
1158cdf0e10cSrcweir {
1159cdf0e10cSrcweir mnInPlaceConfigEvent = 0;
1160cdf0e10cSrcweir StartInPlacePresentation();
1161cdf0e10cSrcweir return 0;
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir
1164cdf0e10cSrcweir // ---------------------------------------------------------
1165cdf0e10cSrcweir
StartInPlacePresentation()1166cdf0e10cSrcweir void SlideShow::StartInPlacePresentation()
1167cdf0e10cSrcweir {
1168cdf0e10cSrcweir if( mpCurrentViewShellBase )
1169cdf0e10cSrcweir {
1170cdf0e10cSrcweir // Save the current view shell type so that it can be restored after the
1171cdf0e10cSrcweir // show has ended. If there already is a saved shell type then that is
1172cdf0e10cSrcweir // not overwritten.
1173cdf0e10cSrcweir
1174cdf0e10cSrcweir ViewShell::ShellType eShell = ViewShell::ST_NONE;
1175cdf0e10cSrcweir
1176cdf0e10cSrcweir ::boost::shared_ptr<FrameworkHelper> pHelper(FrameworkHelper::Instance(*mpCurrentViewShellBase));
1177cdf0e10cSrcweir ::boost::shared_ptr<ViewShell> pMainViewShell(pHelper->GetViewShell(FrameworkHelper::msCenterPaneURL));
1178cdf0e10cSrcweir
1179cdf0e10cSrcweir if( pMainViewShell.get() )
1180cdf0e10cSrcweir eShell = pMainViewShell->GetShellType();
1181cdf0e10cSrcweir
1182cdf0e10cSrcweir if( eShell != ViewShell::ST_IMPRESS )
1183cdf0e10cSrcweir {
1184cdf0e10cSrcweir // Switch temporary to a DrawViewShell which supports the in-place presentation.
1185cdf0e10cSrcweir
1186cdf0e10cSrcweir if( pMainViewShell.get() )
1187cdf0e10cSrcweir {
1188cdf0e10cSrcweir FrameView* pFrameView = pMainViewShell->GetFrameView();
1189cdf0e10cSrcweir pFrameView->SetPresentationViewShellId(SID_VIEWSHELL1);
1190cdf0e10cSrcweir pFrameView->SetPreviousViewShellType (pMainViewShell->GetShellType());
1191cdf0e10cSrcweir pFrameView->SetPageKind (PK_STANDARD);
1192cdf0e10cSrcweir }
1193cdf0e10cSrcweir
1194cdf0e10cSrcweir pHelper->RequestView( FrameworkHelper::msImpressViewURL, FrameworkHelper::msCenterPaneURL );
1195cdf0e10cSrcweir pHelper->RunOnConfigurationEvent( FrameworkHelper::msConfigurationUpdateEndEvent, ::boost::bind(&SlideShow::StartInPlacePresentationConfigurationCallback, this) );
1196cdf0e10cSrcweir return;
1197cdf0e10cSrcweir }
1198cdf0e10cSrcweir else
1199cdf0e10cSrcweir {
1200cdf0e10cSrcweir ::Window* pParentWindow = mxCurrentSettings->mpParentWindow;
1201cdf0e10cSrcweir if( pParentWindow == 0 )
1202cdf0e10cSrcweir pParentWindow = mpCurrentViewShellBase->GetViewWindow();
1203cdf0e10cSrcweir
1204cdf0e10cSrcweir CreateController( pMainViewShell.get(), pMainViewShell->GetView(), pParentWindow );
1205cdf0e10cSrcweir }
1206cdf0e10cSrcweir }
1207cdf0e10cSrcweir else if( mxCurrentSettings->mpParentWindow )
1208cdf0e10cSrcweir {
1209cdf0e10cSrcweir // no current view shell, but parent window
1210cdf0e10cSrcweir CreateController( 0, 0, mxCurrentSettings->mpParentWindow );
1211cdf0e10cSrcweir }
1212cdf0e10cSrcweir
1213cdf0e10cSrcweir if( mxController.is() )
1214cdf0e10cSrcweir {
1215cdf0e10cSrcweir sal_Bool bSuccess = sal_False;
1216cdf0e10cSrcweir if( mxCurrentSettings.get() && mxCurrentSettings->mbPreview )
1217cdf0e10cSrcweir {
1218cdf0e10cSrcweir bSuccess = mxController->startPreview(mxCurrentSettings->mxStartPage, mxCurrentSettings->mxAnimationNode, mxCurrentSettings->mpParentWindow );
1219cdf0e10cSrcweir }
1220cdf0e10cSrcweir else
1221cdf0e10cSrcweir {
1222cdf0e10cSrcweir bSuccess = mxController->startShow(mxCurrentSettings.get());
1223cdf0e10cSrcweir }
1224cdf0e10cSrcweir
1225cdf0e10cSrcweir if( !bSuccess )
1226cdf0e10cSrcweir end();
1227*0deba7fbSSteve Yin else
1228*0deba7fbSSteve Yin {
1229*0deba7fbSSteve Yin if(mpCurrentViewShellBase)
1230*0deba7fbSSteve Yin mpCurrentViewShellBase->GetWindow()->GrabFocus();
1231*0deba7fbSSteve Yin }
1232cdf0e10cSrcweir }
1233cdf0e10cSrcweir }
1234cdf0e10cSrcweir
1235cdf0e10cSrcweir // ---------------------------------------------------------
1236cdf0e10cSrcweir
StartFullscreenPresentation()1237cdf0e10cSrcweir void SlideShow::StartFullscreenPresentation( )
1238cdf0e10cSrcweir {
1239cdf0e10cSrcweir // Create the top level window in which the PresentationViewShell(Base)
1240cdf0e10cSrcweir // will be created. This is done here explicitly so that we can make it
1241cdf0e10cSrcweir // fullscreen.
1242cdf0e10cSrcweir const sal_Int32 nDisplay (GetDisplay());
1243cdf0e10cSrcweir WorkWindow* pWorkWindow = new FullScreenWorkWindow(this, mpCurrentViewShellBase);
1244cdf0e10cSrcweir pWorkWindow->SetBackground(Wallpaper(COL_BLACK));
1245cdf0e10cSrcweir pWorkWindow->StartPresentationMode( sal_True, mpDoc->getPresentationSettings().mbAlwaysOnTop ? PRESENTATION_HIDEALLAPPS : 0, nDisplay);
1246cdf0e10cSrcweir // pWorkWindow->ShowFullScreenMode(sal_False, nDisplay);
1247cdf0e10cSrcweir
1248cdf0e10cSrcweir if (pWorkWindow->IsVisible())
1249cdf0e10cSrcweir {
1250cdf0e10cSrcweir // Initialize the new presentation view shell with a copy of the
1251cdf0e10cSrcweir // frame view of the current view shell. This avoids that
1252cdf0e10cSrcweir // changes made by the presentation have an effect on the other
1253cdf0e10cSrcweir // view shells.
1254cdf0e10cSrcweir FrameView* pOriginalFrameView = mpCurrentViewShellBase ? mpCurrentViewShellBase->GetMainViewShell()->GetFrameView() : 0;
1255cdf0e10cSrcweir
1256cdf0e10cSrcweir if( mpFullScreenFrameView )
1257cdf0e10cSrcweir delete mpFullScreenFrameView;
1258cdf0e10cSrcweir mpFullScreenFrameView = new FrameView(mpDoc, pOriginalFrameView);
1259cdf0e10cSrcweir
1260cdf0e10cSrcweir // Reference<XController> xController;
1261cdf0e10cSrcweir
1262cdf0e10cSrcweir // The new frame is created hidden. To make it visible and activate the
1263cdf0e10cSrcweir // new view shell--a prerequisite to process slot calls and initialize
1264cdf0e10cSrcweir // its panes--a GrabFocus() has to be called later on.
1265cdf0e10cSrcweir SfxFrame* pNewFrame = SfxFrame::Create( *mpDoc->GetDocSh(), *pWorkWindow, PRESENTATION_FACTORY_ID, true );
1266cdf0e10cSrcweir pNewFrame->SetPresentationMode(sal_True);
1267cdf0e10cSrcweir
1268cdf0e10cSrcweir mpFullScreenViewShellBase = static_cast<ViewShellBase*>(pNewFrame->GetCurrentViewFrame()->GetViewShell());
1269cdf0e10cSrcweir if(mpFullScreenViewShellBase != NULL)
1270cdf0e10cSrcweir {
1271cdf0e10cSrcweir // The following GrabFocus() is responsible for activating the
1272cdf0e10cSrcweir // new view shell. Without it the screen remains blank (under
1273cdf0e10cSrcweir // Windows and some Linux variants.)
1274cdf0e10cSrcweir mpFullScreenViewShellBase->GetWindow()->GrabFocus();
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir }
1277cdf0e10cSrcweir }
1278cdf0e10cSrcweir
1279cdf0e10cSrcweir // ---------------------------------------------------------
1280cdf0e10cSrcweir
GetDisplay()1281cdf0e10cSrcweir sal_Int32 SlideShow::GetDisplay()
1282cdf0e10cSrcweir
1283cdf0e10cSrcweir {
1284cdf0e10cSrcweir sal_Int32 nDisplay = 0;
1285cdf0e10cSrcweir
1286cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
1287cdf0e10cSrcweir if( pOptions )
1288cdf0e10cSrcweir nDisplay = pOptions->GetDisplay();
1289cdf0e10cSrcweir
1290cdf0e10cSrcweir return nDisplay;
1291cdf0e10cSrcweir }
1292cdf0e10cSrcweir
1293cdf0e10cSrcweir // ---------------------------------------------------------
1294cdf0e10cSrcweir
1295cdf0e10cSrcweir
dependsOn(ViewShellBase * pViewShellBase)1296cdf0e10cSrcweir bool SlideShow::dependsOn( ViewShellBase* pViewShellBase )
1297cdf0e10cSrcweir {
1298cdf0e10cSrcweir return mxController.is() && (pViewShellBase == mpCurrentViewShellBase) && mpFullScreenViewShellBase;
1299cdf0e10cSrcweir }
1300cdf0e10cSrcweir
1301cdf0e10cSrcweir // ---------------------------------------------------------
1302cdf0e10cSrcweir
CreatePresentation(const SdDrawDocument & rDocument)1303cdf0e10cSrcweir Reference< XPresentation2 > CreatePresentation( const SdDrawDocument& rDocument )
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir return Reference< XPresentation2 >( SlideShow::Create( const_cast< SdDrawDocument* >( &rDocument ) ).get() );
1306cdf0e10cSrcweir }
1307cdf0e10cSrcweir
1308cdf0e10cSrcweir // ---------------------------------------------------------
1309cdf0e10cSrcweir
1310