Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/accessibility/listboxhelper.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
#pragma once
21
22
#include <accessibility/IComboListBoxHelper.hxx>
23
#include <tools/gen.hxx>
24
25
26
// globals
27
28
29
const sal_Int32 DEFAULT_INDEX_IN_PARENT = -1;
30
31
32
33
34
template< class T > class VCLListBoxHelper final : public IComboListBoxHelper
35
{
36
private:
37
    T&  m_aComboListBox;
38
39
public:
40
    VCLListBoxHelper( T& _pListBox ) :
41
0
        m_aComboListBox( _pListBox ){}
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::VCLListBoxHelper(ComboBox&)
Unexecuted instantiation: VCLListBoxHelper<ListBox>::VCLListBoxHelper(ListBox&)
42
43
44
    virtual OUString        GetEntry( sal_Int32  nPos ) const override
45
0
    {
46
0
        return m_aComboListBox.GetEntry( nPos );
47
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetEntry(int) const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetEntry(int) const
48
49
    virtual tools::Rectangle       GetDropDownPosSizePixel() const override
50
0
    {
51
0
        return m_aComboListBox.GetDropDownPosSizePixel();
52
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetDropDownPosSizePixel() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetDropDownPosSizePixel() const
53
54
    virtual tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const override
55
0
    {
56
0
        tools::Rectangle aRect;
57
0
        if ( m_aComboListBox.IsInDropDown() && IsEntryVisible( nItem ) )
58
0
        {
59
0
            tools::Rectangle aTemp = m_aComboListBox.GetDropDownPosSizePixel();
60
0
            Size aSize = aTemp.GetSize();
61
0
            sal_uInt16 nLineCount = m_aComboListBox.GetDisplayLineCount();
62
0
            assert(nLineCount && "div-by-zero");
63
0
            aSize.setHeight( aSize.Height() / nLineCount );
64
0
            Point aTopLeft = aTemp.TopLeft();
65
0
            aTopLeft.AdjustY( aSize.Height() * ( nItem - m_aComboListBox.GetTopEntry() ) );
66
0
            aRect = tools::Rectangle( aTopLeft, aSize );
67
0
        }
68
0
        else
69
0
            aRect = m_aComboListBox.GetBoundingRectangle( nItem );
70
0
        return aRect;
71
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetBoundingRectangle(int) const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetBoundingRectangle(int) const
72
73
    virtual bool            IsEnabled() const override
74
0
    {
75
0
        return m_aComboListBox.IsEnabled();
76
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::IsEnabled() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::IsEnabled() const
77
78
    virtual bool            IsEntryVisible( sal_Int32  nPos ) const override
79
0
    {
80
0
        sal_Int32  nTopEntry = m_aComboListBox.GetTopEntry();
81
0
        sal_uInt16 nLines = m_aComboListBox.GetDisplayLineCount();
82
0
        return ( nPos >= nTopEntry && nPos < ( nTopEntry + nLines ) );
83
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::IsEntryVisible(int) const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::IsEntryVisible(int) const
84
85
    virtual sal_uInt16      GetDisplayLineCount() const override
86
0
    {
87
0
        return m_aComboListBox.GetDisplayLineCount();
88
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetDisplayLineCount() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetDisplayLineCount() const
89
90
    virtual void            GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const override
91
0
    {
92
0
        m_aComboListBox.GetMaxVisColumnsAndLines(rnCols,rnLines);
93
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetMaxVisColumnsAndLines(unsigned short&, unsigned short&) const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetMaxVisColumnsAndLines(unsigned short&, unsigned short&) const
94
95
    virtual WinBits         GetStyle() const override
96
0
    {
97
0
        return m_aComboListBox.GetStyle();
98
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetStyle() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetStyle() const
99
100
    virtual bool            IsMultiSelectionEnabled() const override
101
0
    {
102
0
        return m_aComboListBox.IsMultiSelectionEnabled();
103
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::IsMultiSelectionEnabled() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::IsMultiSelectionEnabled() const
104
105
    virtual sal_Int32       GetTopEntry() const override
106
0
    {
107
0
        return m_aComboListBox.GetTopEntry();
108
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetTopEntry() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetTopEntry() const
109
110
    virtual bool            IsEntryPosSelected( sal_Int32  nPos ) const override
111
0
    {
112
0
        return m_aComboListBox.IsEntryPosSelected(nPos);
113
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::IsEntryPosSelected(int) const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::IsEntryPosSelected(int) const
114
115
    virtual sal_Int32       GetEntryCount() const override
116
0
    {
117
0
        return m_aComboListBox.GetEntryCount();
118
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetEntryCount() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetEntryCount() const
119
120
    virtual void            Select() override
121
0
    {
122
0
        m_aComboListBox.Select();
123
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::Select()
Unexecuted instantiation: VCLListBoxHelper<ListBox>::Select()
124
125
    virtual void            SelectEntryPos( sal_Int32  nPos, bool bSelect = true ) override
126
0
    {
127
0
        m_aComboListBox.SelectEntryPos(nPos,bSelect);
128
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::SelectEntryPos(int, bool)
Unexecuted instantiation: VCLListBoxHelper<ListBox>::SelectEntryPos(int, bool)
129
130
    virtual sal_Int32       GetSelectedEntryCount() const override
131
0
    {
132
0
        return m_aComboListBox.GetSelectedEntryCount();
133
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetSelectedEntryCount() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetSelectedEntryCount() const
134
135
    virtual void    SetNoSelection() override
136
0
    {
137
0
        m_aComboListBox.SetNoSelection();
138
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::SetNoSelection()
Unexecuted instantiation: VCLListBoxHelper<ListBox>::SetNoSelection()
139
140
    virtual sal_Int32       GetSelectedEntryPos( sal_Int32  nSelIndex = 0 ) const override
141
0
    {
142
0
        return m_aComboListBox.GetSelectedEntryPos(nSelIndex);
143
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetSelectedEntryPos(int) const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetSelectedEntryPos(int) const
144
145
    virtual bool            IsInDropDown() const override
146
0
    {
147
0
        return m_aComboListBox.IsInDropDown();
148
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::IsInDropDown() const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::IsInDropDown() const
149
150
    virtual tools::Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const override
151
0
    {
152
0
        tools::Rectangle aRect;
153
154
0
        Pair aEntryCharacterRange = m_aComboListBox.GetLineStartEnd( _nEntryPos );
155
0
        if ( aEntryCharacterRange.A() + _nCharacterIndex <= aEntryCharacterRange.B() )
156
0
        {
157
0
            tools::Long nIndex = aEntryCharacterRange.A() + _nCharacterIndex;
158
0
            aRect = m_aComboListBox.GetCharacterBounds( nIndex );
159
0
        }
160
0
        return aRect;
161
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetEntryCharacterBounds(int, int) const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetEntryCharacterBounds(int, int) const
162
163
    tools::Long GetIndexForPoint( const Point& rPoint, sal_Int32& nPos ) const override
164
0
    {
165
0
        return m_aComboListBox.GetIndexForPoint( rPoint, nPos );
166
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetIndexForPoint(Point const&, int&) const
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetIndexForPoint(Point const&, int&) const
167
168
    css::uno::Reference< css::datatransfer::clipboard::XClipboard >
169
        GetClipboard() override
170
0
    {
171
0
        return m_aComboListBox.GetClipboard();
172
0
    }
Unexecuted instantiation: VCLListBoxHelper<ComboBox>::GetClipboard()
Unexecuted instantiation: VCLListBoxHelper<ListBox>::GetClipboard()
173
174
};
175
176
177
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */