Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/treeglue.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
10
#include "svimpbox.hxx"
11
#include "svtabbx.hxx"
12
13
class LclTabListBox final : public SvTabListBox
14
{
15
    Link<SvTreeListBox*, void> m_aModelChangedHdl;
16
    Link<SvTreeListBox*, bool> m_aStartDragHdl;
17
    Link<SvTreeListBox*, void> m_aEndDragHdl;
18
19
public:
20
    LclTabListBox(vcl::Window* pParent, WinBits nWinStyle)
21
0
        : SvTabListBox(pParent, nWinStyle)
22
0
    {
23
0
    }
24
25
0
    void SetModelChangedHdl(const Link<SvTreeListBox*, void>& rLink) { m_aModelChangedHdl = rLink; }
26
0
    void SetStartDragHdl(const Link<SvTreeListBox*, bool>& rLink) { m_aStartDragHdl = rLink; }
27
0
    void SetEndDragHdl(const Link<SvTreeListBox*, void>& rLink) { m_aEndDragHdl = rLink; }
28
29
    virtual void StartDrag(sal_Int8 nAction, const Point& rPosPixel) override
30
0
    {
31
0
        if (m_aStartDragHdl.Call(this))
32
0
            return;
33
0
        SvTabListBox::StartDrag(nAction, rPosPixel);
34
0
    }
35
36
    virtual void DragFinished(sal_Int8 nDropAction) override
37
0
    {
38
0
        SvTabListBox::DragFinished(nDropAction);
39
0
        m_aEndDragHdl.Call(this);
40
0
    }
41
42
    virtual void ModelHasCleared() override
43
0
    {
44
0
        SvTabListBox::ModelHasCleared();
45
0
        m_aModelChangedHdl.Call(this);
46
0
    }
47
48
    virtual void ModelHasInserted(SvTreeListEntry* pEntry) override
49
0
    {
50
0
        SvTabListBox::ModelHasInserted(pEntry);
51
0
        m_aModelChangedHdl.Call(this);
52
0
    }
53
54
    virtual void ModelHasInsertedTree(SvTreeListEntry* pEntry) override
55
0
    {
56
0
        SvTabListBox::ModelHasInsertedTree(pEntry);
57
0
        m_aModelChangedHdl.Call(this);
58
0
    }
59
60
    virtual void ModelHasMoved(SvTreeListEntry* pSource) override
61
0
    {
62
0
        SvTabListBox::ModelHasMoved(pSource);
63
0
        m_aModelChangedHdl.Call(this);
64
0
    }
65
66
    virtual void ModelHasRemoved(SvTreeListEntry* pEntry) override
67
0
    {
68
0
        SvTabListBox::ModelHasRemoved(pEntry);
69
0
        m_aModelChangedHdl.Call(this);
70
0
    }
71
72
    SvTreeListEntry* GetTargetAtPoint(const Point& rPos, bool bHighLightTarget, bool bScroll = true)
73
0
    {
74
0
        SvTreeListEntry* pOldTargetEntry = m_pTargetEntry;
75
0
        m_pTargetEntry = PosOverBody(rPos) ? m_pImpl->GetEntry(rPos) : nullptr;
76
0
        if (pOldTargetEntry != m_pTargetEntry)
77
0
            ImplShowTargetEmphasis(pOldTargetEntry, false);
78
79
0
        if (bScroll)
80
0
        {
81
            // scroll
82
0
            if (rPos.Y() < 12)
83
0
            {
84
0
                ImplShowTargetEmphasis(m_pTargetEntry, false);
85
0
                ScrollOutputArea(+1);
86
0
            }
87
0
            else
88
0
            {
89
0
                Size aSize(m_pImpl->GetOutputSize());
90
0
                if (rPos.Y() > aSize.Height() - 12)
91
0
                {
92
0
                    ImplShowTargetEmphasis(m_pTargetEntry, false);
93
0
                    ScrollOutputArea(-1);
94
0
                }
95
0
            }
96
0
        }
97
98
0
        if (m_pTargetEntry && bHighLightTarget)
99
0
            ImplShowTargetEmphasis(m_pTargetEntry, true);
100
0
        return m_pTargetEntry;
101
0
    }
102
103
    virtual SvTreeListEntry* GetDropTarget(const Point& rPos) override
104
0
    {
105
0
        return GetTargetAtPoint(rPos, true);
106
0
    }
107
};
108
109
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */