diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-12-17 14:16:47 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-12-17 14:16:47 +0100 |
commit | e8dce783c66d41bbd29d01079bdfac7b5fbf0f1d (patch) | |
tree | 513c8a512289ff614f23f30d828fc46c1d4e05b5 /toolkit | |
parent | caa7780d3aae5624cf930c0794c63114564d8781 (diff) |
gridsort: let XGridColumnModel::getColumn throw an IndexOutOfBoundsException when appropriate
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/controls/grid/defaultgridcolumnmodel.cxx | 11 | ||||
-rw-r--r-- | toolkit/source/controls/grid/defaultgridcolumnmodel.hxx | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index 2a5b5683efad..16e0c8a0a0bc 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -58,6 +58,7 @@ namespace toolkit using ::com::sun::star::container::XContainerListener; using ::com::sun::star::container::ContainerEvent; using ::com::sun::star::uno::Exception; + using ::com::sun::star::lang::IndexOutOfBoundsException; /** === end UNO using === **/ //================================================================================================================== @@ -104,16 +105,14 @@ namespace toolkit } //------------------------------------------------------------------------------------------------------------------ - Reference< XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (RuntimeException) + Reference< XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (IndexOutOfBoundsException, RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex ); + if ( index >=0 && index < ((sal_Int32)m_aColumns.size())) - { return m_aColumns[index]; - } - else - // TODO: exception - return Reference< XGridColumn >(); + + throw IndexOutOfBoundsException(); } //------------------------------------------------------------------------------------------------------------------ diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx index 964d604c8ab1..4b4382048566 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx @@ -61,7 +61,7 @@ public: virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setColumnHeaderHeight( sal_Int32 _value) throw (com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getColumnHeaderHeight() throw (com::sun::star::uno::RuntimeException); virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException); |