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