xref: /aoo4110/main/sd/source/ui/slideshow/showwin.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #include <com/sun/star/awt/Key.hpp>
28 
29 #include "showwindow.hxx"
30 
31 #include <unotools/syslocale.hxx>
32 #include <sfx2/viewfrm.hxx>
33 
34 
35 #include "res_bmp.hrc"
36 #include "slideshow.hxx"
37 #include "ViewShellBase.hxx"
38 #include "slideshow.hxx"
39 #include "sdresid.hxx"
40 #include "helpids.h"
41 #include "strings.hrc"
42 #include <vcl/virdev.hxx>
43 
44 using namespace ::com::sun::star;
45 
46 namespace sd {
47 
48 static const sal_uLong HIDE_MOUSE_TIMEOUT = 10000;
49 static const sal_uLong SHOW_MOUSE_TIMEOUT = 1000;
50 
51 // =============================================================================
52 
ShowWindow(const::rtl::Reference<SlideshowImpl> & xController,::Window * pParent)53 ShowWindow::ShowWindow( const ::rtl::Reference< SlideshowImpl >& xController, ::Window* pParent )
54 : ::sd::Window( pParent )
55 , mnPauseTimeout( SLIDE_NO_TIMEOUT )
56 , mnRestartPageIndex( PAGE_NO_END )
57 , meShowWindowMode(SHOWWINDOWMODE_NORMAL)
58 , mbShowNavigatorAfterSpecialMode( sal_False )
59 , mbMouseAutoHide(true)
60 , mbMouseCursorHidden(false)
61 , mnFirstMouseMove(0)
62 , mxController( xController )
63 {
64 	SetOutDevViewType( OUTDEV_VIEWTYPE_SLIDESHOW );
65 
66     // Do never mirror the preview window.  This explicitly includes right
67     // to left writing environments.
68     EnableRTL (sal_False);
69 
70 	MapMode aMap(GetMapMode());
71 	aMap.SetMapUnit(MAP_100TH_MM);
72 	SetMapMode(aMap);
73 
74 	// HelpId setzen
75 	SetHelpId( HID_SD_WIN_PRESENTATION );
76 	SetUniqueId( HID_SD_WIN_PRESENTATION );
77 
78 	maPauseTimer.SetTimeoutHdl( LINK( this, ShowWindow, PauseTimeoutHdl ) );
79 	maPauseTimer.SetTimeout( 1000 );
80 	maMouseTimer.SetTimeoutHdl( LINK( this, ShowWindow, MouseTimeoutHdl ) );
81 	maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
82 
83 	maShowBackground = Wallpaper( Color( COL_BLACK ) );
84 //	SetBackground( Wallpaper( Color( COL_BLACK ) ) );
85     SetBackground(); // avoids that VCL paints any background!
86 	GetParent()->Show();
87 	AddEventListener( LINK( this, ShowWindow, EventHdl ) );
88 }
89 
~ShowWindow(void)90 ShowWindow::~ShowWindow(void)
91 {
92 	maPauseTimer.Stop();
93 	maMouseTimer.Stop();
94 }
95 
96 /*************************************************************************
97 |*
98 |* Keyboard event
99 |*
100 \************************************************************************/
101 
KeyInput(const KeyEvent & rKEvt)102 void ShowWindow::KeyInput(const KeyEvent& rKEvt)
103 {
104 	sal_Bool bReturn = sal_False;
105 
106 	if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
107 	{
108 		TerminateShow();
109 		bReturn = true;
110 	}
111 	else if( SHOWWINDOWMODE_END == meShowWindowMode )
112 	{
113 		const int nKeyCode = rKEvt.GetKeyCode().GetCode();
114 		switch( nKeyCode )
115 		{
116 		case KEY_PAGEUP:
117 		case KEY_LEFT:
118 		case KEY_UP:
119 		case KEY_P:
120 		case KEY_HOME:
121 		case KEY_END:
122 		case awt::Key::CONTEXTMENU:
123 			// these keys will be handled by the slide show even
124 			// while in end mode
125 			break;
126 		default:
127 			TerminateShow();
128 			bReturn = true;
129 		}
130 	}
131 	else if( SHOWWINDOWMODE_BLANK == meShowWindowMode )
132 	{
133 		RestartShow();
134 		bReturn = true;
135 	}
136 	else if( SHOWWINDOWMODE_PAUSE == meShowWindowMode )
137 	{
138 		const int nKeyCode = rKEvt.GetKeyCode().GetCode();
139 		switch( nKeyCode )
140 		{
141 		case KEY_ESCAPE:
142 			TerminateShow();
143 			bReturn = true;
144 			break;
145 		case KEY_PAGEUP:
146 		case KEY_RIGHT:
147 		case KEY_UP:
148 		case KEY_P:
149 		case KEY_HOME:
150 		case KEY_END:
151 		case awt::Key::CONTEXTMENU:
152 			// these keys will be handled by the slide show even
153 			// while in end mode
154 			break;
155 		default:
156 			RestartShow();
157 			bReturn = true;
158 			break;
159 		}
160 	}
161 
162 	if( !bReturn )
163 	{
164 		if( mxController.is() )
165 			bReturn = mxController->keyInput(rKEvt);
166 
167 		if( !bReturn )
168 		{
169 			if( mpViewShell )
170 			{
171 				mpViewShell->KeyInput(rKEvt,this);
172 			}
173 			else
174 			{
175 				Window::KeyInput(rKEvt);
176 			}
177 		}
178 	}
179 
180 	if( mpViewShell )
181 		mpViewShell->SetActiveWindow( this );
182 }
183 
184 /*************************************************************************
185 |*
186 |* MouseButtonDown event
187 |*
188 \************************************************************************/
189 
MouseButtonDown(const MouseEvent &)190 void ShowWindow::MouseButtonDown(const MouseEvent& /*rMEvt*/)
191 {
192 	if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
193 	{
194 		TerminateShow();
195 	}
196 	else if( mpViewShell )
197 	{
198 		mpViewShell->SetActiveWindow( this );
199 	}
200 }
201 
202 /*************************************************************************
203 |*
204 |* MouseMove event
205 |*
206 \************************************************************************/
207 
MouseMove(const MouseEvent &)208 void ShowWindow::MouseMove(const MouseEvent& /*rMEvt*/)
209 {
210 	if( mbMouseAutoHide )
211 	{
212 		if( mbMouseCursorHidden )
213 		{
214 			if( mnFirstMouseMove )
215 			{
216 				// if this is not the first mouse move while hidden, see if
217 				// enough time has pasted to show mouse pointer again
218 				sal_uLong nTime = Time::GetSystemTicks();
219 				if( (nTime - mnFirstMouseMove) >= SHOW_MOUSE_TIMEOUT )
220 				{
221 					ShowPointer( sal_True );
222 					mnFirstMouseMove = 0;
223 					mbMouseCursorHidden = false;
224 					maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
225 					maMouseTimer.Start();
226 				}
227 			}
228 			else
229 			{
230 				// if this is the first mouse move, note current
231 				// time and start idle timer to cancel show mouse pointer
232 				// again if not enough mouse movement is measured
233 				mnFirstMouseMove = Time::GetSystemTicks();
234 				maMouseTimer.SetTimeout( 2*SHOW_MOUSE_TIMEOUT );
235 				maMouseTimer.Start();
236 			}
237 		}
238 		else
239 		{
240 			// current mousemove restarts the idle timer to hide the mouse
241 			maMouseTimer.Start();
242 		}
243 	}
244 
245 	if( mpViewShell )
246 		mpViewShell->SetActiveWindow( this );
247 }
248 
249 /*************************************************************************
250 |*
251 |* MouseButtonUp event
252 |*
253 \************************************************************************/
254 
MouseButtonUp(const MouseEvent & rMEvt)255 void ShowWindow::MouseButtonUp(const MouseEvent& rMEvt)
256 {
257 	if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
258 	{
259 		TerminateShow();
260 	}
261 	else if( (SHOWWINDOWMODE_END == meShowWindowMode) && !rMEvt.IsRight() )
262 	{
263 		TerminateShow();
264 	}
265 	else if( (( SHOWWINDOWMODE_BLANK == meShowWindowMode ) || ( SHOWWINDOWMODE_PAUSE == meShowWindowMode ))
266 			 && !rMEvt.IsRight() )
267 	{
268         RestartShow();
269 	}
270 	else
271 	{
272 		if( mxController.is() )
273 			mxController->mouseButtonUp( rMEvt );
274 	}
275 }
276 
277 /*************************************************************************
278 |*
279 |* Paint-Event: wenn FuSlideShow noch erreichbar ist, weiterleiten
280 |*
281 \************************************************************************/
282 
Paint(const Rectangle & rRect)283 void ShowWindow::Paint(const Rectangle& rRect)
284 {
285 	if( (meShowWindowMode == SHOWWINDOWMODE_NORMAL) || (meShowWindowMode == SHOWWINDOWMODE_PREVIEW) )
286 	{
287 /*
288 		Region aOldClipRegion( GetClipRegion() );
289 
290 		Region aClipRegion( rRect );
291 		aClipRegion.Exclude( maPresArea );
292 		SetClipRegion( aClipRegion );
293 
294 		DrawWallpaper( rRect, maShowBackground );
295 
296 		SetClipRegion( aOldClipRegion );
297 */
298 		if( mxController.is() )
299 		{
300 			mxController->paint(rRect);
301 		}
302 		else if(mpViewShell )
303 		{
304 			mpViewShell->Paint(rRect, this);
305 		}
306 	}
307 	else
308 	{
309 		DrawWallpaper( rRect, maShowBackground );
310 
311 		if( SHOWWINDOWMODE_END == meShowWindowMode )
312 		{
313 			DrawEndScene();
314 		}
315 		else if( SHOWWINDOWMODE_PAUSE == meShowWindowMode )
316 		{
317 			DrawPauseScene( sal_False );
318 		}
319 		else if( SHOWWINDOWMODE_BLANK == meShowWindowMode )
320 		{
321 			DrawBlankScene();
322 		}
323 	}
324 }
325 
326 /*************************************************************************
327 |*
328 |* Notify
329 |*
330 \************************************************************************/
331 
Notify(NotifyEvent & rNEvt)332 long ShowWindow::Notify(NotifyEvent& rNEvt)
333 {
334 	long nOK = sal_False;
335 /*
336 	if( mpViewShell && rNEvt.GetType() == EVENT_GETFOCUS )
337 	{
338 		NotifyEvent aNEvt(EVENT_GETFOCUS, this);
339 		nOK = mpViewShell->GetViewFrame()->GetWindow().Notify(aNEvt);
340 	}
341 */
342 	if (!nOK)
343 		nOK = Window::Notify(rNEvt);
344 
345 	return nOK;
346 }
347 
348 
349 // -----------------------------------------------------------------------------
350 
GetFocus()351 void ShowWindow::GetFocus()
352 {
353 	// Basisklasse
354 	Window::GetFocus();
355 /*
356 	if( mpViewShell )
357 	{
358 		NotifyEvent aNEvt(EVENT_GETFOCUS, this);
359 		mpViewShell->GetViewFrame()->GetWindow().Notify(aNEvt);
360 	}
361 */
362 }
363 
364 // -----------------------------------------------------------------------------
365 
LoseFocus()366 void ShowWindow::LoseFocus()
367 {
368 	Window::LoseFocus();
369 
370 	if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode)
371 		TerminateShow();
372 }
373 
374 // -----------------------------------------------------------------------------
375 
Resize()376 void ShowWindow::Resize()
377 {
378 	::sd::Window::Resize();
379 }
380 
381 // -----------------------------------------------------------------------------
382 
Move()383 void ShowWindow::Move()
384 {
385 	::sd::Window::Move();
386 }
387 
388 // -----------------------------------------------------------------------------
389 
SetEndMode()390 sal_Bool ShowWindow::SetEndMode()
391 {
392 	if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
393 	{
394 		DeleteWindowFromPaintView();
395 		meShowWindowMode = SHOWWINDOWMODE_END;
396 //		maShowBackground = GetBackground();
397 //		SetBackground( Wallpaper( Color( COL_BLACK ) ) );
398 		maShowBackground = Wallpaper( Color( COL_BLACK ) );
399 
400 		// hide navigator if it is visible
401 		if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
402 		{
403 			mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
404 			mbShowNavigatorAfterSpecialMode = sal_True;
405 		}
406 
407 		Invalidate();
408 	}
409 
410 	return( SHOWWINDOWMODE_END == meShowWindowMode );
411 }
412 
413 // -----------------------------------------------------------------------------
414 
SetPauseMode(sal_Int32 nPageIndexToRestart,sal_Int32 nTimeout,Graphic * pLogo)415 sal_Bool ShowWindow::SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeout, Graphic* pLogo )
416 {
417 	rtl::Reference< SlideShow > xSlideShow;
418 
419 	if( mpViewShell )
420 		xSlideShow = SlideShow::GetSlideShow( mpViewShell->GetViewShellBase() );
421 
422 	if( xSlideShow.is() && !nTimeout )
423 	{
424 		xSlideShow->jumpToPageIndex( nPageIndexToRestart );
425 	}
426 	else if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
427 	{
428 		DeleteWindowFromPaintView();
429 		mnPauseTimeout = nTimeout;
430 		mnRestartPageIndex = nPageIndexToRestart;
431 		meShowWindowMode = SHOWWINDOWMODE_PAUSE;
432 //		maShowBackground = GetBackground();
433 //		SetBackground( Wallpaper( Color( COL_BLACK ) ) );
434 		maShowBackground = Wallpaper( Color( COL_BLACK ) );
435 
436 		// hide navigator if it is visible
437 		if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
438 		{
439 			mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
440 			mbShowNavigatorAfterSpecialMode = sal_True;
441 		}
442 
443 		if( pLogo )
444 			maLogo = *pLogo;
445 
446 		Invalidate();
447 
448 		if( SLIDE_NO_TIMEOUT != mnPauseTimeout )
449 			maPauseTimer.Start();
450 	}
451 
452 	return( SHOWWINDOWMODE_PAUSE == meShowWindowMode );
453 }
454 
455 // -----------------------------------------------------------------------------
456 
SetBlankMode(sal_Int32 nPageIndexToRestart,const Color & rBlankColor)457 sal_Bool ShowWindow::SetBlankMode( sal_Int32 nPageIndexToRestart, const Color& rBlankColor )
458 {
459     if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
460 	{
461 		DeleteWindowFromPaintView();
462 		mnRestartPageIndex = nPageIndexToRestart;
463 		meShowWindowMode = SHOWWINDOWMODE_BLANK;
464 //		maShowBackground = GetBackground();
465 //		SetBackground( Wallpaper( rBlankColor ) );
466 		maShowBackground = Wallpaper( rBlankColor );
467 
468 		// hide navigator if it is visible
469 		if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
470 		{
471 			mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
472 			mbShowNavigatorAfterSpecialMode = sal_True;
473 		}
474 
475 		Invalidate();
476 	}
477 
478 	return( SHOWWINDOWMODE_BLANK == meShowWindowMode );
479 }
480 
481 // -----------------------------------------------------------------------------
482 
SetPreviewMode()483 void ShowWindow::SetPreviewMode()
484 {
485 	meShowWindowMode = SHOWWINDOWMODE_PREVIEW;
486 }
487 
488 // -----------------------------------------------------------------------------
489 
TerminateShow()490 void ShowWindow::TerminateShow()
491 {
492 	maLogo.Clear();
493 	maPauseTimer.Stop();
494 	maMouseTimer.Stop();
495 	Erase();
496 //	SetBackground( maShowBackground );
497 	maShowBackground = Wallpaper( Color( COL_BLACK ) );
498     meShowWindowMode = SHOWWINDOWMODE_NORMAL;
499 	mnPauseTimeout = SLIDE_NO_TIMEOUT;
500 
501 	if( mpViewShell )
502 	{
503 		// show navigator?
504 		if( mbShowNavigatorAfterSpecialMode )
505 		{
506 			mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_True );
507 			mbShowNavigatorAfterSpecialMode = sal_False;
508 		}
509 	}
510 
511 	if( mxController.is() )
512 		mxController->endPresentation();
513 
514 	mnRestartPageIndex = PAGE_NO_END;
515 }
516 
517 // -----------------------------------------------------------------------------
518 
RestartShow()519 void ShowWindow::RestartShow()
520 {
521 	RestartShow( mnRestartPageIndex );
522 }
523 
524 // -----------------------------------------------------------------------------
525 
RestartShow(sal_Int32 nPageIndexToRestart)526 void ShowWindow::RestartShow( sal_Int32 nPageIndexToRestart )
527 
528 {
529     ShowWindowMode eOldShowWindowMode = meShowWindowMode;
530 
531 	maLogo.Clear();
532 	maPauseTimer.Stop();
533 	Erase();
534 //	SetBackground( maShowBackground );
535 	maShowBackground = Wallpaper( Color( COL_BLACK ) );
536 	meShowWindowMode = SHOWWINDOWMODE_NORMAL;
537 	mnPauseTimeout = SLIDE_NO_TIMEOUT;
538 
539 	if( mpViewShell )
540 	{
541 		rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( mpViewShell->GetViewShellBase() ) );
542 
543  		if( xSlideShow.is() )
544 		{
545 			AddWindowToPaintView();
546 
547 		    if( SHOWWINDOWMODE_BLANK == eOldShowWindowMode )
548 			{
549 				xSlideShow->pause(false);
550 				Invalidate();
551 			}
552 		    else
553 			{
554 				xSlideShow->jumpToPageIndex( nPageIndexToRestart );
555 			}
556 		}
557 	}
558 
559 	mnRestartPageIndex = PAGE_NO_END;
560 
561 	// show navigator?
562 	if( mbShowNavigatorAfterSpecialMode )
563 	{
564 		mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_True );
565 		mbShowNavigatorAfterSpecialMode = sal_False;
566 	}
567 }
568 
569 // -----------------------------------------------------------------------------
570 
DrawPauseScene(sal_Bool bTimeoutOnly)571 void ShowWindow::DrawPauseScene( sal_Bool bTimeoutOnly )
572 {
573 	const MapMode&	rMap = GetMapMode();
574 	const Point		aOutOrg( PixelToLogic( Point() ) );
575 	const Size		aOutSize( GetOutputSize() );
576 	const Size		aTextSize( LogicToLogic( Size( 0, 14 ), MAP_POINT, rMap ) );
577 	const Size		aOffset( LogicToLogic( Size( 1000, 1000 ), MAP_100TH_MM, rMap ) );
578 	String			aText( SdResId( STR_PRES_PAUSE ) );
579 	sal_Bool			bDrawn = sal_False;
580 
581 	Font 			aFont( GetSettings().GetStyleSettings().GetMenuFont() );
582 	const Font 		aOldFont( GetFont() );
583 
584 	aFont.SetSize( aTextSize );
585 	aFont.SetColor( COL_WHITE );
586 	aFont.SetCharSet( aOldFont.GetCharSet() );
587 	aFont.SetLanguage( aOldFont.GetLanguage() );
588 
589 	if( !bTimeoutOnly && ( maLogo.GetType() != GRAPHIC_NONE ) )
590 	{
591 		Size aGrfSize;
592 
593 		if( maLogo.GetPrefMapMode() == MAP_PIXEL )
594 			aGrfSize = PixelToLogic( maLogo.GetPrefSize() );
595 		else
596 			aGrfSize = LogicToLogic( maLogo.GetPrefSize(), maLogo.GetPrefMapMode(), rMap );
597 
598 		const Point	aGrfPos( Max( aOutOrg.X() + aOutSize.Width() - aGrfSize.Width() - aOffset.Width(), aOutOrg.X() ),
599 							 Max( aOutOrg.Y() + aOutSize.Height() - aGrfSize.Height() - aOffset.Height(), aOutOrg.Y() ) );
600 
601 		if( maLogo.IsAnimated() )
602 			maLogo.StartAnimation( this, aGrfPos, aGrfSize, (long) this );
603 		else
604 			maLogo.Draw( this, aGrfPos, aGrfSize );
605 	}
606 
607 	if( SLIDE_NO_TIMEOUT != mnPauseTimeout )
608 	{
609 		MapMode			aVMap( rMap );
610 		VirtualDevice	aVDev( *this );
611 
612 		aVMap.SetOrigin( Point() );
613 		aVDev.SetMapMode( aVMap );
614 		aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) );
615 
616 		// set font first, to determine real output height
617 		aVDev.SetFont( aFont );
618 
619 		const Size aVDevSize( aOutSize.Width(), aVDev.GetTextHeight() );
620 
621 		if( aVDev.SetOutputSize( aVDevSize ) )
622 		{
623 			// Note: if performance gets an issue here, we can use NumberFormatter directly
624 			SvtSysLocale				aSysLocale;
625 			const LocaleDataWrapper&    aLocaleData = aSysLocale.GetLocaleData();
626 
627 			aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " ( " ));
628 			aText += aLocaleData.getDuration( Time( 0, 0, mnPauseTimeout ) );
629 			aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " )" ));
630 			aVDev.DrawText( Point( aOffset.Width(), 0 ), aText );
631 			DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, aVDev );
632 			bDrawn = sal_True;
633 		}
634 	}
635 
636 	if( !bDrawn )
637 	{
638 		SetFont( aFont );
639 		DrawText( Point( aOutOrg.X() + aOffset.Width(), aOutOrg.Y() + aOffset.Height() ), aText );
640 		SetFont( aOldFont );
641 	}
642 }
643 
644 // -----------------------------------------------------------------------------
645 
DrawEndScene()646 void ShowWindow::DrawEndScene()
647 {
648 	const Font		aOldFont( GetFont() );
649 	Font			aFont( GetSettings().GetStyleSettings().GetMenuFont() );
650 
651 	const Point		aOutOrg( PixelToLogic( Point() ) );
652 	const Size		aTextSize( LogicToLogic( Size( 0, 14 ), MAP_POINT, GetMapMode() ) );
653 	const String	aText( SdResId( STR_PRES_SOFTEND ) );
654 
655 	aFont.SetSize( aTextSize );
656 	aFont.SetColor( COL_WHITE );
657 	aFont.SetCharSet( aOldFont.GetCharSet() );
658 	aFont.SetLanguage( aOldFont.GetLanguage() );
659 	SetFont( aFont );
660 	DrawText( Point( aOutOrg.X() + aTextSize.Height(), aOutOrg.Y() + aTextSize.Height() ), aText );
661 	SetFont( aOldFont );
662 }
663 
664 // -----------------------------------------------------------------------------
665 
DrawBlankScene()666 void ShowWindow::DrawBlankScene()
667 {
668     // just blank through background color => nothing to be done here
669 }
670 
671 // -----------------------------------------------------------------------------
672 
IMPL_LINK(ShowWindow,PauseTimeoutHdl,Timer *,pTimer)673 IMPL_LINK( ShowWindow, PauseTimeoutHdl, Timer*, pTimer )
674 {
675 	if( !( --mnPauseTimeout ) )
676 		RestartShow();
677 	else
678 	{
679 		DrawPauseScene( sal_True );
680 		pTimer->Start();
681 	}
682 
683 	return 0L;
684 }
685 
IMPL_LINK(ShowWindow,MouseTimeoutHdl,Timer *,EMPTYARG)686 IMPL_LINK( ShowWindow, MouseTimeoutHdl, Timer*, EMPTYARG )
687 {
688 	if( mbMouseCursorHidden )
689 	{
690 		// not enough mouse movements since first recording so
691 		// cancle show mouse pointer for now
692 		mnFirstMouseMove = 0;
693 	}
694 	else
695 	{
696 		// mouse has been idle to long, hide pointer
697 		ShowPointer( sal_False );
698 		mbMouseCursorHidden = true;
699 	}
700 	return 0L;
701 }
702 
IMPL_LINK(ShowWindow,EventHdl,VclWindowEvent *,pEvent)703 IMPL_LINK( ShowWindow, EventHdl, VclWindowEvent*, pEvent )
704 {
705 	if( mbMouseAutoHide )
706 	{
707 		if (pEvent->GetId() == VCLEVENT_WINDOW_SHOW)
708 		{
709 			maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
710 			maMouseTimer.Start();
711 		}
712 	}
713 	return 0L;
714 }
715 
SetPresentationArea(const Rectangle & rPresArea)716 void ShowWindow::SetPresentationArea( const Rectangle& rPresArea )
717 {
718 	maPresArea = rPresArea;
719 }
720 
DeleteWindowFromPaintView()721 void ShowWindow::DeleteWindowFromPaintView()
722 {
723 	if( mpViewShell->GetView() )
724 		mpViewShell->GetView()->DeleteWindowFromPaintView( this );
725 
726     sal_uInt16 nChild = GetChildCount();
727 	while( nChild-- )
728 		GetChild( nChild )->Show( sal_False );
729 }
730 
AddWindowToPaintView()731 void ShowWindow::AddWindowToPaintView()
732 {
733 	if( mpViewShell->GetView() )
734 		mpViewShell->GetView()->AddWindowToPaintView( this );
735 
736     sal_uInt16 nChild = GetChildCount();
737 	while( nChild-- )
738 		GetChild( nChild )->Show( sal_True );
739 }
740 
741 // Overload the sd::Window's CreateAccessible to create a different accessible object
742 ::com::sun::star::uno::Reference<
743     ::com::sun::star::accessibility::XAccessible>
CreateAccessible(void)744     ShowWindow::CreateAccessible (void)
745 {
746 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc = GetAccessible(sal_False);
747 	if (xAcc.get())
748 	{
749 		return xAcc;
750 	}
751     if (mpViewShell != NULL)
752 	{
753 		xAcc = mpViewShell->CreateAccessibleDocumentView (this);
754 		SetAccessible(xAcc);
755 		return xAcc;
756 	}
757     else
758     {
759         OSL_TRACE ("::sd::Window::CreateAccessible: no view shell");
760 	return ::Window::CreateAccessible ();
761     }
762 }
763 } // end of namespace sd
764