diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index 91ad989a26c1..29d33d0526ee 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -532,10 +532,7 @@ namespace svt { namespace table try { - Sequence< ::rtl::OUString > const aRowHeaders( xDataModel->getRowHeaders() ); - ENSURE_OR_RETURN( ( i_rowPos >= 0 ) && ( i_rowPos < aRowHeaders.getLength() ), - "UnoControlTableModel::getRowHeader: illegal row position!", sRowHeader ); - sRowHeader = aRowHeaders[ i_rowPos ]; + sRowHeader = xDataModel->getRowTitle( i_rowPos ); } catch( const Exception& ) { diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index 7a04b77c2574..8e12260be7d2 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -146,9 +146,14 @@ namespace toolkit } //------------------------------------------------------------------------------------------------------------------ - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getRowHeaders() throw (::com::sun::star::uno::RuntimeException) + ::rtl::OUString SAL_CALL DefaultGridDataModel::getRowTitle( ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException) { - return comphelper::containerToSequence(m_aRowHeaders); + ::osl::MutexGuard aGuard( GetMutex() ); + + if ( ( i_row < 0 ) || ( size_t( i_row ) >= m_aRowHeaders.size() ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); + + return m_aRowHeaders[ i_row ]; } //------------------------------------------------------------------------------------------------------------------ diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx index 43bb43a005a8..c44c02fb0227 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx @@ -64,9 +64,9 @@ public: // XGridDataModel virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowHeaders() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getRowTitle( ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & _aData) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addGridDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);