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