LCOV - code coverage report
Current view: top level - toolkit/source/controls/grid - defaultgriddatamodel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 176 13.6 %
Date: 2012-08-25 Functions: 7 31 22.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 14 354 4.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "defaultgriddatamodel.hxx"
      31                 :            : 
      32                 :            : #include <comphelper/stlunosequence.hxx>
      33                 :            : #include <comphelper/componentguard.hxx>
      34                 :            : #include <toolkit/helper/servicenames.hxx>
      35                 :            : #include <tools/diagnose_ex.h>
      36                 :            : #include <rtl/ref.hxx>
      37                 :            : 
      38                 :            : #include <algorithm>
      39                 :            : 
      40                 :            : //......................................................................................................................
      41                 :            : namespace toolkit
      42                 :            : //......................................................................................................................
      43                 :            : {
      44                 :            :     /** === begin UNO using === **/
      45                 :            :     using ::com::sun::star::uno::Reference;
      46                 :            :     using ::com::sun::star::uno::RuntimeException;
      47                 :            :     using ::com::sun::star::uno::Sequence;
      48                 :            :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      49                 :            :     using ::com::sun::star::uno::UNO_QUERY;
      50                 :            :     using ::com::sun::star::uno::XInterface;
      51                 :            :     using ::com::sun::star::lang::XComponent;
      52                 :            :     using ::com::sun::star::lang::EventObject;
      53                 :            :     using ::com::sun::star::uno::Exception;
      54                 :            :     using ::com::sun::star::util::XCloneable;
      55                 :            :     /** === end UNO using === **/
      56                 :            : 
      57                 :            :     using ::comphelper::stl_begin;
      58                 :            :     using ::comphelper::stl_end;
      59                 :            : 
      60                 :            :     //==================================================================================================================
      61                 :            :     //= DefaultGridDataModel
      62                 :            :     //==================================================================================================================
      63                 :            :     //------------------------------------------------------------------------------------------------------------------
      64                 :          2 :     DefaultGridDataModel::DefaultGridDataModel()
      65                 :            :         :DefaultGridDataModel_Base( m_aMutex )
      66                 :            :         ,m_aRowHeaders()
      67 [ +  - ][ +  - ]:          2 :         ,m_nColumnCount(0)
      68                 :            :     {
      69                 :          2 :     }
      70                 :            : 
      71                 :            :     //------------------------------------------------------------------------------------------------------------------
      72                 :          0 :     DefaultGridDataModel::DefaultGridDataModel( DefaultGridDataModel const & i_copySource )
      73                 :            :         :cppu::BaseMutex()
      74                 :            :         ,DefaultGridDataModel_Base( m_aMutex )
      75                 :            :         ,m_aData( i_copySource.m_aData )
      76                 :            :         ,m_aRowHeaders( i_copySource.m_aRowHeaders )
      77 [ #  # ][ #  # ]:          0 :         ,m_nColumnCount( i_copySource.m_nColumnCount )
      78                 :            :     {
      79                 :          0 :     }
      80                 :            : 
      81                 :            :     //------------------------------------------------------------------------------------------------------------------
      82         [ +  - ]:          2 :     DefaultGridDataModel::~DefaultGridDataModel()
      83                 :            :     {
      84         [ -  + ]:          4 :     }
      85                 :            : 
      86                 :            :     //------------------------------------------------------------------------------------------------------------------
      87                 :          0 :     void DefaultGridDataModel::broadcast( GridDataEvent const & i_event,
      88                 :            :         void ( SAL_CALL XGridDataListener::*i_listenerMethod )( GridDataEvent const & ), ::comphelper::ComponentGuard & i_instanceLock )
      89                 :            :     {
      90                 :          0 :         ::cppu::OInterfaceContainerHelper* pListeners = rBHelper.getContainer( XGridDataListener::static_type() );
      91         [ #  # ]:          0 :         if ( !pListeners )
      92                 :          0 :             return;
      93                 :            : 
      94                 :          0 :         i_instanceLock.clear();
      95                 :          0 :         pListeners->notifyEach( i_listenerMethod, i_event );
      96                 :            :     }
      97                 :            : 
      98                 :            :     //------------------------------------------------------------------------------------------------------------------
      99                 :          0 :     ::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException)
     100                 :            :     {
     101         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     102         [ #  # ]:          0 :         return m_aData.size();
     103                 :            :     }
     104                 :            : 
     105                 :            :     //------------------------------------------------------------------------------------------------------------------
     106                 :          0 :     ::sal_Int32 SAL_CALL DefaultGridDataModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
     107                 :            :     {
     108         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     109         [ #  # ]:          0 :         return m_nColumnCount;
     110                 :            :     }
     111                 :            : 
     112                 :            :     //------------------------------------------------------------------------------------------------------------------
     113                 :          0 :     DefaultGridDataModel::CellData const & DefaultGridDataModel::impl_getCellData_throw( sal_Int32 const i_column, sal_Int32 const i_row ) const
     114                 :            :     {
     115 [ #  # ][ #  # ]:          0 :         if  (   ( i_row < 0 ) || ( size_t( i_row ) > m_aData.size() )
         [ #  # ][ #  # ]
                 [ #  # ]
     116                 :            :             ||  ( i_column < 0 ) || ( i_column > m_nColumnCount )
     117                 :            :             )
     118 [ #  # ][ #  # ]:          0 :             throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< DefaultGridDataModel* >( this ) );
     119                 :            : 
     120                 :          0 :         RowData const & rRow( m_aData[ i_row ] );
     121         [ #  # ]:          0 :         if ( size_t( i_column ) < rRow.size() )
     122                 :          0 :             return rRow[ i_column ];
     123                 :            : 
     124 [ #  # ][ #  # ]:          0 :         static CellData s_aEmpty;
     125                 :          0 :         return s_aEmpty;
     126                 :            :     }
     127                 :            : 
     128                 :            :     //------------------------------------------------------------------------------------------------------------------
     129                 :          0 :     DefaultGridDataModel::RowData& DefaultGridDataModel::impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount )
     130                 :            :     {
     131                 :            :         OSL_ENSURE( i_requiredColumnCount <= size_t( m_nColumnCount ), "DefaultGridDataModel::impl_getRowDataAccess_throw: invalid column count!" );
     132 [ #  # ][ #  # ]:          0 :         if  ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
                 [ #  # ]
     133 [ #  # ][ #  # ]:          0 :             throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
     134                 :            : 
     135                 :          0 :         RowData& rRowData( m_aData[ i_rowIndex ] );
     136         [ #  # ]:          0 :         if ( rRowData.size() < i_requiredColumnCount )
     137                 :          0 :             rRowData.resize( i_requiredColumnCount );
     138                 :          0 :         return rRowData;
     139                 :            :     }
     140                 :            : 
     141                 :            :     //------------------------------------------------------------------------------------------------------------------
     142                 :          0 :     DefaultGridDataModel::CellData& DefaultGridDataModel::impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex )
     143                 :            :     {
     144 [ #  # ][ #  # ]:          0 :         if  ( ( i_columnIndex < 0 ) || ( i_columnIndex >= m_nColumnCount ) )
     145 [ #  # ][ #  # ]:          0 :             throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
     146                 :            : 
     147                 :          0 :         RowData& rRowData( impl_getRowDataAccess_throw( i_rowIndex, size_t( i_columnIndex + 1 ) ) );
     148                 :          0 :         return rRowData[ i_columnIndex ];
     149                 :            :     }
     150                 :            : 
     151                 :            :     //------------------------------------------------------------------------------------------------------------------
     152                 :          0 :     Any SAL_CALL DefaultGridDataModel::getCellData( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
     153                 :            :     {
     154         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     155 [ #  # ][ #  # ]:          0 :         return impl_getCellData_throw( i_column, i_row ).first;
     156                 :            :     }
     157                 :            : 
     158                 :            :     //------------------------------------------------------------------------------------------------------------------
     159                 :          0 :     Any SAL_CALL DefaultGridDataModel::getCellToolTip( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
     160                 :            :     {
     161         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     162 [ #  # ][ #  # ]:          0 :         return impl_getCellData_throw( i_column, i_row ).second;
     163                 :            :     }
     164                 :            : 
     165                 :            :     //------------------------------------------------------------------------------------------------------------------
     166                 :          0 :     Any SAL_CALL DefaultGridDataModel::getRowHeading( ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
     167                 :            :     {
     168         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     169                 :            : 
     170 [ #  # ][ #  # ]:          0 :         if ( ( i_row < 0 ) || ( size_t( i_row ) >= m_aRowHeaders.size() ) )
                 [ #  # ]
     171 [ #  # ][ #  # ]:          0 :             throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
     172                 :            : 
     173         [ #  # ]:          0 :         return m_aRowHeaders[ i_row ];
     174                 :            :     }
     175                 :            : 
     176                 :            :     //------------------------------------------------------------------------------------------------------------------
     177                 :          0 :     void SAL_CALL DefaultGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException)
     178                 :            :     {
     179         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     180                 :            : 
     181                 :          0 :         sal_Int32 const columnCount = i_data.getLength();
     182                 :            : 
     183                 :            :         // store header name
     184         [ #  # ]:          0 :         m_aRowHeaders.push_back( i_heading );
     185                 :            : 
     186                 :            :         // store row m_aData
     187         [ #  # ]:          0 :         impl_addRow( i_data );
     188                 :            : 
     189                 :            :         // update column count
     190         [ #  # ]:          0 :         if ( columnCount > m_nColumnCount )
     191                 :          0 :             m_nColumnCount = columnCount;
     192                 :            : 
     193                 :          0 :         sal_Int32 const rowIndex = sal_Int32( m_aData.size() - 1 );
     194                 :            :         broadcast(
     195                 :            :             GridDataEvent( *this, -1, -1, rowIndex, rowIndex ),
     196                 :            :             &XGridDataListener::rowsInserted,
     197                 :            :             aGuard
     198 [ #  # ][ #  # ]:          0 :         );
         [ #  # ][ #  # ]
                 [ #  # ]
     199                 :          0 :     }
     200                 :            : 
     201                 :            :     //------------------------------------------------------------------------------------------------------------------
     202                 :          0 :     void DefaultGridDataModel::impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount )
     203                 :            :     {
     204                 :            :         OSL_PRECOND( ( i_assumedColCount <= 0 ) || ( i_assumedColCount >= i_rowData.getLength() ),
     205                 :            :             "DefaultGridDataModel::impl_addRow: invalid column count!" );
     206                 :            : 
     207 [ #  # ][ #  # ]:          0 :         RowData newRow( i_assumedColCount > 0 ? i_assumedColCount : i_rowData.getLength() );
     208                 :          0 :         RowData::iterator cellData = newRow.begin();
     209 [ #  # ][ #  # ]:          0 :         for ( const Any* pData = stl_begin( i_rowData ); pData != stl_end( i_rowData ); ++pData, ++cellData )
                 [ #  # ]
     210                 :          0 :             cellData->first = *pData;
     211                 :            : 
     212         [ #  # ]:          0 :         m_aData.push_back( newRow );
     213                 :          0 :     }
     214                 :            : 
     215                 :            :     //------------------------------------------------------------------------------------------------------------------
     216                 :          0 :     void SAL_CALL DefaultGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException)
     217                 :            :     {
     218         [ #  # ]:          0 :         if ( i_headings.getLength() != i_data.getLength() )
     219 [ #  # ][ #  # ]:          0 :             throw IllegalArgumentException( ::rtl::OUString(), *this, -1 );
     220                 :            : 
     221         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     222                 :            : 
     223                 :          0 :         sal_Int32 const rowCount = i_headings.getLength();
     224         [ #  # ]:          0 :         if ( rowCount == 0 )
     225                 :          0 :             return;
     226                 :            : 
     227                 :            :         // determine max col count in the new data
     228                 :          0 :         sal_Int32 maxColCount = 0;
     229         [ #  # ]:          0 :         for ( sal_Int32 row=0; row<rowCount; ++row )
     230         [ #  # ]:          0 :             if ( i_data[row].getLength() > maxColCount )
     231                 :          0 :                 maxColCount = i_data[row].getLength();
     232                 :            : 
     233         [ #  # ]:          0 :         if ( maxColCount < m_nColumnCount )
     234                 :          0 :             maxColCount = m_nColumnCount;
     235                 :            : 
     236         [ #  # ]:          0 :         for ( sal_Int32 row=0; row<rowCount;  ++row )
     237                 :            :         {
     238         [ #  # ]:          0 :             m_aRowHeaders.push_back( i_headings[row] );
     239         [ #  # ]:          0 :             impl_addRow( i_data[row], maxColCount );
     240                 :            :         }
     241                 :            : 
     242         [ #  # ]:          0 :         if ( maxColCount > m_nColumnCount )
     243                 :          0 :             m_nColumnCount = maxColCount;
     244                 :            : 
     245                 :          0 :         sal_Int32 const firstRow = sal_Int32( m_aData.size() - rowCount );
     246                 :          0 :         sal_Int32 const lastRow = sal_Int32( m_aData.size() - 1 );
     247                 :            :         broadcast(
     248                 :            :             GridDataEvent( *this, -1, -1, firstRow, lastRow ),
     249                 :            :             &XGridDataListener::rowsInserted,
     250                 :            :             aGuard
     251 [ #  # ][ #  # ]:          0 :         );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     252                 :            :     }
     253                 :            : 
     254                 :            :     //------------------------------------------------------------------------------------------------------------------
     255                 :          0 :     void SAL_CALL DefaultGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
     256                 :            :     {
     257         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     258                 :            : 
     259 [ #  # ][ #  # ]:          0 :         if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
                 [ #  # ]
     260 [ #  # ][ #  # ]:          0 :             throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
     261                 :            : 
     262 [ #  # ][ #  # ]:          0 :         m_aRowHeaders.erase( m_aRowHeaders.begin() + i_rowIndex );
     263 [ #  # ][ #  # ]:          0 :         m_aData.erase( m_aData.begin() + i_rowIndex );
     264                 :            : 
     265                 :            :         broadcast(
     266                 :            :             GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
     267                 :            :             &XGridDataListener::rowsRemoved,
     268                 :            :             aGuard
     269 [ #  # ][ #  # ]:          0 :         );
         [ #  # ][ #  # ]
                 [ #  # ]
     270                 :          0 :     }
     271                 :            : 
     272                 :            :     //------------------------------------------------------------------------------------------------------------------
     273                 :          0 :     void SAL_CALL DefaultGridDataModel::removeAllRows(  ) throw (RuntimeException)
     274                 :            :     {
     275         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     276                 :            : 
     277                 :          0 :         m_aRowHeaders.clear();
     278                 :          0 :         m_aData.clear();
     279                 :            : 
     280                 :            :         broadcast(
     281                 :            :             GridDataEvent( *this, -1, -1, -1, -1 ),
     282                 :            :             &XGridDataListener::rowsRemoved,
     283                 :            :             aGuard
     284 [ #  # ][ #  # ]:          0 :         );
         [ #  # ][ #  # ]
                 [ #  # ]
     285                 :          0 :     }
     286                 :            : 
     287                 :            :     //------------------------------------------------------------------------------------------------------------------
     288                 :          0 :     void SAL_CALL DefaultGridDataModel::updateCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
     289                 :            :     {
     290         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     291                 :            : 
     292         [ #  # ]:          0 :         impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).first = i_value;
     293                 :            : 
     294                 :            :         broadcast(
     295                 :            :             GridDataEvent( *this, i_columnIndex, i_columnIndex, i_rowIndex, i_rowIndex ),
     296                 :            :             &XGridDataListener::dataChanged,
     297                 :            :             aGuard
     298 [ #  # ][ #  # ]:          0 :         );
         [ #  # ][ #  # ]
                 [ #  # ]
     299                 :          0 :     }
     300                 :            : 
     301                 :            :     //------------------------------------------------------------------------------------------------------------------
     302                 :          0 :     void SAL_CALL DefaultGridDataModel::updateRowData( const Sequence< ::sal_Int32 >& i_columnIndexes, ::sal_Int32 i_rowIndex, const Sequence< Any >& i_values ) throw (IndexOutOfBoundsException, IllegalArgumentException, RuntimeException)
     303                 :            :     {
     304         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     305                 :            : 
     306 [ #  # ][ #  # ]:          0 :         if  ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
                 [ #  # ]
     307 [ #  # ][ #  # ]:          0 :             throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
     308                 :            : 
     309         [ #  # ]:          0 :         if ( i_columnIndexes.getLength() != i_values.getLength() )
     310 [ #  # ][ #  # ]:          0 :             throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
     311                 :            : 
     312                 :          0 :         sal_Int32 const columnCount = i_columnIndexes.getLength();
     313         [ #  # ]:          0 :         if ( columnCount == 0 )
     314                 :          0 :             return;
     315                 :            : 
     316         [ #  # ]:          0 :         for ( sal_Int32 col = 0; col < columnCount; ++col )
     317                 :            :         {
     318 [ #  # ][ #  # ]:          0 :             if ( ( i_columnIndexes[col] < 0 ) || ( i_columnIndexes[col] > m_nColumnCount ) )
                 [ #  # ]
     319 [ #  # ][ #  # ]:          0 :                 throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
     320                 :            :         }
     321                 :            : 
     322                 :          0 :         RowData& rDataRow = m_aData[ i_rowIndex ];
     323         [ #  # ]:          0 :         for ( sal_Int32 col = 0; col < columnCount; ++col )
     324                 :            :         {
     325                 :          0 :             sal_Int32 const columnIndex = i_columnIndexes[ col ];
     326         [ #  # ]:          0 :             if ( size_t( columnIndex ) >= rDataRow.size() )
     327         [ #  # ]:          0 :                 rDataRow.resize( columnIndex + 1 );
     328                 :            : 
     329                 :          0 :             rDataRow[ columnIndex ].first = i_values[ col ];
     330                 :            :         }
     331                 :            : 
     332 [ #  # ][ #  # ]:          0 :         sal_Int32 const firstAffectedColumn = *::std::min_element( stl_begin( i_columnIndexes ), stl_end( i_columnIndexes ) );
                 [ #  # ]
     333 [ #  # ][ #  # ]:          0 :         sal_Int32 const lastAffectedColumn = *::std::max_element( stl_begin( i_columnIndexes ), stl_end( i_columnIndexes ) );
                 [ #  # ]
     334                 :            :         broadcast(
     335                 :            :             GridDataEvent( *this, firstAffectedColumn, lastAffectedColumn, i_rowIndex, i_rowIndex ),
     336                 :            :             &XGridDataListener::dataChanged,
     337                 :            :             aGuard
     338 [ #  # ][ #  # ]:          0 :         );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     339                 :            :     }
     340                 :            : 
     341                 :            :     //------------------------------------------------------------------------------------------------------------------
     342                 :          0 :     void SAL_CALL DefaultGridDataModel::updateRowHeading( ::sal_Int32 i_rowIndex, const Any& i_heading ) throw (IndexOutOfBoundsException, RuntimeException)
     343                 :            :     {
     344         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     345                 :            : 
     346 [ #  # ][ #  # ]:          0 :         if  ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aRowHeaders.size() ) )
                 [ #  # ]
     347 [ #  # ][ #  # ]:          0 :             throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
     348                 :            : 
     349                 :          0 :         m_aRowHeaders[ i_rowIndex ] = i_heading;
     350                 :            : 
     351                 :            :         broadcast(
     352                 :            :             GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
     353                 :            :             &XGridDataListener::rowHeadingChanged,
     354                 :            :             aGuard
     355 [ #  # ][ #  # ]:          0 :         );
         [ #  # ][ #  # ]
                 [ #  # ]
     356                 :          0 :     }
     357                 :            : 
     358                 :            :     //------------------------------------------------------------------------------------------------------------------
     359                 :          0 :     void SAL_CALL DefaultGridDataModel::updateCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
     360                 :            :     {
     361         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     362 [ #  # ][ #  # ]:          0 :         impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).second = i_value;
     363                 :          0 :     }
     364                 :            : 
     365                 :            :     //------------------------------------------------------------------------------------------------------------------
     366                 :          0 :     void SAL_CALL DefaultGridDataModel::updateRowToolTip( ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
     367                 :            :     {
     368         [ #  # ]:          0 :         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
     369                 :            : 
     370         [ #  # ]:          0 :         RowData& rRowData = impl_getRowDataAccess_throw( i_rowIndex, m_nColumnCount );
     371 [ #  # ][ #  # ]:          0 :         for ( RowData::iterator cell = rRowData.begin(); cell != rRowData.end(); ++cell )
     372         [ #  # ]:          0 :             cell->second = i_value;
     373                 :          0 :     }
     374                 :            : 
     375                 :            :     //------------------------------------------------------------------------------------------------------------------
     376                 :          2 :     void SAL_CALL DefaultGridDataModel::addGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException)
     377                 :            :     {
     378                 :          2 :         rBHelper.addListener( XGridDataListener::static_type(), i_listener );
     379                 :          2 :     }
     380                 :            : 
     381                 :            :     //------------------------------------------------------------------------------------------------------------------
     382                 :          2 :     void SAL_CALL DefaultGridDataModel::removeGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException)
     383                 :            :     {
     384                 :          2 :         rBHelper.removeListener( XGridDataListener::static_type(), i_listener );
     385                 :          2 :     }
     386                 :            : 
     387                 :            :     //------------------------------------------------------------------------------------------------------------------
     388                 :          2 :     void SAL_CALL DefaultGridDataModel::disposing()
     389                 :            :     {
     390         [ +  - ]:          2 :         ::com::sun::star::lang::EventObject aEvent;
     391 [ +  - ][ +  - ]:          2 :         aEvent.Source.set( *this );
     392         [ +  - ]:          2 :         rBHelper.aLC.disposeAndClear( aEvent );
     393                 :            : 
     394         [ +  - ]:          2 :         ::osl::MutexGuard aGuard( m_aMutex );
     395         [ +  - ]:          2 :         GridData aEmptyData;
     396                 :          2 :         m_aData.swap( aEmptyData );
     397                 :            : 
     398         [ +  - ]:          2 :         ::std::vector< Any > aEmptyRowHeaders;
     399                 :          2 :         m_aRowHeaders.swap( aEmptyRowHeaders );
     400                 :            : 
     401 [ +  - ][ +  - ]:          2 :         m_nColumnCount = 0;
     402                 :          2 :     }
     403                 :            : 
     404                 :            :     //------------------------------------------------------------------------------------------------------------------
     405                 :          0 :     ::rtl::OUString SAL_CALL DefaultGridDataModel::getImplementationName(  ) throw (RuntimeException)
     406                 :            :     {
     407 [ #  # ][ #  # ]:          0 :         static const ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridDataModel" ) );
         [ #  # ][ #  # ]
     408                 :          0 :         return aImplName;
     409                 :            :     }
     410                 :            : 
     411                 :            :     //------------------------------------------------------------------------------------------------------------------
     412                 :          0 :     sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
     413                 :            :     {
     414                 :          0 :         return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel );
     415                 :            :     }
     416                 :            : 
     417                 :            :     //------------------------------------------------------------------------------------------------------------------
     418                 :          0 :     Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames(  ) throw (RuntimeException)
     419                 :            :     {
     420 [ #  # ][ #  # ]:          0 :         static const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_DefaultGridDataModel ) );
     421 [ #  # ][ #  # ]:          0 :         static const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
         [ #  # ][ #  # ]
     422                 :          0 :         return aSeq;
     423                 :            :     }
     424                 :            : 
     425                 :            :     //------------------------------------------------------------------------------------------------------------------
     426                 :          0 :     Reference< XCloneable > SAL_CALL DefaultGridDataModel::createClone(  ) throw (RuntimeException)
     427                 :            :     {
     428 [ #  # ][ #  # ]:          0 :         return new DefaultGridDataModel( *this );
     429                 :            :     }
     430                 :            : 
     431                 :            : //......................................................................................................................
     432                 :            : }   // namespace toolkit
     433                 :            : //......................................................................................................................
     434                 :            : 
     435                 :          2 : Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
     436                 :            : {
     437         [ +  - ]:          2 :     return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel() );
     438                 :            : }
     439                 :            : 
     440                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10