bump product version to 5.0.4.1
[LibreOffice.git] / svx / source / table / tablerows.cxx
blobbfaecd7d78d30c28ae02d0758447b37af16a314b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <com/sun/star/lang/DisposedException.hpp>
23 #include "cell.hxx"
24 #include "tablerow.hxx"
25 #include "tablerows.hxx"
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::lang;
31 using namespace ::com::sun::star::container;
32 using namespace ::com::sun::star::table;
36 namespace sdr { namespace table {
38 TableRows::TableRows( const TableModelRef& xTableModel )
39 : mxTableModel( xTableModel )
45 TableRows::~TableRows()
47 dispose();
52 void TableRows::dispose()
54 mxTableModel.clear();
59 void TableRows::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException)
61 if( !mxTableModel.is() )
62 throw DisposedException();
66 // XTableRows
69 void SAL_CALL TableRows::insertByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (RuntimeException, std::exception)
71 throwIfDisposed();
72 mxTableModel->insertRows( nIndex, nCount );
77 void SAL_CALL TableRows::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (RuntimeException, std::exception)
79 throwIfDisposed();
80 mxTableModel->removeRows( nIndex, nCount );
84 // XIndexAccess
87 sal_Int32 SAL_CALL TableRows::getCount() throw (RuntimeException, std::exception)
89 throwIfDisposed();
90 return mxTableModel->getRowCount();
95 Any SAL_CALL TableRows::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException, std::exception)
97 throwIfDisposed();
98 return Any( Reference< XCellRange >( static_cast< XCellRange* >( mxTableModel->getRow( Index ).get() ) ) );
102 // XElementAccess
105 Type SAL_CALL TableRows::getElementType() throw (RuntimeException, std::exception)
107 throwIfDisposed();
108 return cppu::UnoType<XCellRange>::get();
113 sal_Bool SAL_CALL TableRows::hasElements() throw (RuntimeException, std::exception)
115 throwIfDisposed();
116 return mxTableModel->getRowCount() != 0;
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */