gridsort: do not retrieve all row headers at once, this doesn't scale. Instead, allow to retrieve the header/title of a row given by index

This commit is contained in:
Frank Schoenheit [fs] 2011-01-07 15:52:55 +01:00
parent ce87fad0a9
commit ee6e84390f
3 changed files with 10 additions and 8 deletions

View file

@ -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& )
{

View file

@ -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 ];
}
//------------------------------------------------------------------------------------------------------------------

View file

@ -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);