2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-02 14:13:40 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-01-23 16:35:00 +01:00
|
|
|
#include <com/sun/star/awt/grid/XMutableGridDataModel.hpp>
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2011-01-10 15:47:51 +01:00
|
|
|
|
2011-01-16 20:59:30 +01:00
|
|
|
#include <comphelper/componentguard.hxx>
|
2014-01-23 16:35:00 +01:00
|
|
|
#include <cppuhelper/basemutex.hxx>
|
2015-09-08 10:41:27 +09:00
|
|
|
#include <cppuhelper/compbase.hxx>
|
2013-10-21 19:04:05 -02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2009-08-26 13:11:27 +00:00
|
|
|
#include <toolkit/helper/servicenames.hxx>
|
2011-01-10 15:47:51 +01:00
|
|
|
#include <tools/diagnose_ex.h>
|
2014-01-23 16:35:00 +01:00
|
|
|
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
#include <algorithm>
|
2012-09-03 12:20:27 -05:00
|
|
|
#include <functional>
|
2014-01-23 16:35:00 +01:00
|
|
|
#include <vector>
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-01-23 16:35:00 +01:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::awt;
|
|
|
|
using namespace ::com::sun::star::awt::grid;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
enum broadcast_type { row_added, row_removed, data_changed};
|
|
|
|
|
2015-09-08 10:41:27 +09:00
|
|
|
typedef ::cppu::WeakComponentImplHelper < XMutableGridDataModel
|
2014-01-23 16:35:00 +01:00
|
|
|
, XServiceInfo
|
|
|
|
> DefaultGridDataModel_Base;
|
|
|
|
|
|
|
|
class DefaultGridDataModel :public ::cppu::BaseMutex
|
|
|
|
,public DefaultGridDataModel_Base
|
2009-08-26 13:11:27 +00:00
|
|
|
{
|
2014-01-23 16:35:00 +01:00
|
|
|
public:
|
|
|
|
DefaultGridDataModel();
|
|
|
|
DefaultGridDataModel( DefaultGridDataModel const & i_copySource );
|
|
|
|
virtual ~DefaultGridDataModel();
|
|
|
|
|
|
|
|
// XMutableGridDataModel
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL addRow( const Any& i_heading, const css::uno::Sequence< css::uno::Any >& Data ) throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL addRows( const css::uno::Sequence< css::uno::Any>& Headings, const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& Data ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL insertRow( ::sal_Int32 i_index, const css::uno::Any& i_heading, const css::uno::Sequence< css::uno::Any >& Data ) throw (css::uno::RuntimeException, css::lang::IndexOutOfBoundsException, std::exception) override;
|
|
|
|
virtual void SAL_CALL insertRows( ::sal_Int32 i_index, const css::uno::Sequence< css::uno::Any>& Headings, const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& Data ) throw (css::lang::IllegalArgumentException, css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL removeAllRows( ) throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const css::uno::Any& Value ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL updateRowData( const css::uno::Sequence< ::sal_Int32 >& ColumnIndexes, ::sal_Int32 RowIndex, const css::uno::Sequence< css::uno::Any >& Values ) throw (css::lang::IndexOutOfBoundsException, css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL updateRowHeading( ::sal_Int32 RowIndex, const css::uno::Any& Heading ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL updateCellToolTip( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const css::uno::Any& Value ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL updateRowToolTip( ::sal_Int32 RowIndex, const css::uno::Any& Value ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL addGridDataListener( const css::uno::Reference< css::awt::grid::XGridDataListener >& Listener ) throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL removeGridDataListener( const css::uno::Reference< css::awt::grid::XGridDataListener >& Listener ) throw (css::uno::RuntimeException, std::exception) override;
|
2014-01-23 16:35:00 +01:00
|
|
|
|
|
|
|
// XGridDataModel
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual ::sal_Int32 SAL_CALL getRowCount() throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual ::sal_Int32 SAL_CALL getColumnCount() throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getRowData( ::sal_Int32 RowIndex ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override;
|
2014-01-23 16:35:00 +01:00
|
|
|
|
|
|
|
// OComponentHelper
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL disposing() override;
|
2014-01-23 16:35:00 +01:00
|
|
|
|
|
|
|
// XCloneable
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) throw (css::uno::RuntimeException, std::exception) override;
|
2014-01-23 16:35:00 +01:00
|
|
|
|
|
|
|
// XServiceInfo
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException, std::exception) override;
|
|
|
|
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException, std::exception) override;
|
2014-01-23 16:35:00 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
typedef ::std::pair< Any, Any > CellData;
|
|
|
|
typedef ::std::vector< CellData > RowData;
|
|
|
|
typedef ::std::vector< RowData > GridData;
|
|
|
|
|
|
|
|
void broadcast(
|
|
|
|
GridDataEvent const & i_event,
|
|
|
|
void ( SAL_CALL css::awt::grid::XGridDataListener::*i_listenerMethod )( css::awt::grid::GridDataEvent const & ),
|
|
|
|
::comphelper::ComponentGuard & i_instanceLock
|
|
|
|
);
|
|
|
|
|
|
|
|
void impl_insertRow( sal_Int32 const i_position, Any const & i_heading, Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount = -1 );
|
|
|
|
|
|
|
|
::sal_Int32 impl_getRowCount_nolck() const { return sal_Int32( m_aData.size() ); }
|
|
|
|
|
|
|
|
CellData const & impl_getCellData_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex ) const;
|
|
|
|
CellData& impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex );
|
|
|
|
RowData& impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount );
|
|
|
|
|
|
|
|
GridData m_aData;
|
|
|
|
::std::vector< css::uno::Any > m_aRowHeaders;
|
|
|
|
sal_Int32 m_nColumnCount;
|
|
|
|
};
|
|
|
|
|
2011-01-03 23:14:55 +01:00
|
|
|
DefaultGridDataModel::DefaultGridDataModel()
|
2011-01-16 20:59:30 +01:00
|
|
|
:DefaultGridDataModel_Base( m_aMutex )
|
2011-01-03 23:14:55 +01:00
|
|
|
,m_aRowHeaders()
|
2011-01-10 15:47:51 +01:00
|
|
|
,m_nColumnCount(0)
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2011-01-03 23:14:55 +01:00
|
|
|
DefaultGridDataModel::DefaultGridDataModel( DefaultGridDataModel const & i_copySource )
|
2011-01-18 11:15:23 +01:00
|
|
|
:cppu::BaseMutex()
|
|
|
|
,DefaultGridDataModel_Base( m_aMutex )
|
2011-01-03 23:14:55 +01:00
|
|
|
,m_aData( i_copySource.m_aData )
|
|
|
|
,m_aRowHeaders( i_copySource.m_aRowHeaders )
|
2011-01-16 20:59:30 +01:00
|
|
|
,m_nColumnCount( i_copySource.m_nColumnCount )
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2011-01-03 23:14:55 +01:00
|
|
|
DefaultGridDataModel::~DefaultGridDataModel()
|
|
|
|
{
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
void DefaultGridDataModel::broadcast( GridDataEvent const & i_event,
|
2011-01-16 20:59:30 +01:00
|
|
|
void ( SAL_CALL XGridDataListener::*i_listenerMethod )( GridDataEvent const & ), ::comphelper::ComponentGuard & i_instanceLock )
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2013-12-12 11:09:57 +01:00
|
|
|
::cppu::OInterfaceContainerHelper* pListeners = rBHelper.getContainer( cppu::UnoType<XGridDataListener>::get() );
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( !pListeners )
|
|
|
|
return;
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
i_instanceLock.clear();
|
|
|
|
pListeners->notifyEach( i_listenerMethod, i_event );
|
2011-01-03 23:14:55 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2015-11-09 09:05:08 +02:00
|
|
|
::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (css::uno::RuntimeException, std::exception)
|
2009-08-26 13:11:27 +00:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2012-09-03 14:45:20 -05:00
|
|
|
return impl_getRowCount_nolck();
|
2009-08-26 13:11:27 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2015-11-09 09:05:08 +02:00
|
|
|
::sal_Int32 SAL_CALL DefaultGridDataModel::getColumnCount() throw (css::uno::RuntimeException, std::exception)
|
2011-01-06 16:28:45 +01:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2011-01-10 15:47:51 +01:00
|
|
|
return m_nColumnCount;
|
2011-01-06 16:28:45 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2011-01-14 13:19:09 +01:00
|
|
|
DefaultGridDataModel::CellData const & DefaultGridDataModel::impl_getCellData_throw( sal_Int32 const i_column, sal_Int32 const i_row ) const
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( ( i_row < 0 ) || ( size_t( i_row ) > m_aData.size() )
|
|
|
|
|| ( i_column < 0 ) || ( i_column > m_nColumnCount )
|
|
|
|
)
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *const_cast< DefaultGridDataModel* >( this ) );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-14 13:19:09 +01:00
|
|
|
RowData const & rRow( m_aData[ i_row ] );
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( size_t( i_column ) < rRow.size() )
|
|
|
|
return rRow[ i_column ];
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-14 13:19:09 +01:00
|
|
|
static CellData s_aEmpty;
|
|
|
|
return s_aEmpty;
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2011-01-14 15:13:23 +01:00
|
|
|
DefaultGridDataModel::RowData& DefaultGridDataModel::impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount )
|
2011-01-14 13:19:09 +01:00
|
|
|
{
|
2011-01-14 15:13:23 +01:00
|
|
|
OSL_ENSURE( i_requiredColumnCount <= size_t( m_nColumnCount ), "DefaultGridDataModel::impl_getRowDataAccess_throw: invalid column count!" );
|
|
|
|
if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2011-01-14 13:19:09 +01:00
|
|
|
|
2011-01-14 15:13:23 +01:00
|
|
|
RowData& rRowData( m_aData[ i_rowIndex ] );
|
|
|
|
if ( rRowData.size() < i_requiredColumnCount )
|
|
|
|
rRowData.resize( i_requiredColumnCount );
|
|
|
|
return rRowData;
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2011-01-14 15:13:23 +01:00
|
|
|
DefaultGridDataModel::CellData& DefaultGridDataModel::impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex )
|
|
|
|
{
|
|
|
|
if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= m_nColumnCount ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-14 15:13:23 +01:00
|
|
|
RowData& rRowData( impl_getRowDataAccess_throw( i_rowIndex, size_t( i_columnIndex + 1 ) ) );
|
|
|
|
return rRowData[ i_columnIndex ];
|
2011-01-14 13:19:09 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Any SAL_CALL DefaultGridDataModel::getCellData( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException, std::exception)
|
2011-01-14 13:19:09 +01:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2011-01-14 13:19:09 +01:00
|
|
|
return impl_getCellData_throw( i_column, i_row ).first;
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Any SAL_CALL DefaultGridDataModel::getCellToolTip( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException, std::exception)
|
2011-01-14 13:19:09 +01:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2011-01-14 13:19:09 +01:00
|
|
|
return impl_getCellData_throw( i_column, i_row ).second;
|
2011-01-03 23:14:55 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Any SAL_CALL DefaultGridDataModel::getRowHeading( ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException, std::exception)
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( ( i_row < 0 ) || ( size_t( i_row ) >= m_aRowHeaders.size() ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
return m_aRowHeaders[ i_row ];
|
2011-01-03 23:14:55 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Sequence< Any > SAL_CALL DefaultGridDataModel::getRowData( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
|
2011-03-22 13:00:39 +01:00
|
|
|
{
|
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
|
|
|
|
|
|
|
Sequence< Any > resultData( m_nColumnCount );
|
|
|
|
RowData& rRowData = impl_getRowDataAccess_throw( i_rowIndex, m_nColumnCount );
|
|
|
|
|
2012-09-03 12:20:27 -05:00
|
|
|
::std::transform( rRowData.begin(), rRowData.end(), resultData.getArray(),
|
2015-11-01 00:24:14 +01:00
|
|
|
[] ( const CellData& rCellData )
|
|
|
|
{ return rCellData.first; });
|
2011-03-22 13:00:39 +01:00
|
|
|
return resultData;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2012-09-03 14:45:20 -05:00
|
|
|
void DefaultGridDataModel::impl_insertRow( sal_Int32 const i_position, Any const & i_heading, Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount )
|
|
|
|
{
|
|
|
|
OSL_PRECOND( ( i_assumedColCount <= 0 ) || ( i_assumedColCount >= i_rowData.getLength() ),
|
|
|
|
"DefaultGridDataModel::impl_insertRow: invalid column count!" );
|
|
|
|
|
|
|
|
// insert heading
|
|
|
|
m_aRowHeaders.insert( m_aRowHeaders.begin() + i_position, i_heading );
|
|
|
|
|
|
|
|
// create new data row
|
|
|
|
RowData newRow( i_assumedColCount > 0 ? i_assumedColCount : i_rowData.getLength() );
|
|
|
|
RowData::iterator cellData = newRow.begin();
|
2013-11-06 15:07:46 -02:00
|
|
|
for ( const Any* pData = i_rowData.begin(); pData != i_rowData.end(); ++pData, ++cellData )
|
2012-09-03 14:45:20 -05:00
|
|
|
cellData->first = *pData;
|
|
|
|
|
|
|
|
// insert data row
|
|
|
|
m_aData.insert( m_aData.begin() + i_position, newRow );
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException, std::exception)
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2012-09-03 14:45:20 -05:00
|
|
|
insertRow( getRowCount(), i_heading, i_data );
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException, std::exception)
|
2012-09-03 14:45:20 -05:00
|
|
|
{
|
|
|
|
insertRows( getRowCount(), i_headings, i_data );
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::insertRow( ::sal_Int32 i_index, const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException, IndexOutOfBoundsException, std::exception)
|
2012-09-03 14:45:20 -05:00
|
|
|
{
|
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2012-09-03 14:45:20 -05:00
|
|
|
if ( ( i_index < 0 ) || ( i_index > impl_getRowCount_nolck() ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2012-09-03 14:45:20 -05:00
|
|
|
|
|
|
|
// actually insert the row
|
|
|
|
impl_insertRow( i_index, i_heading, i_data );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
// update column count
|
2012-09-03 14:45:20 -05:00
|
|
|
sal_Int32 const columnCount = i_data.getLength();
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( columnCount > m_nColumnCount )
|
|
|
|
m_nColumnCount = columnCount;
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
broadcast(
|
2012-09-03 14:45:20 -05:00
|
|
|
GridDataEvent( *this, -1, -1, i_index, i_index ),
|
gridsort: reworked the notification system for inserted/removed rows
In this course, more code which was in SVTXGridControl was moved to the places it belongs to, effectively
meaning that the TableControl has better chances than before to be used outside an SVTXGridControl (though
we're not there, yet).
Also, the selection-related methods in TableControl/_Impl got some refactoring love, so the implementation
details are hidden in the Impl class now, instead of being exposed to an exploited by the TableControl.
And while we were there ... The XGridSelection does not provide a |selectColumn| anymore (there was no
preparation whatsoever for column selection, anywhere, thus it was a complete dummy.)
Also, its de/selectRows methods have been removed: They have questionable use, and make implementation
rather difficult, compared with multiple calls to de/selectRow.
2011-01-13 14:08:36 +01:00
|
|
|
&XGridDataListener::rowsInserted,
|
2011-01-10 15:47:51 +01:00
|
|
|
aGuard
|
|
|
|
);
|
2011-01-03 23:14:55 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::insertRows( ::sal_Int32 i_index, const Sequence< Any>& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, IndexOutOfBoundsException, RuntimeException, std::exception)
|
2009-08-26 13:11:27 +00:00
|
|
|
{
|
2011-01-16 22:18:58 +01:00
|
|
|
if ( i_headings.getLength() != i_data.getLength() )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IllegalArgumentException( OUString(), *this, -1 );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2012-09-03 14:45:20 -05:00
|
|
|
if ( ( i_index < 0 ) || ( i_index > impl_getRowCount_nolck() ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2012-09-03 14:45:20 -05:00
|
|
|
|
2011-01-16 22:18:58 +01:00
|
|
|
sal_Int32 const rowCount = i_headings.getLength();
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( rowCount == 0 )
|
|
|
|
return;
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
// determine max col count in the new data
|
|
|
|
sal_Int32 maxColCount = 0;
|
|
|
|
for ( sal_Int32 row=0; row<rowCount; ++row )
|
|
|
|
if ( i_data[row].getLength() > maxColCount )
|
|
|
|
maxColCount = i_data[row].getLength();
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( maxColCount < m_nColumnCount )
|
|
|
|
maxColCount = m_nColumnCount;
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
for ( sal_Int32 row=0; row<rowCount; ++row )
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2012-09-03 14:45:20 -05:00
|
|
|
impl_insertRow( i_index + row, i_headings[row], i_data[row], maxColCount );
|
2011-01-03 23:14:55 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( maxColCount > m_nColumnCount )
|
|
|
|
m_nColumnCount = maxColCount;
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
broadcast(
|
2012-09-03 14:45:20 -05:00
|
|
|
GridDataEvent( *this, -1, -1, i_index, i_index + rowCount - 1 ),
|
gridsort: reworked the notification system for inserted/removed rows
In this course, more code which was in SVTXGridControl was moved to the places it belongs to, effectively
meaning that the TableControl has better chances than before to be used outside an SVTXGridControl (though
we're not there, yet).
Also, the selection-related methods in TableControl/_Impl got some refactoring love, so the implementation
details are hidden in the Impl class now, instead of being exposed to an exploited by the TableControl.
And while we were there ... The XGridSelection does not provide a |selectColumn| anymore (there was no
preparation whatsoever for column selection, anywhere, thus it was a complete dummy.)
Also, its de/selectRows methods have been removed: They have questionable use, and make implementation
rather difficult, compared with multiple calls to de/selectRow.
2011-01-13 14:08:36 +01:00
|
|
|
&XGridDataListener::rowsInserted,
|
2011-01-10 15:47:51 +01:00
|
|
|
aGuard
|
|
|
|
);
|
2009-08-26 13:11:27 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
|
2009-08-26 13:11:27 +00:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
m_aRowHeaders.erase( m_aRowHeaders.begin() + i_rowIndex );
|
|
|
|
m_aData.erase( m_aData.begin() + i_rowIndex );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
broadcast(
|
gridsort: reworked the notification system for inserted/removed rows
In this course, more code which was in SVTXGridControl was moved to the places it belongs to, effectively
meaning that the TableControl has better chances than before to be used outside an SVTXGridControl (though
we're not there, yet).
Also, the selection-related methods in TableControl/_Impl got some refactoring love, so the implementation
details are hidden in the Impl class now, instead of being exposed to an exploited by the TableControl.
And while we were there ... The XGridSelection does not provide a |selectColumn| anymore (there was no
preparation whatsoever for column selection, anywhere, thus it was a complete dummy.)
Also, its de/selectRows methods have been removed: They have questionable use, and make implementation
rather difficult, compared with multiple calls to de/selectRow.
2011-01-13 14:08:36 +01:00
|
|
|
GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
|
2011-01-10 15:47:51 +01:00
|
|
|
&XGridDataListener::rowsRemoved,
|
|
|
|
aGuard
|
|
|
|
);
|
2009-08-26 13:11:27 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::removeAllRows( ) throw (RuntimeException, std::exception)
|
2009-08-26 13:11:27 +00:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2011-01-10 15:47:51 +01:00
|
|
|
|
|
|
|
m_aRowHeaders.clear();
|
|
|
|
m_aData.clear();
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
broadcast(
|
gridsort: reworked the notification system for inserted/removed rows
In this course, more code which was in SVTXGridControl was moved to the places it belongs to, effectively
meaning that the TableControl has better chances than before to be used outside an SVTXGridControl (though
we're not there, yet).
Also, the selection-related methods in TableControl/_Impl got some refactoring love, so the implementation
details are hidden in the Impl class now, instead of being exposed to an exploited by the TableControl.
And while we were there ... The XGridSelection does not provide a |selectColumn| anymore (there was no
preparation whatsoever for column selection, anywhere, thus it was a complete dummy.)
Also, its de/selectRows methods have been removed: They have questionable use, and make implementation
rather difficult, compared with multiple calls to de/selectRow.
2011-01-13 14:08:36 +01:00
|
|
|
GridDataEvent( *this, -1, -1, -1, -1 ),
|
2011-01-10 15:47:51 +01:00
|
|
|
&XGridDataListener::rowsRemoved,
|
|
|
|
aGuard
|
|
|
|
);
|
2009-08-26 13:11:27 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::updateCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
|
2009-08-26 13:11:27 +00:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2011-01-10 15:47:51 +01:00
|
|
|
|
2011-01-14 13:19:09 +01:00
|
|
|
impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).first = i_value;
|
2011-01-10 15:47:51 +01:00
|
|
|
|
|
|
|
broadcast(
|
gridsort: reworked the notification system for inserted/removed rows
In this course, more code which was in SVTXGridControl was moved to the places it belongs to, effectively
meaning that the TableControl has better chances than before to be used outside an SVTXGridControl (though
we're not there, yet).
Also, the selection-related methods in TableControl/_Impl got some refactoring love, so the implementation
details are hidden in the Impl class now, instead of being exposed to an exploited by the TableControl.
And while we were there ... The XGridSelection does not provide a |selectColumn| anymore (there was no
preparation whatsoever for column selection, anywhere, thus it was a complete dummy.)
Also, its de/selectRows methods have been removed: They have questionable use, and make implementation
rather difficult, compared with multiple calls to de/selectRow.
2011-01-13 14:08:36 +01:00
|
|
|
GridDataEvent( *this, i_columnIndex, i_columnIndex, i_rowIndex, i_rowIndex ),
|
2011-01-10 15:47:51 +01:00
|
|
|
&XGridDataListener::dataChanged,
|
|
|
|
aGuard
|
|
|
|
);
|
2009-08-26 13:11:27 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::updateRowData( const Sequence< ::sal_Int32 >& i_columnIndexes, ::sal_Int32 i_rowIndex, const Sequence< Any >& i_values ) throw (IndexOutOfBoundsException, IllegalArgumentException, RuntimeException, std::exception)
|
2010-04-23 17:41:32 +02:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( i_columnIndexes.getLength() != i_values.getLength() )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IllegalArgumentException( OUString(), *this, 1 );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
sal_Int32 const columnCount = i_columnIndexes.getLength();
|
|
|
|
if ( columnCount == 0 )
|
|
|
|
return;
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
for ( sal_Int32 col = 0; col < columnCount; ++col )
|
2010-04-23 17:41:32 +02:00
|
|
|
{
|
2011-01-10 15:47:51 +01:00
|
|
|
if ( ( i_columnIndexes[col] < 0 ) || ( i_columnIndexes[col] > m_nColumnCount ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2010-04-23 17:41:32 +02:00
|
|
|
}
|
2011-01-10 15:47:51 +01:00
|
|
|
|
2011-01-14 13:19:09 +01:00
|
|
|
RowData& rDataRow = m_aData[ i_rowIndex ];
|
2011-01-10 15:47:51 +01:00
|
|
|
for ( sal_Int32 col = 0; col < columnCount; ++col )
|
2010-04-23 17:41:32 +02:00
|
|
|
{
|
2011-01-10 15:47:51 +01:00
|
|
|
sal_Int32 const columnIndex = i_columnIndexes[ col ];
|
|
|
|
if ( size_t( columnIndex ) >= rDataRow.size() )
|
|
|
|
rDataRow.resize( columnIndex + 1 );
|
|
|
|
|
2011-01-14 13:19:09 +01:00
|
|
|
rDataRow[ columnIndex ].first = i_values[ col ];
|
2010-04-23 17:41:32 +02:00
|
|
|
}
|
2011-01-10 15:47:51 +01:00
|
|
|
|
2013-11-06 15:07:46 -02:00
|
|
|
sal_Int32 const firstAffectedColumn = *::std::min_element( i_columnIndexes.begin(), i_columnIndexes.end() );
|
|
|
|
sal_Int32 const lastAffectedColumn = *::std::max_element( i_columnIndexes.begin(), i_columnIndexes.end() );
|
2011-01-10 15:47:51 +01:00
|
|
|
broadcast(
|
gridsort: reworked the notification system for inserted/removed rows
In this course, more code which was in SVTXGridControl was moved to the places it belongs to, effectively
meaning that the TableControl has better chances than before to be used outside an SVTXGridControl (though
we're not there, yet).
Also, the selection-related methods in TableControl/_Impl got some refactoring love, so the implementation
details are hidden in the Impl class now, instead of being exposed to an exploited by the TableControl.
And while we were there ... The XGridSelection does not provide a |selectColumn| anymore (there was no
preparation whatsoever for column selection, anywhere, thus it was a complete dummy.)
Also, its de/selectRows methods have been removed: They have questionable use, and make implementation
rather difficult, compared with multiple calls to de/selectRow.
2011-01-13 14:08:36 +01:00
|
|
|
GridDataEvent( *this, firstAffectedColumn, lastAffectedColumn, i_rowIndex, i_rowIndex ),
|
2011-01-10 15:47:51 +01:00
|
|
|
&XGridDataListener::dataChanged,
|
|
|
|
aGuard
|
|
|
|
);
|
2010-04-23 17:41:32 +02:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::updateRowHeading( ::sal_Int32 i_rowIndex, const Any& i_heading ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
|
2010-04-23 17:41:32 +02:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-14 13:19:09 +01:00
|
|
|
if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aRowHeaders.size() ) )
|
2013-04-07 12:06:47 +02:00
|
|
|
throw IndexOutOfBoundsException( OUString(), *this );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-16 22:18:58 +01:00
|
|
|
m_aRowHeaders[ i_rowIndex ] = i_heading;
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-10 15:47:51 +01:00
|
|
|
broadcast(
|
gridsort: reworked the notification system for inserted/removed rows
In this course, more code which was in SVTXGridControl was moved to the places it belongs to, effectively
meaning that the TableControl has better chances than before to be used outside an SVTXGridControl (though
we're not there, yet).
Also, the selection-related methods in TableControl/_Impl got some refactoring love, so the implementation
details are hidden in the Impl class now, instead of being exposed to an exploited by the TableControl.
And while we were there ... The XGridSelection does not provide a |selectColumn| anymore (there was no
preparation whatsoever for column selection, anywhere, thus it was a complete dummy.)
Also, its de/selectRows methods have been removed: They have questionable use, and make implementation
rather difficult, compared with multiple calls to de/selectRow.
2011-01-13 14:08:36 +01:00
|
|
|
GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
|
2011-01-16 22:18:58 +01:00
|
|
|
&XGridDataListener::rowHeadingChanged,
|
2011-01-10 15:47:51 +01:00
|
|
|
aGuard
|
|
|
|
);
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::updateCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
|
2011-01-14 13:19:09 +01:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2011-01-14 13:19:09 +01:00
|
|
|
impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).second = i_value;
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::updateRowToolTip( ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
|
2011-01-14 15:13:23 +01:00
|
|
|
{
|
2011-01-16 20:59:30 +01:00
|
|
|
::comphelper::ComponentGuard aGuard( *this, rBHelper );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-14 15:13:23 +01:00
|
|
|
RowData& rRowData = impl_getRowDataAccess_throw( i_rowIndex, m_nColumnCount );
|
|
|
|
for ( RowData::iterator cell = rRowData.begin(); cell != rRowData.end(); ++cell )
|
|
|
|
cell->second = i_value;
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::addGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException, std::exception)
|
2011-01-10 15:47:51 +01:00
|
|
|
{
|
2013-12-12 11:09:57 +01:00
|
|
|
rBHelper.addListener( cppu::UnoType<XGridDataListener>::get(), i_listener );
|
2011-01-10 15:47:51 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::removeGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException, std::exception)
|
2011-01-10 15:47:51 +01:00
|
|
|
{
|
2013-12-12 11:09:57 +01:00
|
|
|
rBHelper.removeListener( cppu::UnoType<XGridDataListener>::get(), i_listener );
|
2010-04-23 17:41:32 +02:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2011-01-16 20:59:30 +01:00
|
|
|
void SAL_CALL DefaultGridDataModel::disposing()
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2015-11-09 09:05:08 +02:00
|
|
|
css::lang::EventObject aEvent;
|
2011-01-16 20:59:30 +01:00
|
|
|
aEvent.Source.set( *this );
|
|
|
|
rBHelper.aLC.disposeAndClear( aEvent );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-16 20:59:30 +01:00
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
GridData aEmptyData;
|
|
|
|
m_aData.swap( aEmptyData );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-16 22:18:58 +01:00
|
|
|
::std::vector< Any > aEmptyRowHeaders;
|
2011-01-16 20:59:30 +01:00
|
|
|
m_aRowHeaders.swap( aEmptyRowHeaders );
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2011-01-16 20:59:30 +01:00
|
|
|
m_nColumnCount = 0;
|
2011-01-03 23:14:55 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString SAL_CALL DefaultGridDataModel::getImplementationName( ) throw (RuntimeException, std::exception)
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2014-01-23 16:35:00 +01:00
|
|
|
return OUString("stardiv.Toolkit.DefaultGridDataModel");
|
2011-01-03 23:14:55 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const OUString& ServiceName ) throw (RuntimeException, std::exception)
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2013-10-21 19:04:05 -02:00
|
|
|
return cppu::supportsService(this, ServiceName);
|
2011-01-03 23:14:55 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException, std::exception)
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
2015-11-15 12:22:28 +02:00
|
|
|
Sequence<OUString> aSeq { "com.sun.star.awt.grid.DefaultGridDataModel" };
|
2011-01-03 23:14:55 +01:00
|
|
|
return aSeq;
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< css::util::XCloneable > SAL_CALL DefaultGridDataModel::createClone( ) throw (RuntimeException, std::exception)
|
2011-01-03 23:14:55 +01:00
|
|
|
{
|
|
|
|
return new DefaultGridDataModel( *this );
|
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-01-23 16:35:00 +01:00
|
|
|
}
|
2009-08-26 13:11:27 +00:00
|
|
|
|
2014-01-23 16:35:00 +01:00
|
|
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
|
|
|
|
stardiv_Toolkit_DefaultGridDataModel_get_implementation(
|
|
|
|
css::uno::XComponentContext *,
|
|
|
|
css::uno::Sequence<css::uno::Any> const &)
|
2009-08-26 13:11:27 +00:00
|
|
|
{
|
2014-01-23 16:35:00 +01:00
|
|
|
return cppu::acquire(new DefaultGridDataModel());
|
2009-08-26 13:11:27 +00:00
|
|
|
}
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|