LCOV - code coverage report
Current view: top level - toolkit/source/controls/grid - gridcontrol.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 65 186 34.9 %
Date: 2012-08-25 Functions: 7 35 20.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 65 387 16.8 %

           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 "gridcontrol.hxx"
      31                 :            : #include "grideventforwarder.hxx"
      32                 :            : 
      33                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      34                 :            : #include <com/sun/star/view/SelectionType.hpp>
      35                 :            : #include <com/sun/star/awt/grid/XGridDataModel.hpp>
      36                 :            : #include <com/sun/star/awt/grid/XMutableGridDataModel.hpp>
      37                 :            : #include <com/sun/star/awt/grid/DefaultGridDataModel.hpp>
      38                 :            : #include <com/sun/star/awt/grid/SortableGridDataModel.hpp>
      39                 :            : #include <com/sun/star/awt/grid/XGridColumnModel.hpp>
      40                 :            : #include <toolkit/helper/unopropertyarrayhelper.hxx>
      41                 :            : #include <toolkit/helper/property.hxx>
      42                 :            : #include <com/sun/star/awt/XVclWindowPeer.hpp>
      43                 :            : #include <comphelper/processfactory.hxx>
      44                 :            : #include <tools/diagnose_ex.h>
      45                 :            : #include <tools/color.hxx>
      46                 :            : 
      47                 :            : using ::rtl::OUString;
      48                 :            : using namespace ::com::sun::star;
      49                 :            : using namespace ::com::sun::star::uno;
      50                 :            : using namespace ::com::sun::star::awt;
      51                 :            : using namespace ::com::sun::star::awt::grid;
      52                 :            : using namespace ::com::sun::star::lang;
      53                 :            : using namespace ::com::sun::star::beans;
      54                 :            : using namespace ::com::sun::star::container;
      55                 :            : using namespace ::com::sun::star::view;
      56                 :            : 
      57                 :            : namespace toolkit
      58                 :            : {
      59                 :            : //======================================================================================================================
      60                 :            : //= UnoGridModel
      61                 :            : //======================================================================================================================
      62                 :            : namespace
      63                 :            : {
      64                 :          2 :     Reference< XGridDataModel > lcl_getDefaultDataModel_throw( ::comphelper::ComponentContext const & i_context )
      65                 :            :     {
      66 [ +  - ][ +  - ]:          2 :         Reference< XMutableGridDataModel > const xDelegatorModel( DefaultGridDataModel::create( i_context.getUNOContext() ), UNO_QUERY_THROW );
                 [ +  - ]
      67 [ +  - ][ +  - ]:          2 :         Reference< XGridDataModel > const xDataModel( SortableGridDataModel::create( i_context.getUNOContext(), xDelegatorModel ), UNO_QUERY_THROW );
                 [ +  - ]
      68                 :          2 :         return xDataModel;
      69                 :            :     }
      70                 :            : 
      71                 :          2 :     Reference< XGridColumnModel > lcl_getDefaultColumnModel_throw( ::comphelper::ComponentContext const & i_context )
      72                 :            :     {
      73         [ +  - ]:          2 :         Reference< XGridColumnModel > const xColumnModel( i_context.createComponent( "com.sun.star.awt.grid.DefaultGridColumnModel" ), UNO_QUERY_THROW );
      74                 :          2 :         return xColumnModel;
      75                 :            :     }
      76                 :            : }
      77                 :            : 
      78                 :            : //----------------------------------------------------------------------------------------------------------------------
      79                 :          2 : UnoGridModel::UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
      80                 :          2 :         :UnoControlModel( i_factory )
      81                 :            : {
      82         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
      83         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_BORDER );
      84         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
      85         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
      86         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_ENABLED );
      87         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
      88         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
      89         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_HELPURL );
      90         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
      91         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable
      92         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_HSCROLL );
      93         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_VSCROLL );
      94         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_TABSTOP );
      95         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
      96         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_ROW_HEADER_WIDTH );
      97         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
      98         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_COLUMN_HEADER_HEIGHT );
      99         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_ROW_HEIGHT );
     100 [ +  - ][ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL, makeAny( lcl_getDefaultDataModel_throw( maContext ) ) );
                 [ +  - ]
     101 [ +  - ][ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL, makeAny( lcl_getDefaultColumnModel_throw( maContext ) ) );
                 [ +  - ]
     102         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
     103         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
     104         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
     105         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
     106         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
     107         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_TEXTLINECOLOR );
     108         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_USE_GRID_LINES );
     109         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR );
     110         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
     111         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_TEXT_COLOR );
     112         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS );
     113         [ +  - ]:          2 :     ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
     114                 :          2 : }
     115                 :            : 
     116                 :            : //----------------------------------------------------------------------------------------------------------------------
     117                 :          0 : UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
     118                 :          0 :     :UnoControlModel( rModel )
     119                 :            : {
     120         [ #  # ]:          0 :     osl_incrementInterlockedCount( &m_refCount );
     121                 :            :     {
     122                 :          0 :         Reference< XGridDataModel > xDataModel;
     123                 :            :         // clone the data model
     124         [ #  # ]:          0 :         const Reference< XFastPropertySet > xCloneSource( &const_cast< UnoGridModel& >( rModel ) );
     125                 :            :         try
     126                 :            :         {
     127 [ #  # ][ #  # ]:          0 :             const Reference< XCloneable > xCloneable( xCloneSource->getFastPropertyValue( BASEPROPERTY_GRID_DATAMODEL ), UNO_QUERY_THROW );
                 [ #  # ]
     128 [ #  # ][ #  # ]:          0 :             xDataModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     129                 :            :         }
     130         [ #  # ]:          0 :         catch( const Exception& )
     131                 :            :         {
     132                 :            :             DBG_UNHANDLED_EXCEPTION();
     133                 :            :         }
     134         [ #  # ]:          0 :         if ( !xDataModel.is() )
     135 [ #  # ][ #  # ]:          0 :             xDataModel = lcl_getDefaultDataModel_throw( maContext );
     136 [ #  # ][ #  # ]:          0 :         UnoControlModel::setFastPropertyValue_NoBroadcast( BASEPROPERTY_GRID_DATAMODEL, makeAny( xDataModel ) );
     137                 :            :             // do *not* use setFastPropertyValue here: The UnoControlModel ctor did a simple copy of all property values,
     138                 :            :             // so before this call here, we share our data model with the own of the clone source. setFastPropertyValue,
     139                 :            :             // then, disposes the old data model - which means the data model which in fact belongs to the clone source.
     140                 :            :             // so, call the UnoControlModel's impl-method for setting the value.
     141                 :            : 
     142                 :            :         // clone the column model
     143                 :          0 :         Reference< XGridColumnModel > xColumnModel;
     144                 :            :         try
     145                 :            :         {
     146 [ #  # ][ #  # ]:          0 :             const Reference< XCloneable > xCloneable( xCloneSource->getFastPropertyValue( BASEPROPERTY_GRID_COLUMNMODEL ), UNO_QUERY_THROW );
                 [ #  # ]
     147 [ #  # ][ #  # ]:          0 :             xColumnModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     148                 :            :         }
     149         [ #  # ]:          0 :         catch( const Exception& )
     150                 :            :         {
     151                 :            :             DBG_UNHANDLED_EXCEPTION();
     152                 :            :         }
     153         [ #  # ]:          0 :         if ( !xColumnModel.is() )
     154 [ #  # ][ #  # ]:          0 :             xColumnModel = lcl_getDefaultColumnModel_throw( maContext );
     155 [ #  # ][ #  # ]:          0 :         UnoControlModel::setFastPropertyValue_NoBroadcast( BASEPROPERTY_GRID_COLUMNMODEL, makeAny( xColumnModel ) );
     156                 :            :             // same comment as above: do not use our own setPropertyValue here.
     157                 :            :     }
     158         [ #  # ]:          0 :     osl_decrementInterlockedCount( &m_refCount );
     159                 :          0 : }
     160                 :            : 
     161                 :            : //----------------------------------------------------------------------------------------------------------------------
     162                 :          0 : UnoControlModel* UnoGridModel::Clone() const
     163                 :            : {
     164         [ #  # ]:          0 :     return new UnoGridModel( *this );
     165                 :            : }
     166                 :            : 
     167                 :            : //----------------------------------------------------------------------------------------------------------------------
     168                 :            : namespace
     169                 :            : {
     170                 :          4 :     void lcl_dispose_nothrow( const Any& i_component )
     171                 :            :     {
     172                 :            :         try
     173                 :            :         {
     174         [ +  - ]:          4 :             const Reference< XComponent > xComponent( i_component, UNO_QUERY_THROW );
     175 [ +  - ][ +  - ]:          4 :             xComponent->dispose();
                 [ #  # ]
     176                 :            :         }
     177                 :          0 :         catch( const Exception& )
     178                 :            :         {
     179                 :            :             DBG_UNHANDLED_EXCEPTION();
     180                 :            :         }
     181                 :          4 :     }
     182                 :            : }
     183                 :            : 
     184                 :            : //----------------------------------------------------------------------------------------------------------------------
     185                 :          2 : void SAL_CALL UnoGridModel::dispose(  ) throw(RuntimeException)
     186                 :            : {
     187         [ +  - ]:          2 :     lcl_dispose_nothrow( getFastPropertyValue( BASEPROPERTY_GRID_COLUMNMODEL ) );
     188         [ +  - ]:          2 :     lcl_dispose_nothrow( getFastPropertyValue( BASEPROPERTY_GRID_DATAMODEL ) );
     189                 :            : 
     190                 :          2 :     UnoControlModel::dispose();
     191                 :          2 : }
     192                 :            : 
     193                 :            : //----------------------------------------------------------------------------------------------------------------------
     194                 :          0 : void SAL_CALL UnoGridModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
     195                 :            : {
     196                 :          0 :     Any aOldSubModel;
     197 [ #  # ][ #  # ]:          0 :     if ( ( nHandle == BASEPROPERTY_GRID_COLUMNMODEL ) || ( nHandle == BASEPROPERTY_GRID_DATAMODEL ) )
     198                 :            :     {
     199         [ #  # ]:          0 :         aOldSubModel = getFastPropertyValue( nHandle );
     200         [ #  # ]:          0 :         if ( aOldSubModel == rValue )
     201                 :            :         {
     202                 :            :             OSL_ENSURE( false, "UnoGridModel::setFastPropertyValue_NoBroadcast: setting the same value, again!" );
     203                 :            :                 // shouldn't this have been caught by convertFastPropertyValue?
     204                 :          0 :             aOldSubModel.clear();
     205                 :            :         }
     206                 :            :     }
     207                 :            : 
     208         [ #  # ]:          0 :     UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
     209                 :            : 
     210         [ #  # ]:          0 :     if ( aOldSubModel.hasValue() )
     211         [ #  # ]:          0 :         lcl_dispose_nothrow( aOldSubModel );
     212                 :          0 : }
     213                 :            : 
     214                 :            : //----------------------------------------------------------------------------------------------------------------------
     215                 :          0 : OUString UnoGridModel::getServiceName() throw(RuntimeException)
     216                 :            : {
     217                 :          0 :     return OUString::createFromAscii( szServiceName_GridControlModel );
     218                 :            : }
     219                 :            : 
     220                 :            : //----------------------------------------------------------------------------------------------------------------------
     221                 :         68 : Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
     222                 :            : {
     223   [ +  +  +  +  :         68 :     switch( nPropId )
                +  +  + ]
     224                 :            :     {
     225                 :            :         case BASEPROPERTY_DEFAULTCONTROL:
     226         [ +  - ]:          2 :             return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) );
     227                 :            :         case BASEPROPERTY_GRID_SELECTIONMODE:
     228         [ +  - ]:          2 :             return uno::makeAny( SelectionType(1) );
     229                 :            :         case BASEPROPERTY_GRID_SHOWROWHEADER:
     230                 :            :         case BASEPROPERTY_USE_GRID_LINES:
     231         [ +  - ]:          4 :             return uno::makeAny( (sal_Bool)sal_False );
     232                 :            :         case BASEPROPERTY_ROW_HEADER_WIDTH:
     233         [ +  - ]:          2 :             return uno::makeAny( sal_Int32( 10 ) );
     234                 :            :         case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
     235         [ +  - ]:          2 :             return uno::makeAny( (sal_Bool)sal_True );
     236                 :            :         case BASEPROPERTY_COLUMN_HEADER_HEIGHT:
     237                 :            :         case BASEPROPERTY_ROW_HEIGHT:
     238                 :            :         case BASEPROPERTY_GRID_HEADER_BACKGROUND:
     239                 :            :         case BASEPROPERTY_GRID_HEADER_TEXT_COLOR:
     240                 :            :         case BASEPROPERTY_GRID_LINE_COLOR:
     241                 :            :         case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS:
     242                 :         12 :             return Any();
     243                 :            :         default:
     244                 :         68 :             return UnoControlModel::ImplGetDefaultValue( nPropId );
     245                 :            :     }
     246                 :            : 
     247                 :            : }
     248                 :            : 
     249                 :            : //----------------------------------------------------------------------------------------------------------------------
     250                 :          4 : ::cppu::IPropertyArrayHelper& UnoGridModel::getInfoHelper()
     251                 :            : {
     252                 :            :     static UnoPropertyArrayHelper* pHelper = NULL;
     253         [ +  + ]:          4 :     if ( !pHelper )
     254                 :            :     {
     255         [ +  - ]:          2 :         Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
     256 [ +  - ][ +  - ]:          2 :         pHelper = new UnoPropertyArrayHelper( aIDs );
     257                 :            :     }
     258                 :          4 :     return *pHelper;
     259                 :            : }
     260                 :            : 
     261                 :            : //----------------------------------------------------------------------------------------------------------------------
     262                 :            : // XMultiPropertySet
     263                 :          0 : Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo(  ) throw(RuntimeException)
     264                 :            : {
     265 [ #  # ][ #  # ]:          0 :     static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     266                 :          0 :     return xInfo;
     267                 :            : }
     268                 :            : 
     269                 :            : 
     270                 :            : //======================================================================================================================
     271                 :            : //= UnoGridControl
     272                 :            : //======================================================================================================================
     273                 :          0 : UnoGridControl::UnoGridControl( const Reference< XMultiServiceFactory >& i_factory )
     274                 :            :     :UnoGridControl_Base( i_factory )
     275                 :            :     ,m_aSelectionListeners( *this )
     276 [ #  # ][ #  # ]:          0 :     ,m_pEventForwarder( new GridEventForwarder( *this ) )
                 [ #  # ]
     277                 :            : {
     278                 :          0 : }
     279                 :            : 
     280                 :            : //----------------------------------------------------------------------------------------------------------------------
     281 [ #  # ][ #  # ]:          0 : UnoGridControl::~UnoGridControl()
     282                 :            : {
     283         [ #  # ]:          0 : }
     284                 :            : 
     285                 :            : //----------------------------------------------------------------------------------------------------------------------
     286                 :          0 : OUString UnoGridControl::GetComponentServiceName()
     287                 :            : {
     288                 :          0 :     return OUString("Grid");
     289                 :            : }
     290                 :            : 
     291                 :            : //----------------------------------------------------------------------------------------------------------------------
     292                 :          0 : void SAL_CALL UnoGridControl::dispose(  ) throw(RuntimeException)
     293                 :            : {
     294         [ #  # ]:          0 :     lang::EventObject aEvt;
     295         [ #  # ]:          0 :     aEvt.Source = (::cppu::OWeakObject*)this;
     296         [ #  # ]:          0 :     m_aSelectionListeners.disposeAndClear( aEvt );
     297 [ #  # ][ #  # ]:          0 :     UnoControl::dispose();
     298                 :          0 : }
     299                 :            : 
     300                 :            : //----------------------------------------------------------------------------------------------------------------------
     301                 :          0 : void SAL_CALL UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
     302                 :            : {
     303         [ #  # ]:          0 :     UnoControlBase::createPeer( rxToolkit, rParentPeer );
     304                 :            : 
     305 [ #  # ][ #  # ]:          0 :     const Reference< XGridControl >  xGrid( getPeer(), UNO_QUERY_THROW );
     306 [ #  # ][ #  # ]:          0 :     xGrid->addSelectionListener(&m_aSelectionListeners);
                 [ #  # ]
     307                 :          0 : }
     308                 :            : 
     309                 :            : //----------------------------------------------------------------------------------------------------------------------
     310                 :            : namespace
     311                 :            : {
     312                 :          0 :     void lcl_setEventForwarding( const Reference< XControlModel >& i_gridControlModel, const ::boost::scoped_ptr< GridEventForwarder >& i_listener,
     313                 :            :         bool const i_add )
     314                 :            :     {
     315         [ #  # ]:          0 :         const Reference< XPropertySet > xModelProps( i_gridControlModel, UNO_QUERY );
     316         [ #  # ]:          0 :         if ( !xModelProps.is() )
     317                 :          0 :             return;
     318                 :            : 
     319                 :            :         try
     320                 :            :         {
     321                 :            :             Reference< XContainer > const xColModel(
     322         [ #  # ]:          0 :                 xModelProps->getPropertyValue( ::rtl::OUString( "ColumnModel" ) ),
     323 [ #  # ][ #  # ]:          0 :                 UNO_QUERY_THROW );
     324         [ #  # ]:          0 :             if ( i_add )
     325 [ #  # ][ #  # ]:          0 :                 xColModel->addContainerListener( i_listener.get() );
         [ #  # ][ #  # ]
     326                 :            :             else
     327 [ #  # ][ #  # ]:          0 :                 xColModel->removeContainerListener( i_listener.get() );
         [ #  # ][ #  # ]
     328                 :            : 
     329                 :            :             Reference< XGridDataModel > const xDataModel(
     330         [ #  # ]:          0 :                 xModelProps->getPropertyValue( ::rtl::OUString( "GridDataModel" ) ),
     331                 :            :                 UNO_QUERY_THROW
     332 [ #  # ][ #  # ]:          0 :             );
     333         [ #  # ]:          0 :             Reference< XMutableGridDataModel > const xMutableDataModel( xDataModel, UNO_QUERY );
     334         [ #  # ]:          0 :             if ( xMutableDataModel.is() )
     335                 :            :             {
     336         [ #  # ]:          0 :                 if ( i_add )
     337 [ #  # ][ #  # ]:          0 :                     xMutableDataModel->addGridDataListener( i_listener.get() );
         [ #  # ][ #  # ]
     338                 :            :                 else
     339 [ #  # ][ #  # ]:          0 :                     xMutableDataModel->removeGridDataListener( i_listener.get() );
         [ #  # ][ #  # ]
     340         [ #  # ]:          0 :             }
     341                 :            :         }
     342         [ #  # ]:          0 :         catch( const Exception& )
     343                 :            :         {
     344                 :            :             DBG_UNHANDLED_EXCEPTION();
     345         [ #  # ]:          0 :         }
     346                 :            :     }
     347                 :            : }
     348                 :            : 
     349                 :            : //----------------------------------------------------------------------------------------------------------------------
     350                 :          0 : sal_Bool SAL_CALL UnoGridControl::setModel( const Reference< XControlModel >& i_model ) throw(RuntimeException)
     351                 :            : {
     352         [ #  # ]:          0 :     lcl_setEventForwarding( getModel(), m_pEventForwarder, false );
     353         [ #  # ]:          0 :     if ( !UnoGridControl_Base::setModel( i_model ) )
     354                 :          0 :         return sal_False;
     355         [ #  # ]:          0 :     lcl_setEventForwarding( getModel(), m_pEventForwarder, true );
     356                 :          0 :     return sal_True;
     357                 :            : }
     358                 :            : 
     359                 :            : //----------------------------------------------------------------------------------------------------------------------
     360                 :          0 : ::sal_Int32 UnoGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
     361                 :            : {
     362 [ #  # ][ #  # ]:          0 :     Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
     363 [ #  # ][ #  # ]:          0 :     return xGrid->getRowAtPoint( x, y );
     364                 :            : }
     365                 :            : 
     366                 :            : //----------------------------------------------------------------------------------------------------------------------
     367                 :          0 : ::sal_Int32 UnoGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
     368                 :            : {
     369 [ #  # ][ #  # ]:          0 :     Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
     370 [ #  # ][ #  # ]:          0 :     return xGrid->getColumnAtPoint( x, y );
     371                 :            : }
     372                 :            : 
     373                 :            : //----------------------------------------------------------------------------------------------------------------------
     374                 :          0 : ::sal_Int32 SAL_CALL UnoGridControl::getCurrentColumn(  ) throw (RuntimeException)
     375                 :            : {
     376 [ #  # ][ #  # ]:          0 :     Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
     377 [ #  # ][ #  # ]:          0 :     return xGrid->getCurrentColumn();
     378                 :            : }
     379                 :            : 
     380                 :            : //----------------------------------------------------------------------------------------------------------------------
     381                 :          0 : ::sal_Int32 SAL_CALL UnoGridControl::getCurrentRow(  ) throw (RuntimeException)
     382                 :            : {
     383 [ #  # ][ #  # ]:          0 :     Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
     384 [ #  # ][ #  # ]:          0 :     return xGrid->getCurrentRow();
     385                 :            : }
     386                 :            : 
     387                 :            : //----------------------------------------------------------------------------------------------------------------------
     388                 :          0 : void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
     389                 :            : {
     390 [ #  # ][ #  # ]:          0 :     Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex );
                 [ #  # ]
     391                 :          0 : }
     392                 :            : 
     393                 :            : //----------------------------------------------------------------------------------------------------------------------
     394                 :          0 : void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
     395                 :            : {
     396 [ #  # ][ #  # ]:          0 :     Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
                 [ #  # ]
     397                 :          0 : }
     398                 :            : 
     399                 :            : //----------------------------------------------------------------------------------------------------------------------
     400                 :          0 : void SAL_CALL UnoGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
     401                 :            : {
     402 [ #  # ][ #  # ]:          0 :     Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex );
                 [ #  # ]
     403                 :          0 : }
     404                 :            : 
     405                 :            : //----------------------------------------------------------------------------------------------------------------------
     406                 :          0 : void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
     407                 :            : {
     408 [ #  # ][ #  # ]:          0 :     Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
                 [ #  # ]
     409                 :          0 : }
     410                 :            : 
     411                 :            : //----------------------------------------------------------------------------------------------------------------------
     412                 :          0 : ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
     413                 :            : {
     414 [ #  # ][ #  # ]:          0 :     return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
                 [ #  # ]
     415                 :            : }
     416                 :            : 
     417                 :            : //----------------------------------------------------------------------------------------------------------------------
     418                 :          0 : ::sal_Bool SAL_CALL UnoGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
     419                 :            : {
     420 [ #  # ][ #  # ]:          0 :     return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectionEmpty();
                 [ #  # ]
     421                 :            : }
     422                 :            : 
     423                 :            : //----------------------------------------------------------------------------------------------------------------------
     424                 :          0 : ::sal_Bool SAL_CALL UnoGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
     425                 :            : {
     426 [ #  # ][ #  # ]:          0 :     return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index );
                 [ #  # ]
     427                 :            : }
     428                 :            : 
     429                 :            : //----------------------------------------------------------------------------------------------------------------------
     430                 :          0 : void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
     431                 :            : {
     432                 :          0 :     m_aSelectionListeners.addInterface( listener );
     433                 :          0 : }
     434                 :            : 
     435                 :            : //----------------------------------------------------------------------------------------------------------------------
     436                 :          0 : void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
     437                 :            : {
     438                 :          0 :     m_aSelectionListeners.removeInterface( listener );
     439                 :          0 : }
     440                 :            : 
     441                 :            : }//namespace toolkit
     442                 :            : 
     443                 :          0 : Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
     444                 :            : {
     445         [ #  # ]:          0 :     return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl( i_factory ) );
     446                 :            : }
     447                 :            : 
     448                 :          0 : Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
     449                 :            : {
     450         [ #  # ]:          0 :     return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel( i_factory ) );
     451                 :            : }
     452                 :            : 
     453                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10