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