LibreOffice Module svx (master) 1
tablecolumns.cxx
Go to the documentation of this file.
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
30using namespace ::com::sun::star::uno;
31using namespace ::com::sun::star::lang;
32using namespace ::com::sun::star::container;
33using namespace ::com::sun::star::table;
34
35
36namespace sdr::table {
37
39: mxTableModel(std::move( xTableModel ))
40{
41}
42
43
45{
46 dispose();
47}
48
49
51{
52 mxTableModel.clear();
53}
54
55
57{
58 if( !mxTableModel.is() )
59 throw DisposedException();
60}
61
62
63// XTableRows
64
65
66void SAL_CALL TableColumns::insertByIndex( sal_Int32 nIndex, sal_Int32 nCount )
67{
69 mxTableModel->insertColumns( nIndex, nCount );
70}
71
72
73void SAL_CALL TableColumns::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount )
74{
76 mxTableModel->removeColumns( nIndex, nCount );
77}
78
79
80// XIndexAccess
81
82
83sal_Int32 SAL_CALL TableColumns::getCount()
84{
86 return mxTableModel->getColumnCount();
87}
88
89
90Any SAL_CALL TableColumns::getByIndex( sal_Int32 Index )
91{
93
94 if( ( Index < 0 ) || ( Index >= mxTableModel->getColumnCount() ) )
95 throw IndexOutOfBoundsException();
96
97 return Any( Reference< XCellRange >( mxTableModel->getColumn( Index ) ) );
98}
99
100
101// XElementAccess
102
103
105{
107
109}
110
111
113{
115
116 return mxTableModel->getColumnCount() != 0;
117}
118
119
120}
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
css::uno::Type const & get()
TableModelRef mxTableModel
virtual sal_Bool SAL_CALL hasElements() override
virtual sal_Int32 SAL_CALL getCount() override
TableColumns(TableModelRef xTableModel)
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) override
void throwIfDisposed() const
virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) override
virtual ~TableColumns() override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
int nCount
sal_Int32 nIndex
Type
unsigned char sal_Bool