Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "com/sun/star/frame/XComponentLoader.hpp"
30 : : #include <com/sun/star/lang/XInitialization.hpp>
31 : : #include <com/sun/star/document/XEventsSupplier.hpp>
32 : : #include <com/sun/star/drawing/XMasterPageTarget.hpp>
33 : : #include <com/sun/star/container/XNameReplace.hpp>
34 : : #include <com/sun/star/beans/PropertyValue.hpp>
35 : : #include <com/sun/star/beans/XPropertySetInfo.hpp>
36 : : #include <com/sun/star/beans/XPropertySet.hpp>
37 : : #include <com/sun/star/awt/SystemPointer.hpp>
38 : : #include <com/sun/star/util/URLTransformer.hpp>
39 : : #include <com/sun/star/util/XURLTransformer.hpp>
40 : : #include <com/sun/star/frame/XDispatch.hpp>
41 : : #include <com/sun/star/frame/XLayoutManager.hpp>
42 : : #include <svl/aeitem.hxx>
43 : : #include <svl/urihelper.hxx>
44 : :
45 : : #include <toolkit/unohlp.hxx>
46 : :
47 : : #include <sfx2/imagemgr.hxx>
48 : : #include <sfx2/request.hxx>
49 : : #include <sfx2/docfile.hxx>
50 : : #include <sfx2/app.hxx>
51 : : #include <svx/unoapi.hxx>
52 : : #include <svx/svdoole2.hxx>
53 : :
54 : : // for child window ids
55 : : #include <sfx2/templdlg.hxx>
56 : : #include <svx/f3dchild.hxx>
57 : : #include <svx/imapdlg.hxx>
58 : : #include <svx/fontwork.hxx>
59 : : #include <svx/colrctrl.hxx>
60 : : #include <svx/bmpmask.hxx>
61 : : #include <svx/srchdlg.hxx>
62 : : #include <svx/hyperdlg.hxx>
63 : : #include <svx/galbrws.hxx>
64 : : #include "NavigatorChildWindow.hxx"
65 : : #include "AnimationChildWindow.hxx"
66 : : #include <slideshowimpl.hxx>
67 : : #include <slideshowviewimpl.hxx>
68 : : #include <pgjump.hxx>
69 : : #include "PaneHider.hxx"
70 : :
71 : : #include "glob.hrc"
72 : : #include "res_bmp.hrc"
73 : : #include "sdresid.hxx"
74 : : #include "vcl/canvastools.hxx"
75 : : #include "comphelper/anytostring.hxx"
76 : : #include "cppuhelper/exc_hlp.hxx"
77 : : #include "rtl/ref.hxx"
78 : : #include "slideshow.hrc"
79 : : #include "canvas/elapsedtime.hxx"
80 : : #include "avmedia/mediawindow.hxx"
81 : : #include "svtools/colrdlg.hxx"
82 : : #include "RemoteServer.hxx"
83 : : #include "customshowlist.hxx"
84 : :
85 : : #include <boost/bind.hpp>
86 : :
87 : : using ::rtl::OUString;
88 : : using ::rtl::OString;
89 : : using ::cppu::OInterfaceContainerHelper;
90 : : using ::comphelper::ImplementationReference;
91 : : using ::com::sun::star::animations::XAnimationNode;
92 : : using ::com::sun::star::animations::XAnimationListener;
93 : : using ::com::sun::star::awt::XWindow;
94 : : using namespace ::com::sun::star;
95 : : using namespace ::com::sun::star::lang;
96 : : using namespace ::com::sun::star::uno;
97 : : using namespace ::com::sun::star::drawing;
98 : : using namespace ::com::sun::star::container;
99 : : using namespace ::com::sun::star::document;
100 : : using namespace ::com::sun::star::presentation;
101 : : using namespace ::com::sun::star::drawing;
102 : : using namespace ::com::sun::star::beans;
103 : :
104 : : extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName );
105 : : extern String getUiNameFromPageApiNameImpl( const OUString& rApiName );
106 : :
107 : : namespace sd
108 : : {
109 : : ///////////////////////////////////////////////////////////////////////
110 : :
111 : : // Slots, welche im Sfx verwaltet werden und in der SlideShow disabled
112 : : // werden sollen (muss in Reihenfolge der SIDs geordnet sein)
113 : : static sal_uInt16 const pAllowed[] =
114 : : {
115 : : SID_OPENDOC , // 5501 // damit interne Spruenge klappen
116 : : SID_JUMPTOMARK , // 5598
117 : : SID_OPENHYPERLINK , // 6676
118 : : SID_NAVIGATOR , // 10366
119 : : SID_PRESENTATION_END , // 27218
120 : : SID_NAVIGATOR_PAGENAME , // 27287
121 : : SID_NAVIGATOR_STATE , // 27288
122 : : SID_NAVIGATOR_INIT , // 27289
123 : : SID_NAVIGATOR_PEN , // 27291
124 : : SID_NAVIGATOR_PAGE , // 27292
125 : : SID_NAVIGATOR_OBJECT // 27293
126 : : };
127 : :
128 : : ///////////////////////////////////////////////////////////////////////
129 : :
130 : : ///////////////////////////////////////////////////////////////////////
131 : : // AnimationSlideController
132 : : ///////////////////////////////////////////////////////////////////////
133 : :
134 : 0 : class AnimationSlideController
135 : : {
136 : : public:
137 : : enum Mode { ALL, FROM, CUSTOM, PREVIEW };
138 : :
139 : : public:
140 : : AnimationSlideController( Reference< XIndexAccess > xSlides, Mode eMode );
141 : :
142 : 0 : void setStartSlideNumber( sal_Int32 nSlideNumber ) { mnStartSlideNumber = nSlideNumber; }
143 : : sal_Int32 getStartSlideIndex() const;
144 : :
145 : : sal_Int32 getCurrentSlideNumber() const;
146 : : sal_Int32 getCurrentSlideIndex() const;
147 : :
148 : 0 : sal_Int32 getSlideIndexCount() const { return maSlideNumbers.size(); }
149 : 0 : sal_Int32 getSlideNumberCount() const { return mnSlideCount; }
150 : :
151 : : sal_Int32 getSlideNumber( sal_Int32 nSlideIndex ) const;
152 : :
153 : : void insertSlideNumber( sal_Int32 nSlideNumber, bool bVisible = true );
154 : : void setPreviewNode( const Reference< XAnimationNode >& xPreviewNode );
155 : :
156 : : bool jumpToSlideIndex( sal_Int32 nNewSlideIndex );
157 : : bool jumpToSlideNumber( sal_Int32 nNewSlideIndex );
158 : :
159 : : bool nextSlide();
160 : : bool previousSlide();
161 : :
162 : : void displayCurrentSlide( const Reference< XSlideShow >& xShow,
163 : : const Reference< XDrawPagesSupplier>& xDrawPages,
164 : : const bool bSkipAllMainSequenceEffects );
165 : :
166 : : sal_Int32 getNextSlideIndex() const;
167 : : sal_Int32 getPreviousSlideIndex() const;
168 : :
169 : : bool isVisibleSlideNumber( sal_Int32 nSlideNumber ) const;
170 : :
171 : : Reference< XDrawPage > getSlideByNumber( sal_Int32 nSlideNumber ) const;
172 : :
173 : : sal_Int32 getNextSlideNumber() const;
174 : :
175 : 0 : bool hasSlides() const { return !maSlideNumbers.empty(); }
176 : :
177 : : private:
178 : : bool getSlideAPI( sal_Int32 nSlideNumber, Reference< XDrawPage >& xSlide, Reference< XAnimationNode >& xAnimNode );
179 : : sal_Int32 findSlideIndex( sal_Int32 nSlideNumber ) const;
180 : :
181 [ # # ][ # # ]: 0 : bool isValidIndex( sal_Int32 nIndex ) const { return (nIndex >= 0) && (nIndex < (sal_Int32)maSlideNumbers.size()); }
182 [ # # ][ # # ]: 0 : bool isValidSlideNumber( sal_Int32 nSlideNumber ) const { return (nSlideNumber >= 0) && (nSlideNumber < mnSlideCount); }
183 : :
184 : : private:
185 : : Mode meMode;
186 : : sal_Int32 mnStartSlideNumber;
187 : : std::vector< sal_Int32 > maSlideNumbers;
188 : : std::vector< bool > maSlideVisible;
189 : : std::vector< bool > maSlideVisited;
190 : : Reference< XAnimationNode > mxPreviewNode;
191 : : sal_Int32 mnSlideCount;
192 : : sal_Int32 mnCurrentSlideIndex;
193 : : sal_Int32 mnHiddenSlideNumber;
194 : : Reference< XIndexAccess > mxSlides;
195 : : };
196 : :
197 : 0 : Reference< XDrawPage > AnimationSlideController::getSlideByNumber( sal_Int32 nSlideNumber ) const
198 : : {
199 : 0 : Reference< XDrawPage > xSlide;
200 [ # # ][ # # ]: 0 : if( mxSlides.is() && (nSlideNumber >= 0) && (nSlideNumber < mxSlides->getCount()) )
[ # # ][ # # ]
[ # # ][ # # ]
201 [ # # ][ # # ]: 0 : mxSlides->getByIndex( nSlideNumber ) >>= xSlide;
[ # # ]
202 : 0 : return xSlide;
203 : : }
204 : :
205 : 0 : bool AnimationSlideController::isVisibleSlideNumber( sal_Int32 nSlideNumber ) const
206 : : {
207 : 0 : sal_Int32 nIndex = findSlideIndex( nSlideNumber );
208 : :
209 [ # # ]: 0 : if( nIndex != -1 )
210 : 0 : return maSlideVisible[ nIndex ];
211 : : else
212 : 0 : return false;
213 : : }
214 : :
215 : :
216 : 0 : void AnimationSlideController::setPreviewNode( const Reference< XAnimationNode >& xPreviewNode )
217 : : {
218 : 0 : mxPreviewNode = xPreviewNode;
219 : 0 : }
220 : :
221 : 0 : AnimationSlideController::AnimationSlideController( Reference< XIndexAccess > xSlides, Mode eMode )
222 : : : meMode( eMode )
223 : : , mnStartSlideNumber(-1)
224 : : , mnSlideCount( 0 )
225 : : , mnCurrentSlideIndex(0)
226 : : , mnHiddenSlideNumber( -1 )
227 [ # # ][ # # ]: 0 : , mxSlides( xSlides )
228 : : {
229 [ # # ]: 0 : if( mxSlides.is() )
230 [ # # ][ # # ]: 0 : mnSlideCount = xSlides->getCount();
231 : 0 : }
232 : :
233 : 0 : sal_Int32 AnimationSlideController::getStartSlideIndex() const
234 : : {
235 [ # # ]: 0 : if( mnStartSlideNumber >= 0 )
236 : : {
237 : : sal_Int32 nIndex;
238 : 0 : const sal_Int32 nCount = maSlideNumbers.size();
239 : :
240 [ # # ]: 0 : for( nIndex = 0; nIndex < nCount; nIndex++ )
241 : : {
242 [ # # ]: 0 : if( maSlideNumbers[nIndex] == mnStartSlideNumber )
243 : 0 : return nIndex;
244 : : }
245 : : }
246 : :
247 : 0 : return 0;
248 : : }
249 : :
250 : 0 : sal_Int32 AnimationSlideController::getCurrentSlideNumber() const
251 : : {
252 [ # # ]: 0 : if( mnHiddenSlideNumber != -1 )
253 : 0 : return mnHiddenSlideNumber;
254 [ # # ]: 0 : else if( !maSlideNumbers.empty() )
255 : 0 : return maSlideNumbers[mnCurrentSlideIndex];
256 : : else
257 : 0 : return 0;
258 : : }
259 : :
260 : 0 : sal_Int32 AnimationSlideController::getCurrentSlideIndex() const
261 : : {
262 [ # # ]: 0 : if( mnHiddenSlideNumber != -1 )
263 : 0 : return -1;
264 : : else
265 : 0 : return mnCurrentSlideIndex;
266 : : }
267 : :
268 : 0 : bool AnimationSlideController::jumpToSlideIndex( sal_Int32 nNewSlideIndex )
269 : : {
270 [ # # ]: 0 : if( isValidIndex( nNewSlideIndex ) )
271 : : {
272 : 0 : mnCurrentSlideIndex = nNewSlideIndex;
273 : 0 : mnHiddenSlideNumber = -1;
274 : 0 : maSlideVisited[mnCurrentSlideIndex] = true;
275 : 0 : return true;
276 : : }
277 : : else
278 : : {
279 : 0 : return false;
280 : : }
281 : : }
282 : :
283 : 0 : bool AnimationSlideController::jumpToSlideNumber( sal_Int32 nNewSlideNumber )
284 : : {
285 : 0 : sal_Int32 nIndex = findSlideIndex( nNewSlideNumber );
286 [ # # ]: 0 : if( isValidIndex( nIndex ) )
287 : : {
288 : 0 : return jumpToSlideIndex( nIndex );
289 : : }
290 [ # # ][ # # ]: 0 : else if( (nNewSlideNumber >= 0) && (nNewSlideNumber < mnSlideCount) )
291 : : {
292 : : // jump to a hidden slide
293 : 0 : mnHiddenSlideNumber = nNewSlideNumber;
294 : 0 : return true;
295 : : }
296 : : else
297 : : {
298 : 0 : return false;
299 : : }
300 : : }
301 : :
302 : 0 : sal_Int32 AnimationSlideController::getSlideNumber( sal_Int32 nSlideIndex ) const
303 : : {
304 [ # # ]: 0 : if( isValidIndex( nSlideIndex ) )
305 : 0 : return maSlideNumbers[nSlideIndex];
306 : : else
307 : 0 : return -1;
308 : : }
309 : :
310 : 0 : void AnimationSlideController::insertSlideNumber( sal_Int32 nSlideNumber, bool bVisible /* = true */ )
311 : : {
312 : : DBG_ASSERT( isValidSlideNumber( nSlideNumber ), "sd::AnimationSlideController::insertSlideNumber(), illegal index" );
313 [ # # ]: 0 : if( isValidSlideNumber( nSlideNumber ) )
314 : : {
315 : 0 : maSlideNumbers.push_back( nSlideNumber );
316 : 0 : maSlideVisible.push_back( bVisible );
317 : 0 : maSlideVisited.push_back( false );
318 : : }
319 : 0 : }
320 : :
321 : 0 : bool AnimationSlideController::getSlideAPI( sal_Int32 nSlideNumber, Reference< XDrawPage >& xSlide, Reference< XAnimationNode >& xAnimNode )
322 : : {
323 [ # # ]: 0 : if( isValidSlideNumber( nSlideNumber ) ) try
324 : : {
325 [ # # ][ # # ]: 0 : xSlide = Reference< XDrawPage >( mxSlides->getByIndex(nSlideNumber), UNO_QUERY_THROW );
[ # # ][ # # ]
326 : :
327 [ # # ]: 0 : if( meMode == PREVIEW )
328 : : {
329 [ # # ]: 0 : xAnimNode = mxPreviewNode;
330 : : }
331 : : else
332 : : {
333 [ # # ]: 0 : Reference< animations::XAnimationNodeSupplier > xAnimNodeSupplier( xSlide, UNO_QUERY_THROW );
334 [ # # ][ # # ]: 0 : xAnimNode = xAnimNodeSupplier->getAnimationNode();
[ # # ][ # # ]
335 : : }
336 : :
337 : 0 : return true;
338 : : }
339 : 0 : catch( Exception& )
340 : : {
341 : : OSL_FAIL(
342 : : (OString("sd::AnimationSlideController::getSlideAPI(), "
343 : : "exception caught: ") +
344 : : rtl::OUStringToOString(
345 : : comphelper::anyToString( cppu::getCaughtException() ),
346 : : RTL_TEXTENCODING_UTF8 )).getStr() );
347 : :
348 : : }
349 : :
350 : 0 : return false;
351 : : }
352 : :
353 : 0 : sal_Int32 AnimationSlideController::findSlideIndex( sal_Int32 nSlideNumber ) const
354 : : {
355 : : sal_Int32 nIndex;
356 : 0 : const sal_Int32 nCount = maSlideNumbers.size();
357 : :
358 [ # # ]: 0 : for( nIndex = 0; nIndex < nCount; nIndex++ )
359 : : {
360 [ # # ]: 0 : if( maSlideNumbers[nIndex] == nSlideNumber )
361 : 0 : return nIndex;
362 : : }
363 : :
364 : 0 : return -1;
365 : : }
366 : :
367 : 0 : sal_Int32 AnimationSlideController::getNextSlideIndex() const
368 : : {
369 [ # # # ]: 0 : switch( meMode )
370 : : {
371 : : case ALL:
372 : : {
373 : 0 : sal_Int32 nNewSlideIndex = mnCurrentSlideIndex + 1;
374 [ # # ]: 0 : if( isValidIndex( nNewSlideIndex ) )
375 : : {
376 : : // if the current slide is not excluded, make sure the
377 : : // next slide is also not excluded.
378 : : // if the current slide is excluded, we want to go
379 : : // to the next slide, even if this is also excluded.
380 [ # # ]: 0 : if( maSlideVisible[mnCurrentSlideIndex] )
381 : : {
382 [ # # ]: 0 : while( isValidIndex( nNewSlideIndex ) )
383 : : {
384 [ # # ]: 0 : if( maSlideVisible[nNewSlideIndex] )
385 : 0 : break;
386 : :
387 : 0 : nNewSlideIndex++;
388 : : }
389 : : }
390 : : }
391 [ # # ]: 0 : return isValidIndex( nNewSlideIndex ) ? nNewSlideIndex : -1;
392 : : }
393 : :
394 : : case FROM:
395 : : case CUSTOM:
396 [ # # ]: 0 : return mnHiddenSlideNumber == -1 ? mnCurrentSlideIndex + 1 : mnCurrentSlideIndex;
397 : :
398 : : default:
399 : : case PREVIEW:
400 : 0 : return -1;
401 : :
402 : : }
403 : : }
404 : :
405 : 0 : sal_Int32 AnimationSlideController::getNextSlideNumber() const
406 : : {
407 : 0 : sal_Int32 nNextSlideIndex = getNextSlideIndex();
408 [ # # ]: 0 : if( isValidIndex( nNextSlideIndex ) )
409 : : {
410 : 0 : return maSlideNumbers[nNextSlideIndex];
411 : : }
412 : : else
413 : : {
414 : 0 : return -1;
415 : : }
416 : : }
417 : :
418 : :
419 : 0 : bool AnimationSlideController::nextSlide()
420 : : {
421 : 0 : return jumpToSlideIndex( getNextSlideIndex() );
422 : : }
423 : :
424 : 0 : sal_Int32 AnimationSlideController::getPreviousSlideIndex() const
425 : : {
426 : 0 : sal_Int32 nNewSlideIndex = mnCurrentSlideIndex - 1;
427 : :
428 [ # # # ]: 0 : switch( meMode )
429 : : {
430 : : case ALL:
431 : : {
432 : : // make sure the previous slide is visible
433 : : // or was already visited
434 [ # # ]: 0 : while( isValidIndex( nNewSlideIndex ) )
435 : : {
436 [ # # ][ # # ]: 0 : if( maSlideVisible[nNewSlideIndex] || maSlideVisited[nNewSlideIndex] )
[ # # ]
437 : 0 : break;
438 : :
439 : 0 : nNewSlideIndex--;
440 : : }
441 : :
442 : 0 : break;
443 : : }
444 : :
445 : : case PREVIEW:
446 : 0 : return -1;
447 : :
448 : : default:
449 : 0 : break;
450 : : }
451 : :
452 : 0 : return nNewSlideIndex;
453 : : }
454 : :
455 : 0 : bool AnimationSlideController::previousSlide()
456 : : {
457 : 0 : return jumpToSlideIndex( getPreviousSlideIndex() );
458 : : }
459 : :
460 : 0 : void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow >& xShow,
461 : : const Reference< XDrawPagesSupplier>& xDrawPages,
462 : : const bool bSkipAllMainSequenceEffects )
463 : : {
464 : 0 : const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber();
465 : :
466 [ # # ][ # # ]: 0 : if( xShow.is() && (nCurrentSlideNumber != -1 ) )
[ # # ]
467 : : {
468 : 0 : Reference< XDrawPage > xSlide;
469 : 0 : Reference< XAnimationNode > xAnimNode;
470 [ # # ]: 0 : ::std::vector<PropertyValue> aProperties;
471 : :
472 [ # # ]: 0 : const sal_Int32 nNextSlideNumber = getNextSlideNumber();
473 [ # # ][ # # ]: 0 : if( getSlideAPI( nNextSlideNumber, xSlide, xAnimNode ) )
474 : : {
475 [ # # ]: 0 : Sequence< Any > aValue(2);
476 [ # # ][ # # ]: 0 : aValue[0] <<= xSlide;
477 [ # # ][ # # ]: 0 : aValue[1] <<= xAnimNode;
478 : : aProperties.push_back(
479 : : PropertyValue( "Prefetch" ,
480 : : -1,
481 : : Any(aValue),
482 [ # # ][ # # ]: 0 : PropertyState_DIRECT_VALUE));
[ # # ]
483 : : }
484 [ # # ]: 0 : if (bSkipAllMainSequenceEffects)
485 : : {
486 : : // Add one property that prevents the slide transition from being
487 : : // shown (to speed up the transition to the previous slide) and
488 : : // one to show all main sequence effects so that the user can
489 : : // continue to undo effects.
490 : : aProperties.push_back(
491 : : PropertyValue( "SkipAllMainSequenceEffects",
492 : : -1,
493 : : Any(sal_True),
494 [ # # ][ # # ]: 0 : PropertyState_DIRECT_VALUE));
495 : : aProperties.push_back(
496 : : PropertyValue("SkipSlideTransition",
497 : : -1,
498 : : Any(sal_True),
499 [ # # ][ # # ]: 0 : PropertyState_DIRECT_VALUE));
500 : : }
501 : :
502 : : // Convert vector into uno Sequence.
503 [ # # ]: 0 : Sequence< PropertyValue > aPropertySequence (aProperties.size());
504 [ # # ]: 0 : for (int nIndex=0,nCount=aProperties.size();nIndex<nCount; ++nIndex)
505 [ # # ]: 0 : aPropertySequence[nIndex] = aProperties[nIndex];
506 : :
507 [ # # ][ # # ]: 0 : if( getSlideAPI( nCurrentSlideNumber, xSlide, xAnimNode ) )
508 [ # # ][ # # ]: 0 : xShow->displaySlide( xSlide, xDrawPages, xAnimNode, aPropertySequence );
[ # # ]
509 : : }
510 : 0 : }
511 : :
512 : : ///////////////////////////////////////////////////////////////////////
513 : : // class SlideshowImpl
514 : : ///////////////////////////////////////////////////////////////////////
515 : :
516 : 0 : SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation, ViewShell* pViewSh, ::sd::View* pView, SdDrawDocument* pDoc, ::Window* pParentWindow )
517 : : : SlideshowImplBase( m_aMutex )
518 : : , mxModel(pDoc->getUnoModel(),UNO_QUERY_THROW)
519 : : , mpView(pView)
520 : : , mpViewShell(pViewSh)
521 : 0 : , mpDocSh(pDoc->GetDocSh())
522 : : , mpDoc(pDoc)
523 : : , mpNewAttr(0)
524 : : , mpParentWindow(pParentWindow)
525 : : , mpShowWindow(0)
526 : : , mpTimeButton(0)
527 : : , mnRestoreSlide(0)
528 : : , maPresSize( -1, -1 )
529 : : , meAnimationMode(ANIMATIONMODE_SHOW)
530 : : , mpOldActiveWindow(0)
531 : : , mnChildMask( 0 )
532 : : , mbGridVisible(false)
533 : : , mbBordVisible(false)
534 : : , mbSlideBorderVisible(false)
535 : : , mbSetOnlineSpelling(false)
536 : : , mbDisposed(false)
537 : : , mbRehearseTimings(false)
538 : : , mbDesignMode(false)
539 : : , mbIsPaused(false)
540 : : , mbInputFreeze(false)
541 : : , mbActive(sal_False)
542 : 0 : , maPresSettings( pDoc->getPresentationSettings() )
543 : : , mnUserPaintColor( 0x80ff0000L )
544 : : , mbUsePen(false)
545 : : , mdUserPaintStrokeWidth ( 150.0 )
546 : : #ifdef ENABLE_ERASER_UI
547 : : , mbSwitchEraserMode(false)
548 : : , mnEraseInkSize(100)
549 : : #endif
550 : : , mnEntryCounter(0)
551 : : , mnLastSlideNumber(-1)
552 : : , msOnClick( "OnClick" )
553 : : , msBookmark( "Bookmark" )
554 : : , msVerb( "Verb" )
555 : : , mnEndShowEvent(0)
556 : : , mnContextMenuEvent(0)
557 : : , mnUpdateEvent(0)
558 [ # # ][ # # ]: 0 : , mxPresentation( xPresentation )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # # # ]
[ # # ]
559 : : {
560 [ # # ]: 0 : if( mpViewShell )
561 [ # # ]: 0 : mpOldActiveWindow = mpViewShell->GetActiveWindow();
562 : :
563 [ # # ]: 0 : maUpdateTimer.SetTimeoutHdl(LINK(this, SlideshowImpl, updateHdl));
564 : :
565 [ # # ]: 0 : maDeactivateTimer.SetTimeoutHdl(LINK(this, SlideshowImpl, deactivateHdl));
566 [ # # ]: 0 : maDeactivateTimer.SetTimeout( 20 );
567 : :
568 [ # # ]: 0 : maInputFreezeTimer.SetTimeoutHdl( LINK( this, SlideshowImpl, ReadyForNextInputHdl ) );
569 [ # # ]: 0 : maInputFreezeTimer.SetTimeout( 20 );
570 : :
571 [ # # ]: 0 : SvtSaveOptions aOptions;
572 : :
573 : : // no autosave during show
574 [ # # ][ # # ]: 0 : if( aOptions.IsAutoSave() )
575 : 0 : mbAutoSaveWasOn = true;
576 : :
577 [ # # ][ # # ]: 0 : Application::AddEventListener( LINK( this, SlideshowImpl, EventListenerHdl ) );
578 : :
579 : 0 : mbUsePen = maPresSettings.mbMouseAsPen;
580 : :
581 [ # # ][ # # ]: 0 : SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
582 [ # # ]: 0 : if( pOptions )
583 : : {
584 [ # # ]: 0 : mnUserPaintColor = pOptions->GetPresentationPenColor();
585 [ # # ]: 0 : mdUserPaintStrokeWidth = pOptions->GetPresentationPenWidth();
586 [ # # ]: 0 : }
587 : 0 : }
588 : :
589 [ # # ][ # # ]: 0 : SlideshowImpl::~SlideshowImpl()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
590 : : {
591 [ # # ]: 0 : SdModule *pModule = SD_MOD();
592 : : //rhbz#806663 SlideshowImpl can outlive SdModule
593 : : SdOptions* pOptions = pModule ?
594 [ # # ][ # # ]: 0 : pModule->GetSdOptions(DOCUMENT_TYPE_IMPRESS) : NULL;
595 [ # # ]: 0 : if( pOptions )
596 : : {
597 [ # # ]: 0 : pOptions->SetPresentationPenColor(mnUserPaintColor);
598 [ # # ]: 0 : pOptions->SetPresentationPenWidth(mdUserPaintStrokeWidth);
599 : : }
600 : :
601 [ # # ][ # # ]: 0 : Application::RemoveEventListener( LINK( this, SlideshowImpl, EventListenerHdl ) );
602 : :
603 [ # # ]: 0 : maDeactivateTimer.Stop();
604 : :
605 [ # # ]: 0 : if( !mbDisposed )
606 : : {
607 : : OSL_FAIL("SlideshowImpl::~SlideshowImpl(), component was not disposed!");
608 [ # # ]: 0 : disposing();
609 : : }
610 [ # # ]: 0 : }
611 : :
612 : 0 : void SAL_CALL SlideshowImpl::disposing()
613 : : {
614 [ # # ]: 0 : RemoteServer::presentationStopped();
615 [ # # ][ # # ]: 0 : if( mxShow.is() && mpDoc )
[ # # ]
616 [ # # ]: 0 : NotifyDocumentEvent( mpDoc, "OnEndPresentation" );
617 : :
618 [ # # ]: 0 : if( mbAutoSaveWasOn )
619 [ # # ]: 0 : setAutoSaveState( true );
620 : :
621 [ # # ]: 0 : if( mnEndShowEvent )
622 [ # # ]: 0 : Application::RemoveUserEvent( mnEndShowEvent );
623 [ # # ]: 0 : if( mnContextMenuEvent )
624 [ # # ]: 0 : Application::RemoveUserEvent( mnContextMenuEvent );
625 : :
626 [ # # ]: 0 : maInputFreezeTimer.Stop();
627 : :
628 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
629 : :
630 [ # # ]: 0 : if( !mxShow.is() )
631 : 0 : return;
632 : :
633 [ # # ]: 0 : if( mxPresentation.is() )
634 [ # # ][ # # ]: 0 : mxPresentation->end();
635 : :
636 [ # # ]: 0 : maUpdateTimer.Stop();
637 : :
638 [ # # ]: 0 : if( mnUpdateEvent )
639 : : {
640 [ # # ]: 0 : Application::RemoveUserEvent( mnUpdateEvent );
641 : 0 : mnUpdateEvent = 0;
642 : : }
643 : :
644 [ # # ]: 0 : removeShapeEvents();
645 : :
646 [ # # ]: 0 : if( mxListenerProxy.is() )
647 [ # # ]: 0 : mxListenerProxy->removeAsSlideShowListener();
648 : :
649 : : try
650 : : {
651 [ # # ]: 0 : if( mxView.is() )
652 [ # # ][ # # ]: 0 : mxShow->removeView( mxView.getRef() );
[ # # ]
653 : :
654 [ # # ]: 0 : Reference< XComponent > xComponent( mxShow, UNO_QUERY );
655 [ # # ]: 0 : if( xComponent.is() )
656 [ # # ][ # # ]: 0 : xComponent->dispose();
657 : :
658 [ # # ]: 0 : if( mxView.is() )
659 [ # # ][ # # ]: 0 : mxView->dispose();
660 : : }
661 [ # # ]: 0 : catch( Exception& )
662 : : {
663 : : OSL_FAIL(
664 : : (OString("sd::SlideshowImpl::stop(), "
665 : : "exception caught: ") +
666 : : rtl::OUStringToOString(
667 : : comphelper::anyToString( cppu::getCaughtException() ),
668 : : RTL_TEXTENCODING_UTF8 )).getStr() );
669 : :
670 : : }
671 : :
672 : 0 : mxShow.clear();
673 [ # # ]: 0 : mxView.reset();
674 : 0 : mxListenerProxy.clear();
675 [ # # ]: 0 : mpSlideController.reset();
676 : :
677 : : // der DrawView das Praesentationfenster wegnehmen und ihr dafuer ihre alten Fenster wiedergeben
678 [ # # ][ # # ]: 0 : if( mpShowWindow && mpView )
679 [ # # ]: 0 : mpView->DeleteWindowFromPaintView( mpShowWindow );
680 : :
681 [ # # ]: 0 : if( mpView )
682 [ # # ]: 0 : mpView->SetAnimationPause( sal_False );
683 : :
684 [ # # ]: 0 : if( mpViewShell )
685 : : {
686 [ # # ]: 0 : mpViewShell->SetActiveWindow(mpOldActiveWindow);
687 [ # # ]: 0 : mpShowWindow->SetViewShell( NULL );
688 : : }
689 : :
690 [ # # ]: 0 : if( mpView )
691 [ # # ]: 0 : mpView->InvalidateAllWin();
692 : :
693 [ # # ]: 0 : if( maPresSettings.mbFullScreen )
694 : : {
695 : : #ifndef DISABLE_SCRIPTING
696 : : // restore StarBASICErrorHdl
697 [ # # ]: 0 : StarBASIC::SetGlobalErrorHdl(maStarBASICGlobalErrorHdl);
698 [ # # ]: 0 : maStarBASICGlobalErrorHdl = Link();
699 : : #endif
700 : : }
701 : : else
702 : : {
703 [ # # ]: 0 : if( mpShowWindow )
704 [ # # ]: 0 : mpShowWindow->Hide();
705 : : }
706 : :
707 [ # # ]: 0 : if( meAnimationMode == ANIMATIONMODE_SHOW )
708 : : {
709 : 0 : mpDocSh->SetSlotFilter();
710 [ # # ]: 0 : mpDocSh->ApplySlotFilter();
711 : :
712 [ # # ]: 0 : Help::EnableContextHelp();
713 [ # # ]: 0 : Help::EnableExtHelp();
714 : :
715 [ # # ]: 0 : showChildWindows();
716 : 0 : mnChildMask = 0UL;
717 : : }
718 : :
719 : : // aktuelle Fenster wieder einblenden
720 [ # # ][ # # ]: 0 : if( mpViewShell && !mpViewShell->ISA(PresentationViewShell))
[ # # ][ # # ]
[ # # ]
721 : : {
722 [ # # ]: 0 : if( meAnimationMode == ANIMATIONMODE_SHOW )
723 : : {
724 [ # # ][ # # ]: 0 : mpViewShell->GetViewShellBase().ShowUIControls (true);
725 : 0 : mpPaneHider.reset();
726 : : }
727 [ # # ]: 0 : else if( meAnimationMode == ANIMATIONMODE_PREVIEW )
728 : : {
729 [ # # ]: 0 : mpViewShell->ShowUIControls (true);
730 : : }
731 : : }
732 : :
733 [ # # ]: 0 : if( mpTimeButton )
734 : : {
735 [ # # ]: 0 : mpTimeButton->Hide();
736 [ # # ][ # # ]: 0 : delete mpTimeButton;
737 : 0 : mpTimeButton = 0;
738 : : }
739 : :
740 [ # # ]: 0 : if( mpShowWindow )
741 [ # # ]: 0 : mpShowWindow->Hide();
742 : :
743 [ # # ]: 0 : if ( mpViewShell )
744 : : {
745 [ # # ]: 0 : if( meAnimationMode == ANIMATIONMODE_SHOW )
746 : : {
747 [ # # ]: 0 : ::sd::Window* pActWin = mpViewShell->GetActiveWindow();
748 : :
749 [ # # ]: 0 : if (pActWin)
750 : : {
751 : 0 : Size aVisSizePixel = pActWin->GetOutputSizePixel();
752 [ # # ][ # # ]: 0 : Rectangle aVisAreaWin = pActWin->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
753 [ # # ]: 0 : mpViewShell->VisAreaChanged(aVisAreaWin);
754 [ # # ]: 0 : mpView->VisAreaChanged(pActWin);
755 [ # # ]: 0 : pActWin->GrabFocus();
756 : : }
757 : : }
758 : :
759 : : // restart the custom show dialog if he started us
760 [ # # ][ # # ]: 0 : if( mpViewShell->IsStartShowWithDialog() && getDispatcher() )
[ # # ][ # # ]
761 : : {
762 : 0 : mpViewShell->SetStartShowWithDialog( sal_False );
763 [ # # ][ # # ]: 0 : getDispatcher()->Execute( SID_CUSTOMSHOW_DLG, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
764 : : }
765 : :
766 [ # # ][ # # ]: 0 : mpViewShell->GetViewShellBase().UpdateBorder(true);
767 : : }
768 : :
769 [ # # ]: 0 : if( mpShowWindow )
770 : : {
771 [ # # ][ # # ]: 0 : delete mpShowWindow;
772 : 0 : mpShowWindow = 0;
773 : : }
774 : :
775 [ # # ]: 0 : setActiveXToolbarsVisible( sal_True );
776 : :
777 [ # # ]: 0 : Application::EnableNoYieldMode(false);
778 [ # # ][ # # ]: 0 : Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
779 : :
780 [ # # ][ # # ]: 0 : mbDisposed = true;
781 : : }
782 : :
783 : 0 : bool SlideshowImpl::startPreview(
784 : : const Reference< XDrawPage >& xDrawPage,
785 : : const Reference< XAnimationNode >& xAnimationNode,
786 : : ::Window* pParent )
787 : : {
788 : 0 : bool bRet = false;
789 : :
790 : : try
791 : : {
792 [ # # ]: 0 : const Reference<lang::XServiceInfo> xServiceInfo( xDrawPage, UNO_QUERY );
793 [ # # ]: 0 : if (xServiceInfo.is()) {
794 : : const Sequence<OUString> supportedServices(
795 [ # # ][ # # ]: 0 : xServiceInfo->getSupportedServiceNames() );
796 [ # # ]: 0 : for ( sal_Int32 pos = supportedServices.getLength(); pos--; ) {
797 [ # # ]: 0 : if ( supportedServices[pos] == "com.sun.star.drawing.MasterPage" ) {
798 : : OSL_FAIL("sd::SlideshowImpl::startPreview() "
799 : : "not allowed on master page!");
800 : 0 : return false;
801 : : }
802 [ # # ][ # # ]: 0 : }
803 : : }
804 : :
805 [ # # ]: 0 : mxPreviewDrawPage = xDrawPage;
806 [ # # ]: 0 : mxPreviewAnimationNode = xAnimationNode;
807 : 0 : meAnimationMode = ANIMATIONMODE_PREVIEW;
808 : :
809 : 0 : maPresSettings.mbAll = sal_False;
810 : 0 : maPresSettings.mbEndless = sal_False;
811 : 0 : maPresSettings.mbCustomShow = sal_False;
812 : 0 : maPresSettings.mbManual = sal_False;
813 : 0 : maPresSettings.mbMouseVisible = sal_False;
814 : 0 : maPresSettings.mbMouseAsPen = sal_False;
815 : 0 : maPresSettings.mbLockedPages = sal_False;
816 : 0 : maPresSettings.mbAlwaysOnTop = sal_False;
817 : 0 : maPresSettings.mbFullScreen = sal_False;
818 : 0 : maPresSettings.mbAnimationAllowed = sal_True;
819 : 0 : maPresSettings.mnPauseTimeout = 0;
820 : 0 : maPresSettings.mbShowPauseLogo = sal_False;
821 : 0 : maPresSettings.mbStartWithNavigator = sal_False;
822 : :
823 [ # # ][ # # ]: 0 : Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW );
824 [ # # ][ # # ]: 0 : Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
[ # # ]
825 [ # # ][ # # ]: 0 : mpSlideController.reset( new AnimationSlideController( xSlides, AnimationSlideController::PREVIEW ) );
[ # # ]
826 : :
827 : 0 : sal_Int32 nSlideNumber = 0;
828 [ # # ]: 0 : Reference< XPropertySet > xSet( mxPreviewDrawPage, UNO_QUERY_THROW );
829 [ # # ][ # # ]: 0 : xSet->getPropertyValue( "Number" ) >>= nSlideNumber;
830 [ # # ]: 0 : mpSlideController->insertSlideNumber( nSlideNumber-1 );
831 [ # # ]: 0 : mpSlideController->setPreviewNode( xAnimationNode );
832 : :
833 [ # # ][ # # ]: 0 : mpShowWindow = new ShowWindow( this, ((pParent == 0) && mpViewShell) ? mpParentWindow : pParent );
[ # # ][ # # ]
834 [ # # ]: 0 : if( mpViewShell )
835 : : {
836 [ # # ]: 0 : mpViewShell->SetActiveWindow( mpShowWindow );
837 [ # # ]: 0 : mpShowWindow->SetViewShell (mpViewShell);
838 [ # # ]: 0 : mpViewShell->ShowUIControls (false);
839 : : }
840 : :
841 [ # # ]: 0 : if( mpView )
842 : : {
843 [ # # ]: 0 : mpView->AddWindowToPaintView( mpShowWindow );
844 [ # # ]: 0 : mpView->SetAnimationPause( sal_True );
845 : : }
846 : :
847 : : // call resize handler
848 [ # # ]: 0 : if( pParent )
849 : : {
850 [ # # ]: 0 : maPresSize = pParent->GetSizePixel();
851 : : }
852 [ # # ]: 0 : else if( mpViewShell )
853 : : {
854 [ # # ][ # # ]: 0 : Rectangle aContentRect (mpViewShell->GetViewShellBase().getClientRectangle());
855 [ # # ][ # # ]: 0 : if (Application::GetSettings().GetLayoutRTL())
[ # # ]
856 : : {
857 : 0 : aContentRect.nLeft = aContentRect.nRight;
858 : 0 : aContentRect.nRight += aContentRect.nRight;
859 : : }
860 [ # # ]: 0 : maPresSize = aContentRect.GetSize();
861 [ # # ]: 0 : mpShowWindow->SetPosPixel( aContentRect.TopLeft() );
862 : : }
863 : : else
864 : : {
865 : : OSL_FAIL("sd::SlideshowImpl::startPreview(), I need either a parent window or a viewshell!");
866 : : }
867 [ # # ]: 0 : resize( maPresSize );
868 : :
869 : 0 : sal_Int32 nPropertyCount = 1;
870 [ # # ]: 0 : if( mxPreviewAnimationNode.is() )
871 : 0 : nPropertyCount++;
872 : :
873 [ # # ]: 0 : Sequence< beans::PropertyValue > aProperties(nPropertyCount);
874 [ # # ]: 0 : aProperties[0].Name = "AutomaticAdvancement";
875 [ # # ][ # # ]: 0 : aProperties[0].Value = uno::makeAny( (double)1.0 ); // one second timeout
876 : :
877 [ # # ]: 0 : if( mxPreviewAnimationNode.is() )
878 : : {
879 [ # # ]: 0 : aProperties[1].Name = "NoSlideTransitions";
880 [ # # ][ # # ]: 0 : aProperties[1].Value = uno::makeAny( sal_True );
881 : : }
882 : :
883 [ # # ]: 0 : bRet = startShowImpl( aProperties );
884 : :
885 [ # # ][ # # ]: 0 : if( mpShowWindow != 0 && meAnimationMode == ANIMATIONMODE_PREVIEW )
886 [ # # ][ # # ]: 0 : mpShowWindow->SetPreviewMode();
[ # # ][ # # ]
887 : :
888 : : }
889 : 0 : catch( Exception& )
890 : : {
891 : : OSL_FAIL(
892 : : (OString("sd::SlideshowImpl::startPreview(), "
893 : : "exception caught: ") +
894 : : rtl::OUStringToOString(
895 : : comphelper::anyToString( cppu::getCaughtException() ),
896 : : RTL_TEXTENCODING_UTF8 )).getStr() );
897 : 0 : bRet = false;
898 : : }
899 : :
900 : 0 : return bRet;
901 : : }
902 : :
903 : 0 : bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
904 : : {
905 : 0 : const rtl::Reference<SlideshowImpl> this_(this);
906 : :
907 : : DBG_ASSERT( !mxShow.is(), "sd::SlideshowImpl::startShow(), called twice!" );
908 [ # # ]: 0 : if( mxShow.is() )
909 : 0 : return true;
910 : : DBG_ASSERT( mpParentWindow!=NULL, "sd::SlideshowImpl::startShow() called without parent window" );
911 [ # # ]: 0 : if (mpParentWindow == NULL)
912 : 0 : return false;
913 : :
914 : 0 : bool bRet = false;
915 : :
916 : : try
917 : : {
918 [ # # ]: 0 : if( pPresSettings )
919 : : {
920 : 0 : maPresSettings = *pPresSettings;
921 : 0 : mbRehearseTimings = pPresSettings->mbRehearseTimings;
922 : : }
923 : :
924 : : // ---
925 : :
926 [ # # ]: 0 : String aPresSlide( maPresSettings.maPresPage );
927 [ # # ][ # # ]: 0 : SdPage* pStartPage = mpViewShell ? mpViewShell->GetActualPage() : 0;
928 : : bool bStartWithActualSlide = pStartPage &&
929 : : ( (meAnimationMode != ANIMATIONMODE_SHOW) ||
930 [ # # ][ # # ]: 0 : SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage() );
[ # # ][ # # ]
[ # # ][ # # ]
931 : :
932 : : // sollen Zeiten gestoppt werden?
933 [ # # ]: 0 : if( mbRehearseTimings )
934 : : {
935 : 0 : maPresSettings.mbEndless = sal_False;
936 : 0 : maPresSettings.mbManual = sal_True;
937 : 0 : maPresSettings.mbMouseVisible = sal_True;
938 : 0 : maPresSettings.mbMouseAsPen = sal_False;
939 : 0 : maPresSettings.mnPauseTimeout = 0;
940 : 0 : maPresSettings.mbShowPauseLogo = sal_False;
941 : 0 : maPresSettings.mbStartWithNavigator = sal_False;
942 : : }
943 : :
944 [ # # ]: 0 : if( pStartPage )
945 : : {
946 [ # # ]: 0 : if( pStartPage->GetPageKind() == PK_NOTES )
947 : : {
948 : : // we are in notes page mode, so get
949 : : // the corresponding draw page
950 [ # # ]: 0 : const sal_uInt16 nPgNum = ( pStartPage->GetPageNum() - 2 ) >> 1;
951 [ # # ]: 0 : pStartPage = mpDoc->GetSdPage( nPgNum, PK_STANDARD );
952 : : }
953 : : }
954 : :
955 [ # # ]: 0 : if( bStartWithActualSlide )
956 : : {
957 [ # # ]: 0 : if( meAnimationMode != ANIMATIONMODE_SHOW )
958 : : {
959 [ # # ]: 0 : if( pStartPage->GetPageKind() == PK_STANDARD )
960 : : {
961 [ # # ][ # # ]: 0 : aPresSlide = pStartPage->GetName();
962 : 0 : maPresSettings.mbAll = false;
963 : : }
964 : : else
965 : : {
966 : 0 : bStartWithActualSlide = false;
967 : : }
968 : : }
969 : : }
970 : : else
971 : : {
972 [ # # ]: 0 : if( pStartPage->GetPageKind() != PK_STANDARD )
973 : : {
974 : 0 : bStartWithActualSlide = false;
975 : : }
976 : : }
977 : :
978 : : // build page list
979 [ # # ]: 0 : createSlideList( maPresSettings.mbAll, false, aPresSlide );
980 : :
981 [ # # ]: 0 : if( bStartWithActualSlide )
982 : : {
983 [ # # ]: 0 : sal_Int32 nSlideNum = ( pStartPage->GetPageNum() - 1 ) >> 1;
984 : :
985 [ # # ][ # # ]: 0 : if( !maPresSettings.mbAll && !maPresSettings.mbCustomShow )
986 : : {
987 : : // its start from dia, find out if it is located before our current Slide
988 [ # # ]: 0 : const sal_Int32 nSlideCount = mpDoc->GetSdPageCount( PK_STANDARD );
989 : : sal_Int32 nSlide;
990 [ # # ]: 0 : for( nSlide = 0; (nSlide < nSlideCount); nSlide++ )
991 : : {
992 [ # # ][ # # ]: 0 : if( mpDoc->GetSdPage( (sal_uInt16) nSlide, PK_STANDARD )->GetName() == aPresSlide )
[ # # ][ # # ]
993 : 0 : break;
994 : : }
995 : :
996 [ # # ]: 0 : if( nSlide > nSlideNum )
997 : 0 : nSlideNum = -1;
998 : : }
999 : :
1000 [ # # ]: 0 : if( nSlideNum != -1 )
1001 : 0 : mpSlideController->setStartSlideNumber( nSlideNum );
1002 : : }
1003 : :
1004 : : // remember Slide number from where the show was started
1005 [ # # ]: 0 : if( pStartPage )
1006 [ # # ]: 0 : mnRestoreSlide = ( pStartPage->GetPageNum() - 1 ) / 2;
1007 : :
1008 [ # # ]: 0 : if( mpSlideController->hasSlides() )
1009 : : {
1010 : : // hide child windows
1011 [ # # ]: 0 : hideChildWindows();
1012 : :
1013 [ # # ][ # # ]: 0 : mpShowWindow = new ShowWindow( this, mpParentWindow );
1014 : 0 : mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible );
1015 [ # # ]: 0 : if( mpViewShell )
1016 : : {
1017 [ # # ]: 0 : mpViewShell->SetActiveWindow( mpShowWindow );
1018 [ # # ]: 0 : mpShowWindow->SetViewShell (mpViewShell);
1019 [ # # ][ # # ]: 0 : mpViewShell->GetViewShellBase().ShowUIControls (false);
1020 : : // Hide the side panes for in-place presentations.
1021 [ # # ]: 0 : if ( ! maPresSettings.mbFullScreen)
1022 [ # # ][ # # ]: 0 : mpPaneHider.reset(new PaneHider(*mpViewShell,this));
1023 : :
1024 [ # # ][ # # ]: 0 : if( getViewFrame() )
1025 [ # # ][ # # ]: 0 : getViewFrame()->SetChildWindow( SID_NAVIGATOR, maPresSettings.mbStartWithNavigator );
1026 : : }
1027 : :
1028 : : // these Slots are forbiden in other views for this document
1029 [ # # ]: 0 : if( mpDocSh )
1030 : : {
1031 : 0 : mpDocSh->SetSlotFilter( sal_True, sizeof( pAllowed ) / sizeof( sal_uInt16 ), pAllowed );
1032 [ # # ]: 0 : mpDocSh->ApplySlotFilter();
1033 : : }
1034 : :
1035 [ # # ]: 0 : Help::DisableContextHelp();
1036 [ # # ]: 0 : Help::DisableExtHelp();
1037 : :
1038 [ # # ]: 0 : if( maPresSettings.mbFullScreen )
1039 : : {
1040 : : #ifndef DISABLE_SCRIPTING
1041 : : // disable basic ide error handling
1042 [ # # ]: 0 : maStarBASICGlobalErrorHdl = StarBASIC::GetGlobalErrorHdl();
1043 [ # # ][ # # ]: 0 : StarBASIC::SetGlobalErrorHdl( Link() );
1044 : : #endif
1045 : : }
1046 : :
1047 : : // call resize handler
1048 [ # # ]: 0 : maPresSize = mpParentWindow->GetSizePixel();
1049 [ # # ][ # # ]: 0 : if( !maPresSettings.mbFullScreen && mpViewShell )
1050 : : {
1051 [ # # ][ # # ]: 0 : const Rectangle& aClientRect = mpViewShell->GetViewShellBase().getClientRectangle();
1052 [ # # ]: 0 : maPresSize = aClientRect.GetSize();
1053 [ # # ]: 0 : mpShowWindow->SetPosPixel( aClientRect.TopLeft() );
1054 [ # # ]: 0 : resize( maPresSize );
1055 : : }
1056 : :
1057 : : // #i41824#
1058 : : // Note: In FullScreen Mode the OS (window manager) sends a resize to
1059 : : // the WorkWindow once it actually resized it to full size. The
1060 : : // WorkWindow propagates the resize to the DrawViewShell which calls
1061 : : // resize() at the SlideShow (this). Calling resize here results in a
1062 : : // temporary display of a black window in the window's default size
1063 : :
1064 [ # # ]: 0 : if( mpView )
1065 : : {
1066 [ # # ]: 0 : mpView->AddWindowToPaintView( mpShowWindow );
1067 [ # # ]: 0 : mpView->SetAnimationPause( sal_True );
1068 : : }
1069 : :
1070 [ # # ]: 0 : SfxBindings* pBindings = getBindings();
1071 [ # # ]: 0 : if( pBindings )
1072 : : {
1073 [ # # ]: 0 : pBindings->Invalidate( SID_PRESENTATION );
1074 [ # # ]: 0 : pBindings->Invalidate( SID_REHEARSE_TIMINGS );
1075 : : }
1076 : :
1077 [ # # ]: 0 : mpShowWindow->GrabFocus();
1078 : :
1079 [ # # ]: 0 : std::vector<beans::PropertyValue> aProperties;
1080 [ # # ]: 0 : aProperties.reserve( 4 );
1081 : :
1082 : : aProperties.push_back(
1083 : : beans::PropertyValue( "AdvanceOnClick" ,
1084 : : -1, Any( ! (maPresSettings.mbLockedPages != sal_False) ),
1085 [ # # ][ # # ]: 0 : beans::PropertyState_DIRECT_VALUE ) );
1086 : :
1087 : : aProperties.push_back(
1088 : : beans::PropertyValue( "ImageAnimationsAllowed" ,
1089 : : -1, Any( maPresSettings.mbAnimationAllowed != sal_False ),
1090 [ # # ][ # # ]: 0 : beans::PropertyState_DIRECT_VALUE ) );
1091 : :
1092 : : const sal_Bool bZOrderEnabled(
1093 [ # # ][ # # ]: 0 : SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsSlideshowRespectZOrder() );
[ # # ]
1094 : : aProperties.push_back(
1095 : : beans::PropertyValue( "DisableAnimationZOrder" ,
1096 : : -1, Any( bZOrderEnabled == sal_False ),
1097 [ # # ][ # # ]: 0 : beans::PropertyState_DIRECT_VALUE ) );
1098 : :
1099 : : aProperties.push_back(
1100 : : beans::PropertyValue( "ForceManualAdvance" ,
1101 : : -1, Any( maPresSettings.mbManual != sal_False ),
1102 [ # # ][ # # ]: 0 : beans::PropertyState_DIRECT_VALUE ) );
1103 : :
1104 [ # # ]: 0 : if( mbUsePen )
1105 : : {
1106 : : aProperties.push_back(
1107 : : beans::PropertyValue( "UserPaintColor" ,
1108 : : // User paint color is black by default.
1109 : : -1, Any( mnUserPaintColor ),
1110 [ # # ][ # # ]: 0 : beans::PropertyState_DIRECT_VALUE ) );
1111 : :
1112 : : aProperties.push_back(
1113 : : beans::PropertyValue( "UserPaintStrokeWidth" ,
1114 : : // User paint color is black by default.
1115 : : -1, Any( mdUserPaintStrokeWidth ),
1116 [ # # ][ # # ]: 0 : beans::PropertyState_DIRECT_VALUE ) );
1117 : : }
1118 : :
1119 [ # # ]: 0 : if (mbRehearseTimings) {
1120 : : aProperties.push_back(
1121 : : beans::PropertyValue( "RehearseTimings" ,
1122 [ # # ][ # # ]: 0 : -1, Any(true), beans::PropertyState_DIRECT_VALUE ) );
1123 : : }
1124 : :
1125 : : bRet = startShowImpl( Sequence<beans::PropertyValue>(
1126 [ # # ][ # # ]: 0 : &aProperties[0], aProperties.size() ) );
[ # # ]
1127 : :
1128 : : }
1129 : :
1130 [ # # ][ # # ]: 0 : setActiveXToolbarsVisible( sal_False );
[ # # ]
1131 : : }
1132 [ # # ]: 0 : catch( Exception& )
1133 : : {
1134 : : OSL_FAIL(
1135 : : (OString("sd::SlideshowImpl::startShow(), "
1136 : : "exception caught: ") +
1137 : : rtl::OUStringToOString(
1138 : : comphelper::anyToString( cppu::getCaughtException() ),
1139 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1140 : 0 : bRet = false;
1141 : : }
1142 : :
1143 : 0 : return bRet;
1144 : : }
1145 : :
1146 : 0 : bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProperties )
1147 : : {
1148 : : try
1149 : : {
1150 [ # # ][ # # ]: 0 : mxShow = Reference< XSlideShow >( createSlideShow(), UNO_QUERY_THROW );
[ # # ]
1151 : : mxView = mxView.createFromQuery( new SlideShowView(
1152 : : *mpShowWindow,
1153 : : mpDoc,
1154 : : meAnimationMode,
1155 : : this,
1156 [ # # ][ # # ]: 0 : maPresSettings.mbFullScreen) );
[ # # ][ # # ]
1157 : :
1158 : : // try add wait symbol to properties:
1159 : : const Reference<rendering::XSpriteCanvas> xSpriteCanvas(
1160 [ # # ]: 0 : mxView->getCanvas() );
1161 [ # # ]: 0 : if (xSpriteCanvas.is())
1162 : : {
1163 [ # # ][ # # ]: 0 : BitmapEx waitSymbolBitmap( SdResId(BMP_WAIT_ICON) );
1164 : : const Reference<rendering::XBitmap> xBitmap(
1165 : : vcl::unotools::xBitmapFromBitmapEx(
1166 [ # # ][ # # ]: 0 : xSpriteCanvas->getDevice(), waitSymbolBitmap ) );
[ # # ]
1167 [ # # ]: 0 : if (xBitmap.is())
1168 : : {
1169 [ # # ]: 0 : mxShow->setProperty(
1170 : : beans::PropertyValue( "WaitSymbolBitmap" ,
1171 : : -1,
1172 : : makeAny( xBitmap ),
1173 [ # # ][ # # ]: 0 : beans::PropertyState_DIRECT_VALUE ) );
1174 [ # # ]: 0 : }
1175 : : }
1176 : :
1177 : 0 : const sal_Int32 nCount = aProperties.getLength();
1178 : : sal_Int32 nIndex;
1179 [ # # ]: 0 : for( nIndex = 0; nIndex < nCount; nIndex++ )
1180 [ # # ][ # # ]: 0 : mxShow->setProperty( aProperties[nIndex] );
1181 : :
1182 [ # # ][ # # ]: 0 : mxShow->addView( mxView.getRef() );
[ # # ]
1183 : :
1184 [ # # ]: 0 : mxListenerProxy.set( new SlideShowListenerProxy( this, mxShow ) );
1185 [ # # ]: 0 : mxListenerProxy->addAsSlideShowListener();
1186 : :
1187 : :
1188 [ # # ]: 0 : NotifyDocumentEvent( mpDoc, "OnStartPresentation");
1189 [ # # ][ # # ]: 0 : displaySlideIndex( mpSlideController->getStartSlideIndex() );
1190 : :
1191 [ # # ]: 0 : return true;
1192 : : }
1193 : 0 : catch( Exception& )
1194 : : {
1195 : : OSL_FAIL(
1196 : : (OString("sd::SlideshowImpl::startShowImpl(), "
1197 : : "exception caught: ") +
1198 : : rtl::OUStringToOString(
1199 : : comphelper::anyToString( cppu::getCaughtException() ),
1200 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1201 : 0 : return false;
1202 : : }
1203 : : }
1204 : :
1205 : : /** called only by the slideshow view when the first paint event occurs.
1206 : : This actually starts the slideshow. */
1207 : 0 : void SlideshowImpl::onFirstPaint()
1208 : : {
1209 : 0 : if( mpShowWindow )
1210 : : {
1211 : : /*
1212 : : mpShowWindow->SetBackground( Wallpaper( Color( COL_BLACK ) ) );
1213 : : mpShowWindow->Erase();
1214 : : mpShowWindow->SetBackground();
1215 : : */
1216 : : }
1217 : :
1218 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
1219 [ # # ]: 0 : maUpdateTimer.SetTimeout( (sal_uLong)100 );
1220 [ # # ][ # # ]: 0 : maUpdateTimer.Start();
1221 : 0 : }
1222 : :
1223 : 0 : void SlideshowImpl::paint( const Rectangle& /* rRect */ )
1224 : : {
1225 [ # # ]: 0 : if( mxView.is() ) try
1226 : : {
1227 [ # # ]: 0 : awt::PaintEvent aEvt;
1228 : : // aEvt.UpdateRect = TODO
1229 [ # # ][ # # ]: 0 : mxView->paint( aEvt );
[ # # ]
1230 : : }
1231 : 0 : catch( Exception& )
1232 : : {
1233 : : OSL_FAIL(
1234 : : (OString("sd::SlideshowImpl::paint(), "
1235 : : "exception caught: ") +
1236 : : rtl::OUStringToOString(
1237 : : comphelper::anyToString( cppu::getCaughtException() ),
1238 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1239 : : }
1240 : 0 : }
1241 : :
1242 : : // --------------------------------------------------------------------
1243 : :
1244 : 0 : void SAL_CALL SlideshowImpl::addSlideShowListener( const Reference< XSlideShowListener >& xListener ) throw (RuntimeException)
1245 : : {
1246 [ # # ]: 0 : if( mxListenerProxy.is() )
1247 : 0 : mxListenerProxy->addSlideShowListener( xListener );
1248 : 0 : }
1249 : :
1250 : : // --------------------------------------------------------------------
1251 : :
1252 : 0 : void SAL_CALL SlideshowImpl::removeSlideShowListener( const Reference< XSlideShowListener >& xListener ) throw (RuntimeException)
1253 : : {
1254 [ # # ]: 0 : if( mxListenerProxy.is() )
1255 : 0 : mxListenerProxy->removeSlideShowListener( xListener );
1256 : 0 : }
1257 : :
1258 : : // ---------------------------------------------------------
1259 : :
1260 : 0 : void SlideshowImpl::slideEnded(const bool bReverse)
1261 : : {
1262 [ # # ]: 0 : if (bReverse)
1263 : 0 : gotoPreviousSlide(true);
1264 : : else
1265 : 0 : gotoNextSlide();
1266 : 0 : }
1267 : :
1268 : : // ---------------------------------------------------------
1269 : :
1270 : 0 : void SlideshowImpl::removeShapeEvents()
1271 : : {
1272 [ # # ][ # # ]: 0 : if( mxShow.is() && mxListenerProxy.is() ) try
[ # # ]
1273 : : {
1274 : 0 : WrappedShapeEventImplMap::iterator aIter;
1275 : 0 : const WrappedShapeEventImplMap::iterator aEnd( maShapeEventMap.end() );
1276 : :
1277 [ # # ]: 0 : for( aIter = maShapeEventMap.begin(); aIter != aEnd; ++aIter )
1278 : : {
1279 [ # # ]: 0 : mxListenerProxy->removeShapeEventListener( (*aIter).first );
1280 [ # # ][ # # ]: 0 : mxShow->setShapeCursor( (*aIter).first, awt::SystemPointer::ARROW );
1281 : : }
1282 : :
1283 : 0 : maShapeEventMap.clear();
1284 : : }
1285 : 0 : catch( Exception& )
1286 : : {
1287 : : OSL_FAIL(
1288 : : (OString("sd::SlideshowImpl::removeShapeEvents(), "
1289 : : "exception caught: ") +
1290 : : rtl::OUStringToOString(
1291 : : comphelper::anyToString( cppu::getCaughtException() ),
1292 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1293 : : }
1294 [ # # ]: 0 : }
1295 : :
1296 : : // ---------------------------------------------------------
1297 : :
1298 : 0 : void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber)
1299 : : {
1300 [ # # ]: 0 : if( nSlideNumber >= 0 ) try
1301 : : {
1302 [ # # ]: 0 : Reference< XDrawPagesSupplier > xDrawPages( mxModel, UNO_QUERY_THROW );
1303 [ # # ][ # # ]: 0 : Reference< XIndexAccess > xPages( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
[ # # ]
1304 : :
1305 : 0 : Reference< XShapes > xDrawPage;
1306 [ # # ][ # # ]: 0 : xPages->getByIndex(nSlideNumber) >>= xDrawPage;
[ # # ]
1307 : :
1308 [ # # ]: 0 : if( xDrawPage.is() )
1309 : : {
1310 [ # # ]: 0 : Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY );
1311 [ # # ]: 0 : if( xMasterPageTarget.is() )
1312 : : {
1313 [ # # ][ # # ]: 0 : Reference< XShapes > xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY );
[ # # ]
1314 [ # # ]: 0 : if( xMasterPage.is() )
1315 [ # # ]: 0 : registerShapeEvents( xMasterPage );
1316 : : }
1317 [ # # ]: 0 : registerShapeEvents( xDrawPage );
1318 [ # # ]: 0 : }
1319 : : }
1320 : 0 : catch( Exception& )
1321 : : {
1322 : : OSL_FAIL(
1323 : : (OString("sd::SlideshowImpl::registerShapeEvents(), "
1324 : : "exception caught: ") +
1325 : : rtl::OUStringToOString(
1326 : : comphelper::anyToString( cppu::getCaughtException() ),
1327 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1328 : : }
1329 : 0 : }
1330 : :
1331 : : // ---------------------------------------------------------
1332 : :
1333 : 0 : void SlideshowImpl::registerShapeEvents( Reference< XShapes >& xShapes ) throw( Exception )
1334 : : {
1335 : : try
1336 : : {
1337 [ # # ][ # # ]: 0 : const sal_Int32 nShapeCount = xShapes->getCount();
1338 : : sal_Int32 nShape;
1339 [ # # ]: 0 : for( nShape = 0; nShape < nShapeCount; nShape++ )
1340 : : {
1341 : 0 : Reference< XShape > xShape;
1342 [ # # ][ # # ]: 0 : xShapes->getByIndex( nShape ) >>= xShape;
[ # # ]
1343 : :
1344 [ # # ][ # # ]: 0 : if( xShape.is() && xShape->getShapeType() == "com.sun.star.drawing.GroupShape" )
[ # # ][ # # ]
[ # # # # ]
[ # # ]
1345 : : {
1346 [ # # ]: 0 : Reference< XShapes > xSubShapes( xShape, UNO_QUERY );
1347 [ # # ]: 0 : if( xSubShapes.is() )
1348 [ # # ]: 0 : registerShapeEvents( xSubShapes );
1349 : : }
1350 : :
1351 [ # # ]: 0 : Reference< XPropertySet > xSet( xShape, UNO_QUERY );
1352 [ # # ]: 0 : if( !xSet.is() )
1353 : 0 : continue;
1354 : :
1355 [ # # ][ # # ]: 0 : Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
1356 [ # # ][ # # ]: 0 : if( !xSetInfo.is() || !xSetInfo->hasPropertyByName( msOnClick ) )
[ # # ][ # # ]
[ # # ]
1357 : 0 : continue;
1358 : :
1359 [ # # ][ # # ]: 0 : WrappedShapeEventImplPtr pEvent( new WrappedShapeEventImpl );
1360 [ # # ][ # # ]: 0 : xSet->getPropertyValue( msOnClick ) >>= pEvent->meClickAction;
[ # # ]
1361 : :
1362 [ # # # # : 0 : switch( pEvent->meClickAction )
# ]
1363 : : {
1364 : : case ClickAction_PREVPAGE:
1365 : : case ClickAction_NEXTPAGE:
1366 : : case ClickAction_FIRSTPAGE:
1367 : : case ClickAction_LASTPAGE:
1368 : : case ClickAction_STOPPRESENTATION:
1369 : 0 : break;
1370 : : case ClickAction_BOOKMARK:
1371 [ # # ][ # # ]: 0 : if( xSetInfo->hasPropertyByName( msBookmark ) )
[ # # ]
1372 [ # # ][ # # ]: 0 : xSet->getPropertyValue( msBookmark ) >>= pEvent->maStrBookmark;
1373 [ # # ][ # # ]: 0 : if( getSlideNumberForBookmark( pEvent->maStrBookmark ) == -1 )
1374 : 0 : continue;
1375 : 0 : break;
1376 : : case ClickAction_DOCUMENT:
1377 : : case ClickAction_SOUND:
1378 : : case ClickAction_PROGRAM:
1379 : : case ClickAction_MACRO:
1380 [ # # ][ # # ]: 0 : if( xSetInfo->hasPropertyByName( msBookmark ) )
[ # # ]
1381 [ # # ][ # # ]: 0 : xSet->getPropertyValue( msBookmark ) >>= pEvent->maStrBookmark;
1382 : 0 : break;
1383 : : case ClickAction_VERB:
1384 [ # # ][ # # ]: 0 : if( xSetInfo->hasPropertyByName( msVerb ) )
[ # # ]
1385 [ # # ][ # # ]: 0 : xSet->getPropertyValue( msVerb ) >>= pEvent->mnVerb;
1386 : 0 : break;
1387 : : default:
1388 : 0 : continue; // skip all others
1389 : : }
1390 : :
1391 [ # # ][ # # ]: 0 : maShapeEventMap[ xShape ] = pEvent;
1392 : :
1393 [ # # ]: 0 : if( mxListenerProxy.is() )
1394 [ # # ]: 0 : mxListenerProxy->addShapeEventListener( xShape );
1395 [ # # ][ # # ]: 0 : mxShow->setShapeCursor( xShape, awt::SystemPointer::REFHAND );
[ # # ]
1396 [ # # ][ # # ]: 0 : }
[ # # ][ # # ]
[ # # ]
1397 : : }
1398 : 0 : catch( Exception& )
1399 : : {
1400 : : OSL_FAIL(
1401 : : (OString("sd::SlideshowImpl::registerShapeEvents(), "
1402 : : "exception caught: ") +
1403 : : rtl::OUStringToOString(
1404 : : comphelper::anyToString( cppu::getCaughtException() ),
1405 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1406 : : }
1407 : 0 : }
1408 : :
1409 : : // ---------------------------------------------------------
1410 : :
1411 : 0 : void SlideshowImpl::displayCurrentSlide (const bool bSkipAllMainSequenceEffects)
1412 : : {
1413 : 0 : stopSound();
1414 : 0 : removeShapeEvents();
1415 : :
1416 [ # # ][ # # ]: 0 : if( mpSlideController.get() && mxShow.is() )
[ # # ]
1417 : : {
1418 : : Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(),
1419 [ # # ][ # # ]: 0 : UNO_QUERY_THROW );
1420 [ # # ]: 0 : mpSlideController->displayCurrentSlide( mxShow, xDrawPages, bSkipAllMainSequenceEffects );
1421 [ # # ][ # # ]: 0 : registerShapeEvents(mpSlideController->getCurrentSlideNumber());
1422 [ # # ]: 0 : update();
1423 : :
1424 [ # # ]: 0 : SfxBindings* pBindings = getBindings();
1425 [ # # ]: 0 : if( pBindings )
1426 : : {
1427 [ # # ]: 0 : pBindings->Invalidate( SID_NAVIGATOR_STATE );
1428 [ # # ]: 0 : pBindings->Invalidate( SID_NAVIGATOR_PAGENAME );
1429 : 0 : }
1430 : : }
1431 : 0 : }
1432 : :
1433 : : // ---------------------------------------------------------
1434 : :
1435 : 0 : void SlideshowImpl::endPresentation()
1436 : : {
1437 [ # # ]: 0 : if( !mnEndShowEvent )
1438 [ # # ]: 0 : mnEndShowEvent = Application::PostUserEvent( LINK(this, SlideshowImpl, endPresentationHdl) );
1439 : 0 : }
1440 : :
1441 : : // ---------------------------------------------------------
1442 : :
1443 : 0 : IMPL_LINK_NOARG(SlideshowImpl, endPresentationHdl)
1444 : : {
1445 : 0 : mnEndShowEvent = 0;
1446 : :
1447 [ # # ]: 0 : if( mxPresentation.is() )
1448 : 0 : mxPresentation->end();
1449 : 0 : return 0;
1450 : : }
1451 : :
1452 : : // ---------------------------------------------------------
1453 : :
1454 : 0 : void SAL_CALL SlideshowImpl::pause() throw (RuntimeException)
1455 : : {
1456 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
1457 : :
1458 [ # # ]: 0 : if( !mbIsPaused ) try
1459 : : {
1460 : 0 : mbIsPaused = sal_True;
1461 [ # # ]: 0 : if( mxShow.is() )
1462 : : {
1463 [ # # ][ # # ]: 0 : mxShow->pause(sal_True);
1464 : :
1465 [ # # ]: 0 : if( mxListenerProxy.is() )
1466 [ # # ]: 0 : mxListenerProxy->paused();
1467 : : }
1468 : : }
1469 [ # # ]: 0 : catch( Exception& )
1470 : : {
1471 : : OSL_FAIL(
1472 : : (OString("sd::SlideshowImpl::pause(), "
1473 : : "exception caught: ") +
1474 : : rtl::OUStringToOString(
1475 : : comphelper::anyToString( cppu::getCaughtException() ),
1476 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1477 [ # # ]: 0 : }
1478 [ # # ]: 0 : }
1479 : :
1480 : : // ---------------------------------------------------------
1481 : :
1482 : 0 : void SAL_CALL SlideshowImpl::resume() throw (RuntimeException)
1483 : : {
1484 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
1485 : :
1486 [ # # ]: 0 : if( mbIsPaused ) try
1487 : : {
1488 [ # # ]: 0 : if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
1489 : : {
1490 [ # # ]: 0 : mpShowWindow->RestartShow();
1491 : : }
1492 : : else
1493 : : {
1494 : 0 : mbIsPaused = sal_False;;
1495 [ # # ]: 0 : if( mxShow.is() )
1496 : : {
1497 [ # # ][ # # ]: 0 : mxShow->pause(sal_False);
1498 [ # # ]: 0 : update();
1499 : :
1500 [ # # ]: 0 : if( mxListenerProxy.is() )
1501 [ # # ]: 0 : mxListenerProxy->resumed();
1502 : : }
1503 : : }
1504 : : }
1505 [ # # ]: 0 : catch( Exception& )
1506 : : {
1507 : : OSL_FAIL(
1508 : : (OString("sd::SlideshowImpl::resume(), "
1509 : : "exception caught: ") +
1510 : : rtl::OUStringToOString(
1511 : : comphelper::anyToString( cppu::getCaughtException() ),
1512 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1513 : : }
1514 [ # # ][ # # ]: 0 : RemoteServer::presentationStarted( this );
[ # # ]
1515 [ # # ]: 0 : }
1516 : :
1517 : : // ---------------------------------------------------------
1518 : :
1519 : 0 : sal_Bool SAL_CALL SlideshowImpl::isPaused() throw (RuntimeException)
1520 : : {
1521 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
1522 [ # # ]: 0 : return mbIsPaused;
1523 : : }
1524 : :
1525 : : // ---------------------------------------------------------
1526 : :
1527 : 0 : void SAL_CALL SlideshowImpl::blankScreen( sal_Int32 nColor ) throw (RuntimeException)
1528 : : {
1529 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
1530 : :
1531 [ # # ][ # # ]: 0 : if( mpShowWindow && mpSlideController )
[ # # ]
1532 : : {
1533 [ # # ][ # # ]: 0 : if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), nColor ) )
1534 : : {
1535 [ # # ]: 0 : pause();
1536 : : }
1537 [ # # ]: 0 : }
1538 : 0 : }
1539 : :
1540 : : // ---------------------------------------------------------
1541 : : // XShapeEventListener
1542 : : // ---------------------------------------------------------
1543 : :
1544 : 0 : void SlideshowImpl::click( const Reference< XShape >& xShape, const ::com::sun::star::awt::MouseEvent& /* aOriginalEvent */ )
1545 : : {
1546 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
1547 : :
1548 [ # # ][ # # ]: 0 : WrappedShapeEventImplPtr pEvent = maShapeEventMap[xShape];
1549 [ # # ]: 0 : if( !pEvent.get() )
1550 : 0 : return;
1551 : :
1552 [ # # # # : 0 : switch( pEvent->meClickAction )
# # # # #
# # # ]
1553 : : {
1554 [ # # ]: 0 : case ClickAction_PREVPAGE: gotoPreviousSlide(); break;
1555 [ # # ]: 0 : case ClickAction_NEXTPAGE: gotoNextSlide(); break;
1556 [ # # ]: 0 : case ClickAction_FIRSTPAGE: gotoFirstSlide(); break;
1557 [ # # ]: 0 : case ClickAction_LASTPAGE: gotoLastSlide(); break;
1558 [ # # ]: 0 : case ClickAction_STOPPRESENTATION: endPresentation(); break;
1559 : : case ClickAction_BOOKMARK:
1560 : : {
1561 [ # # ]: 0 : gotoBookmark( pEvent->maStrBookmark );
1562 : : }
1563 : 0 : break;
1564 : : case ClickAction_SOUND:
1565 : : {
1566 : : try
1567 : : {
1568 [ # # ][ # # ]: 0 : mxPlayer.set(avmedia::MediaWindow::createPlayer(pEvent->maStrBookmark), uno::UNO_QUERY_THROW );
[ # # ]
1569 [ # # ][ # # ]: 0 : mxPlayer->start();
1570 : : }
1571 [ # # ]: 0 : catch( uno::Exception& )
1572 : : {
1573 : : OSL_FAIL("sd::SlideshowImpl::click(), exception caught!" );
1574 : : }
1575 : : }
1576 : 0 : break;
1577 : :
1578 : : case ClickAction_DOCUMENT:
1579 : : {
1580 : 0 : OUString aBookmark( pEvent->maStrBookmark );
1581 : :
1582 : 0 : sal_Int32 nPos = aBookmark.indexOf( sal_Unicode('#') );
1583 [ # # ]: 0 : if( nPos >= 0 )
1584 : : {
1585 : 0 : OUString aURL( aBookmark.copy( 0, nPos+1 ) );
1586 : 0 : OUString aName( aBookmark.copy( nPos+1 ) );
1587 [ # # ][ # # ]: 0 : aURL += getUiNameFromPageApiNameImpl( aName );
[ # # ]
1588 : 0 : aBookmark = aURL;
1589 : : }
1590 : :
1591 [ # # ][ # # ]: 0 : mpDocSh->OpenBookmark( aBookmark );
[ # # ]
1592 : : }
1593 : 0 : break;
1594 : :
1595 : : case ClickAction_PROGRAM:
1596 : : {
1597 : : INetURLObject aURL(
1598 : : ::URIHelper::SmartRel2Abs(
1599 : : INetURLObject(mpDocSh->GetMedium()->GetBaseURL()),
1600 : 0 : pEvent->maStrBookmark, ::URIHelper::GetMaybeFileHdl(), true,
1601 : : false, INetURLObject::WAS_ENCODED,
1602 [ # # # # ]: 0 : INetURLObject::DECODE_UNAMBIGUOUS ) );
[ # # ][ # # ]
[ # # ][ # # ]
1603 : :
1604 [ # # ]: 0 : if( INET_PROT_FILE == aURL.GetProtocol() )
1605 : : {
1606 [ # # ][ # # ]: 0 : SfxStringItem aUrl( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
[ # # ][ # # ]
1607 [ # # ]: 0 : SfxBoolItem aBrowsing( SID_BROWSE, sal_True );
1608 : :
1609 [ # # ]: 0 : SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1610 [ # # ]: 0 : if (pViewFrm)
1611 : : pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
1612 : : SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
1613 : : &aUrl,
1614 : : &aBrowsing,
1615 [ # # ][ # # ]: 0 : 0L );
[ # # ]
1616 [ # # ]: 0 : }
1617 : : }
1618 : 0 : break;
1619 : :
1620 : : case presentation::ClickAction_MACRO:
1621 : : {
1622 [ # # ]: 0 : const String aMacro( pEvent->maStrBookmark );
1623 : :
1624 [ # # ][ # # ]: 0 : if ( SfxApplication::IsXScriptURL( aMacro ) )
1625 : : {
1626 : 0 : Any aRet;
1627 [ # # ]: 0 : Sequence< sal_Int16 > aOutArgsIndex;
1628 [ # # ]: 0 : Sequence< Any > aOutArgs;
1629 [ # # ]: 0 : Sequence< Any >* pInArgs = new Sequence< Any >(0);
1630 [ # # ][ # # ]: 0 : mpDocSh->CallXScript( aMacro, *pInArgs, aRet, aOutArgsIndex, aOutArgs);
[ # # ]
1631 : : }
1632 : : else
1633 : : {
1634 : : // aMacro has the following syntax:
1635 : : // "Macroname.Modulname.Libname.Dokumentname" or
1636 : : // "Macroname.Modulname.Libname.Applikationsname"
1637 [ # # ]: 0 : String aMacroName = aMacro.GetToken(0, sal_Unicode('.'));
1638 [ # # ]: 0 : String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
1639 [ # # ]: 0 : String aLibName = aMacro.GetToken(2, sal_Unicode('.'));
1640 [ # # ]: 0 : String aDocName = aMacro.GetToken(3, sal_Unicode('.'));
1641 : :
1642 : : // todo: is the limitation still given that only
1643 : : // Modulname+Macroname can be used here?
1644 [ # # ]: 0 : String aExecMacro(aModulName);
1645 [ # # ]: 0 : aExecMacro.Append( sal_Unicode('.') );
1646 [ # # ]: 0 : aExecMacro.Append( aMacroName );
1647 [ # # ][ # # ]: 0 : mpDocSh->GetBasic()->Call(aExecMacro);
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1648 [ # # ]: 0 : }
1649 : : }
1650 : 0 : break;
1651 : :
1652 : : case ClickAction_VERB:
1653 : : {
1654 : : // todo, better do it async?
1655 : 0 : SdrObject* pObj = GetSdrObjectFromXShape( xShape );
1656 [ # # ][ # # ]: 0 : SdrOle2Obj* pOleObject = PTR_CAST(SdrOle2Obj, pObj);
[ # # ][ # # ]
1657 [ # # ][ # # ]: 0 : if (pOleObject && mpViewShell )
1658 [ # # ]: 0 : mpViewShell->ActivateObject(pOleObject, pEvent->mnVerb);
1659 : : }
1660 : 0 : break;
1661 : : default:
1662 : 0 : break;
1663 [ # # ][ # # ]: 0 : }
[ # # ][ # # ]
1664 : : }
1665 : :
1666 : : // ---------------------------------------------------------
1667 : :
1668 : 0 : sal_Int32 SlideshowImpl::getSlideNumberForBookmark( const OUString& rStrBookmark )
1669 : : {
1670 : : sal_Bool bIsMasterPage;
1671 [ # # ][ # # ]: 0 : OUString aBookmark = getUiNameFromPageApiNameImpl( rStrBookmark );
[ # # ]
1672 [ # # ][ # # ]: 0 : sal_uInt16 nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage );
[ # # ]
1673 : :
1674 [ # # ]: 0 : if( nPgNum == SDRPAGE_NOTFOUND )
1675 : : {
1676 : : // Is the bookmark an object?
1677 [ # # ][ # # ]: 0 : SdrObject* pObj = mpDoc->GetObj( aBookmark );
[ # # ]
1678 : :
1679 [ # # ]: 0 : if( pObj )
1680 : : {
1681 [ # # ][ # # ]: 0 : nPgNum = pObj->GetPage()->GetPageNum();
1682 [ # # ]: 0 : bIsMasterPage = (sal_Bool)pObj->GetPage()->IsMasterPage();
1683 : : }
1684 : : }
1685 : :
1686 [ # # ][ # # ]: 0 : if( (nPgNum == SDRPAGE_NOTFOUND) || bIsMasterPage || static_cast<SdPage*>(mpDoc->GetPage(nPgNum))->GetPageKind() != PK_STANDARD )
[ # # ][ # # ]
[ # # ]
1687 : 0 : return -1;
1688 : :
1689 : 0 : return ( nPgNum - 1) >> 1;
1690 : : }
1691 : :
1692 : : // ---------------------------------------------------------
1693 : :
1694 : 0 : void SlideshowImpl::hyperLinkClicked( rtl::OUString const& aHyperLink ) throw (RuntimeException)
1695 : : {
1696 : 0 : OUString aBookmark( aHyperLink );
1697 : :
1698 : 0 : sal_Int32 nPos = aBookmark.indexOf( sal_Unicode('#') );
1699 [ # # ]: 0 : if( nPos >= 0 )
1700 : : {
1701 : 0 : OUString aURL( aBookmark.copy( 0, nPos+1 ) );
1702 : 0 : OUString aName( aBookmark.copy( nPos+1 ) );
1703 [ # # ][ # # ]: 0 : aURL += getUiNameFromPageApiNameImpl( aName );
[ # # ]
1704 : 0 : aBookmark = aURL;
1705 : : }
1706 : :
1707 [ # # ][ # # ]: 0 : mpDocSh->OpenBookmark( aBookmark );
[ # # ]
1708 : 0 : }
1709 : :
1710 : : // ---------------------------------------------------------
1711 : :
1712 : 0 : void SlideshowImpl::displaySlideNumber( sal_Int32 nSlideNumber )
1713 : : {
1714 [ # # ]: 0 : if( mpSlideController.get() )
1715 : : {
1716 [ # # ]: 0 : if( mpSlideController->jumpToSlideNumber( nSlideNumber ) )
1717 : : {
1718 : 0 : displayCurrentSlide();
1719 : : }
1720 : : }
1721 : 0 : }
1722 : :
1723 : : // ---------------------------------------------------------
1724 : :
1725 : : /** nSlideIndex == -1 displays current slide again */
1726 : 0 : void SlideshowImpl::displaySlideIndex( sal_Int32 nSlideIndex )
1727 : : {
1728 [ # # ]: 0 : if( mpSlideController.get() )
1729 : : {
1730 [ # # ][ # # ]: 0 : if( (nSlideIndex == -1) || mpSlideController->jumpToSlideIndex( nSlideIndex ) )
[ # # ]
1731 : : {
1732 : 0 : displayCurrentSlide();
1733 : : }
1734 : : }
1735 : 0 : }
1736 : :
1737 : : // ---------------------------------------------------------
1738 : :
1739 : 0 : void SlideshowImpl::jumpToBookmark( const String& sBookmark )
1740 : : {
1741 [ # # ]: 0 : sal_Int32 nSlideNumber = getSlideNumberForBookmark( sBookmark );
1742 [ # # ]: 0 : if( nSlideNumber != -1 )
1743 : 0 : displaySlideNumber( nSlideNumber );
1744 : 0 : }
1745 : :
1746 : : // ---------------------------------------------------------
1747 : :
1748 : 0 : sal_Int32 SlideshowImpl::getCurrentSlideNumber()
1749 : : {
1750 [ # # ]: 0 : return mpSlideController.get() ? mpSlideController->getCurrentSlideNumber() : -1;
1751 : : }
1752 : :
1753 : : // ---------------------------------------------------------
1754 : :
1755 : 0 : sal_Int32 SlideshowImpl::getFirstSlideNumber()
1756 : : {
1757 : 0 : sal_Int32 nRet = 0;
1758 [ # # ]: 0 : if( mpSlideController.get() )
1759 : : {
1760 : 0 : sal_Int32 nSlideIndexCount = mpSlideController->getSlideIndexCount() - 1;
1761 [ # # ]: 0 : if( nSlideIndexCount >= 0 )
1762 : : {
1763 : 0 : nRet = mpSlideController->getSlideNumber( nSlideIndexCount );
1764 [ # # ]: 0 : while( nSlideIndexCount-- )
1765 : : {
1766 : 0 : sal_Int32 nTemp = mpSlideController->getSlideNumber( nSlideIndexCount );
1767 [ # # ]: 0 : if( nRet > nTemp )
1768 : 0 : nRet = nTemp;
1769 : : }
1770 : : }
1771 : : }
1772 : :
1773 : 0 : return nRet;
1774 : : }
1775 : :
1776 : : // ---------------------------------------------------------
1777 : :
1778 : 0 : sal_Int32 SlideshowImpl::getLastSlideNumber()
1779 : : {
1780 : 0 : sal_Int32 nRet = 0;
1781 [ # # ]: 0 : if( mpSlideController.get() )
1782 : : {
1783 : 0 : sal_Int32 nSlideIndexCount = mpSlideController->getSlideIndexCount() - 1;
1784 [ # # ]: 0 : if( nSlideIndexCount >= 0 )
1785 : : {
1786 : 0 : nRet = mpSlideController->getSlideNumber( nSlideIndexCount );
1787 [ # # ]: 0 : while( nSlideIndexCount-- )
1788 : : {
1789 : 0 : sal_Int32 nTemp = mpSlideController->getSlideNumber( nSlideIndexCount );
1790 [ # # ]: 0 : if( nRet < nTemp )
1791 : 0 : nRet = nTemp;
1792 : : }
1793 : : }
1794 : : }
1795 : :
1796 : 0 : return nRet;
1797 : : }
1798 : :
1799 : : // ---------------------------------------------------------
1800 : :
1801 : 0 : sal_Bool SAL_CALL SlideshowImpl::isEndless() throw( RuntimeException )
1802 : : {
1803 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
1804 [ # # ]: 0 : return maPresSettings.mbEndless;
1805 : : }
1806 : :
1807 : : // ---------------------------------------------------------
1808 : :
1809 : 0 : double SlideshowImpl::update()
1810 : : {
1811 : 0 : startUpdateTimer();
1812 : 0 : return -1;
1813 : : }
1814 : :
1815 : : // ---------------------------------------------------------
1816 : :
1817 : 0 : void SlideshowImpl::startUpdateTimer()
1818 : : {
1819 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
1820 [ # # ]: 0 : maUpdateTimer.SetTimeout( 0 );
1821 [ # # ][ # # ]: 0 : maUpdateTimer.Start();
1822 : 0 : }
1823 : :
1824 : : // ---------------------------------------------------------
1825 : :
1826 : : /** this timer is called 20ms after a new slide was displayed.
1827 : : This is used to unfreeze user input that was disabled after
1828 : : slide change to skip input that was buffered during slide
1829 : : transition preperation */
1830 : 0 : IMPL_LINK_NOARG(SlideshowImpl, ReadyForNextInputHdl)
1831 : : {
1832 : 0 : mbInputFreeze = false;
1833 : 0 : return 0;
1834 : : }
1835 : :
1836 : : // ---------------------------------------------------------
1837 : :
1838 : : /** if I catch someone someday who calls this method by hand
1839 : : and not by using the timer, I will personaly punish this
1840 : : person seriously, even if this person is me.
1841 : : */
1842 : 0 : IMPL_LINK_NOARG(SlideshowImpl, updateHdl)
1843 : : {
1844 : 0 : mnUpdateEvent = 0;
1845 : :
1846 : 0 : return updateSlideShow();
1847 : : }
1848 : :
1849 : :
1850 : :
1851 : :
1852 : 0 : IMPL_LINK_NOARG(SlideshowImpl, PostYieldListener)
1853 : : {
1854 : : // prevent me from deletion when recursing (App::Reschedule does)
1855 : 0 : const rtl::Reference<SlideshowImpl> this_(this);
1856 : :
1857 [ # # ]: 0 : Application::EnableNoYieldMode(false);
1858 [ # # ][ # # ]: 0 : Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
1859 [ # # ]: 0 : Application::Reschedule(true); // fix for fdo#32861 - process
1860 : : // *all* outstanding events after
1861 : : // yield is done.
1862 [ # # ]: 0 : if (mbDisposed)
1863 : 0 : return 0;
1864 [ # # ]: 0 : return updateSlideShow();
1865 : : }
1866 : :
1867 : :
1868 : :
1869 : :
1870 : 0 : sal_Int32 SlideshowImpl::updateSlideShow (void)
1871 : : {
1872 : : // prevent me from deletion when recursing (App::EnableYieldMode does)
1873 : 0 : const rtl::Reference<SlideshowImpl> this_(this);
1874 : :
1875 : 0 : Reference< XSlideShow > xShow( mxShow );
1876 [ # # ]: 0 : if ( ! xShow.is())
1877 : 0 : return 0;
1878 : :
1879 : : try
1880 : : {
1881 : : // TODO(Q3): Evaluate under various systems and setups,
1882 : : // whether this is really necessary. Under WinXP and Matrox
1883 : : // G550, the frame rates were much more steadier with this
1884 : : // tweak, although.
1885 : :
1886 : : // currently no solution, because this kills sound (at least on Windows)
1887 : :
1888 : 0 : double fUpdate = 0.0;
1889 [ # # ][ # # ]: 0 : if( !xShow->update(fUpdate) )
[ # # ]
1890 : 0 : fUpdate = -1.0;
1891 : :
1892 [ # # ][ # # ]: 0 : if (mxShow.is() && (fUpdate >= 0.0))
[ # # ]
1893 : : {
1894 [ # # ]: 0 : if (::basegfx::fTools::equalZero(fUpdate))
1895 : : {
1896 : : // Use post yield listener for short update intervalls.
1897 [ # # ]: 0 : Application::EnableNoYieldMode(true);
1898 [ # # ][ # # ]: 0 : Application::AddPostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
1899 : : }
1900 : : else
1901 : : {
1902 : : // Avoid busy loop when the previous call to update()
1903 : : // returns a small positive number but not 0 (which is
1904 : : // handled above). Also, make sure that calls to update()
1905 : : // have a minimum frequency.
1906 : : // => Allow up to 60 frames per second. Call at least once
1907 : : // every 4 seconds.
1908 : : const static sal_Int32 mnMaximumFrameCount (60);
1909 : : const static double mnMinimumTimeout (1.0 / mnMaximumFrameCount);
1910 : : const static double mnMaximumTimeout (4.0);
1911 : 0 : fUpdate = ::basegfx::clamp(fUpdate, mnMinimumTimeout, mnMaximumTimeout);
1912 : :
1913 : : // Make sure that the maximum frame count has not been set
1914 : : // too high (only then conversion to milliseconds and long
1915 : : // integer may lead to zero value.)
1916 : : OSL_ASSERT(static_cast<sal_uLong>(fUpdate * 1000.0) > 0);
1917 : :
1918 [ # # ]: 0 : Application::EnableNoYieldMode(false);
1919 [ # # ]: 0 : Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
[ # # # # ]
1920 : :
1921 : : // Use a timer for the asynchronous callback.
1922 [ # # ]: 0 : maUpdateTimer.SetTimeout(static_cast<sal_uLong>(fUpdate * 1000.0));
1923 [ # # ]: 0 : maUpdateTimer.Start();
1924 : : }
1925 : : }
1926 : : }
1927 [ # # ]: 0 : catch( Exception& )
1928 : : {
1929 : : OSL_FAIL(
1930 : : (OString("sd::SlideshowImpl::updateSlideShow(), exception caught: ")
1931 : : + rtl::OUStringToOString(
1932 : : comphelper::anyToString( cppu::getCaughtException() ),
1933 : : RTL_TEXTENCODING_UTF8 )).getStr() );
1934 : : }
1935 : 0 : return 0;
1936 : : }
1937 : :
1938 : : // ---------------------------------------------------------
1939 : :
1940 : 0 : bool SlideshowImpl::keyInput(const KeyEvent& rKEvt)
1941 : : {
1942 [ # # ][ # # ]: 0 : if( !mxShow.is() || mbInputFreeze )
[ # # ]
1943 : 0 : return false;
1944 : :
1945 : 0 : bool bRet = true;
1946 : :
1947 : : try
1948 : : {
1949 : 0 : const int nKeyCode = rKEvt.GetKeyCode().GetCode();
1950 [ # # # # : 0 : switch( nKeyCode )
# # # # #
# # # ]
1951 : : {
1952 : : case awt::Key::CONTEXTMENU:
1953 [ # # ]: 0 : if( !mnContextMenuEvent )
1954 : : {
1955 [ # # ]: 0 : if( mpShowWindow )
1956 [ # # ]: 0 : maPopupMousePos = mpShowWindow->GetPointerState().maPos;
1957 [ # # ][ # # ]: 0 : mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
[ # # ]
1958 : : }
1959 : 0 : break;
1960 : :
1961 : : // cancel show
1962 : : case KEY_ESCAPE:
1963 : : case KEY_SUBTRACT:
1964 : : // in case the user cancels the presentation, switch to current slide
1965 : : // in edit mode
1966 [ # # ][ # # ]: 0 : if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
[ # # ]
1967 : : {
1968 [ # # ][ # # ]: 0 : if( mpSlideController->getCurrentSlideNumber() != -1 )
1969 [ # # ]: 0 : mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
1970 : : }
1971 [ # # ]: 0 : endPresentation();
1972 : 0 : break;
1973 : :
1974 : : // advance show
1975 : : case KEY_PAGEDOWN:
1976 [ # # ]: 0 : if(rKEvt.GetKeyCode().IsMod2())
1977 : : {
1978 [ # # ]: 0 : gotoNextSlide();
1979 : 0 : break;
1980 : : }
1981 : : // warning, fall through!
1982 : : case KEY_SPACE:
1983 : : case KEY_RIGHT:
1984 : : case KEY_DOWN:
1985 : : case KEY_N:
1986 [ # # ]: 0 : gotoNextEffect();
1987 : 0 : break;
1988 : :
1989 : : case KEY_RETURN:
1990 : : {
1991 [ # # ]: 0 : if( maCharBuffer.Len() )
1992 : : {
1993 [ # # ]: 0 : if( mpSlideController.get() )
1994 : : {
1995 [ # # ][ # # ]: 0 : if( mpSlideController->jumpToSlideNumber( maCharBuffer.ToInt32() - 1 ) )
[ # # ]
1996 [ # # ]: 0 : displayCurrentSlide();
1997 : : }
1998 [ # # ]: 0 : maCharBuffer.Erase();
1999 : : }
2000 : : else
2001 : : {
2002 [ # # ]: 0 : gotoNextEffect();
2003 : : }
2004 : : }
2005 : 0 : break;
2006 : :
2007 : : // numeric: add to buffer
2008 : : case KEY_0:
2009 : : case KEY_1:
2010 : : case KEY_2:
2011 : : case KEY_3:
2012 : : case KEY_4:
2013 : : case KEY_5:
2014 : : case KEY_6:
2015 : : case KEY_7:
2016 : : case KEY_8:
2017 : : case KEY_9:
2018 [ # # ]: 0 : maCharBuffer.Append( rKEvt.GetCharCode() );
2019 : 0 : break;
2020 : :
2021 : : case KEY_PAGEUP:
2022 [ # # ]: 0 : if(rKEvt.GetKeyCode().IsMod2())
2023 : : {
2024 [ # # ]: 0 : gotoPreviousSlide();
2025 : 0 : break;
2026 : : }
2027 : : // warning, fall through!
2028 : : case KEY_LEFT:
2029 : : case KEY_UP:
2030 : : case KEY_P:
2031 : : case KEY_BACKSPACE:
2032 [ # # ]: 0 : gotoPreviousEffect();
2033 : 0 : break;
2034 : :
2035 : : case KEY_HOME:
2036 [ # # ]: 0 : gotoFirstSlide();
2037 : 0 : break;
2038 : :
2039 : : case KEY_END:
2040 [ # # ]: 0 : gotoLastSlide();
2041 : 0 : break;
2042 : :
2043 : : case KEY_B:
2044 : : case KEY_W:
2045 : : case KEY_POINT:
2046 : : case KEY_COMMA:
2047 : : {
2048 [ # # ][ # # ]: 0 : blankScreen( ((nKeyCode == KEY_W ) || (nKeyCode == KEY_COMMA)) ? 0x00ffffff : 0x00000000 );
[ # # ]
2049 : : }
2050 : 0 : break;
2051 : :
2052 : : default:
2053 : 0 : bRet = false;
2054 : 0 : break;
2055 : : }
2056 : : }
2057 : 0 : catch( Exception& )
2058 : : {
2059 : 0 : bRet = false;
2060 : : OSL_FAIL(
2061 : : (OString("sd::SlideshowImpl::keyInput(), "
2062 : : "exception caught: ") +
2063 : : rtl::OUStringToOString(
2064 : : comphelper::anyToString( cppu::getCaughtException() ),
2065 : : RTL_TEXTENCODING_UTF8 )).getStr() );
2066 : : }
2067 : :
2068 : 0 : return bRet;
2069 : : }
2070 : :
2071 : 0 : IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent*, pEvent )
2072 : : {
2073 [ # # ][ # # ]: 0 : if( !mxShow.is() || mbInputFreeze )
[ # # ]
2074 : 0 : return 0;
2075 : :
2076 [ # # ][ # # ]: 0 : if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
[ # # ][ # # ]
2077 : : {
2078 : 0 : const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData();
2079 : :
2080 [ # # ]: 0 : if( rEvent.GetCommand() == COMMAND_MEDIA )
2081 : : {
2082 [ # # # # : 0 : switch( rEvent.GetMediaCommand() )
# # # #
# ]
2083 : : {
2084 : : #if defined( QUARTZ )
2085 : : case MEDIA_COMMAND_MENU:
2086 : : if( !mnContextMenuEvent )
2087 : : {
2088 : : if( mpShowWindow )
2089 : : maPopupMousePos = mpShowWindow->GetPointerState().maPos;
2090 : : mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
2091 : : }
2092 : : break;
2093 : : case MEDIA_COMMAND_VOLUME_DOWN:
2094 : : gotoPreviousSlide();
2095 : : break;
2096 : : case MEDIA_COMMAND_VOLUME_UP:
2097 : : gotoNextEffect();
2098 : : break;
2099 : : #endif
2100 : : case MEDIA_COMMAND_NEXTTRACK:
2101 : 0 : gotoNextEffect();
2102 : 0 : break;
2103 : : case MEDIA_COMMAND_PAUSE:
2104 [ # # ]: 0 : if( !mbIsPaused )
2105 : 0 : blankScreen(0);
2106 : 0 : break;
2107 : : case MEDIA_COMMAND_PLAY:
2108 [ # # ]: 0 : if( mbIsPaused )
2109 : 0 : resume();
2110 : 0 : break;
2111 : :
2112 : : case MEDIA_COMMAND_PLAY_PAUSE:
2113 [ # # ]: 0 : if( mbIsPaused )
2114 : 0 : resume();
2115 : : else
2116 : 0 : blankScreen(0);
2117 : 0 : break;
2118 : : case MEDIA_COMMAND_PREVIOUSTRACK:
2119 : 0 : gotoPreviousSlide();
2120 : 0 : break;
2121 : : case MEDIA_COMMAND_NEXTTRACK_HOLD:
2122 : 0 : gotoLastSlide();
2123 : 0 : break;
2124 : :
2125 : : case MEDIA_COMMAND_REWIND:
2126 : 0 : gotoFirstSlide();
2127 : 0 : break;
2128 : : case MEDIA_COMMAND_STOP:
2129 : : // in case the user cancels the presentation, switch to current slide
2130 : : // in edit mode
2131 [ # # ][ # # ]: 0 : if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
[ # # ]
2132 : : {
2133 [ # # ]: 0 : if( mpSlideController->getCurrentSlideNumber() != -1 )
2134 : 0 : mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
2135 : : }
2136 : 0 : endPresentation();
2137 : 0 : break;
2138 : : }
2139 : : }
2140 : : }
2141 : :
2142 : 0 : return 0;
2143 : : }
2144 : :
2145 : : // ---------------------------------------------------------
2146 : :
2147 : 0 : void SlideshowImpl::mouseButtonUp(const MouseEvent& rMEvt)
2148 : : {
2149 [ # # ][ # # ]: 0 : if( rMEvt.IsRight() && !mnContextMenuEvent )
[ # # ]
2150 : : {
2151 : 0 : maPopupMousePos = rMEvt.GetPosPixel();
2152 [ # # ]: 0 : mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
2153 : : }
2154 : 0 : }
2155 : :
2156 : : // ---------------------------------------------------------
2157 : :
2158 : 0 : IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl)
2159 : : {
2160 : 0 : mnContextMenuEvent = 0;
2161 : :
2162 [ # # ]: 0 : if( mpSlideController.get() == 0 )
2163 : 0 : return 0;
2164 : :
2165 : 0 : mbWasPaused = mbIsPaused;
2166 [ # # ]: 0 : if( !mbWasPaused )
2167 : 0 : pause();
2168 : :
2169 [ # # ][ # # ]: 0 : PopupMenu* pMenu = new PopupMenu( SdResId( RID_SLIDESHOW_CONTEXTMENU ) );
2170 : :
2171 : : // Adding button to display if in Pen mode
2172 : 0 : pMenu->CheckItem( CM_PEN_MODE, mbUsePen);
2173 : :
2174 : 0 : const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
2175 : 0 : pMenu->EnableItem( CM_NEXT_SLIDE, ( mpSlideController->getNextSlideIndex() != -1 ) );
2176 [ # # ][ # # ]: 0 : pMenu->EnableItem( CM_PREV_SLIDE, ( mpSlideController->getPreviousSlideIndex() != -1 ) || (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) );
[ # # ][ # # ]
2177 : :
2178 : 0 : PopupMenu* pPageMenu = pMenu->GetPopupMenu( CM_GOTO );
2179 : :
2180 : 0 : SfxViewFrame* pViewFrame = getViewFrame();
2181 [ # # ]: 0 : if( pViewFrame )
2182 : : {
2183 [ # # ][ # # ]: 0 : Reference< ::com::sun::star::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() );
2184 [ # # ]: 0 : if( xFrame.is() )
2185 : : {
2186 [ # # ][ # # ]: 0 : pMenu->SetItemImage( CM_NEXT_SLIDE, GetImage( xFrame, "slot:10617" , sal_False ) );
[ # # ]
2187 [ # # ][ # # ]: 0 : pMenu->SetItemImage( CM_PREV_SLIDE, GetImage( xFrame, "slot:10618" , sal_False ) );
[ # # ]
2188 : :
2189 [ # # ]: 0 : if( pPageMenu )
2190 : : {
2191 [ # # ][ # # ]: 0 : pPageMenu->SetItemImage( CM_FIRST_SLIDE, GetImage( xFrame, "slot:10616" , sal_False ) );
[ # # ]
2192 [ # # ][ # # ]: 0 : pPageMenu->SetItemImage( CM_LAST_SLIDE, GetImage( xFrame, "slot:10619" , sal_False ) );
[ # # ]
2193 : : }
2194 : 0 : }
2195 : : }
2196 : :
2197 : : // populate slide goto list
2198 [ # # ]: 0 : if( pPageMenu )
2199 : : {
2200 : 0 : const sal_Int32 nPageNumberCount = mpSlideController->getSlideNumberCount();
2201 [ # # ]: 0 : if( nPageNumberCount <= 1 )
2202 : : {
2203 : 0 : pMenu->EnableItem( CM_GOTO, sal_False );
2204 : : }
2205 : : else
2206 : : {
2207 : 0 : sal_Int32 nCurrentSlideNumber = mpSlideController->getCurrentSlideNumber();
2208 [ # # ][ # # ]: 0 : if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
[ # # ]
2209 : 0 : nCurrentSlideNumber = -1;
2210 : :
2211 : 0 : pPageMenu->EnableItem( CM_FIRST_SLIDE, ( mpSlideController->getSlideNumber(0) != nCurrentSlideNumber ) );
2212 : 0 : pPageMenu->EnableItem( CM_LAST_SLIDE, ( mpSlideController->getSlideNumber( mpSlideController->getSlideIndexCount() - 1) != nCurrentSlideNumber ) );
2213 : :
2214 : : sal_Int32 nPageNumber;
2215 : :
2216 [ # # ]: 0 : for( nPageNumber = 0; nPageNumber < nPageNumberCount; nPageNumber++ )
2217 : : {
2218 [ # # ]: 0 : if( mpSlideController->isVisibleSlideNumber( nPageNumber ) )
2219 : : {
2220 : 0 : SdPage* pPage = mpDoc->GetSdPage((sal_uInt16)nPageNumber, PK_STANDARD);
2221 [ # # ]: 0 : if (pPage)
2222 : : {
2223 : 0 : pPageMenu->InsertItem( (sal_uInt16)(CM_SLIDES + nPageNumber), pPage->GetName() );
2224 [ # # ]: 0 : if( nPageNumber == nCurrentSlideNumber )
2225 : 0 : pPageMenu->CheckItem( (sal_uInt16)(CM_SLIDES + nPageNumber) );
2226 : : }
2227 : : }
2228 : : }
2229 : : }
2230 : : }
2231 : :
2232 [ # # ]: 0 : if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
2233 : : {
2234 : 0 : PopupMenu* pBlankMenu = pMenu->GetPopupMenu( CM_SCREEN );
2235 [ # # ]: 0 : if( pBlankMenu )
2236 : : {
2237 [ # # ][ # # ]: 0 : pBlankMenu->CheckItem( ( mpShowWindow->GetBlankColor() == Color( COL_WHITE ) ) ? CM_SCREEN_WHITE : CM_SCREEN_BLACK );
[ # # ]
2238 : : }
2239 : : }
2240 : :
2241 : 0 : PopupMenu* pWidthMenu = pMenu->GetPopupMenu( CM_WIDTH_PEN);
2242 : :
2243 : : // populate color width list
2244 [ # # ]: 0 : if( pWidthMenu )
2245 : : {
2246 : : sal_Int32 nIterator;
2247 : : double nWidth;
2248 : :
2249 : 0 : nWidth = 4.0;
2250 [ # # ]: 0 : for( nIterator = 1; nIterator < 6; nIterator++)
2251 : : {
2252 [ # # # # : 0 : switch(nIterator)
# # ]
2253 : : {
2254 : : case 1:
2255 : 0 : nWidth = 4.0;
2256 : 0 : break;
2257 : : case 2:
2258 : 0 : nWidth = 100.0;
2259 : 0 : break;
2260 : : case 3:
2261 : 0 : nWidth = 150.0;
2262 : 0 : break;
2263 : : case 4:
2264 : 0 : nWidth = 200.0;
2265 : 0 : break;
2266 : : case 5:
2267 : 0 : nWidth = 400.0;
2268 : 0 : break;
2269 : : default:
2270 : 0 : break;
2271 : : }
2272 : :
2273 : 0 : pWidthMenu->EnableItem( (sal_uInt16)(CM_WIDTH_PEN + nIterator), sal_True);
2274 [ # # ]: 0 : if( nWidth == mdUserPaintStrokeWidth)
2275 : 0 : pWidthMenu->CheckItem( (sal_uInt16)(CM_WIDTH_PEN + nIterator) );
2276 : : }
2277 : : }
2278 : :
2279 : 0 : pMenu->SetSelectHdl( LINK( this, SlideshowImpl, ContextMenuSelectHdl ) );
2280 : 0 : pMenu->Execute( mpShowWindow, maPopupMousePos );
2281 [ # # ]: 0 : delete pMenu;
2282 : :
2283 [ # # ]: 0 : if( mxView.is() )
2284 : 0 : mxView->ignoreNextMouseReleased();
2285 : :
2286 [ # # ]: 0 : if( !mbWasPaused )
2287 : 0 : resume();
2288 : 0 : return 0;
2289 : : }
2290 : :
2291 : : // ---------------------------------------------------------
2292 : :
2293 : 0 : IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu )
2294 : : {
2295 [ # # ]: 0 : if( pMenu )
2296 : : {
2297 : 0 : sal_uInt16 nMenuId = pMenu->GetCurItemId();
2298 : :
2299 [ # # # # : 0 : switch( nMenuId )
# # # # #
# # # # #
# ]
2300 : : {
2301 : : case CM_PREV_SLIDE:
2302 : 0 : gotoPreviousSlide();
2303 : 0 : mbWasPaused = false;
2304 : 0 : break;
2305 : : case CM_NEXT_SLIDE:
2306 : 0 : gotoNextSlide();
2307 : 0 : mbWasPaused = false;
2308 : 0 : break;
2309 : : case CM_FIRST_SLIDE:
2310 : 0 : gotoFirstSlide();
2311 : 0 : mbWasPaused = false;
2312 : 0 : break;
2313 : : case CM_LAST_SLIDE:
2314 : 0 : gotoLastSlide();
2315 : 0 : mbWasPaused = false;
2316 : 0 : break;
2317 : : case CM_SCREEN_BLACK:
2318 : : case CM_SCREEN_WHITE:
2319 : : {
2320 [ # # ]: 0 : const Color aBlankColor( (nMenuId == CM_SCREEN_WHITE) ? COL_WHITE : COL_BLACK );
2321 [ # # ]: 0 : if( mbWasPaused )
2322 : : {
2323 [ # # ]: 0 : if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
2324 : : {
2325 [ # # ][ # # ]: 0 : if( mpShowWindow->GetBlankColor() == aBlankColor )
2326 : : {
2327 : 0 : mbWasPaused = false;
2328 [ # # ]: 0 : mpShowWindow->RestartShow();
2329 : : break;
2330 : : }
2331 : : }
2332 [ # # ]: 0 : mpShowWindow->RestartShow();
2333 : : }
2334 [ # # ][ # # ]: 0 : if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), aBlankColor ) )
2335 : : {
2336 [ # # ]: 0 : pause();
2337 : 0 : mbWasPaused = true;
2338 : : }
2339 : : }
2340 : 0 : break;
2341 : : case CM_COLOR_PEN:
2342 : : {
2343 : : //Open a color picker based on SvColorDialog
2344 : 0 : ::Color aColor( mnUserPaintColor );
2345 [ # # ]: 0 : SvColorDialog aColorDlg( mpShowWindow);
2346 [ # # ]: 0 : aColorDlg.SetColor( aColor );
2347 : :
2348 [ # # ][ # # ]: 0 : if (aColorDlg.Execute() )
2349 : : {
2350 [ # # ]: 0 : aColor = aColorDlg.GetColor();
2351 [ # # ]: 0 : setPenColor(aColor.GetColor());
2352 : : }
2353 [ # # ]: 0 : mbWasPaused = false;
2354 : : }
2355 : 0 : break;
2356 : :
2357 : : case CM_WIDTH_PEN_VERY_THIN:
2358 : : {
2359 : 0 : setPenWidth(4.0);
2360 : 0 : mbWasPaused = false;
2361 : : }
2362 : 0 : break;
2363 : :
2364 : : case CM_WIDTH_PEN_THIN:
2365 : : {
2366 : 0 : setPenWidth(100.0);
2367 : 0 : mbWasPaused = false;
2368 : : }
2369 : 0 : break;
2370 : :
2371 : : case CM_WIDTH_PEN_NORMAL:
2372 : : {
2373 : 0 : setPenWidth(150.0);
2374 : 0 : mbWasPaused = false;
2375 : : }
2376 : 0 : break;
2377 : :
2378 : : case CM_WIDTH_PEN_THICK:
2379 : : {
2380 : 0 : setPenWidth(200.0);
2381 : 0 : mbWasPaused = false;
2382 : : }
2383 : 0 : break;
2384 : :
2385 : : case CM_WIDTH_PEN_VERY_THICK:
2386 : : {
2387 : 0 : setPenWidth(400.0);
2388 : 0 : mbWasPaused = false;
2389 : : }
2390 : 0 : break;
2391 : : case CM_ERASE_ALLINK:
2392 : : {
2393 : 0 : setEraseAllInk(true);
2394 : 0 : mbWasPaused = false;
2395 : : }
2396 : 0 : break;
2397 : : case CM_PEN_MODE:
2398 : : {
2399 : 0 : setUsePen(!mbUsePen);
2400 : 0 : mbWasPaused = false;
2401 : : }
2402 : 0 : break;
2403 : : case CM_ENDSHOW:
2404 : : // in case the user cancels the presentation, switch to current slide
2405 : : // in edit mode
2406 [ # # ][ # # ]: 0 : if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
[ # # ]
2407 : : {
2408 [ # # ]: 0 : if( mpSlideController->getCurrentSlideNumber() != -1 )
2409 : : {
2410 : 0 : mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
2411 : : }
2412 : : }
2413 : 0 : endPresentation();
2414 : 0 : break;
2415 : : default:
2416 : 0 : sal_Int32 nPageNumber = nMenuId - CM_SLIDES;
2417 : 0 : const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
2418 [ # # ][ # # ]: 0 : if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
[ # # ]
2419 : : {
2420 : 0 : mpShowWindow->RestartShow( nPageNumber );
2421 : : }
2422 [ # # ]: 0 : else if( nPageNumber != mpSlideController->getCurrentSlideNumber() )
2423 : : {
2424 : 0 : displaySlideNumber( nPageNumber );
2425 : : }
2426 : 0 : mbWasPaused = false;
2427 : 0 : break;
2428 : : }
2429 : : }
2430 : :
2431 : 0 : return 0;
2432 : : }
2433 : :
2434 : : // ---------------------------------------------------------
2435 : :
2436 : 0 : Reference< XSlideShow > SlideshowImpl::createSlideShow() const
2437 : : {
2438 : 0 : Reference< XSlideShow > xShow;
2439 : :
2440 : : try
2441 : : {
2442 : : Reference< lang::XMultiServiceFactory > xFactory(
2443 : : ::comphelper::getProcessServiceFactory(),
2444 [ # # ][ # # ]: 0 : UNO_QUERY_THROW );
2445 : :
2446 [ # # ][ # # ]: 0 : Reference< XInterface > xInt( xFactory->createInstance( "com.sun.star.presentation.SlideShow" ) );
2447 : :
2448 [ # # ][ # # ]: 0 : xShow.set( xInt, UNO_QUERY_THROW );
2449 : : }
2450 [ # # ]: 0 : catch( uno::Exception& )
2451 : : {
2452 : : OSL_FAIL(
2453 : : (OString("sd::SlideshowImpl::createSlideShow(), "
2454 : : "exception caught: ") +
2455 : : rtl::OUStringToOString(
2456 : : comphelper::anyToString( cppu::getCaughtException() ),
2457 : : RTL_TEXTENCODING_UTF8 )).getStr() );
2458 : : }
2459 : :
2460 : 0 : return xShow;
2461 : : }
2462 : :
2463 : : // ---------------------------------------------------------
2464 : :
2465 : 0 : void SlideshowImpl::createSlideList( bool bAll, bool bStartWithActualSlide, const String& rPresSlide )
2466 : : {
2467 : 0 : const long nSlideCount = mpDoc->GetSdPageCount( PK_STANDARD );
2468 : :
2469 [ # # ]: 0 : if( nSlideCount )
2470 : : {
2471 : : SdCustomShow* pCustomShow;
2472 : :
2473 [ # # ][ # # ]: 0 : if( !bStartWithActualSlide && mpDoc->GetCustomShowList() && maPresSettings.mbCustomShow )
[ # # ][ # # ]
[ # # ]
2474 [ # # ][ # # ]: 0 : pCustomShow = mpDoc->GetCustomShowList()->GetCurObject();
2475 : : else
2476 : 0 : pCustomShow = NULL;
2477 : :
2478 : : // create animation slide controller
2479 : : AnimationSlideController::Mode eMode =
2480 [ # # ]: 0 : ( pCustomShow && pCustomShow->PagesVector().size() ) ? AnimationSlideController::CUSTOM :
2481 [ # # # # ]: 0 : (bAll ? AnimationSlideController::ALL : AnimationSlideController::FROM);
[ # # ]
2482 : :
2483 [ # # ][ # # ]: 0 : Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW );
2484 [ # # ][ # # ]: 0 : Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
[ # # ]
2485 [ # # ][ # # ]: 0 : mpSlideController.reset( new AnimationSlideController( xSlides, eMode ) );
[ # # ]
2486 : :
2487 [ # # ]: 0 : if( eMode != AnimationSlideController::CUSTOM )
2488 : : {
2489 : 0 : sal_Int32 nFirstSlide = 0;
2490 : :
2491 : : // normale Praesentation
2492 [ # # ]: 0 : if( eMode == AnimationSlideController::FROM )
2493 : : {
2494 [ # # ]: 0 : if( rPresSlide.Len() )
2495 : : {
2496 : : sal_Int32 nSlide;
2497 : 0 : sal_Bool bTakeNextAvailable = sal_False;
2498 : :
2499 [ # # ][ # # ]: 0 : for( nSlide = 0, nFirstSlide = -1; ( nSlide < nSlideCount ) && ( -1 == nFirstSlide ); nSlide++ )
[ # # ]
2500 : : {
2501 [ # # ]: 0 : SdPage* pTestSlide = mpDoc->GetSdPage( (sal_uInt16)nSlide, PK_STANDARD );
2502 : :
2503 [ # # ][ # # ]: 0 : if( pTestSlide->GetName() == rPresSlide )
[ # # ]
2504 : : {
2505 [ # # ]: 0 : if( pTestSlide->IsExcluded() )
2506 : 0 : bTakeNextAvailable = sal_True;
2507 : : else
2508 : 0 : nFirstSlide = nSlide;
2509 : : }
2510 [ # # ][ # # ]: 0 : else if( bTakeNextAvailable && !pTestSlide->IsExcluded() )
[ # # ]
2511 : 0 : nFirstSlide = nSlide;
2512 : : }
2513 : :
2514 [ # # ]: 0 : if( -1 == nFirstSlide )
2515 : 0 : nFirstSlide = 0;
2516 : : }
2517 : : }
2518 : :
2519 [ # # ]: 0 : for( sal_Int32 i = 0; i < nSlideCount; i++ )
2520 : : {
2521 [ # # ]: 0 : bool bVisible = ( mpDoc->GetSdPage( (sal_uInt16)i, PK_STANDARD ) )->IsExcluded() ? false : true;
2522 [ # # ][ # # ]: 0 : if( bVisible || (eMode == AnimationSlideController::ALL) )
2523 [ # # ]: 0 : mpSlideController->insertSlideNumber( i, bVisible );
2524 : : }
2525 : :
2526 : 0 : mpSlideController->setStartSlideNumber( nFirstSlide );
2527 : : }
2528 : : else
2529 : : {
2530 [ # # ][ # # ]: 0 : if( meAnimationMode != ANIMATIONMODE_SHOW && rPresSlide.Len() )
[ # # ]
2531 : : {
2532 : : sal_Int32 nSlide;
2533 [ # # ]: 0 : for( nSlide = 0; nSlide < nSlideCount; nSlide++ )
2534 [ # # ][ # # ]: 0 : if( rPresSlide == mpDoc->GetSdPage( (sal_uInt16) nSlide, PK_STANDARD )->GetName() )
[ # # ][ # # ]
2535 : 0 : break;
2536 : :
2537 [ # # ]: 0 : if( nSlide < nSlideCount )
2538 [ # # ]: 0 : mpSlideController->insertSlideNumber( (sal_uInt16) nSlide );
2539 : : }
2540 : :
2541 : 0 : sal_Int32 nSlideIndex = 0;
2542 [ # # ][ # # ]: 0 : for( SdCustomShow::PageVec::iterator it = pCustomShow->PagesVector().begin();
[ # # ]
2543 [ # # ]: 0 : it != pCustomShow->PagesVector().end(); ++it, nSlideIndex++ )
2544 : : {
2545 [ # # ]: 0 : const sal_uInt16 nSdSlide = ( ( (SdPage*) (*it) )->GetPageNum() - 1 ) / 2;
2546 : :
2547 [ # # ][ # # ]: 0 : if( !( mpDoc->GetSdPage( nSdSlide, PK_STANDARD ) )->IsExcluded())
2548 [ # # ]: 0 : mpSlideController->insertSlideNumber( nSdSlide );
2549 : : }
2550 : 0 : }
2551 : : }
2552 : 0 : }
2553 : :
2554 : : // ---------------------------------------------------------
2555 : :
2556 : : typedef sal_uInt16 (*FncGetChildWindowId)();
2557 : :
2558 : : FncGetChildWindowId aShowChildren[] =
2559 : : {
2560 : : &AnimationChildWindow::GetChildWindowId,
2561 : : &Svx3DChildWindow::GetChildWindowId,
2562 : : &SvxFontWorkChildWindow::GetChildWindowId,
2563 : : &SvxColorChildWindow::GetChildWindowId,
2564 : : &SvxSearchDialogWrapper::GetChildWindowId,
2565 : : &SvxBmpMaskChildWindow::GetChildWindowId,
2566 : : &SvxIMapDlgChildWindow::GetChildWindowId,
2567 : : &SvxHlinkDlgWrapper::GetChildWindowId,
2568 : : &SfxTemplateDialogWrapper::GetChildWindowId,
2569 : : &GalleryChildWindow::GetChildWindowId
2570 : : };
2571 : :
2572 : : #define NAVIGATOR_CHILD_MASK 0x80000000UL
2573 : :
2574 : 0 : void SlideshowImpl::hideChildWindows()
2575 : : {
2576 : 0 : mnChildMask = 0UL;
2577 : :
2578 [ # # ]: 0 : if( ANIMATIONMODE_SHOW == meAnimationMode )
2579 : : {
2580 : 0 : SfxViewFrame* pViewFrame = getViewFrame();
2581 : :
2582 [ # # ]: 0 : if( pViewFrame )
2583 : : {
2584 [ # # ]: 0 : if( pViewFrame->GetChildWindow( SID_NAVIGATOR ) != NULL )
2585 : 0 : mnChildMask |= NAVIGATOR_CHILD_MASK;
2586 : :
2587 [ # # ]: 0 : for( sal_uLong i = 0, nCount = sizeof( aShowChildren ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
2588 : : {
2589 : 0 : const sal_uInt16 nId = ( *aShowChildren[ i ] )();
2590 : :
2591 [ # # ]: 0 : if( pViewFrame->GetChildWindow( nId ) )
2592 : : {
2593 : 0 : pViewFrame->SetChildWindow( nId, sal_False );
2594 : 0 : mnChildMask |= 1 << i;
2595 : : }
2596 : : }
2597 : : }
2598 : : }
2599 : 0 : }
2600 : :
2601 : : // ---------------------------------------------------------
2602 : :
2603 : 0 : void SlideshowImpl::showChildWindows()
2604 : : {
2605 [ # # ]: 0 : if( ANIMATIONMODE_SHOW == meAnimationMode )
2606 : : {
2607 : 0 : SfxViewFrame* pViewFrame = getViewFrame();
2608 [ # # ]: 0 : if( pViewFrame )
2609 : : {
2610 : 0 : pViewFrame->SetChildWindow( SID_NAVIGATOR, ( mnChildMask & NAVIGATOR_CHILD_MASK ) != 0 );
2611 : :
2612 [ # # ]: 0 : for( sal_uLong i = 0, nCount = sizeof( aShowChildren ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
2613 : : {
2614 [ # # ]: 0 : if( mnChildMask & ( 1 << i ) )
2615 : 0 : pViewFrame->SetChildWindow( ( *aShowChildren[ i ] )(), sal_True );
2616 : : }
2617 : : }
2618 : : }
2619 : 0 : }
2620 : :
2621 : : // ---------------------------------------------------------
2622 : :
2623 : 0 : SfxViewFrame* SlideshowImpl::getViewFrame() const
2624 : : {
2625 [ # # ]: 0 : return mpViewShell ? mpViewShell->GetViewFrame() : 0;
2626 : : }
2627 : :
2628 : : // ---------------------------------------------------------
2629 : :
2630 : 0 : SfxDispatcher* SlideshowImpl::getDispatcher() const
2631 : : {
2632 [ # # ][ # # ]: 0 : return (mpViewShell && mpViewShell->GetViewFrame()) ? mpViewShell->GetViewFrame()->GetDispatcher() : 0;
2633 : : }
2634 : :
2635 : : // ---------------------------------------------------------
2636 : :
2637 : 0 : SfxBindings* SlideshowImpl::getBindings() const
2638 : : {
2639 [ # # ][ # # ]: 0 : return (mpViewShell && mpViewShell->GetViewFrame()) ? &mpViewShell->GetViewFrame()->GetBindings() : 0;
2640 : : }
2641 : :
2642 : : // ---------------------------------------------------------
2643 : :
2644 : 0 : void SlideshowImpl::resize( const Size& rSize )
2645 : : {
2646 : 0 : maPresSize = rSize;
2647 : :
2648 [ # # ][ # # ]: 0 : if( mpShowWindow && (ANIMATIONMODE_VIEW != meAnimationMode) )
2649 : : {
2650 : 0 : mpShowWindow->SetSizePixel( maPresSize );
2651 : 0 : mpShowWindow->Show();
2652 : : }
2653 : :
2654 [ # # ]: 0 : if( mxView.is() ) try
2655 : : {
2656 [ # # ]: 0 : awt::WindowEvent aEvt;
2657 [ # # ][ # # ]: 0 : mxView->windowResized(aEvt);
[ # # ]
2658 : : }
2659 : 0 : catch( Exception& )
2660 : : {
2661 : : OSL_FAIL(
2662 : : (OString("sd::SlideshowImpl::resize(), "
2663 : : "exception caught: ") +
2664 : : rtl::OUStringToOString(
2665 : : comphelper::anyToString( cppu::getCaughtException() ),
2666 : : RTL_TEXTENCODING_UTF8 )).getStr() );
2667 : : }
2668 : 0 : }
2669 : :
2670 : : // -----------------------------------------------------------------------------
2671 : :
2672 : 0 : void SlideshowImpl::setActiveXToolbarsVisible( sal_Bool bVisible )
2673 : : {
2674 : : // in case of ActiveX control the toolbars should not be visible if slide show runs in window mode
2675 : : // actually it runs always in window mode in case of ActiveX control
2676 [ # # ][ # # ]: 0 : if ( !maPresSettings.mbFullScreen && mpDocSh && mpDocSh->GetMedium() )
[ # # ][ # # ]
2677 : : {
2678 : 0 : SFX_ITEMSET_ARG( mpDocSh->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_VIEWONLY, sal_False );
2679 [ # # ][ # # ]: 0 : if ( pItem && pItem->GetValue() )
[ # # ]
2680 : : {
2681 : : // this is a plugin/activex mode, no toolbars should be visible during slide show
2682 : : // after the end of slide show they should be visible again
2683 : 0 : SfxViewFrame* pViewFrame = getViewFrame();
2684 [ # # ]: 0 : if( pViewFrame )
2685 : : {
2686 : : try
2687 : : {
2688 : 0 : Reference< frame::XLayoutManager > xLayoutManager;
2689 [ # # ][ # # ]: 0 : Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame().GetTopFrame().GetFrameInterface(), UNO_QUERY_THROW );
[ # # ][ # # ]
2690 [ # # # # ]: 0 : if ( ( xFrameProps->getPropertyValue( "LayoutManager" )
[ # # ][ # # ]
2691 [ # # ][ # # ]: 0 : >>= xLayoutManager )
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
2692 : 0 : && xLayoutManager.is() )
2693 : : {
2694 [ # # ][ # # ]: 0 : xLayoutManager->setVisible( bVisible );
2695 [ # # ]: 0 : }
2696 : : }
2697 : 0 : catch( uno::Exception& )
2698 : : {}
2699 : : }
2700 : : }
2701 : : }
2702 : 0 : }
2703 : :
2704 : : // -----------------------------------------------------------------------------
2705 : :
2706 : 0 : void SAL_CALL SlideshowImpl::activate() throw (RuntimeException)
2707 : : {
2708 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2709 : :
2710 [ # # ]: 0 : maDeactivateTimer.Stop();
2711 : :
2712 [ # # ][ # # ]: 0 : if( !mbActive && mxShow.is() )
[ # # ]
2713 : : {
2714 : 0 : mbActive = sal_True;
2715 : :
2716 [ # # ]: 0 : if( ANIMATIONMODE_SHOW == meAnimationMode )
2717 : : {
2718 [ # # ]: 0 : if( mbAutoSaveWasOn )
2719 [ # # ]: 0 : setAutoSaveState( false );
2720 : :
2721 [ # # ]: 0 : if( mpShowWindow )
2722 : : {
2723 [ # # ]: 0 : SfxViewFrame* pViewFrame = getViewFrame();
2724 [ # # ]: 0 : SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : 0;
2725 : :
2726 [ # # ]: 0 : hideChildWindows();
2727 : :
2728 [ # # ]: 0 : if( pDispatcher )
2729 : : {
2730 : : // filter all forbiden slots
2731 [ # # ]: 0 : pDispatcher->SetSlotFilter( sal_True, sizeof(pAllowed) / sizeof(sal_uInt16), pAllowed );
2732 : : }
2733 : :
2734 [ # # ][ # # ]: 0 : if( getBindings() )
2735 [ # # ][ # # ]: 0 : getBindings()->InvalidateAll(sal_True);
2736 : :
2737 [ # # ]: 0 : mpShowWindow->GrabFocus();
2738 : : }
2739 : : }
2740 : :
2741 [ # # ]: 0 : resume();
2742 [ # # ]: 0 : }
2743 : 0 : }
2744 : :
2745 : : // -----------------------------------------------------------------------------
2746 : :
2747 : 0 : void SAL_CALL SlideshowImpl::deactivate() throw (RuntimeException)
2748 : : {
2749 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2750 : :
2751 [ # # ][ # # ]: 0 : if( mbActive && mxShow.is() )
[ # # ]
2752 : : {
2753 [ # # ]: 0 : maDeactivateTimer.Start();
2754 [ # # ]: 0 : }
2755 : 0 : }
2756 : :
2757 : : // -----------------------------------------------------------------------------
2758 : :
2759 : 0 : IMPL_LINK_NOARG(SlideshowImpl, deactivateHdl)
2760 : : {
2761 [ # # ][ # # ]: 0 : if( mbActive && mxShow.is() )
[ # # ]
2762 : : {
2763 : 0 : mbActive = sal_False;
2764 : :
2765 : 0 : pause();
2766 : :
2767 [ # # ]: 0 : if( ANIMATIONMODE_SHOW == meAnimationMode )
2768 : : {
2769 [ # # ]: 0 : if( mbAutoSaveWasOn )
2770 : 0 : setAutoSaveState( true );
2771 : :
2772 [ # # ]: 0 : if( mpShowWindow )
2773 : : {
2774 : 0 : showChildWindows();
2775 : : }
2776 : : }
2777 : : }
2778 : 0 : return 0;
2779 : : }
2780 : :
2781 : : // ---------------------------------------------------------
2782 : :
2783 : 0 : sal_Bool SAL_CALL SlideshowImpl::isActive() throw (RuntimeException)
2784 : : {
2785 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2786 [ # # ]: 0 : return mbActive;
2787 : : }
2788 : :
2789 : : // -----------------------------------------------------------------------------
2790 : :
2791 : 0 : void SlideshowImpl::receiveRequest(SfxRequest& rReq)
2792 : : {
2793 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
2794 : :
2795 [ # # # # ]: 0 : switch ( rReq.GetSlot() )
2796 : : {
2797 : : case SID_NAVIGATOR_PEN:
2798 : 0 : setUsePen(!mbUsePen);
2799 : 0 : break;
2800 : :
2801 : : case SID_NAVIGATOR_PAGE:
2802 : : {
2803 : 0 : PageJump eJump = (PageJump)((SfxAllEnumItem&) pArgs->Get(SID_NAVIGATOR_PAGE)).GetValue();
2804 [ # # # # : 0 : switch( eJump )
# # ]
2805 : : {
2806 : 0 : case PAGE_FIRST: gotoFirstSlide(); break;
2807 : 0 : case PAGE_LAST: gotoLastSlide(); break;
2808 : 0 : case PAGE_NEXT: gotoNextSlide(); break;
2809 : 0 : case PAGE_PREVIOUS: gotoPreviousSlide(); break;
2810 : 0 : case PAGE_NONE: break;
2811 : : }
2812 : : }
2813 : 0 : break;
2814 : :
2815 : : case SID_NAVIGATOR_OBJECT:
2816 : : {
2817 [ # # ][ # # ]: 0 : const String aTarget( ((SfxStringItem&) pArgs->Get(SID_NAVIGATOR_OBJECT)).GetValue() );
2818 : :
2819 : : // is the bookmark a Slide?
2820 : : sal_Bool bIsMasterPage;
2821 [ # # ]: 0 : sal_uInt16 nPgNum = mpDoc->GetPageByName( aTarget, bIsMasterPage );
2822 : 0 : SdrObject* pObj = NULL;
2823 : :
2824 [ # # ]: 0 : if( nPgNum == SDRPAGE_NOTFOUND )
2825 : : {
2826 : : // is the bookmark an object?
2827 [ # # ]: 0 : pObj = mpDoc->GetObj( aTarget );
2828 : :
2829 [ # # ]: 0 : if( pObj )
2830 [ # # ][ # # ]: 0 : nPgNum = pObj->GetPage()->GetPageNum();
2831 : : }
2832 : :
2833 [ # # ]: 0 : if( nPgNum != SDRPAGE_NOTFOUND )
2834 : : {
2835 : 0 : nPgNum = ( nPgNum - 1 ) >> 1;
2836 [ # # ]: 0 : displaySlideNumber( nPgNum );
2837 [ # # ]: 0 : }
2838 : : }
2839 : 0 : break;
2840 : : }
2841 : 0 : }
2842 : :
2843 : : // ---------------------------------------------------------
2844 : :
2845 : 0 : void SlideshowImpl::setAutoSaveState( bool bOn)
2846 : : {
2847 : : try
2848 : : {
2849 [ # # ]: 0 : uno::Reference<lang::XMultiServiceFactory> xFac( ::comphelper::getProcessServiceFactory() );
2850 [ # # ]: 0 : uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
2851 : :
2852 [ # # ]: 0 : uno::Reference< util::XURLTransformer > xParser(util::URLTransformer::create(xContext));
2853 : 0 : util::URL aURL;
2854 : 0 : aURL.Complete = "vnd.sun.star.autorecovery:/setAutoSaveState";
2855 [ # # ][ # # ]: 0 : xParser->parseStrict(aURL);
2856 : :
2857 [ # # ]: 0 : Sequence< beans::PropertyValue > aArgs(1);
2858 [ # # ]: 0 : aArgs[0].Name = "AutoSaveState";
2859 [ # # ][ # # ]: 0 : aArgs[0].Value <<= bOn ? sal_True : sal_False;
[ # # ]
2860 : :
2861 : : uno::Reference< frame::XDispatch > xAutoSave(
2862 [ # # ]: 0 : xFac->createInstance( "com.sun.star.frame.AutoRecovery" ),
2863 [ # # ][ # # ]: 0 : uno::UNO_QUERY_THROW);
2864 [ # # ][ # # ]: 0 : xAutoSave->dispatch(aURL, aArgs);
[ # # ][ # # ]
2865 : : }
2866 : 0 : catch( Exception& )
2867 : : {
2868 : : OSL_FAIL("sd::SlideshowImpl::setAutoSaveState(), exception caught!");
2869 : : }
2870 : 0 : }
2871 : :
2872 : : // ---------------------------------------------------------
2873 : :
2874 : 0 : Reference< XDrawPage > SAL_CALL SlideshowImpl::getCurrentSlide() throw (RuntimeException)
2875 : : {
2876 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2877 : :
2878 : 0 : Reference< XDrawPage > xSlide;
2879 [ # # ][ # # ]: 0 : if( mxShow.is() && mpSlideController.get() )
[ # # ]
2880 : : {
2881 [ # # ]: 0 : sal_Int32 nSlide = getCurrentSlideNumber();
2882 [ # # ][ # # ]: 0 : if( (nSlide >= 0) && (nSlide < mpSlideController->getSlideNumberCount() ) )
[ # # ]
2883 [ # # ][ # # ]: 0 : xSlide = mpSlideController->getSlideByNumber( nSlide );
2884 : : }
2885 : :
2886 [ # # ]: 0 : return xSlide;
2887 : : }
2888 : :
2889 : : // ---------------------------------------------------------
2890 : :
2891 : 0 : sal_Int32 SAL_CALL SlideshowImpl::getNextSlideIndex() throw (RuntimeException)
2892 : : {
2893 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2894 : :
2895 [ # # ]: 0 : if( mxShow.is() )
2896 : : {
2897 [ # # ]: 0 : return mpSlideController->getNextSlideIndex();
2898 : : }
2899 : : else
2900 : : {
2901 : 0 : return -1;
2902 [ # # ]: 0 : }
2903 : : }
2904 : :
2905 : : // ---------------------------------------------------------
2906 : :
2907 : 0 : sal_Int32 SAL_CALL SlideshowImpl::getCurrentSlideIndex() throw (RuntimeException)
2908 : : {
2909 [ # # ]: 0 : return mpSlideController.get() ? mpSlideController->getCurrentSlideIndex() : -1;
2910 : : }
2911 : :
2912 : : // --------------------------------------------------------------------
2913 : : // ::com::sun::star::presentation::XSlideShowController:
2914 : : // --------------------------------------------------------------------
2915 : :
2916 : 0 : ::sal_Int32 SAL_CALL SlideshowImpl::getSlideCount() throw (RuntimeException)
2917 : : {
2918 [ # # ]: 0 : return mpSlideController.get() ? mpSlideController->getSlideIndexCount() : 0;
2919 : : }
2920 : :
2921 : : // --------------------------------------------------------------------
2922 : :
2923 : 0 : Reference< XDrawPage > SAL_CALL SlideshowImpl::getSlideByIndex(::sal_Int32 Index) throw (RuntimeException, css::lang::IndexOutOfBoundsException)
2924 : : {
2925 [ # # ][ # # ]: 0 : if( (mpSlideController.get() == 0 ) || (Index < 0) || (Index >= mpSlideController->getSlideIndexCount() ) )
[ # # ][ # # ]
2926 [ # # ]: 0 : throw IndexOutOfBoundsException();
2927 : :
2928 : 0 : return mpSlideController->getSlideByNumber( mpSlideController->getSlideNumber( Index ) );
2929 : : }
2930 : :
2931 : 0 : sal_Bool SAL_CALL SlideshowImpl::getAlwaysOnTop() throw (RuntimeException)
2932 : : {
2933 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2934 [ # # ]: 0 : return maPresSettings.mbAlwaysOnTop;
2935 : : }
2936 : :
2937 : : // --------------------------------------------------------------------
2938 : :
2939 : 0 : void SAL_CALL SlideshowImpl::setAlwaysOnTop( sal_Bool bAlways ) throw (RuntimeException)
2940 : : {
2941 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2942 [ # # ]: 0 : if( maPresSettings.mbAlwaysOnTop != bAlways )
2943 : : {
2944 : 0 : maPresSettings.mbAlwaysOnTop = bAlways;
2945 : : // todo, can this be changed while running?
2946 [ # # ]: 0 : }
2947 : 0 : }
2948 : :
2949 : : // --------------------------------------------------------------------
2950 : :
2951 : 0 : sal_Bool SAL_CALL SlideshowImpl::isFullScreen() throw (RuntimeException)
2952 : : {
2953 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2954 [ # # ]: 0 : return maPresSettings.mbFullScreen;
2955 : : }
2956 : :
2957 : : // --------------------------------------------------------------------
2958 : :
2959 : 0 : sal_Bool SAL_CALL SlideshowImpl::getMouseVisible() throw (RuntimeException)
2960 : : {
2961 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2962 [ # # ]: 0 : return maPresSettings.mbMouseVisible;
2963 : : }
2964 : :
2965 : : // --------------------------------------------------------------------
2966 : :
2967 : 0 : void SAL_CALL SlideshowImpl::setMouseVisible( sal_Bool bVisible ) throw (RuntimeException)
2968 : : {
2969 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2970 [ # # ]: 0 : if( maPresSettings.mbMouseVisible != bVisible )
2971 : : {
2972 : 0 : maPresSettings.mbMouseVisible = bVisible;
2973 [ # # ]: 0 : if( mpShowWindow )
2974 : 0 : mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible );
2975 [ # # ]: 0 : }
2976 : 0 : }
2977 : :
2978 : : // --------------------------------------------------------------------
2979 : :
2980 : 0 : sal_Bool SAL_CALL SlideshowImpl::getUsePen() throw (RuntimeException)
2981 : : {
2982 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2983 [ # # ]: 0 : return mbUsePen;
2984 : : }
2985 : :
2986 : : // --------------------------------------------------------------------
2987 : :
2988 : 0 : void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeException)
2989 : : {
2990 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
2991 : 0 : mbUsePen = bMouseAsPen;
2992 [ # # ]: 0 : if( mxShow.is() ) try
2993 : : {
2994 : : // For Pencolor;
2995 : 0 : Any aValue;
2996 [ # # ]: 0 : if( mbUsePen )
2997 [ # # ]: 0 : aValue <<= mnUserPaintColor;
2998 : 0 : beans::PropertyValue aPenProp;
2999 : 0 : aPenProp.Name = "UserPaintColor";
3000 : 0 : aPenProp.Value = aValue;
3001 [ # # ][ # # ]: 0 : mxShow->setProperty( aPenProp );
3002 : :
3003 : : //for StrokeWidth :
3004 [ # # ]: 0 : if( mbUsePen )
3005 : : {
3006 : 0 : beans::PropertyValue aPenPropWidth;
3007 : 0 : aPenPropWidth.Name = "UserPaintStrokeWidth";
3008 [ # # ]: 0 : aPenPropWidth.Value <<= mdUserPaintStrokeWidth;
3009 [ # # ][ # # ]: 0 : mxShow->setProperty( aPenPropWidth );
3010 : :
3011 : : // for Pen Mode
3012 : 0 : beans::PropertyValue aPenPropSwitchPenMode;
3013 : 0 : aPenPropSwitchPenMode.Name = "SwitchPenMode";
3014 [ # # ]: 0 : aPenPropSwitchPenMode.Value <<= sal_True;
3015 [ # # ][ # # ]: 0 : mxShow->setProperty( aPenPropSwitchPenMode );
3016 [ # # ]: 0 : }
3017 : : }
3018 [ # # ]: 0 : catch( Exception& )
3019 : : {
3020 : : OSL_FAIL(
3021 : : (OString("sd::SlideshowImpl::setUsePen(), "
3022 : : "exception caught: ") +
3023 : : rtl::OUStringToOString(
3024 : : comphelper::anyToString( cppu::getCaughtException() ),
3025 : : RTL_TEXTENCODING_UTF8 )).getStr() );
3026 [ # # ]: 0 : }
3027 : 0 : }
3028 : :
3029 : : // --------------------------------------------------------------------
3030 : :
3031 : 0 : double SAL_CALL SlideshowImpl::getPenWidth() throw (RuntimeException)
3032 : : {
3033 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3034 [ # # ]: 0 : return mdUserPaintStrokeWidth;
3035 : : }
3036 : :
3037 : : // --------------------------------------------------------------------
3038 : :
3039 : 0 : void SAL_CALL SlideshowImpl::setPenWidth( double dStrokeWidth ) throw (RuntimeException)
3040 : : {
3041 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3042 : 0 : mdUserPaintStrokeWidth = dStrokeWidth;
3043 [ # # ][ # # ]: 0 : setUsePen( true ); // enable pen mode, update color and width
3044 : 0 : }
3045 : :
3046 : : // --------------------------------------------------------------------
3047 : :
3048 : 0 : sal_Int32 SAL_CALL SlideshowImpl::getPenColor() throw (RuntimeException)
3049 : : {
3050 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3051 [ # # ]: 0 : return mnUserPaintColor;
3052 : : }
3053 : :
3054 : : // --------------------------------------------------------------------
3055 : :
3056 : 0 : void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor ) throw (RuntimeException)
3057 : : {
3058 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3059 : 0 : mnUserPaintColor = nColor;
3060 [ # # ][ # # ]: 0 : setUsePen( true ); // enable pen mode, update color
3061 : 0 : }
3062 : :
3063 : : // --------------------------------------------------------------------
3064 : :
3065 : 0 : void SAL_CALL SlideshowImpl::setUseEraser( ::sal_Bool /*_usepen*/ ) throw (css::uno::RuntimeException)
3066 : : {
3067 : 0 : }
3068 : :
3069 : : // --------------------------------------------------------------------
3070 : :
3071 : 0 : void SAL_CALL SlideshowImpl::setPenMode( bool bSwitchPenMode ) throw (RuntimeException)
3072 : : {
3073 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3074 [ # # ][ # # ]: 0 : setUsePen( bSwitchPenMode ); // SwitchPen Mode
3075 : :
3076 : 0 : }
3077 : :
3078 : : // --------------------------------------------------------------------
3079 : :
3080 : 0 : void SAL_CALL SlideshowImpl::setEraseAllInk(bool bEraseAllInk) throw (RuntimeException)
3081 : : {
3082 [ # # ]: 0 : if( bEraseAllInk )
3083 : : {
3084 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3085 [ # # ]: 0 : if( mxShow.is() ) try
3086 : : {
3087 : 0 : beans::PropertyValue aPenPropEraseAllInk;
3088 : 0 : aPenPropEraseAllInk.Name = "EraseAllInk";
3089 [ # # ]: 0 : aPenPropEraseAllInk.Value <<= bEraseAllInk;
3090 [ # # ][ # # ]: 0 : mxShow->setProperty( aPenPropEraseAllInk );
[ # # ]
3091 : : }
3092 [ # # ]: 0 : catch( Exception& )
3093 : : {
3094 : : OSL_TRACE(
3095 : : (OString("sd::SlideshowImpl::setEraseAllInk(), "
3096 : : "exception caught: ") +
3097 : : rtl::OUStringToOString(
3098 : : comphelper::anyToString( cppu::getCaughtException() ),
3099 : : RTL_TEXTENCODING_UTF8 )).getStr() );
3100 [ # # ]: 0 : }
3101 : : }
3102 : 0 : }
3103 : :
3104 : 0 : void SAL_CALL SlideshowImpl::setEraseInk( sal_Int32 /*nEraseInkSize*/ ) throw (css::uno::RuntimeException)
3105 : : {
3106 : 0 : }
3107 : :
3108 : 0 : void SAL_CALL SlideshowImpl::setEraserMode( bool /*bSwitchEraserMode*/ ) throw (css::uno::RuntimeException)
3109 : : {
3110 : 0 : }
3111 : :
3112 : : // --------------------------------------------------------------------
3113 : : // XSlideShowController Methods
3114 : : // --------------------------------------------------------------------
3115 : :
3116 : 0 : sal_Bool SAL_CALL SlideshowImpl::isRunning( ) throw (RuntimeException)
3117 : : {
3118 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3119 [ # # ]: 0 : return mxShow.is();
3120 : : }
3121 : :
3122 : : // --------------------------------------------------------------------
3123 : :
3124 : 0 : void SAL_CALL SlideshowImpl::gotoNextEffect( ) throw (RuntimeException)
3125 : : {
3126 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3127 : :
3128 [ # # ][ # # ]: 0 : if( mxShow.is() && mpSlideController.get() && mpShowWindow )
[ # # ][ # # ]
3129 : : {
3130 [ # # ]: 0 : if( mbIsPaused )
3131 [ # # ]: 0 : resume();
3132 : :
3133 : 0 : const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
3134 [ # # ]: 0 : if( eMode == SHOWWINDOWMODE_END )
3135 : : {
3136 [ # # ]: 0 : endPresentation();
3137 : : }
3138 [ # # ][ # # ]: 0 : else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
3139 : : {
3140 [ # # ]: 0 : mpShowWindow->RestartShow();
3141 : : }
3142 : : else
3143 : : {
3144 [ # # ][ # # ]: 0 : mxShow->nextEffect();
3145 [ # # ]: 0 : update();
3146 : : }
3147 [ # # ]: 0 : }
3148 : 0 : }
3149 : :
3150 : : // --------------------------------------------------------------------
3151 : :
3152 : 0 : void SAL_CALL SlideshowImpl::gotoPreviousEffect( ) throw (RuntimeException)
3153 : : {
3154 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3155 : :
3156 [ # # ][ # # ]: 0 : if( mxShow.is() && mpSlideController.get() && mpShowWindow )
[ # # ][ # # ]
3157 : : {
3158 [ # # ]: 0 : if( mbIsPaused )
3159 [ # # ]: 0 : resume();
3160 : :
3161 : 0 : const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
3162 [ # # ][ # # ]: 0 : if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
3163 : : {
3164 [ # # ]: 0 : mpShowWindow->RestartShow();
3165 : : }
3166 : : else
3167 : : {
3168 [ # # ][ # # ]: 0 : mxShow->previousEffect();
3169 [ # # ]: 0 : update();
3170 : : }
3171 [ # # ]: 0 : }
3172 : 0 : }
3173 : :
3174 : : // --------------------------------------------------------------------
3175 : :
3176 : 0 : void SAL_CALL SlideshowImpl::gotoFirstSlide( ) throw (RuntimeException)
3177 : : {
3178 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3179 : :
3180 [ # # ][ # # ]: 0 : if( mpShowWindow && mpSlideController.get() )
[ # # ]
3181 : : {
3182 [ # # ]: 0 : if( mbIsPaused )
3183 [ # # ]: 0 : resume();
3184 : :
3185 [ # # ]: 0 : if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END )
3186 : : {
3187 [ # # ]: 0 : if( mpSlideController->getSlideIndexCount() )
3188 [ # # ]: 0 : mpShowWindow->RestartShow( 0);
3189 : : }
3190 : : else
3191 : : {
3192 [ # # ]: 0 : displaySlideIndex( 0 );
3193 : : }
3194 [ # # ]: 0 : }
3195 : 0 : }
3196 : :
3197 : : // --------------------------------------------------------------------
3198 : :
3199 : 0 : void SAL_CALL SlideshowImpl::gotoNextSlide( ) throw (RuntimeException)
3200 : : {
3201 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3202 : :
3203 [ # # ]: 0 : if( mbIsPaused )
3204 [ # # ]: 0 : resume();
3205 : :
3206 : 0 : const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
3207 [ # # ][ # # ]: 0 : if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
3208 : : {
3209 [ # # ]: 0 : mpShowWindow->RestartShow();
3210 : : }
3211 : : else
3212 : : {
3213 : : // if this is a show, ignore user inputs and
3214 : : // start 20ms timer to reenable inputs to fiter
3215 : : // buffered inputs during slide transition
3216 [ # # ]: 0 : if( meAnimationMode == ANIMATIONMODE_SHOW )
3217 : : {
3218 : 0 : mbInputFreeze = true;
3219 [ # # ]: 0 : maInputFreezeTimer.Start();
3220 : : }
3221 : :
3222 [ # # ]: 0 : if( mpSlideController.get() )
3223 : : {
3224 [ # # ][ # # ]: 0 : if( mpSlideController->nextSlide() )
3225 : : {
3226 [ # # ]: 0 : displayCurrentSlide();
3227 : : }
3228 : : else
3229 : : {
3230 [ # # ]: 0 : stopSound();
3231 : :
3232 [ # # ]: 0 : if( meAnimationMode == ANIMATIONMODE_PREVIEW )
3233 : : {
3234 [ # # ]: 0 : endPresentation();
3235 : : }
3236 [ # # ]: 0 : else if( maPresSettings.mbEndless )
3237 : : {
3238 [ # # ]: 0 : if( maPresSettings.mnPauseTimeout )
3239 : : {
3240 [ # # ]: 0 : if( mpShowWindow )
3241 : : {
3242 [ # # ][ # # ]: 0 : Graphic aGraphic( SfxApplication::GetApplicationLogo().GetBitmapEx() );
[ # # ][ # # ]
[ # # ]
3243 [ # # ][ # # ]: 0 : mpShowWindow->SetPauseMode( 0, maPresSettings.mnPauseTimeout, &aGraphic );
3244 : : }
3245 : : }
3246 : : else
3247 : : {
3248 [ # # ]: 0 : displaySlideIndex( 0 );
3249 : : }
3250 : : }
3251 : : else
3252 : : {
3253 [ # # ]: 0 : if( mpShowWindow )
3254 : : {
3255 [ # # ]: 0 : mpShowWindow->SetEndMode();
3256 [ # # ][ # # ]: 0 : if( !mpViewShell->GetDoc()->IsStartWithPresentation() )
[ # # ]
3257 [ # # ]: 0 : pause();
3258 : : }
3259 : : }
3260 : : }
3261 : : }
3262 [ # # ]: 0 : }
3263 : 0 : }
3264 : :
3265 : : // --------------------------------------------------------------------
3266 : :
3267 : 0 : void SAL_CALL SlideshowImpl::gotoPreviousSlide( ) throw (RuntimeException)
3268 : : {
3269 : 0 : gotoPreviousSlide(false);
3270 : 0 : }
3271 : :
3272 : 0 : void SlideshowImpl::gotoPreviousSlide (const bool bSkipAllMainSequenceEffects)
3273 : : {
3274 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3275 : :
3276 [ # # ][ # # ]: 0 : if( mxShow.is() && mpSlideController.get() ) try
[ # # ]
3277 : : {
3278 [ # # ]: 0 : if( mbIsPaused )
3279 [ # # ]: 0 : resume();
3280 : :
3281 : 0 : const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
3282 [ # # ]: 0 : if( eMode == SHOWWINDOWMODE_END )
3283 : : {
3284 : 0 : const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1;
3285 [ # # ]: 0 : if( nLastSlideIndex >= 0 )
3286 [ # # ]: 0 : mpShowWindow->RestartShow( nLastSlideIndex );
3287 : : }
3288 [ # # ][ # # ]: 0 : else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
3289 : : {
3290 [ # # ]: 0 : mpShowWindow->RestartShow();
3291 : : }
3292 : : else
3293 : : {
3294 [ # # ][ # # ]: 0 : if( mpSlideController->previousSlide())
3295 [ # # ]: 0 : displayCurrentSlide(bSkipAllMainSequenceEffects);
3296 [ # # ]: 0 : else if (bSkipAllMainSequenceEffects)
3297 : : {
3298 : : // We could not go to the previous slide (probably because
3299 : : // the current slide is already the first one). We still
3300 : : // have to call displayCurrentSlide because the calling
3301 : : // slideshow can not determine whether there is a previous
3302 : : // slide or not and has already prepared for a slide change.
3303 : : // This slide change has to be completed now, even when
3304 : : // changing to the same slide.
3305 : : // Note that in this special case we do NOT pass
3306 : : // bSkipAllMainSequenceEffects because we display the same
3307 : : // slide as before and do not want to show all its effects.
3308 [ # # ]: 0 : displayCurrentSlide(false);
3309 : : }
3310 : : }
3311 : : }
3312 [ # # ]: 0 : catch( Exception& )
3313 : : {
3314 : : OSL_FAIL(
3315 : : (OString("sd::SlideshowImpl::gotoPreviousSlide(), "
3316 : : "exception caught: ") +
3317 : : rtl::OUStringToOString(
3318 : : comphelper::anyToString( cppu::getCaughtException() ),
3319 : : RTL_TEXTENCODING_UTF8 )).getStr() );
3320 [ # # ]: 0 : }
3321 [ # # ]: 0 : }
3322 : :
3323 : : // --------------------------------------------------------------------
3324 : :
3325 : 0 : void SAL_CALL SlideshowImpl::gotoLastSlide() throw (RuntimeException)
3326 : : {
3327 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3328 : :
3329 [ # # ]: 0 : if( mpSlideController.get() )
3330 : : {
3331 [ # # ]: 0 : if( mbIsPaused )
3332 [ # # ]: 0 : resume();
3333 : :
3334 : 0 : const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1;
3335 [ # # ]: 0 : if( nLastSlideIndex >= 0 )
3336 : : {
3337 [ # # ]: 0 : if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END )
3338 : : {
3339 [ # # ]: 0 : mpShowWindow->RestartShow( nLastSlideIndex );
3340 : : }
3341 : : else
3342 : : {
3343 [ # # ]: 0 : displaySlideIndex( nLastSlideIndex );
3344 : : }
3345 : : }
3346 [ # # ]: 0 : }
3347 : 0 : }
3348 : :
3349 : : // --------------------------------------------------------------------
3350 : :
3351 : 0 : void SAL_CALL SlideshowImpl::gotoBookmark( const OUString& rBookmark ) throw (RuntimeException)
3352 : : {
3353 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3354 : :
3355 [ # # ]: 0 : if( mbIsPaused )
3356 [ # # ]: 0 : resume();
3357 : :
3358 [ # # ]: 0 : sal_Int32 nSlideNumber = getSlideNumberForBookmark( rBookmark );
3359 [ # # ]: 0 : if( nSlideNumber != -1 )
3360 [ # # ][ # # ]: 0 : displaySlideNumber( nSlideNumber );
3361 : 0 : }
3362 : :
3363 : : // --------------------------------------------------------------------
3364 : :
3365 : 0 : void SAL_CALL SlideshowImpl::gotoSlide( const Reference< XDrawPage >& xSlide )
3366 : : throw(IllegalArgumentException, RuntimeException)
3367 : : {
3368 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3369 : :
3370 [ # # ][ # # ]: 0 : if( mpSlideController.get() && xSlide.is() )
[ # # ]
3371 : : {
3372 [ # # ]: 0 : if( mbIsPaused )
3373 [ # # ]: 0 : resume();
3374 : :
3375 : 0 : const sal_Int32 nSlideCount = mpSlideController->getSlideNumberCount();
3376 [ # # ]: 0 : for( sal_Int32 nSlide = 0; nSlide < nSlideCount; nSlide++ )
3377 : : {
3378 [ # # ][ # # ]: 0 : if( mpSlideController->getSlideByNumber( nSlide ) == xSlide )
[ # # ]
3379 : : {
3380 [ # # ]: 0 : displaySlideNumber( nSlide );
3381 : : }
3382 : : }
3383 [ # # ]: 0 : }
3384 : 0 : }
3385 : :
3386 : : // --------------------------------------------------------------------
3387 : :
3388 : 0 : void SAL_CALL SlideshowImpl::gotoSlideIndex( sal_Int32 nIndex ) throw (RuntimeException)
3389 : : {
3390 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3391 : :
3392 [ # # ]: 0 : if( mbIsPaused )
3393 [ # # ]: 0 : resume();
3394 : :
3395 [ # # ][ # # ]: 0 : displaySlideIndex( nIndex );
3396 : 0 : }
3397 : :
3398 : : // --------------------------------------------------------------------
3399 : :
3400 : 0 : void SAL_CALL SlideshowImpl::stopSound( ) throw (RuntimeException)
3401 : : {
3402 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3403 : :
3404 : : try
3405 : : {
3406 [ # # ]: 0 : if( mxPlayer.is() )
3407 : : {
3408 [ # # ][ # # ]: 0 : mxPlayer->stop();
3409 : 0 : mxPlayer.clear();
3410 : : }
3411 : : }
3412 [ # # ]: 0 : catch( Exception& )
3413 : : {
3414 : : OSL_FAIL(
3415 : : (OString("sd::SlideshowImpl::stopSound(), "
3416 : : "exception caught: ") +
3417 : : rtl::OUStringToOString(
3418 : : comphelper::anyToString( cppu::getCaughtException() ),
3419 : : RTL_TEXTENCODING_UTF8 )).getStr() );
3420 [ # # ]: 0 : }
3421 [ # # ]: 0 : }
3422 : :
3423 : : // --------------------------------------------------------------------
3424 : : // XIndexAccess
3425 : : // --------------------------------------------------------------------
3426 : :
3427 : 0 : ::sal_Int32 SAL_CALL SlideshowImpl::getCount( ) throw (::com::sun::star::uno::RuntimeException)
3428 : : {
3429 : 0 : return getSlideCount();
3430 : : }
3431 : :
3432 : : // --------------------------------------------------------------------
3433 : :
3434 : 0 : ::com::sun::star::uno::Any SAL_CALL SlideshowImpl::getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
3435 : : {
3436 [ # # ]: 0 : return Any( getSlideByIndex( Index ) );
3437 : : }
3438 : :
3439 : : // --------------------------------------------------------------------
3440 : :
3441 : 0 : ::com::sun::star::uno::Type SAL_CALL SlideshowImpl::getElementType( ) throw (::com::sun::star::uno::RuntimeException)
3442 : : {
3443 : 0 : return XDrawPage::static_type();
3444 : : }
3445 : :
3446 : : // --------------------------------------------------------------------
3447 : :
3448 : 0 : ::sal_Bool SAL_CALL SlideshowImpl::hasElements( ) throw (::com::sun::star::uno::RuntimeException)
3449 : : {
3450 : 0 : return getSlideCount() != 0;
3451 : : }
3452 : :
3453 : : // --------------------------------------------------------------------
3454 : :
3455 : 0 : Reference< XSlideShow > SAL_CALL SlideshowImpl::getSlideShow() throw (RuntimeException)
3456 : : {
3457 : 0 : return mxShow;
3458 : : }
3459 : :
3460 : : // --------------------------------------------------------------------
3461 : :
3462 : :
3463 : 0 : PresentationSettingsEx::PresentationSettingsEx( const PresentationSettingsEx& r )
3464 : : : PresentationSettings( r )
3465 : : , mbRehearseTimings(r.mbRehearseTimings)
3466 : : , mbPreview(r.mbPreview)
3467 : 0 : , mpParentWindow( 0 )
3468 : : {
3469 : 0 : }
3470 : :
3471 : 0 : PresentationSettingsEx::PresentationSettingsEx( PresentationSettings& r )
3472 : : : PresentationSettings( r )
3473 : : , mbRehearseTimings(sal_False)
3474 : : , mbPreview(sal_False)
3475 : 0 : , mpParentWindow(0)
3476 : : {
3477 : 0 : }
3478 : :
3479 : 0 : void PresentationSettingsEx::SetArguments( const Sequence< PropertyValue >& rArguments ) throw (IllegalArgumentException)
3480 : : {
3481 : 0 : sal_Int32 nArguments = rArguments.getLength();
3482 : 0 : const PropertyValue* pValue = rArguments.getConstArray();
3483 : :
3484 [ # # ]: 0 : while( nArguments-- )
3485 : : {
3486 : 0 : SetPropertyValue( pValue->Name, pValue->Value );
3487 : 0 : pValue++;
3488 : : }
3489 : 0 : }
3490 : :
3491 : 0 : void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const Any& rValue ) throw (IllegalArgumentException)
3492 : : {
3493 [ # # ]: 0 : if ( rProperty == "RehearseTimings" )
3494 : : {
3495 [ # # ]: 0 : if( rValue >>= mbRehearseTimings )
3496 : 0 : return;
3497 : : }
3498 [ # # ]: 0 : else if ( rProperty == "Preview" )
3499 : : {
3500 [ # # ]: 0 : if( rValue >>= mbPreview )
3501 : 0 : return;
3502 : : }
3503 [ # # ]: 0 : else if ( rProperty == "AnimationNode" )
3504 : : {
3505 [ # # ]: 0 : if( rValue >>= mxAnimationNode )
3506 : 0 : return;
3507 : : }
3508 [ # # ]: 0 : else if ( rProperty == "ParentWindow" )
3509 : : {
3510 : 0 : Reference< XWindow > xWindow;
3511 [ # # ][ # # ]: 0 : if( rValue >>= xWindow )
3512 : : {
3513 [ # # ][ # # ]: 0 : mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : 0;
3514 : : return;
3515 [ # # ]: 0 : }
3516 : : }
3517 [ # # ]: 0 : else if ( rProperty == "AllowAnimations" )
3518 : : {
3519 [ # # ]: 0 : if( rValue >>= mbAnimationAllowed )
3520 : 0 : return;
3521 : : }
3522 [ # # ]: 0 : else if ( rProperty == "FirstPage" )
3523 : : {
3524 : 0 : OUString aPresPage;
3525 [ # # ]: 0 : if( rValue >>= aPresPage )
3526 : : {
3527 [ # # ][ # # ]: 0 : maPresPage = getUiNameFromPageApiNameImpl(aPresPage);
[ # # ]
3528 : 0 : mbCustomShow = sal_False;
3529 : 0 : mbAll = sal_False;
3530 : : return;
3531 : : }
3532 : : else
3533 : : {
3534 [ # # ][ # # ]: 0 : if( rValue >>= mxStartPage )
3535 : : return;
3536 [ # # ]: 0 : }
3537 : : }
3538 [ # # ]: 0 : else if ( rProperty == "IsAlwaysOnTop" )
3539 : : {
3540 [ # # ]: 0 : if( rValue >>= mbAlwaysOnTop )
3541 : 0 : return;
3542 : : }
3543 [ # # ]: 0 : else if ( rProperty == "IsAutomatic" )
3544 : : {
3545 [ # # ]: 0 : if( rValue >>= mbManual )
3546 : 0 : return;
3547 : : }
3548 [ # # ]: 0 : else if ( rProperty == "IsEndless" )
3549 : : {
3550 [ # # ]: 0 : if( rValue >>= mbEndless )
3551 : 0 : return;
3552 : : }
3553 [ # # ]: 0 : else if ( rProperty == "IsFullScreen" )
3554 : : {
3555 [ # # ]: 0 : if( rValue >>= mbFullScreen )
3556 : 0 : return;
3557 : : }
3558 [ # # ]: 0 : else if ( rProperty == "IsMouseVisible" )
3559 : : {
3560 [ # # ]: 0 : if( rValue >>= mbMouseVisible )
3561 : 0 : return;
3562 : : }
3563 [ # # ]: 0 : else if ( rProperty == "Pause" )
3564 : : {
3565 : 0 : sal_Int32 nPause = -1;
3566 [ # # ][ # # ]: 0 : if( (rValue >>= nPause) && (nPause >= 0) )
[ # # ]
3567 : : {
3568 : 0 : mnPauseTimeout = nPause;
3569 : : return;
3570 : : }
3571 : : }
3572 [ # # ]: 0 : else if ( rProperty == "StartWithNavigator" )
3573 : : {
3574 [ # # ]: 0 : if( rValue >>= mbStartWithNavigator )
3575 : 0 : return;
3576 : : }
3577 [ # # ]: 0 : else if ( rProperty == "UsePen" )
3578 : : {
3579 [ # # ]: 0 : if( rValue >>= mbMouseAsPen )
3580 : 0 : return;
3581 : : }
3582 [ # # ]: 0 : throw IllegalArgumentException();
3583 : : }
3584 : :
3585 : : ////////////////////////////////
3586 : :
3587 : : // ---------------------------------------------------------
3588 : : // XAnimationListener
3589 : : // ---------------------------------------------------------
3590 : :
3591 : 0 : SlideShowListenerProxy::SlideShowListenerProxy( const rtl::Reference< SlideshowImpl >& xController, const css::uno::Reference< css::presentation::XSlideShow >& xSlideShow )
3592 : : : maListeners( m_aMutex )
3593 : : , mxController( xController )
3594 [ # # ][ # # ]: 0 : , mxSlideShow( xSlideShow )
3595 : : {
3596 : 0 : }
3597 : :
3598 : : // ---------------------------------------------------------
3599 : :
3600 [ # # ][ # # ]: 0 : SlideShowListenerProxy::~SlideShowListenerProxy()
3601 : : {
3602 [ # # ]: 0 : }
3603 : :
3604 : : // ---------------------------------------------------------
3605 : :
3606 : 0 : void SlideShowListenerProxy::addAsSlideShowListener()
3607 : : {
3608 [ # # ]: 0 : if( mxSlideShow.is() )
3609 : : {
3610 [ # # ]: 0 : Reference< XSlideShowListener > xSlideShowListener( this );
3611 [ # # ][ # # ]: 0 : mxSlideShow->addSlideShowListener( xSlideShowListener );
3612 : : }
3613 : 0 : }
3614 : :
3615 : : // ---------------------------------------------------------
3616 : :
3617 : 0 : void SlideShowListenerProxy::removeAsSlideShowListener()
3618 : : {
3619 [ # # ]: 0 : if( mxSlideShow.is() )
3620 : : {
3621 [ # # ]: 0 : Reference< XSlideShowListener > xSlideShowListener( this );
3622 [ # # ][ # # ]: 0 : mxSlideShow->removeSlideShowListener( xSlideShowListener );
3623 : : }
3624 : 0 : }
3625 : :
3626 : : // ---------------------------------------------------------
3627 : :
3628 : 0 : void SlideShowListenerProxy::addShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape )
3629 : : {
3630 [ # # ]: 0 : if( mxSlideShow.is() )
3631 : : {
3632 [ # # ]: 0 : Reference< XShapeEventListener > xListener( this );
3633 [ # # ][ # # ]: 0 : mxSlideShow->addShapeEventListener( xListener, xShape );
3634 : : }
3635 : 0 : }
3636 : :
3637 : : // ---------------------------------------------------------
3638 : :
3639 : 0 : void SlideShowListenerProxy::removeShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape )
3640 : : {
3641 [ # # ]: 0 : if( mxSlideShow.is() )
3642 : : {
3643 [ # # ]: 0 : Reference< XShapeEventListener > xListener( this );
3644 [ # # ][ # # ]: 0 : mxSlideShow->removeShapeEventListener( xListener, xShape );
3645 : : }
3646 : 0 : }
3647 : :
3648 : : // ---------------------------------------------------------
3649 : :
3650 : 0 : void SlideShowListenerProxy::addSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& xListener )
3651 : : {
3652 : 0 : maListeners.addInterface(xListener);
3653 : 0 : }
3654 : :
3655 : : // ---------------------------------------------------------
3656 : :
3657 : 0 : void SlideShowListenerProxy::removeSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& xListener )
3658 : : {
3659 : 0 : maListeners.removeInterface(xListener);
3660 : 0 : }
3661 : :
3662 : : // ---------------------------------------------------------
3663 : :
3664 : 0 : void SAL_CALL SlideShowListenerProxy::beginEvent( const Reference< XAnimationNode >& xNode ) throw (RuntimeException)
3665 : : {
3666 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3667 : :
3668 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3669 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::beginEvent, _1, boost::cref(xNode) ));
[ # # ][ # # ]
3670 : 0 : }
3671 : :
3672 : : // ---------------------------------------------------------
3673 : :
3674 : 0 : void SAL_CALL SlideShowListenerProxy::endEvent( const Reference< XAnimationNode >& xNode ) throw (RuntimeException)
3675 : : {
3676 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3677 : :
3678 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3679 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::endEvent, _1, boost::cref(xNode) ));
[ # # ][ # # ]
3680 : 0 : }
3681 : :
3682 : : // ---------------------------------------------------------
3683 : :
3684 : 0 : void SAL_CALL SlideShowListenerProxy::repeat( const Reference< XAnimationNode >& xNode, ::sal_Int32 nRepeat ) throw (RuntimeException)
3685 : : {
3686 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3687 : :
3688 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3689 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::repeat, _1, boost::cref(xNode), boost::cref(nRepeat) ));
[ # # ][ # # ]
[ # # ]
3690 : 0 : }
3691 : :
3692 : : // ---------------------------------------------------------
3693 : : // ::com::sun::star::presentation::XSlideShowListener:
3694 : : // ---------------------------------------------------------
3695 : :
3696 : 0 : void SAL_CALL SlideShowListenerProxy::paused( ) throw (::com::sun::star::uno::RuntimeException)
3697 : : {
3698 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3699 : :
3700 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3701 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::paused ) );
[ # # ]
3702 : 0 : }
3703 : :
3704 : : // ---------------------------------------------------------
3705 : :
3706 : 0 : void SAL_CALL SlideShowListenerProxy::resumed( ) throw (::com::sun::star::uno::RuntimeException)
3707 : : {
3708 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3709 : :
3710 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3711 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::resumed ) );
[ # # ]
3712 : 0 : }
3713 : :
3714 : : // ---------------------------------------------------------
3715 : :
3716 : 0 : void SAL_CALL SlideShowListenerProxy::slideTransitionStarted( ) throw (RuntimeException)
3717 : : {
3718 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3719 : :
3720 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3721 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideTransitionStarted ) );
[ # # ]
3722 : 0 : }
3723 : :
3724 : : // ---------------------------------------------------------
3725 : :
3726 : 0 : void SAL_CALL SlideShowListenerProxy::slideTransitionEnded( ) throw (::com::sun::star::uno::RuntimeException)
3727 : : {
3728 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3729 : :
3730 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3731 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideTransitionEnded ) );
[ # # ]
3732 : 0 : }
3733 : :
3734 : : // ---------------------------------------------------------
3735 : :
3736 : 0 : void SAL_CALL SlideShowListenerProxy::slideAnimationsEnded( ) throw (::com::sun::star::uno::RuntimeException)
3737 : : {
3738 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3739 : :
3740 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3741 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideAnimationsEnded ) );
[ # # ]
3742 : 0 : }
3743 : :
3744 : : // ---------------------------------------------------------
3745 : :
3746 : 0 : void SlideShowListenerProxy::slideEnded(sal_Bool bReverse) throw (RuntimeException)
3747 : : {
3748 : : {
3749 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3750 : :
3751 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3752 : : maListeners.forEach<XSlideShowListener>(
3753 [ # # ][ # # ]: 0 : boost::bind( &XSlideShowListener::slideEnded, _1, bReverse) );
[ # # ]
3754 : : }
3755 : :
3756 : : {
3757 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3758 [ # # ]: 0 : if( mxController.is() )
3759 [ # # ][ # # ]: 0 : mxController->slideEnded(bReverse);
3760 : : }
3761 : 0 : }
3762 : :
3763 : : // ---------------------------------------------------------
3764 : :
3765 : 0 : void SlideShowListenerProxy::hyperLinkClicked( rtl::OUString const& aHyperLink ) throw (RuntimeException)
3766 : : {
3767 : : {
3768 [ # # ]: 0 : ::osl::MutexGuard aGuard( m_aMutex );
3769 : :
3770 [ # # ][ # # ]: 0 : if( maListeners.getLength() >= 0 )
3771 [ # # ][ # # ]: 0 : maListeners.forEach<XSlideShowListener>( boost::bind( &XSlideShowListener::hyperLinkClicked, _1, boost::cref(aHyperLink) ));
[ # # ][ # # ]
3772 : : }
3773 : :
3774 : : {
3775 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3776 [ # # ]: 0 : if( mxController.is() )
3777 [ # # ][ # # ]: 0 : mxController->hyperLinkClicked(aHyperLink);
3778 : : }
3779 : 0 : }
3780 : :
3781 : : // ---------------------------------------------------------
3782 : : // XEventListener
3783 : : // ---------------------------------------------------------
3784 : :
3785 : 0 : void SAL_CALL SlideShowListenerProxy::disposing( const ::com::sun::star::lang::EventObject& aDisposeEvent ) throw (RuntimeException)
3786 : : {
3787 : 0 : maListeners.disposeAndClear( aDisposeEvent );
3788 : 0 : mxController.clear();
3789 : 0 : mxSlideShow.clear();
3790 : 0 : }
3791 : :
3792 : : // ---------------------------------------------------------
3793 : : // XShapeEventListener
3794 : : // ---------------------------------------------------------
3795 : :
3796 : 0 : void SAL_CALL SlideShowListenerProxy::click( const Reference< XShape >& xShape, const ::com::sun::star::awt::MouseEvent& aOriginalEvent ) throw (RuntimeException)
3797 : : {
3798 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
3799 [ # # ]: 0 : if( mxController.is() )
3800 [ # # ][ # # ]: 0 : mxController->click(xShape, aOriginalEvent );
3801 : 0 : }
3802 : :
3803 [ + - ][ + - ]: 75 : } // namespace ::sd
3804 : :
3805 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|