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

Generated by: LCOV version 1.10