Coverage Report

Created: 2026-09-28 10:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/vcl/split.hxx
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
#ifndef INCLUDED_VCL_SPLIT_HXX
21
#define INCLUDED_VCL_SPLIT_HXX
22
23
#include <vcl/dllapi.h>
24
#include <vcl/window.hxx>
25
26
namespace vcl { class KeyCode; }
27
28
0
#define SPLITTER_DEFAULTSTEPSIZE 0xFFFF
29
30
class VCL_DLLPUBLIC Splitter : public vcl::Window
31
{
32
private:
33
    VclPtr<vcl::Window> mpRefWin;
34
    tools::Long                mnSplitPos;
35
    tools::Long                mnLastSplitPos;
36
    tools::Long                mnStartSplitPos;
37
    Point               maDragPos;
38
    tools::Rectangle           maDragRect;
39
    bool                mbHorzSplit;
40
    bool                mbDragFull;
41
    bool                mbKbdSplitting;
42
    bool                mbInKeyEvent;
43
    tools::Long                mnKeyboardStepSize;
44
    Link<Splitter*,void>   maStartSplitHdl;
45
    Link<Splitter*,void>   maSplitHdl;
46
    Link<Splitter*,void>   maEndSplitHdl;
47
48
    SAL_DLLPRIVATE void      ImplDrawSplitter();
49
    SAL_DLLPRIVATE void      ImplSplitMousePos( Point& rPos );
50
    SAL_DLLPRIVATE void      ImplStartKbdSplitting();
51
    SAL_DLLPRIVATE void      ImplKbdTracking( vcl::KeyCode aKeyCode );
52
    SAL_DLLPRIVATE bool      ImplSplitterActive();
53
    SAL_DLLPRIVATE Splitter* ImplFindSibling();
54
    SAL_DLLPRIVATE void      ImplRestoreSplitter();
55
    SAL_DLLPRIVATE void      ImplInitHorVer(bool bNew);
56
57
                             Splitter (const Splitter &) = delete;
58
                             Splitter& operator= (const Splitter &) = delete;
59
60
protected:
61
    using Window::ImplInit;
62
    SAL_DLLPRIVATE void      ImplInit( vcl::Window* pParent, WinBits nWinStyle );
63
64
public:
65
    explicit            Splitter( vcl::Window* pParent, WinBits nStyle = WB_VSCROLL );
66
    virtual             ~Splitter() override;
67
    virtual void        dispose() override;
68
69
    void                StartSplit();
70
    void                EndSplit();
71
    void                Split();
72
73
    virtual void        MouseButtonDown( const MouseEvent& rMEvt ) override;
74
    virtual void        Tracking( const TrackingEvent& rTEvt ) override;
75
76
    virtual void        GetFocus() override;
77
    virtual void        LoseFocus() override;
78
    virtual void        KeyInput( const KeyEvent& rKEvt ) override;
79
    virtual void        Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rPaintRect ) override;
80
    virtual Size        GetOptimalSize() const override;
81
82
    virtual void        DataChanged( const DataChangedEvent& rDCEvt ) override;
83
84
    void                StartDrag();
85
86
    void                SetDragRectPixel( const tools::Rectangle& rDragRect,
87
                                          vcl::Window* pRefWin = nullptr );
88
89
    void                SetSplitPosPixel( tools::Long nPos );
90
0
    tools::Long                GetSplitPosPixel() const { return mnSplitPos; }
91
92
0
    bool                IsHorizontal() const { return mbHorzSplit; }
93
    void                SetHorizontal(bool bNew);
94
95
    // set the stepsize of the splitter for cursor movement
96
    // the default is 10% of the reference window's width/height
97
    void                SetKeyboardStepSize( tools::Long nStepSize );
98
99
0
    void                SetStartSplitHdl( const Link<Splitter*,void>& rLink ) { maStartSplitHdl = rLink; }
100
0
    void                SetSplitHdl( const Link<Splitter*,void>& rLink ) { maSplitHdl = rLink; }
101
0
    void                SetEndSplitHdl( const Link<Splitter*,void>& rLink ) { maEndSplitHdl = rLink; }
102
};
103
104
#endif // INCLUDED_VCL_SPLIT_HXX
105
106
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */