LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/toolkit/source/controls/grid - gridcontrol.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 155 194 79.9 %
Date: 2013-07-09 Functions: 24 36 66.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10