Coverage Report

Created: 2026-06-30 11:14

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