Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/table/tablecolumns.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
21
#include <com/sun/star/lang/DisposedException.hpp>
22
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
23
24
#include <tablemodel.hxx>
25
#include <utility>
26
#include "tablecolumns.hxx"
27
#include "tablecolumn.hxx"
28
29
30
using namespace ::com::sun::star::uno;
31
using namespace ::com::sun::star::lang;
32
using namespace ::com::sun::star::table;
33
34
35
namespace sdr::table {
36
37
TableColumns::TableColumns( TableModelRef xTableModel )
38
2.34k
: mxTableModel(std::move( xTableModel ))
39
2.34k
{
40
2.34k
}
41
42
43
TableColumns::~TableColumns()
44
2.34k
{
45
2.34k
    dispose();
46
2.34k
}
47
48
49
void TableColumns::dispose()
50
4.68k
{
51
4.68k
    mxTableModel.clear();
52
4.68k
}
53
54
55
void TableColumns::throwIfDisposed() const
56
175k
{
57
175k
    if( !mxTableModel.is() )
58
0
        throw DisposedException();
59
175k
}
60
61
62
// XTableRows
63
64
65
void SAL_CALL TableColumns::insertByIndex( sal_Int32 nIndex, sal_Int32 nCount )
66
40.5k
{
67
40.5k
    throwIfDisposed();
68
40.5k
    mxTableModel->insertColumns( nIndex, nCount );
69
40.5k
}
70
71
72
void SAL_CALL TableColumns::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount )
73
0
{
74
0
    throwIfDisposed();
75
0
    mxTableModel->removeColumns( nIndex, nCount );
76
0
}
77
78
79
// XIndexAccess
80
81
82
sal_Int32 SAL_CALL TableColumns::getCount()
83
127k
{
84
127k
    throwIfDisposed();
85
127k
    return mxTableModel->getColumnCount();
86
127k
}
87
88
89
Any SAL_CALL TableColumns::getByIndex( sal_Int32 Index )
90
7.12k
{
91
7.12k
    throwIfDisposed();
92
93
7.12k
    if( ( Index < 0 ) || ( Index >= mxTableModel->getColumnCount() ) )
94
0
        throw IndexOutOfBoundsException();
95
96
7.12k
    return Any( Reference< XCellRange >( mxTableModel->getColumn( Index ) ) );
97
7.12k
}
98
99
100
// XElementAccess
101
102
103
Type SAL_CALL TableColumns::getElementType()
104
0
{
105
0
    throwIfDisposed();
106
107
0
    return cppu::UnoType<XCellRange>::get();
108
0
}
109
110
111
sal_Bool SAL_CALL TableColumns::hasElements()
112
0
{
113
0
    throwIfDisposed();
114
115
0
    return mxTableModel->getColumnCount() != 0;
116
0
}
117
118
119
}
120
121
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */