Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/window/split.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 <tools/poly.hxx>
21
22
#include <vcl/event.hxx>
23
#include <vcl/split.hxx>
24
#include <vcl/svapp.hxx>
25
#include <vcl/syswin.hxx>
26
#include <vcl/taskpanelist.hxx>
27
#include <vcl/lineinfo.hxx>
28
#include <vcl/settings.hxx>
29
#include <vcl/ptrstyle.hxx>
30
#include <tools/lazydelete.hxx>
31
#include <tools/mapunit.hxx>
32
33
#include <window.h>
34
35
namespace
36
{
37
    Wallpaper& ImplBlackWall()
38
0
    {
39
0
        static tools::DeleteOnDeinit< Wallpaper > SINGLETON(COL_BLACK);
40
0
        return *SINGLETON.get();
41
0
    }
42
    Wallpaper& ImplWhiteWall()
43
0
    {
44
0
        static tools::DeleteOnDeinit< Wallpaper > SINGLETON(COL_LIGHTGRAY);
45
0
        return *SINGLETON.get();
46
0
    }
47
}
48
49
// Should only be called from an ImplInit method for initialization or
50
// after checking bNew is different from the current mbHorzSplit value.
51
// The public method that does that check is Splitter::SetHorizontal().
52
void Splitter::ImplInitHorVer(bool bNew)
53
0
{
54
0
    mbHorzSplit = bNew;
55
56
0
    PointerStyle ePointerStyle;
57
0
    const StyleSettings& rSettings = GetSettings().GetStyleSettings();
58
59
0
    if ( mbHorzSplit )
60
0
    {
61
0
        ePointerStyle = PointerStyle::HSplit;
62
0
        SetSizePixel( Size( StyleSettings::GetSplitSize(), rSettings.GetScrollBarSize() ) );
63
0
    }
64
0
    else
65
0
    {
66
0
        ePointerStyle = PointerStyle::VSplit;
67
0
        SetSizePixel( Size( rSettings.GetScrollBarSize(), StyleSettings::GetSplitSize() ) );
68
0
    }
69
70
0
    SetPointer( ePointerStyle );
71
0
}
72
73
void Splitter::ImplInit( vcl::Window* pParent, WinBits nWinStyle )
74
0
{
75
0
    Window::ImplInit( pParent, nWinStyle, nullptr );
76
77
0
    mpRefWin = pParent;
78
79
0
    ImplInitHorVer(nWinStyle & WB_HSCROLL);
80
81
0
    if( GetSettings().GetStyleSettings().GetFaceColor().IsDark() )
82
0
        SetBackground( ImplWhiteWall() );
83
0
    else
84
0
        SetBackground( ImplBlackWall() );
85
86
0
    TaskPaneList *pTList = GetSystemWindow()->GetTaskPaneList();
87
0
    pTList->AddWindow( this );
88
0
}
89
90
void Splitter::ImplSplitMousePos( Point& rPos )
91
0
{
92
0
    if ( mbHorzSplit )
93
0
    {
94
0
        if ( rPos.X() > maDragRect.Right()-1 )
95
0
            rPos.setX( maDragRect.Right()-1 );
96
0
        if ( rPos.X() < maDragRect.Left()+1 )
97
0
            rPos.setX( maDragRect.Left()+1 );
98
0
    }
99
0
    else
100
0
    {
101
0
        if ( rPos.Y() > maDragRect.Bottom()-1 )
102
0
            rPos.setY( maDragRect.Bottom()-1 );
103
0
        if ( rPos.Y() < maDragRect.Top()+1 )
104
0
            rPos.setY( maDragRect.Top()+1 );
105
0
    }
106
0
}
107
108
void Splitter::ImplDrawSplitter()
109
0
{
110
0
    tools::Rectangle aInvRect( maDragRect );
111
112
0
    if ( mbHorzSplit )
113
0
    {
114
0
        aInvRect.SetLeft( maDragPos.X() - 1 );
115
0
        aInvRect.SetRight( maDragPos.X() + 1 );
116
0
    }
117
0
    else
118
0
    {
119
0
        aInvRect.SetTop( maDragPos.Y() - 1 );
120
0
        aInvRect.SetBottom( maDragPos.Y() + 1 );
121
0
    }
122
123
0
    mpRefWin->InvertTracking( mpRefWin->PixelToLogic(aInvRect), ShowTrackFlags::Split );
124
0
}
125
126
Splitter::Splitter( vcl::Window* pParent, WinBits nStyle ) :
127
0
    Window( WindowType::SPLITTER ),
128
0
    mpRefWin( nullptr ),
129
0
    mnSplitPos( 0 ),
130
0
    mnLastSplitPos( 0 ),
131
0
    mnStartSplitPos( 0 ),
132
0
    mbDragFull( false ),
133
0
    mbKbdSplitting( false ),
134
0
    mbInKeyEvent( false ),
135
0
    mnKeyboardStepSize( SPLITTER_DEFAULTSTEPSIZE )
136
0
{
137
0
    ImplGetWindowImpl()->mbSplitter        = true;
138
139
0
    ImplInit( pParent, nStyle );
140
141
0
    GetOutDev()->SetLineColor();
142
0
    GetOutDev()->SetFillColor();
143
0
}
Unexecuted instantiation: Splitter::Splitter(vcl::Window*, long)
Unexecuted instantiation: Splitter::Splitter(vcl::Window*, long)
144
145
Splitter::~Splitter()
146
0
{
147
0
    disposeOnce();
148
0
}
149
150
void Splitter::dispose()
151
0
{
152
0
    SystemWindow *pSysWin = GetSystemWindow();
153
0
    if(pSysWin)
154
0
    {
155
0
        TaskPaneList *pTList = pSysWin->GetTaskPaneList();
156
0
        pTList->RemoveWindow(this);
157
0
    }
158
0
    mpRefWin.reset();
159
0
    Window::dispose();
160
0
}
161
162
void Splitter::SetHorizontal(bool bNew)
163
0
{
164
0
    if(bNew != mbHorzSplit)
165
0
    {
166
0
        ImplInitHorVer(bNew);
167
0
    }
168
0
}
169
170
void Splitter::SetKeyboardStepSize( tools::Long nStepSize )
171
0
{
172
0
    mnKeyboardStepSize = nStepSize;
173
0
}
174
175
Splitter* Splitter::ImplFindSibling()
176
0
{
177
    // look for another splitter with the same parent but different orientation
178
0
    vcl::Window *pWin = GetParent()->GetWindow( GetWindowType::FirstChild );
179
0
    Splitter *pSplitter = nullptr;
180
0
    while( pWin )
181
0
    {
182
0
        if( pWin->ImplIsSplitter() )
183
0
        {
184
0
            pSplitter = static_cast<Splitter*>(pWin);
185
0
            if( pSplitter != this && IsHorizontal() != pSplitter->IsHorizontal() )
186
0
                return pSplitter;
187
0
        }
188
0
        pWin = pWin->GetWindow( GetWindowType::Next );
189
0
    }
190
0
    return nullptr;
191
0
}
192
193
bool Splitter::ImplSplitterActive()
194
0
{
195
    // is splitter in document or at scrollbar handle ?
196
197
0
    bool bActive = true;
198
0
    const StyleSettings& rSettings = GetSettings().GetStyleSettings();
199
0
    tools::Long nA = rSettings.GetScrollBarSize();
200
0
    tools::Long nB = StyleSettings::GetSplitSize();
201
202
0
    Size aSize = GetOutDev()->GetOutputSize();
203
0
    if ( mbHorzSplit )
204
0
    {
205
0
        if( aSize.Width() == nB && aSize.Height() == nA )
206
0
            bActive = false;
207
0
    }
208
0
    else
209
0
    {
210
0
        if( aSize.Width() == nA && aSize.Height() == nB )
211
0
            bActive = false;
212
0
    }
213
0
    return bActive;
214
0
}
215
216
void Splitter::MouseButtonDown( const MouseEvent& rMEvt )
217
0
{
218
0
    if ( rMEvt.GetClicks() == 2 )
219
0
    {
220
0
        if ( mnLastSplitPos != mnSplitPos )
221
0
        {
222
0
            StartSplit();
223
0
            Point aPos = rMEvt.GetPosPixel();
224
0
            if ( mbHorzSplit )
225
0
                aPos.setX( mnLastSplitPos );
226
0
            else
227
0
                aPos.setY( mnLastSplitPos );
228
0
            ImplSplitMousePos( aPos );
229
0
            tools::Long nTemp = mnSplitPos;
230
0
            if ( mbHorzSplit )
231
0
                SetSplitPosPixel( aPos.X() );
232
0
            else
233
0
                SetSplitPosPixel( aPos.Y() );
234
0
            mnLastSplitPos = nTemp;
235
0
            Split();
236
0
            EndSplit();
237
0
        }
238
0
    }
239
0
    else
240
0
        StartDrag();
241
0
}
242
243
void Splitter::Tracking( const TrackingEvent& rTEvt )
244
0
{
245
0
    if ( rTEvt.IsTrackingEnded() )
246
0
    {
247
0
        if ( !mbDragFull )
248
0
            ImplDrawSplitter();
249
250
0
        if ( !rTEvt.IsTrackingCanceled() )
251
0
        {
252
0
            tools::Long nNewPos;
253
0
            if ( mbHorzSplit )
254
0
                nNewPos = maDragPos.X();
255
0
            else
256
0
                nNewPos = maDragPos.Y();
257
0
            if ( nNewPos != mnStartSplitPos )
258
0
            {
259
0
                SetSplitPosPixel( nNewPos );
260
0
                mnLastSplitPos = 0;
261
0
                Split();
262
0
            }
263
0
            EndSplit();
264
0
        }
265
0
        else if ( mbDragFull )
266
0
        {
267
0
            SetSplitPosPixel( mnStartSplitPos );
268
0
            Split();
269
0
        }
270
0
        mnStartSplitPos = 0;
271
0
    }
272
0
    else
273
0
    {
274
        //Point aNewPos = mpRefWin->ScreenToOutputPixel( OutputToScreenPixel( rTEvt.GetMouseEvent().GetPosPixel() ) );
275
0
        Point aNewPos = mpRefWin->NormalizedScreenToOutputPixel( OutputToNormalizedScreenPixel( rTEvt.GetMouseEvent().GetPosPixel() ) );
276
0
        ImplSplitMousePos( aNewPos );
277
278
0
        if ( mbHorzSplit )
279
0
        {
280
0
            if ( aNewPos.X() == maDragPos.X() )
281
0
                return;
282
0
        }
283
0
        else
284
0
        {
285
0
            if ( aNewPos.Y() == maDragPos.Y() )
286
0
                return;
287
0
        }
288
289
0
        if ( mbDragFull )
290
0
        {
291
0
            maDragPos = aNewPos;
292
0
            tools::Long nNewPos;
293
0
            if ( mbHorzSplit )
294
0
                nNewPos = maDragPos.X();
295
0
            else
296
0
                nNewPos = maDragPos.Y();
297
0
            if ( nNewPos != mnSplitPos )
298
0
            {
299
0
                SetSplitPosPixel( nNewPos );
300
0
                mnLastSplitPos = 0;
301
0
                Split();
302
0
            }
303
304
0
            GetParent()->PaintImmediately();
305
0
        }
306
0
        else
307
0
        {
308
0
            ImplDrawSplitter();
309
0
            maDragPos = aNewPos;
310
0
            ImplDrawSplitter();
311
0
        }
312
0
    }
313
0
}
314
315
void Splitter::ImplKbdTracking( vcl::KeyCode aKeyCode )
316
0
{
317
0
    sal_uInt16 nCode = aKeyCode.GetCode();
318
0
    if ( nCode == KEY_ESCAPE || nCode == KEY_RETURN )
319
0
    {
320
0
        if( !mbKbdSplitting )
321
0
            return;
322
0
        else
323
0
            mbKbdSplitting = false;
324
325
0
        if ( nCode != KEY_ESCAPE )
326
0
        {
327
0
            tools::Long nNewPos;
328
0
            if ( mbHorzSplit )
329
0
                nNewPos = maDragPos.X();
330
0
            else
331
0
                nNewPos = maDragPos.Y();
332
0
            if ( nNewPos != mnStartSplitPos )
333
0
            {
334
0
                SetSplitPosPixel( nNewPos );
335
0
                mnLastSplitPos = 0;
336
0
                Split();
337
0
            }
338
0
        }
339
0
        else
340
0
        {
341
0
            SetSplitPosPixel( mnStartSplitPos );
342
0
            Split();
343
0
            EndSplit();
344
0
        }
345
0
        mnStartSplitPos = 0;
346
0
    }
347
0
    else
348
0
    {
349
0
        Point aNewPos;
350
0
        Size aSize = mpRefWin->GetOutDev()->GetOutputSize();
351
0
        Point aPos = GetPosPixel();
352
        // depending on the position calc allows continuous moves or snaps to row/columns
353
        // continuous mode is active when position is at the origin or end of the splitter
354
        // otherwise snap mode is active
355
        // default here is snap, holding shift sets continuous mode
356
0
        if( mbHorzSplit )
357
0
            aNewPos = Point( ImplSplitterActive() ? aPos.X() : mnSplitPos, aKeyCode.IsShift() ? 0 : aSize.Height()/2);
358
0
        else
359
0
            aNewPos = Point( aKeyCode.IsShift() ? 0 : aSize.Width()/2, ImplSplitterActive() ? aPos.Y() : mnSplitPos );
360
361
0
        Point aOldWindowPos = GetPosPixel();
362
363
0
        int maxiter = 500;  // avoid endless loop
364
0
        int delta=0;
365
0
        int delta_step = mbHorzSplit  ? aSize.Width()/10 : aSize.Height()/10;
366
367
        // use the specified step size if it was set
368
0
        if( mnKeyboardStepSize != SPLITTER_DEFAULTSTEPSIZE )
369
0
            delta_step = mnKeyboardStepSize;
370
371
0
        while( maxiter-- && aOldWindowPos == GetPosPixel() )
372
0
        {
373
            // inc/dec position until application performs changes
374
            // thus a single key press really moves the splitter
375
0
            if( aKeyCode.IsShift() )
376
0
                delta++;
377
0
            else
378
0
                delta += delta_step;
379
380
0
            switch( nCode )
381
0
            {
382
0
            case KEY_LEFT:
383
0
                aNewPos.AdjustX( -delta );
384
0
                break;
385
0
            case KEY_RIGHT:
386
0
                aNewPos.AdjustX(delta );
387
0
                break;
388
0
            case KEY_UP:
389
0
                aNewPos.AdjustY( -delta );
390
0
                break;
391
0
            case KEY_DOWN:
392
0
                aNewPos.AdjustY(delta );
393
0
                break;
394
0
            default:
395
0
                maxiter = 0;    // leave loop
396
0
                break;
397
0
            }
398
0
            ImplSplitMousePos( aNewPos );
399
400
0
            if ( mbHorzSplit )
401
0
            {
402
0
                if ( aNewPos.X() == maDragPos.X() )
403
0
                    continue;
404
0
            }
405
0
            else
406
0
            {
407
0
                if ( aNewPos.Y() == maDragPos.Y() )
408
0
                    continue;
409
0
            }
410
411
0
            maDragPos = aNewPos;
412
0
            tools::Long nNewPos;
413
0
            if ( mbHorzSplit )
414
0
                nNewPos = maDragPos.X();
415
0
            else
416
0
                nNewPos = maDragPos.Y();
417
0
            if ( nNewPos != mnSplitPos )
418
0
            {
419
0
                SetSplitPosPixel( nNewPos );
420
0
                mnLastSplitPos = 0;
421
0
                Split();
422
0
            }
423
0
            GetParent()->PaintImmediately();
424
0
        }
425
0
    }
426
0
}
427
428
void Splitter::StartSplit()
429
0
{
430
0
    maStartSplitHdl.Call( this );
431
0
}
432
433
void Splitter::Split()
434
0
{
435
0
    maSplitHdl.Call( this );
436
0
}
437
438
void Splitter::EndSplit()
439
0
{
440
0
    maEndSplitHdl.Call( this );
441
0
}
442
443
void Splitter::SetDragRectPixel( const tools::Rectangle& rDragRect, vcl::Window* _pRefWin )
444
0
{
445
0
    maDragRect = rDragRect;
446
0
    if ( !_pRefWin )
447
0
        mpRefWin = GetParent();
448
0
    else
449
0
        mpRefWin = _pRefWin;
450
0
}
451
452
void Splitter::SetSplitPosPixel( tools::Long nNewPos )
453
0
{
454
0
    mnSplitPos = nNewPos;
455
0
}
456
457
void Splitter::StartDrag()
458
0
{
459
0
    if ( IsTracking() )
460
0
        return;
461
462
0
    StartSplit();
463
464
    // Start tracking
465
0
    StartTracking();
466
467
    // Determine start position
468
0
    maDragPos = mpRefWin->GetPointerPosPixel();
469
0
    ImplSplitMousePos( maDragPos );
470
0
    if ( mbHorzSplit )
471
0
        mnStartSplitPos = maDragPos.X();
472
0
    else
473
0
        mnStartSplitPos = maDragPos.Y();
474
475
0
    mbDragFull = bool(Application::GetSettings().GetStyleSettings().GetDragFullOptions() & DragFullOptions::Split);
476
0
    if ( !mbDragFull )
477
0
        ImplDrawSplitter();
478
0
}
479
480
void Splitter::ImplStartKbdSplitting()
481
0
{
482
0
    if( mbKbdSplitting )
483
0
        return;
484
485
0
    mbKbdSplitting = true;
486
487
0
    StartSplit();
488
489
    // determine start position
490
    // because we have no mouse position we take either the position
491
    // of the splitter window or the last split position
492
    // the other coordinate is just the center of the reference window
493
0
    Size aSize = mpRefWin->GetOutDev()->GetOutputSize();
494
0
    Point aPos = GetPosPixel();
495
0
    if( mbHorzSplit )
496
0
        maDragPos = Point( ImplSplitterActive() ? aPos.X() : mnSplitPos, aSize.Height()/2 );
497
0
    else
498
0
        maDragPos = Point( aSize.Width()/2, ImplSplitterActive() ? aPos.Y() : mnSplitPos );
499
0
    ImplSplitMousePos( maDragPos );
500
0
    if ( mbHorzSplit )
501
0
        mnStartSplitPos = maDragPos.X();
502
0
    else
503
0
        mnStartSplitPos = maDragPos.Y();
504
0
}
505
506
void Splitter::ImplRestoreSplitter()
507
0
{
508
    // set splitter in the center of the ref window
509
0
    StartSplit();
510
0
    Size aSize = mpRefWin->GetOutDev()->GetOutputSize();
511
0
    Point aPos( aSize.Width()/2 , aSize.Height()/2);
512
0
    if ( mnLastSplitPos != mnSplitPos && mnLastSplitPos > 5 )
513
0
    {
514
        // restore last pos if it was a useful position (>5)
515
0
        if ( mbHorzSplit )
516
0
            aPos.setX( mnLastSplitPos );
517
0
        else
518
0
            aPos.setY( mnLastSplitPos );
519
0
    }
520
521
0
    ImplSplitMousePos( aPos );
522
0
    tools::Long nTemp = mnSplitPos;
523
0
    if ( mbHorzSplit )
524
0
        SetSplitPosPixel( aPos.X() );
525
0
    else
526
0
        SetSplitPosPixel( aPos.Y() );
527
0
    mnLastSplitPos = nTemp;
528
0
    Split();
529
0
    EndSplit();
530
0
}
531
532
void Splitter::GetFocus()
533
0
{
534
0
    if( !ImplSplitterActive() )
535
0
        ImplRestoreSplitter();
536
537
0
    Invalidate();
538
0
}
539
540
void Splitter::LoseFocus()
541
0
{
542
0
    if( mbKbdSplitting )
543
0
    {
544
0
        vcl::KeyCode aReturnKey( KEY_RETURN );
545
0
        ImplKbdTracking( aReturnKey );
546
0
        mbKbdSplitting = false;
547
0
    }
548
0
    Invalidate();
549
0
}
550
551
void Splitter::KeyInput( const KeyEvent& rKEvt )
552
0
{
553
0
    if( mbInKeyEvent )
554
0
        return;
555
556
0
    mbInKeyEvent = true;
557
558
0
    Splitter *pSibling = ImplFindSibling();
559
0
    vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
560
0
    sal_uInt16 nCode = aKeyCode.GetCode();
561
0
    switch ( nCode )
562
0
    {
563
0
        case KEY_UP:
564
0
        case KEY_DOWN:
565
0
            if( !mbHorzSplit )
566
0
            {
567
0
                ImplStartKbdSplitting();
568
0
                ImplKbdTracking( aKeyCode );
569
0
            }
570
0
            else
571
0
            {
572
0
                if( pSibling )
573
0
                {
574
0
                    pSibling->GrabFocus();
575
0
                    pSibling->KeyInput( rKEvt );
576
0
                }
577
0
            }
578
0
            break;
579
0
        case KEY_RIGHT:
580
0
        case KEY_LEFT:
581
0
            if( mbHorzSplit )
582
0
            {
583
0
                ImplStartKbdSplitting();
584
0
                ImplKbdTracking( aKeyCode );
585
0
            }
586
0
            else
587
0
            {
588
0
                if( pSibling )
589
0
                {
590
0
                    pSibling->GrabFocus();
591
0
                    pSibling->KeyInput( rKEvt );
592
0
                }
593
0
            }
594
0
            break;
595
596
0
        case KEY_DELETE:
597
0
            if( ImplSplitterActive() )
598
0
            {
599
0
                if( mbKbdSplitting )
600
0
                {
601
0
                    vcl::KeyCode aKey( KEY_ESCAPE );
602
0
                    ImplKbdTracking( aKey );
603
0
                }
604
605
0
                StartSplit();
606
0
                Point aPos;
607
0
                if ( mbHorzSplit )
608
0
                    aPos.setX( 0 );
609
0
                else
610
0
                    aPos.setY( 0 );
611
0
                ImplSplitMousePos( aPos );
612
0
                tools::Long nTemp = mnSplitPos;
613
0
                if ( mbHorzSplit )
614
0
                    SetSplitPosPixel( aPos.X() );
615
0
                else
616
0
                    SetSplitPosPixel( aPos.Y() );
617
0
                mnLastSplitPos = nTemp;
618
0
                Split();
619
0
                EndSplit();
620
621
                // Shift-Del deletes both splitters
622
0
                if( aKeyCode.IsShift() && pSibling )
623
0
                    pSibling->KeyInput( rKEvt );
624
625
0
                GrabFocusToDocument();
626
0
            }
627
0
            break;
628
629
0
        case KEY_ESCAPE:
630
0
            if( mbKbdSplitting )
631
0
                ImplKbdTracking( aKeyCode );
632
0
            else
633
0
                GrabFocusToDocument();
634
0
            break;
635
636
0
        case KEY_RETURN:
637
0
            ImplKbdTracking( aKeyCode );
638
0
            GrabFocusToDocument();
639
0
            break;
640
0
        default:    // let any key input fix the splitter
641
0
            Window::KeyInput( rKEvt );
642
0
            GrabFocusToDocument();
643
0
            break;
644
0
    }
645
0
    mbInKeyEvent = false;
646
0
}
647
648
void Splitter::DataChanged( const DataChangedEvent& rDCEvt )
649
0
{
650
0
    Window::DataChanged( rDCEvt );
651
0
    if( rDCEvt.GetType() != DataChangedEventType::SETTINGS )
652
0
        return;
653
654
0
    const AllSettings* pOldSettings = rDCEvt.GetOldSettings();
655
0
    if(!pOldSettings)
656
0
        return;
657
658
0
    Color oldFaceColor = pOldSettings->GetStyleSettings().GetFaceColor();
659
0
    Color newFaceColor = Application::GetSettings().GetStyleSettings().GetFaceColor();
660
0
    if( oldFaceColor.IsDark() != newFaceColor.IsDark() )
661
0
    {
662
0
        if( newFaceColor.IsDark() )
663
0
            SetBackground( ImplWhiteWall() );
664
0
        else
665
0
            SetBackground( ImplBlackWall() );
666
0
    }
667
0
}
668
669
void Splitter::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rPaintRect)
670
0
{
671
0
    rRenderContext.DrawRect(rPaintRect);
672
673
0
    tools::Polygon aPoly(rPaintRect);
674
0
    tools::PolyPolygon aPolyPoly(aPoly);
675
0
    rRenderContext.DrawTransparent(aPolyPoly, 85);
676
677
0
    if (mbKbdSplitting)
678
0
    {
679
0
        LineInfo aInfo( LineStyle::Dash );
680
        //aInfo.SetDashLen( 2 );
681
        //aInfo.SetDashCount( 1 );
682
0
        aInfo.SetDistance( 1 );
683
0
        aInfo.SetDotLen( 2 );
684
0
        aInfo.SetDotCount( 3 );
685
686
0
        rRenderContext.DrawPolyLine( aPoly, aInfo );
687
0
    }
688
0
    else
689
0
    {
690
0
        rRenderContext.DrawRect(rPaintRect);
691
0
    }
692
0
}
693
694
Size Splitter::GetOptimalSize() const
695
0
{
696
0
    return LogicToPixel(Size(3, 3), MapMode(MapUnit::MapAppFont));
697
0
}
698
699
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */