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