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