/src/libreoffice/sd/source/ui/slideshow/showwin.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #include <com/sun/star/awt/Key.hpp> |
21 | | |
22 | | #include "showwindow.hxx" |
23 | | #include "slideshowimpl.hxx" |
24 | | |
25 | | #include <unotools/localedatawrapper.hxx> |
26 | | #include <unotools/syslocale.hxx> |
27 | | #include <sfx2/viewfrm.hxx> |
28 | | #include <sfx2/sfxsids.hrc> |
29 | | |
30 | | |
31 | | #include <slideshow.hxx> |
32 | | #include <ViewShell.hxx> |
33 | | #include <sdresid.hxx> |
34 | | #include <helpids.h> |
35 | | #include <strings.hrc> |
36 | | |
37 | | #include <sal/log.hxx> |
38 | | #include <utility> |
39 | | #include <vcl/settings.hxx> |
40 | | #include <vcl/virdev.hxx> |
41 | | #include <tools/duration.hxx> |
42 | | |
43 | | using namespace ::com::sun::star; |
44 | | |
45 | | namespace sd { |
46 | | |
47 | | const sal_uInt64 HIDE_MOUSE_TIMEOUT = 10000; |
48 | | const sal_uInt64 SHOW_MOUSE_TIMEOUT = 1000; |
49 | | |
50 | | ShowWindow::ShowWindow( ::rtl::Reference< SlideshowImpl > xController, vcl::Window* pParent ) |
51 | 0 | : ::sd::Window( pParent ) |
52 | 0 | , maPauseTimer("sd ShowWindow maPauseTimer") |
53 | 0 | , maMouseTimer("sd ShowWindow maMouseTimer") |
54 | | , mnPauseTimeout( SLIDE_NO_TIMEOUT ) |
55 | 0 | , mnRestartPageIndex( PAGE_NO_END ) |
56 | 0 | , meShowWindowMode(SHOWWINDOWMODE_NORMAL) |
57 | 0 | , mbShowNavigatorAfterSpecialMode( false ) |
58 | 0 | , mbMouseAutoHide(true) |
59 | 0 | , mbMouseCursorHidden(false) |
60 | 0 | , mnFirstMouseMove(0) |
61 | 0 | , mxController(std::move( xController )) |
62 | 0 | { |
63 | 0 | GetOutDev()->SetOutDevViewType( OutDevViewType::SlideShow ); |
64 | | |
65 | | // Do never mirror the preview window. This explicitly includes right |
66 | | // to left writing environments. |
67 | 0 | EnableRTL (false); |
68 | |
|
69 | 0 | MapMode aMap(GetMapMode()); |
70 | 0 | aMap.SetMapUnit(MapUnit::Map100thMM); |
71 | 0 | SetMapMode(aMap); |
72 | | |
73 | | // set HelpId |
74 | 0 | SetHelpId( HID_SD_WIN_PRESENTATION ); |
75 | |
|
76 | 0 | maPauseTimer.SetInvokeHandler( LINK( this, ShowWindow, PauseTimeoutHdl ) ); |
77 | 0 | maPauseTimer.SetTimeout( 1000 ); |
78 | 0 | maMouseTimer.SetInvokeHandler( LINK( this, ShowWindow, MouseTimeoutHdl ) ); |
79 | 0 | maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT ); |
80 | |
|
81 | 0 | maShowBackground = Wallpaper( COL_BLACK ); |
82 | 0 | SetBackground(); // avoids that VCL paints any background! |
83 | 0 | GetParent()->Show(); |
84 | 0 | AddEventListener( LINK( this, ShowWindow, EventHdl ) ); |
85 | 0 | } Unexecuted instantiation: sd::ShowWindow::ShowWindow(rtl::Reference<sd::SlideshowImpl>, vcl::Window*) Unexecuted instantiation: sd::ShowWindow::ShowWindow(rtl::Reference<sd::SlideshowImpl>, vcl::Window*) |
86 | | |
87 | | ShowWindow::~ShowWindow() |
88 | 0 | { |
89 | 0 | disposeOnce(); |
90 | 0 | } |
91 | | |
92 | | void ShowWindow::dispose() |
93 | 0 | { |
94 | 0 | maPauseTimer.Stop(); |
95 | 0 | maMouseTimer.Stop(); |
96 | 0 | ::sd::Window::dispose(); |
97 | 0 | } |
98 | | |
99 | | void ShowWindow::KeyInput(const KeyEvent& rKEvt) |
100 | 0 | { |
101 | 0 | bool bReturn = false; |
102 | |
|
103 | 0 | if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode ) |
104 | 0 | { |
105 | 0 | TerminateShow(); |
106 | 0 | bReturn = true; |
107 | 0 | } |
108 | 0 | else if( SHOWWINDOWMODE_END == meShowWindowMode ) |
109 | 0 | { |
110 | 0 | const int nKeyCode = rKEvt.GetKeyCode().GetCode(); |
111 | 0 | switch( nKeyCode ) |
112 | 0 | { |
113 | 0 | case KEY_PAGEUP: |
114 | 0 | case KEY_LEFT: |
115 | 0 | case KEY_UP: |
116 | 0 | case KEY_P: |
117 | 0 | case KEY_HOME: |
118 | 0 | case KEY_END: |
119 | 0 | case awt::Key::CONTEXTMENU: |
120 | | // these keys will be handled by the slide show even |
121 | | // while in end mode |
122 | 0 | break; |
123 | 0 | default: |
124 | 0 | TerminateShow(); |
125 | 0 | bReturn = true; |
126 | 0 | } |
127 | 0 | } |
128 | 0 | else if( SHOWWINDOWMODE_BLANK == meShowWindowMode ) |
129 | 0 | { |
130 | 0 | RestartShow(); |
131 | 0 | bReturn = true; |
132 | 0 | } |
133 | 0 | else if( SHOWWINDOWMODE_PAUSE == meShowWindowMode ) |
134 | 0 | { |
135 | 0 | const int nKeyCode = rKEvt.GetKeyCode().GetCode(); |
136 | 0 | switch( nKeyCode ) |
137 | 0 | { |
138 | 0 | case KEY_ESCAPE: |
139 | 0 | TerminateShow(); |
140 | 0 | bReturn = true; |
141 | 0 | break; |
142 | 0 | case KEY_PAGEUP: |
143 | 0 | case KEY_RIGHT: |
144 | 0 | case KEY_UP: |
145 | 0 | case KEY_P: |
146 | 0 | case KEY_HOME: |
147 | 0 | case KEY_END: |
148 | 0 | case awt::Key::CONTEXTMENU: |
149 | | // these keys will be handled by the slide show even |
150 | | // while in end mode |
151 | 0 | break; |
152 | 0 | default: |
153 | 0 | RestartShow(); |
154 | 0 | bReturn = true; |
155 | 0 | break; |
156 | 0 | } |
157 | 0 | } |
158 | | |
159 | 0 | if( !bReturn ) |
160 | 0 | { |
161 | 0 | if( mxController.is() ) |
162 | 0 | bReturn = mxController->keyInput(rKEvt); |
163 | |
|
164 | 0 | if( !bReturn ) |
165 | 0 | { |
166 | 0 | if( mpViewShell ) |
167 | 0 | { |
168 | 0 | mpViewShell->KeyInput(rKEvt,this); |
169 | 0 | } |
170 | 0 | else |
171 | 0 | { |
172 | 0 | Window::KeyInput(rKEvt); |
173 | 0 | } |
174 | 0 | } |
175 | 0 | } |
176 | |
|
177 | 0 | if( mpViewShell ) |
178 | 0 | mpViewShell->SetActiveWindow( this ); |
179 | 0 | } |
180 | | |
181 | | void ShowWindow::MouseButtonDown(const MouseEvent& /*rMEvt*/) |
182 | 0 | { |
183 | 0 | if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode ) |
184 | 0 | { |
185 | 0 | TerminateShow(); |
186 | 0 | } |
187 | 0 | else if( mpViewShell ) |
188 | 0 | { |
189 | 0 | mpViewShell->SetActiveWindow( this ); |
190 | 0 | } |
191 | 0 | } |
192 | | |
193 | | void ShowWindow::MouseMove(const MouseEvent& /*rMEvt*/) |
194 | 0 | { |
195 | 0 | if( mbMouseAutoHide ) |
196 | 0 | { |
197 | 0 | if( mbMouseCursorHidden ) |
198 | 0 | { |
199 | 0 | if( mnFirstMouseMove ) |
200 | 0 | { |
201 | | // if this is not the first mouse move while hidden, see if |
202 | | // enough time has pasted to show mouse pointer again |
203 | 0 | sal_uInt64 nTime = ::tools::Time::GetSystemTicks(); |
204 | 0 | if( (nTime - mnFirstMouseMove) >= SHOW_MOUSE_TIMEOUT ) |
205 | 0 | { |
206 | 0 | ShowPointer( true ); |
207 | 0 | mnFirstMouseMove = 0; |
208 | 0 | mbMouseCursorHidden = false; |
209 | 0 | maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT ); |
210 | 0 | maMouseTimer.Start(); |
211 | 0 | } |
212 | 0 | } |
213 | 0 | else |
214 | 0 | { |
215 | | // if this is the first mouse move, note current |
216 | | // time and start idle timer to cancel show mouse pointer |
217 | | // again if not enough mouse movement is measured |
218 | 0 | mnFirstMouseMove = ::tools::Time::GetSystemTicks(); |
219 | 0 | maMouseTimer.SetTimeout( 2*SHOW_MOUSE_TIMEOUT ); |
220 | 0 | maMouseTimer.Start(); |
221 | 0 | } |
222 | 0 | } |
223 | 0 | else |
224 | 0 | { |
225 | | // current mousemove restarts the idle timer to hide the mouse |
226 | 0 | maMouseTimer.Start(); |
227 | 0 | } |
228 | 0 | } |
229 | |
|
230 | 0 | if( mpViewShell ) |
231 | 0 | mpViewShell->SetActiveWindow( this ); |
232 | 0 | } |
233 | | |
234 | | void ShowWindow::MouseButtonUp(const MouseEvent& rMEvt) |
235 | 0 | { |
236 | 0 | if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode ) |
237 | 0 | { |
238 | 0 | TerminateShow(); |
239 | 0 | } |
240 | 0 | else if( (SHOWWINDOWMODE_END == meShowWindowMode) && !rMEvt.IsRight() ) |
241 | 0 | { |
242 | 0 | TerminateShow(); |
243 | 0 | } |
244 | 0 | else if( (( SHOWWINDOWMODE_BLANK == meShowWindowMode ) || ( SHOWWINDOWMODE_PAUSE == meShowWindowMode )) |
245 | 0 | && !rMEvt.IsRight() ) |
246 | 0 | { |
247 | 0 | RestartShow(); |
248 | 0 | } |
249 | 0 | else |
250 | 0 | { |
251 | 0 | if( mxController.is() ) |
252 | 0 | mxController->mouseButtonUp( rMEvt ); |
253 | 0 | } |
254 | 0 | } |
255 | | |
256 | | /** |
257 | | * if FuSlideShow is still available, forward it |
258 | | */ |
259 | | void ShowWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const ::tools::Rectangle& rRect) |
260 | 0 | { |
261 | 0 | if( (meShowWindowMode == SHOWWINDOWMODE_NORMAL) || (meShowWindowMode == SHOWWINDOWMODE_PREVIEW) ) |
262 | 0 | { |
263 | 0 | if( mxController.is() ) |
264 | 0 | { |
265 | 0 | mxController->paint(); |
266 | 0 | } |
267 | 0 | else if(mpViewShell ) |
268 | 0 | { |
269 | 0 | mpViewShell->Paint(rRect, this); |
270 | 0 | } |
271 | 0 | } |
272 | 0 | else |
273 | 0 | { |
274 | 0 | GetOutDev()->DrawWallpaper( rRect, maShowBackground ); |
275 | |
|
276 | 0 | if( SHOWWINDOWMODE_END == meShowWindowMode ) |
277 | 0 | { |
278 | 0 | DrawEndScene(); |
279 | 0 | } |
280 | 0 | else if( SHOWWINDOWMODE_PAUSE == meShowWindowMode ) |
281 | 0 | { |
282 | 0 | DrawPauseScene( false ); |
283 | 0 | } |
284 | 0 | else if( SHOWWINDOWMODE_BLANK == meShowWindowMode ) |
285 | 0 | { |
286 | | // just blank through background color => nothing to be done here |
287 | 0 | } |
288 | 0 | } |
289 | 0 | } |
290 | | |
291 | | void ShowWindow::LoseFocus() |
292 | 0 | { |
293 | 0 | Window::LoseFocus(); |
294 | |
|
295 | 0 | if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode) |
296 | 0 | TerminateShow(); |
297 | 0 | } |
298 | | |
299 | | void ShowWindow::SetEndMode() |
300 | 0 | { |
301 | 0 | if( !(( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView()) ) |
302 | 0 | return; |
303 | | |
304 | 0 | DeleteWindowFromPaintView(); |
305 | 0 | meShowWindowMode = SHOWWINDOWMODE_END; |
306 | 0 | maShowBackground = Wallpaper( COL_BLACK ); |
307 | | |
308 | | // hide navigator if it is visible |
309 | 0 | if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) ) |
310 | 0 | { |
311 | 0 | mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, false ); |
312 | 0 | mbShowNavigatorAfterSpecialMode = true; |
313 | 0 | } |
314 | |
|
315 | 0 | Invalidate(); |
316 | 0 | } |
317 | | |
318 | | bool ShowWindow::SetPauseMode( sal_Int32 nTimeout, Graphic const * pLogo ) |
319 | 0 | { |
320 | 0 | rtl::Reference< SlideShow > xSlideShow; |
321 | |
|
322 | 0 | if( mpViewShell ) |
323 | 0 | xSlideShow = SlideShow::GetSlideShow( mpViewShell->GetViewShellBase() ); |
324 | |
|
325 | 0 | if( xSlideShow.is() && !nTimeout ) |
326 | 0 | { |
327 | 0 | xSlideShow->jumpToPageIndex( 0 ); |
328 | 0 | } |
329 | 0 | else if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() ) |
330 | 0 | { |
331 | 0 | DeleteWindowFromPaintView(); |
332 | 0 | mnPauseTimeout = nTimeout; |
333 | 0 | mnRestartPageIndex = 0; |
334 | 0 | meShowWindowMode = SHOWWINDOWMODE_PAUSE; |
335 | 0 | maShowBackground = Wallpaper( COL_BLACK ); |
336 | | |
337 | | // hide navigator if it is visible |
338 | 0 | if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) ) |
339 | 0 | { |
340 | 0 | mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, false ); |
341 | 0 | mbShowNavigatorAfterSpecialMode = true; |
342 | 0 | } |
343 | |
|
344 | 0 | if( pLogo ) |
345 | 0 | maLogo = *pLogo; |
346 | |
|
347 | 0 | Invalidate(); |
348 | |
|
349 | 0 | if( SLIDE_NO_TIMEOUT != mnPauseTimeout ) |
350 | 0 | maPauseTimer.Start(); |
351 | 0 | } |
352 | |
|
353 | 0 | return( SHOWWINDOWMODE_PAUSE == meShowWindowMode ); |
354 | 0 | } |
355 | | |
356 | | bool ShowWindow::SetBlankMode( sal_Int32 nPageIndexToRestart, const Color& rBlankColor ) |
357 | 0 | { |
358 | 0 | if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() ) |
359 | 0 | { |
360 | 0 | DeleteWindowFromPaintView(); |
361 | 0 | mnRestartPageIndex = nPageIndexToRestart; |
362 | 0 | meShowWindowMode = SHOWWINDOWMODE_BLANK; |
363 | 0 | maShowBackground = Wallpaper( rBlankColor ); |
364 | | |
365 | | // hide navigator if it is visible |
366 | 0 | if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) ) |
367 | 0 | { |
368 | 0 | mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, false ); |
369 | 0 | mbShowNavigatorAfterSpecialMode = true; |
370 | 0 | } |
371 | |
|
372 | 0 | Invalidate(); |
373 | 0 | } |
374 | |
|
375 | 0 | return( SHOWWINDOWMODE_BLANK == meShowWindowMode ); |
376 | 0 | } |
377 | | |
378 | | void ShowWindow::SetPreviewMode() |
379 | 0 | { |
380 | 0 | meShowWindowMode = SHOWWINDOWMODE_PREVIEW; |
381 | 0 | } |
382 | | |
383 | | void ShowWindow::TerminateShow() |
384 | 0 | { |
385 | 0 | maLogo.Clear(); |
386 | 0 | maPauseTimer.Stop(); |
387 | 0 | maMouseTimer.Stop(); |
388 | 0 | GetOutDev()->Erase(); |
389 | 0 | maShowBackground = Wallpaper( COL_BLACK ); |
390 | 0 | meShowWindowMode = SHOWWINDOWMODE_NORMAL; |
391 | 0 | mnPauseTimeout = SLIDE_NO_TIMEOUT; |
392 | |
|
393 | 0 | if( mpViewShell ) |
394 | 0 | { |
395 | | // show navigator? |
396 | 0 | if( mbShowNavigatorAfterSpecialMode ) |
397 | 0 | { |
398 | 0 | mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR ); |
399 | 0 | mbShowNavigatorAfterSpecialMode = false; |
400 | 0 | } |
401 | 0 | } |
402 | |
|
403 | 0 | if( mxController.is() ) |
404 | 0 | mxController->endPresentation(); |
405 | |
|
406 | 0 | mnRestartPageIndex = PAGE_NO_END; |
407 | 0 | } |
408 | | |
409 | | void ShowWindow::RestartShow() |
410 | 0 | { |
411 | 0 | RestartShow( mnRestartPageIndex ); |
412 | 0 | } |
413 | | |
414 | | void ShowWindow::RestartShow( sal_Int32 nPageIndexToRestart ) |
415 | 0 | { |
416 | 0 | ShowWindowMode eOldShowWindowMode = meShowWindowMode; |
417 | |
|
418 | 0 | maLogo.Clear(); |
419 | 0 | maPauseTimer.Stop(); |
420 | 0 | GetOutDev()->Erase(); |
421 | 0 | maShowBackground = Wallpaper( COL_BLACK ); |
422 | 0 | meShowWindowMode = SHOWWINDOWMODE_NORMAL; |
423 | 0 | mnPauseTimeout = SLIDE_NO_TIMEOUT; |
424 | |
|
425 | 0 | if( mpViewShell ) |
426 | 0 | { |
427 | 0 | rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( mpViewShell->GetViewShellBase() ) ); |
428 | |
|
429 | 0 | if( xSlideShow.is() ) |
430 | 0 | { |
431 | 0 | AddWindowToPaintView(); |
432 | |
|
433 | 0 | if( SHOWWINDOWMODE_BLANK == eOldShowWindowMode || SHOWWINDOWMODE_END == eOldShowWindowMode ) |
434 | 0 | { |
435 | 0 | xSlideShow->pause(false); |
436 | 0 | Invalidate(); |
437 | 0 | } |
438 | 0 | else |
439 | 0 | { |
440 | 0 | xSlideShow->jumpToPageIndex( nPageIndexToRestart ); |
441 | 0 | } |
442 | 0 | } |
443 | 0 | } |
444 | |
|
445 | 0 | mnRestartPageIndex = PAGE_NO_END; |
446 | | |
447 | | // show navigator? |
448 | 0 | if( mbShowNavigatorAfterSpecialMode ) |
449 | 0 | { |
450 | 0 | if (mpViewShell) |
451 | 0 | mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR ); |
452 | 0 | mbShowNavigatorAfterSpecialMode = false; |
453 | 0 | } |
454 | 0 | } |
455 | | |
456 | | void ShowWindow::DrawPauseScene( bool bTimeoutOnly ) |
457 | 0 | { |
458 | 0 | const MapMode& rMap = GetMapMode(); |
459 | 0 | const Point aOutOrg( PixelToLogic( Point() ) ); |
460 | 0 | const Size aOutSize( GetOutDev()->GetOutputSize() ); |
461 | 0 | const Size aTextSize(OutputDevice::LogicToLogic(Size(0, 14), MapMode(MapUnit::MapPoint), rMap)); |
462 | 0 | const Size aOffset(OutputDevice::LogicToLogic(Size(1000, 1000), MapMode(MapUnit::Map100thMM), rMap)); |
463 | 0 | OUString aText( SdResId( STR_PRES_PAUSE ) ); |
464 | 0 | bool bDrawn = false; |
465 | |
|
466 | 0 | vcl::Font aFont( GetSettings().GetStyleSettings().GetMenuFont() ); |
467 | 0 | const vcl::Font aOldFont( GetFont() ); |
468 | |
|
469 | 0 | aFont.SetFontSize( aTextSize ); |
470 | 0 | aFont.SetColor( COL_WHITE ); |
471 | 0 | aFont.SetCharSet( aOldFont.GetCharSet() ); |
472 | 0 | aFont.SetLanguage( aOldFont.GetLanguage() ); |
473 | |
|
474 | 0 | if( !bTimeoutOnly && ( maLogo.GetType() != GraphicType::NONE ) ) |
475 | 0 | { |
476 | 0 | Size aGrfSize; |
477 | |
|
478 | 0 | if (maLogo.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel) |
479 | 0 | aGrfSize = PixelToLogic( maLogo.GetPrefSize() ); |
480 | 0 | else |
481 | 0 | aGrfSize = OutputDevice::LogicToLogic( maLogo.GetPrefSize(), maLogo.GetPrefMapMode(), rMap ); |
482 | |
|
483 | 0 | const Point aGrfPos( std::max( aOutOrg.X() + aOutSize.Width() - aGrfSize.Width() - aOffset.Width(), aOutOrg.X() ), |
484 | 0 | std::max( aOutOrg.Y() + aOutSize.Height() - aGrfSize.Height() - aOffset.Height(), aOutOrg.Y() ) ); |
485 | |
|
486 | 0 | if( maLogo.IsAnimated() ) |
487 | 0 | maLogo.StartAnimation(*GetOutDev(), aGrfPos, aGrfSize, reinterpret_cast<sal_IntPtr>(this)); |
488 | 0 | else |
489 | 0 | maLogo.Draw(*GetOutDev(), aGrfPos, aGrfSize); |
490 | 0 | } |
491 | |
|
492 | 0 | if( SLIDE_NO_TIMEOUT != mnPauseTimeout ) |
493 | 0 | { |
494 | 0 | MapMode aVMap( rMap ); |
495 | 0 | ScopedVclPtrInstance< VirtualDevice > pVDev( *GetOutDev() ); |
496 | |
|
497 | 0 | aVMap.SetOrigin( Point() ); |
498 | 0 | pVDev->SetMapMode( aVMap ); |
499 | 0 | pVDev->SetBackground( Wallpaper( COL_BLACK ) ); |
500 | | |
501 | | // set font first, to determine real output height |
502 | 0 | pVDev->SetFont( aFont ); |
503 | |
|
504 | 0 | const Size aVDevSize( aOutSize.Width(), pVDev->GetTextHeight() ); |
505 | |
|
506 | 0 | if( pVDev->SetOutputSize( aVDevSize ) ) |
507 | 0 | { |
508 | | // Note: if performance gets an issue here, we can use NumberFormatter directly |
509 | 0 | SvtSysLocale aSysLocale; |
510 | 0 | const LocaleDataWrapper& aLocaleData = aSysLocale.GetLocaleData(); |
511 | |
|
512 | 0 | aText += " ( " + aLocaleData.getDuration( ::tools::Duration( 0, 0, 0, mnPauseTimeout, 0 )) + " )"; |
513 | 0 | pVDev->DrawText( Point( aOffset.Width(), 0 ), aText ); |
514 | 0 | GetOutDev()->DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, *pVDev ); |
515 | 0 | bDrawn = true; |
516 | 0 | } |
517 | 0 | } |
518 | |
|
519 | 0 | if( !bDrawn ) |
520 | 0 | { |
521 | 0 | SetFont( aFont ); |
522 | 0 | GetOutDev()->DrawText( Point( aOutOrg.X() + aOffset.Width(), aOutOrg.Y() + aOffset.Height() ), aText ); |
523 | 0 | SetFont( aOldFont ); |
524 | 0 | } |
525 | 0 | } |
526 | | |
527 | | void ShowWindow::DrawEndScene() |
528 | 0 | { |
529 | 0 | const vcl::Font aOldFont( GetFont() ); |
530 | 0 | vcl::Font aFont( GetSettings().GetStyleSettings().GetMenuFont() ); |
531 | |
|
532 | 0 | const Point aOutOrg( PixelToLogic( Point() ) ); |
533 | 0 | const Size aTextSize(OutputDevice::LogicToLogic(Size(0, 14), MapMode(MapUnit::MapPoint), GetMapMode())); |
534 | 0 | const OUString aText( SdResId( STR_PRES_SOFTEND ) ); |
535 | |
|
536 | 0 | aFont.SetFontSize( aTextSize ); |
537 | 0 | aFont.SetColor( COL_WHITE ); |
538 | 0 | aFont.SetCharSet( aOldFont.GetCharSet() ); |
539 | 0 | aFont.SetLanguage( aOldFont.GetLanguage() ); |
540 | 0 | SetFont( aFont ); |
541 | 0 | GetOutDev()->DrawText( Point( aOutOrg.X() + aTextSize.Height(), aOutOrg.Y() + aTextSize.Height() ), aText ); |
542 | 0 | SetFont( aOldFont ); |
543 | 0 | } |
544 | | |
545 | | IMPL_LINK( ShowWindow, PauseTimeoutHdl, Timer*, pTimer, void ) |
546 | 0 | { |
547 | 0 | if( !( --mnPauseTimeout ) ) |
548 | 0 | RestartShow(); |
549 | 0 | else |
550 | 0 | { |
551 | 0 | DrawPauseScene( true ); |
552 | 0 | pTimer->Start(); |
553 | 0 | } |
554 | 0 | } |
555 | | |
556 | | IMPL_LINK_NOARG(ShowWindow, MouseTimeoutHdl, Timer *, void) |
557 | 0 | { |
558 | 0 | if( mbMouseCursorHidden ) |
559 | 0 | { |
560 | | // not enough mouse movements since first recording so |
561 | | // cancel show mouse pointer for now |
562 | 0 | mnFirstMouseMove = 0; |
563 | 0 | } |
564 | 0 | else |
565 | 0 | { |
566 | | // mouse has been idle too long, hide pointer |
567 | 0 | ShowPointer( false ); |
568 | 0 | mbMouseCursorHidden = true; |
569 | 0 | } |
570 | 0 | } |
571 | | |
572 | | IMPL_LINK( ShowWindow, EventHdl, VclWindowEvent&, rEvent, void ) |
573 | 0 | { |
574 | 0 | if( mbMouseAutoHide ) |
575 | 0 | { |
576 | 0 | if (rEvent.GetId() == VclEventId::WindowShow) |
577 | 0 | { |
578 | 0 | maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT ); |
579 | 0 | maMouseTimer.Start(); |
580 | 0 | } |
581 | 0 | } |
582 | 0 | } |
583 | | |
584 | | void ShowWindow::DeleteWindowFromPaintView() |
585 | 0 | { |
586 | 0 | if( mpViewShell->GetView() ) |
587 | 0 | mpViewShell->GetView()->DeleteDeviceFromPaintView( *GetOutDev() ); |
588 | |
|
589 | 0 | sal_uInt16 nChild = GetChildCount(); |
590 | 0 | while (nChild) |
591 | 0 | { |
592 | 0 | --nChild; |
593 | 0 | GetChild(nChild)->Show( false ); |
594 | 0 | } |
595 | 0 | } |
596 | | |
597 | | void ShowWindow::AddWindowToPaintView() |
598 | 0 | { |
599 | 0 | if( mpViewShell->GetView() ) |
600 | 0 | mpViewShell->GetView()->AddDeviceToPaintView( *GetOutDev(), nullptr ); |
601 | |
|
602 | 0 | sal_uInt16 nChild = GetChildCount(); |
603 | 0 | while (nChild) |
604 | 0 | { |
605 | 0 | --nChild; |
606 | 0 | GetChild(nChild)->Show(); |
607 | 0 | } |
608 | 0 | } |
609 | | |
610 | | // Override the sd::Window's CreateAccessible to create a different accessible object |
611 | | rtl::Reference<comphelper::OAccessible> ShowWindow::CreateAccessible() |
612 | 0 | { |
613 | 0 | if (mpViewShell != nullptr) |
614 | 0 | { |
615 | 0 | return mpViewShell->CreateAccessibleDocumentView(this); |
616 | 0 | } |
617 | 0 | else |
618 | 0 | { |
619 | 0 | SAL_WARN("sd", "::sd::Window::CreateAccessible: no view shell"); |
620 | 0 | return vcl::Window::CreateAccessible (); |
621 | 0 | } |
622 | 0 | } |
623 | | } // end of namespace sd |
624 | | |
625 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |