LCOV - code coverage report
Current view: top level - toolkit/source/controls/tree - treecontrol.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 49 197 24.9 %
Date: 2012-08-25 Functions: 8 46 17.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 45 501 9.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 <treecontrol.hxx>
      31                 :            : 
      32                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      33                 :            : #include <com/sun/star/view/SelectionType.hpp>
      34                 :            : #include <com/sun/star/awt/tree/XTreeDataModel.hpp>
      35                 :            : #include <toolkit/helper/unopropertyarrayhelper.hxx>
      36                 :            : #include <toolkit/helper/property.hxx>
      37                 :            : #include <com/sun/star/awt/XVclWindowPeer.hpp>
      38                 :            : #include <comphelper/processfactory.hxx>
      39                 :            : #include <osl/diagnose.h>
      40                 :            : 
      41                 :            : using ::rtl::OUString;
      42                 :            : using namespace ::com::sun::star;
      43                 :            : using namespace ::com::sun::star::uno;
      44                 :            : using namespace ::com::sun::star::awt::tree;
      45                 :            : using namespace ::com::sun::star::lang;
      46                 :            : using namespace ::com::sun::star::beans;
      47                 :            : using namespace ::com::sun::star::container;
      48                 :            : using namespace ::com::sun::star::view;
      49                 :            : 
      50                 :            : namespace toolkit
      51                 :            : {
      52                 :            : //  ----------------------------------------------------
      53                 :            : //  class UnoTreeModel
      54                 :            : //  ----------------------------------------------------
      55                 :          6 : UnoTreeModel::UnoTreeModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
      56                 :          6 :     :UnoControlModel( i_factory )
      57                 :            : {
      58         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
      59         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_BORDER );
      60         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
      61         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
      62         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_ENABLED );
      63         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
      64         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
      65         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
      66         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_HELPURL );
      67         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
      68         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_TABSTOP );
      69         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_TREE_SELECTIONTYPE );
      70         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_TREE_EDITABLE );
      71         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_TREE_DATAMODEL );
      72         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_TREE_ROOTDISPLAYED );
      73         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSHANDLES );
      74         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSROOTHANDLES );
      75         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_ROW_HEIGHT );
      76         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING );
      77         [ +  - ]:          6 :     ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
      78                 :          6 : }
      79                 :            : 
      80                 :          2 : UnoTreeModel::UnoTreeModel( const UnoTreeModel& rModel )
      81                 :          2 : : UnoControlModel( rModel )
      82                 :            : {
      83                 :          2 : }
      84                 :            : 
      85                 :          2 : UnoControlModel* UnoTreeModel::Clone() const
      86                 :            : {
      87         [ +  - ]:          2 :     return new UnoTreeModel( *this );
      88                 :            : }
      89                 :            : 
      90                 :          2 : OUString UnoTreeModel::getServiceName() throw(RuntimeException)
      91                 :            : {
      92                 :          2 :     return OUString::createFromAscii( szServiceName_TreeControlModel );
      93                 :            : }
      94                 :            : 
      95                 :        160 : Any UnoTreeModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
      96                 :            : {
      97   [ +  +  +  +  :        160 :     switch( nPropId )
                +  +  + ]
      98                 :            :     {
      99                 :            :     case BASEPROPERTY_TREE_SELECTIONTYPE:
     100         [ +  - ]:          8 :         return Any( SelectionType_NONE );
     101                 :            :     case BASEPROPERTY_ROW_HEIGHT:
     102         [ +  - ]:          8 :         return Any( sal_Int32( 0 ) );
     103                 :            :     case BASEPROPERTY_TREE_DATAMODEL:
     104         [ +  - ]:          8 :         return Any( Reference< XTreeDataModel >( 0 ) );
     105                 :            :     case BASEPROPERTY_TREE_EDITABLE:
     106                 :            :     case BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING:
     107         [ +  - ]:         16 :         return Any( sal_False );
     108                 :            :     case BASEPROPERTY_TREE_ROOTDISPLAYED:
     109                 :            :     case BASEPROPERTY_TREE_SHOWSROOTHANDLES:
     110                 :            :     case BASEPROPERTY_TREE_SHOWSHANDLES:
     111         [ +  - ]:         24 :         return Any( sal_True );
     112                 :            :     case BASEPROPERTY_DEFAULTCONTROL:
     113         [ +  - ]:          8 :         return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_TreeControl ) );
     114                 :            :     default:
     115                 :        160 :         return UnoControlModel::ImplGetDefaultValue( nPropId );
     116                 :            :     }
     117                 :            : }
     118                 :            : 
     119                 :        964 : ::cppu::IPropertyArrayHelper& UnoTreeModel::getInfoHelper()
     120                 :            : {
     121                 :            :     static UnoPropertyArrayHelper* pHelper = NULL;
     122         [ +  + ]:        964 :     if ( !pHelper )
     123                 :            :     {
     124         [ +  - ]:          2 :         Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
     125 [ +  - ][ +  - ]:          2 :         pHelper = new UnoPropertyArrayHelper( aIDs );
     126                 :            :     }
     127                 :        964 :     return *pHelper;
     128                 :            : }
     129                 :            : 
     130                 :            : // XMultiPropertySet
     131                 :         22 : Reference< XPropertySetInfo > UnoTreeModel::getPropertySetInfo(  ) throw(RuntimeException)
     132                 :            : {
     133 [ +  + ][ +  - ]:         22 :     static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
         [ +  - ][ +  - ]
                 [ #  # ]
     134                 :         22 :     return xInfo;
     135                 :            : }
     136                 :            : 
     137                 :            : 
     138                 :            : //  ----------------------------------------------------
     139                 :            : //  class UnoTreeControl
     140                 :            : //  ----------------------------------------------------
     141                 :          0 : UnoTreeControl::UnoTreeControl( const Reference< XMultiServiceFactory >& i_factory )
     142                 :            : : UnoTreeControl_Base( i_factory )
     143                 :            : , maSelectionListeners( *this )
     144                 :            : , maTreeExpansionListeners( *this )
     145 [ #  # ][ #  # ]:          0 : , maTreeEditListeners( *this )
                 [ #  # ]
     146                 :            : {
     147                 :          0 : }
     148                 :            : 
     149                 :          0 : OUString UnoTreeControl::GetComponentServiceName()
     150                 :            : {
     151                 :          0 :     return OUString("Tree");
     152                 :            : }
     153                 :            : 
     154                 :            : // -------------------------------------------------------------------
     155                 :            : // ::com::sun::star::view::XSelectionSupplier
     156                 :            : // -------------------------------------------------------------------
     157                 :            : 
     158                 :          0 : sal_Bool SAL_CALL UnoTreeControl::select( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
     159                 :            : {
     160 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->select( rSelection );
                 [ #  # ]
     161                 :            : }
     162                 :            : 
     163                 :            : // -------------------------------------------------------------------
     164                 :            : 
     165                 :          0 : Any SAL_CALL UnoTreeControl::getSelection() throw (RuntimeException)
     166                 :            : {
     167 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
                 [ #  # ]
     168                 :            : }
     169                 :            : 
     170                 :            : // -------------------------------------------------------------------
     171                 :            : 
     172                 :          0 : void SAL_CALL UnoTreeControl::addSelectionChangeListener( const Reference< XSelectionChangeListener >& xListener ) throw (RuntimeException)
     173                 :            : {
     174                 :          0 :     maSelectionListeners.addInterface( xListener );
     175 [ #  # ][ #  # ]:          0 :     if( getPeer().is() && (maSelectionListeners.getLength() == 1) )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     176                 :            :     {
     177                 :            :         // maSelectionListeners acts as a proxy,
     178                 :            :         // add it to the peer if this is the first listener added to that proxy
     179         [ #  # ]:          0 :         Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     180 [ #  # ][ #  # ]:          0 :         Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addSelectionChangeListener(&maSelectionListeners);
         [ #  # ][ #  # ]
     181                 :            :     }
     182                 :          0 : }
     183                 :            : 
     184                 :            : // -------------------------------------------------------------------
     185                 :            : 
     186                 :          0 : void SAL_CALL UnoTreeControl::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& xListener ) throw (RuntimeException)
     187                 :            : {
     188 [ #  # ][ #  # ]:          0 :     if( getPeer().is() && (maSelectionListeners.getLength() == 1) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     189                 :            :     {
     190                 :            :         // maSelectionListeners acts as a proxy,
     191                 :            :         // remove it from the peer if this is the last listener removed from that proxy
     192         [ #  # ]:          0 :         Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     193 [ #  # ][ #  # ]:          0 :         Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeSelectionChangeListener(&maSelectionListeners);
         [ #  # ][ #  # ]
     194                 :            :     }
     195                 :          0 :     maSelectionListeners.removeInterface( xListener );
     196                 :          0 : }
     197                 :            : 
     198                 :            : // -------------------------------------------------------------------
     199                 :            : // ::com::sun::star::view::XMultiSelectionSupplier
     200                 :            : // -------------------------------------------------------------------
     201                 :            : 
     202                 :          0 : sal_Bool SAL_CALL UnoTreeControl::addSelection( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
     203                 :            : {
     204 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->addSelection(rSelection);
                 [ #  # ]
     205                 :            : }
     206                 :            : 
     207                 :            : // -------------------------------------------------------------------
     208                 :            : 
     209                 :          0 : void SAL_CALL UnoTreeControl::removeSelection( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
     210                 :            : {
     211         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     212 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeSelection(rSelection);
                 [ #  # ]
     213                 :          0 : }
     214                 :            : 
     215                 :            : // -------------------------------------------------------------------
     216                 :            : 
     217                 :          0 : void SAL_CALL UnoTreeControl::clearSelection() throw (RuntimeException)
     218                 :            : {
     219         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     220 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->clearSelection();
                 [ #  # ]
     221                 :          0 : }
     222                 :            : 
     223                 :            : // -------------------------------------------------------------------
     224                 :            : 
     225                 :          0 : sal_Int32 SAL_CALL UnoTreeControl::getSelectionCount() throw (RuntimeException)
     226                 :            : {
     227 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getSelectionCount();
                 [ #  # ]
     228                 :            : }
     229                 :            : 
     230                 :            : // -------------------------------------------------------------------
     231                 :            : 
     232                 :          0 : Reference< XEnumeration > SAL_CALL UnoTreeControl::createSelectionEnumeration() throw (RuntimeException)
     233                 :            : {
     234 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->createSelectionEnumeration();
                 [ #  # ]
     235                 :            : }
     236                 :            : 
     237                 :            : // -------------------------------------------------------------------
     238                 :            : 
     239                 :          0 : Reference< XEnumeration > SAL_CALL UnoTreeControl::createReverseSelectionEnumeration() throw (RuntimeException)
     240                 :            : {
     241 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->createReverseSelectionEnumeration();
                 [ #  # ]
     242                 :            : }
     243                 :            : 
     244                 :            : // --------------------------------------------------------------------
     245                 :            : // XTreeControl
     246                 :            : // --------------------------------------------------------------------
     247                 :            : 
     248                 :          0 : OUString SAL_CALL UnoTreeControl::getDefaultExpandedGraphicURL() throw (RuntimeException)
     249                 :            : {
     250 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getDefaultExpandedGraphicURL();
                 [ #  # ]
     251                 :            : }
     252                 :            : 
     253                 :            : // -------------------------------------------------------------------
     254                 :            : 
     255                 :          0 : void SAL_CALL UnoTreeControl::setDefaultExpandedGraphicURL( const OUString& _defaultexpansiongraphicurl ) throw (RuntimeException)
     256                 :            : {
     257         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     258 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->setDefaultExpandedGraphicURL(_defaultexpansiongraphicurl);
                 [ #  # ]
     259                 :          0 : }
     260                 :            : 
     261                 :            : // -------------------------------------------------------------------
     262                 :            : 
     263                 :          0 : OUString SAL_CALL UnoTreeControl::getDefaultCollapsedGraphicURL() throw (RuntimeException)
     264                 :            : {
     265 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getDefaultCollapsedGraphicURL();
                 [ #  # ]
     266                 :            : }
     267                 :            : 
     268                 :            : // -------------------------------------------------------------------
     269                 :            : 
     270                 :          0 : void SAL_CALL UnoTreeControl::setDefaultCollapsedGraphicURL( const OUString& _defaultcollapsedgraphicurl ) throw (RuntimeException)
     271                 :            : {
     272         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     273 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->setDefaultCollapsedGraphicURL(_defaultcollapsedgraphicurl);
                 [ #  # ]
     274                 :          0 : }
     275                 :            : 
     276                 :            : // -------------------------------------------------------------------
     277                 :            : 
     278                 :          0 : sal_Bool SAL_CALL UnoTreeControl::isNodeExpanded( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
     279                 :            : {
     280 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeExpanded(xNode);
                 [ #  # ]
     281                 :            : }
     282                 :            : 
     283                 :            : // -------------------------------------------------------------------
     284                 :            : 
     285                 :          0 : sal_Bool SAL_CALL UnoTreeControl::isNodeCollapsed( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
     286                 :            : {
     287 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeCollapsed(xNode);
                 [ #  # ]
     288                 :            : }
     289                 :            : 
     290                 :            : // -------------------------------------------------------------------
     291                 :            : 
     292                 :          0 : void SAL_CALL UnoTreeControl::makeNodeVisible( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
     293                 :            : {
     294         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     295 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->makeNodeVisible(xNode);
                 [ #  # ]
     296                 :          0 : }
     297                 :            : 
     298                 :            : // -------------------------------------------------------------------
     299                 :            : 
     300                 :          0 : sal_Bool SAL_CALL UnoTreeControl::isNodeVisible( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
     301                 :            : {
     302 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeVisible(xNode);
                 [ #  # ]
     303                 :            : }
     304                 :            : 
     305                 :            : // -------------------------------------------------------------------
     306                 :            : 
     307                 :          0 : void SAL_CALL UnoTreeControl::expandNode( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
     308                 :            : {
     309         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     310 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->expandNode(xNode);
                 [ #  # ]
     311                 :          0 : }
     312                 :            : 
     313                 :            : // -------------------------------------------------------------------
     314                 :            : 
     315                 :          0 : void SAL_CALL UnoTreeControl::collapseNode( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
     316                 :            : {
     317         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     318 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->collapseNode(xNode);
                 [ #  # ]
     319                 :          0 : }
     320                 :            : 
     321                 :            : // -------------------------------------------------------------------
     322                 :            : 
     323                 :          0 : void SAL_CALL UnoTreeControl::addTreeExpansionListener( const Reference< XTreeExpansionListener >& xListener ) throw (RuntimeException)
     324                 :            : {
     325                 :          0 :     maTreeExpansionListeners.addInterface( xListener );
     326 [ #  # ][ #  # ]:          0 :     if( getPeer().is() && (maTreeExpansionListeners.getLength() == 1) )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     327                 :            :     {
     328                 :            :         // maSelectionListeners acts as a proxy,
     329                 :            :         // add it to the peer if this is the first listener added to that proxy
     330         [ #  # ]:          0 :         Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     331 [ #  # ][ #  # ]:          0 :         Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addTreeExpansionListener(&maTreeExpansionListeners);
         [ #  # ][ #  # ]
     332                 :            :     }
     333                 :          0 : }
     334                 :            : 
     335                 :            : // -------------------------------------------------------------------
     336                 :            : 
     337                 :          0 : void SAL_CALL UnoTreeControl::removeTreeExpansionListener( const Reference< XTreeExpansionListener >& xListener ) throw (RuntimeException)
     338                 :            : {
     339 [ #  # ][ #  # ]:          0 :     if( getPeer().is() && (maTreeExpansionListeners.getLength() == 1) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     340                 :            :     {
     341                 :            :         // maSelectionListeners acts as a proxy,
     342                 :            :         // remove it from the peer if this is the last listener removed from that proxy
     343         [ #  # ]:          0 :         Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     344 [ #  # ][ #  # ]:          0 :         Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeTreeExpansionListener(&maTreeExpansionListeners);
         [ #  # ][ #  # ]
     345                 :            :     }
     346                 :          0 :     maTreeExpansionListeners.removeInterface( xListener );
     347                 :          0 : }
     348                 :            : 
     349                 :            : // -------------------------------------------------------------------
     350                 :            : 
     351                 :          0 : Reference< XTreeNode > SAL_CALL UnoTreeControl::getNodeForLocation( sal_Int32 x, sal_Int32 y ) throw (RuntimeException)
     352                 :            : {
     353 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeForLocation(x,y);
                 [ #  # ]
     354                 :            : }
     355                 :            : 
     356                 :            : // -------------------------------------------------------------------
     357                 :            : 
     358                 :          0 : Reference< XTreeNode > SAL_CALL UnoTreeControl::getClosestNodeForLocation( sal_Int32 x, sal_Int32 y ) throw (RuntimeException)
     359                 :            : {
     360 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getClosestNodeForLocation(x,y);
                 [ #  # ]
     361                 :            : }
     362                 :            : 
     363                 :            : // -------------------------------------------------------------------
     364                 :            : 
     365                 :          0 : awt::Rectangle SAL_CALL UnoTreeControl::getNodeRect( const Reference< XTreeNode >& Node ) throw (IllegalArgumentException, RuntimeException)
     366                 :            : {
     367 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeRect( Node );
                 [ #  # ]
     368                 :            : }
     369                 :            : 
     370                 :            : // -------------------------------------------------------------------
     371                 :            : 
     372                 :          0 : sal_Bool SAL_CALL UnoTreeControl::isEditing(  ) throw (RuntimeException)
     373                 :            : {
     374 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isEditing();
                 [ #  # ]
     375                 :            : }
     376                 :            : 
     377                 :            : // -------------------------------------------------------------------
     378                 :            : 
     379                 :          0 : sal_Bool SAL_CALL UnoTreeControl::stopEditing() throw (RuntimeException)
     380                 :            : {
     381 [ #  # ][ #  # ]:          0 :     return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->stopEditing();
                 [ #  # ]
     382                 :            : }
     383                 :            : 
     384                 :            : // -------------------------------------------------------------------
     385                 :            : 
     386                 :          0 : void SAL_CALL UnoTreeControl::cancelEditing() throw (RuntimeException)
     387                 :            : {
     388         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     389 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->cancelEditing();
                 [ #  # ]
     390                 :          0 : }
     391                 :            : 
     392                 :            : // -------------------------------------------------------------------
     393                 :            : 
     394                 :          0 : void SAL_CALL UnoTreeControl::startEditingAtNode( const Reference< XTreeNode >& xNode ) throw (IllegalArgumentException, RuntimeException)
     395                 :            : {
     396         [ #  # ]:          0 :     Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     397 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->startEditingAtNode(xNode);
                 [ #  # ]
     398                 :          0 : }
     399                 :            : 
     400                 :            : // -------------------------------------------------------------------
     401                 :            : 
     402                 :          0 : void SAL_CALL UnoTreeControl::addTreeEditListener( const Reference< XTreeEditListener >& xListener ) throw (RuntimeException)
     403                 :            : {
     404                 :          0 :     maTreeEditListeners.addInterface( xListener );
     405 [ #  # ][ #  # ]:          0 :     if( getPeer().is() && (maTreeEditListeners.getLength() == 1) )
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     406                 :            :     {
     407                 :            :         // maSelectionListeners acts as a proxy,
     408                 :            :         // add it to the peer if this is the first listener added to that proxy
     409         [ #  # ]:          0 :         Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     410 [ #  # ][ #  # ]:          0 :         Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addTreeEditListener(&maTreeEditListeners);
         [ #  # ][ #  # ]
     411                 :            :     }
     412                 :          0 : }
     413                 :            : 
     414                 :            : // -------------------------------------------------------------------
     415                 :            : 
     416                 :          0 : void SAL_CALL UnoTreeControl::removeTreeEditListener( const Reference< XTreeEditListener >& xListener ) throw (RuntimeException)
     417                 :            : {
     418 [ #  # ][ #  # ]:          0 :     if( getPeer().is() && (maTreeEditListeners.getLength() == 1) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     419                 :            :     {
     420                 :            :         // maSelectionListeners acts as a proxy,
     421                 :            :         // remove it from the peer if this is the last listener removed from that proxy
     422         [ #  # ]:          0 :         Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
     423 [ #  # ][ #  # ]:          0 :         Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeTreeEditListener(&maTreeEditListeners);
         [ #  # ][ #  # ]
     424                 :            :     }
     425                 :          0 :     maTreeEditListeners.removeInterface( xListener );
     426                 :          0 : }
     427                 :            : 
     428                 :            : // -------------------------------------------------------------------
     429                 :            : // XComponent
     430                 :            : // -------------------------------------------------------------------
     431                 :            : 
     432                 :          0 : void SAL_CALL UnoTreeControl::dispose(  ) throw(RuntimeException)
     433                 :            : {
     434         [ #  # ]:          0 :     lang::EventObject aEvt;
     435         [ #  # ]:          0 :     aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
     436         [ #  # ]:          0 :     maSelectionListeners.disposeAndClear( aEvt );
     437         [ #  # ]:          0 :     maTreeExpansionListeners.disposeAndClear( aEvt );
     438 [ #  # ][ #  # ]:          0 :     UnoControl::dispose();
     439                 :          0 : }
     440                 :            : 
     441                 :          0 : void UnoTreeControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer >  & rParentPeer ) throw(uno::RuntimeException)
     442                 :            : {
     443         [ #  # ]:          0 :     UnoControlBase::createPeer( rxToolkit, rParentPeer );
     444                 :            : 
     445 [ #  # ][ #  # ]:          0 :     Reference< XTreeControl >  xTree( getPeer(), UNO_QUERY_THROW );
     446 [ #  # ][ #  # ]:          0 :     if( maSelectionListeners.getLength() )
     447 [ #  # ][ #  # ]:          0 :         xTree->addSelectionChangeListener( &maSelectionListeners );
                 [ #  # ]
     448 [ #  # ][ #  # ]:          0 :     if( maTreeExpansionListeners.getLength() )
     449 [ #  # ][ #  # ]:          0 :         xTree->addTreeExpansionListener( &maTreeExpansionListeners );
                 [ #  # ]
     450                 :          0 : }
     451                 :            : 
     452                 :            : }
     453                 :            : 
     454                 :          0 : Reference< XInterface > SAL_CALL TreeControl_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
     455                 :            : {
     456         [ #  # ]:          0 :     return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeControl( i_factory ) );
     457                 :            : }
     458                 :            : 
     459                 :          4 : Reference< XInterface > SAL_CALL TreeControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
     460                 :            : {
     461         [ +  - ]:          4 :     return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeModel( i_factory ) );
     462                 :            : }
     463                 :            : 
     464                 :          0 : void SAL_CALL TreeEditListenerMultiplexer::nodeEditing( const Reference< XTreeNode >& Node ) throw (RuntimeException, ::com::sun::star::util::VetoException)
     465                 :            : {
     466         [ #  # ]:          0 :     ::cppu::OInterfaceIteratorHelper aIt( *this );
     467         [ #  # ]:          0 :     while( aIt.hasMoreElements() )
     468                 :            :     {
     469 [ #  # ][ #  # ]:          0 :         Reference< XTreeEditListener > xListener(static_cast< XTreeEditListener* >( aIt.next() ) );
     470                 :            :         try
     471                 :            :         {
     472 [ #  # ][ #  # ]:          0 :             xListener->nodeEditing( Node );
     473                 :            :         }
     474   [ #  #  #  #  :          0 :         catch( const DisposedException& e )
                      # ]
     475                 :            :         {
     476                 :            :             OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" );
     477   [ #  #  #  #  :          0 :             if ( e.Context == xListener || !e.Context.is() )
             #  #  #  # ]
     478         [ #  # ]:          0 :                 aIt.remove();
     479                 :            :         }
     480         [ #  # ]:          0 :         catch( const RuntimeException& e )
     481                 :            :         {
     482                 :            :             (void)e;
     483                 :            :             DISPLAY_EXCEPTION( TreeEditListenerMultiplexer, nodeEditing, e )
     484                 :            :         }
     485         [ #  # ]:          0 :     }
     486                 :          0 : }
     487                 :            : 
     488                 :          0 : void SAL_CALL TreeEditListenerMultiplexer::nodeEdited( const Reference< XTreeNode >& Node, const OUString& NewText ) throw (RuntimeException)
     489                 :            : {
     490         [ #  # ]:          0 :     ::cppu::OInterfaceIteratorHelper aIt( *this );
     491         [ #  # ]:          0 :     while( aIt.hasMoreElements() )
     492                 :            :     {
     493 [ #  # ][ #  # ]:          0 :         Reference< XTreeEditListener > xListener( static_cast< XTreeEditListener* >( aIt.next() ) );
     494                 :            :         try
     495                 :            :         {
     496 [ #  # ][ #  # ]:          0 :             xListener->nodeEdited( Node, NewText );
     497                 :            :         }
     498   [ #  #  #  #  :          0 :         catch( const DisposedException& e )
                      # ]
     499                 :            :         {
     500                 :            :             OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" );
     501   [ #  #  #  #  :          0 :             if ( e.Context == xListener || !e.Context.is() )
             #  #  #  # ]
     502         [ #  # ]:          0 :                 aIt.remove();
     503                 :            :         }
     504         [ #  # ]:          0 :         catch( const RuntimeException& e )
     505                 :            :         {
     506                 :            :             (void)e;
     507                 :            :             DISPLAY_EXCEPTION( TreeEditListenerMultiplexer, nodeEdited, e )
     508                 :            :         }
     509         [ #  # ]:          0 :     }
     510                 :          0 : }
     511                 :            : 
     512                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10