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