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

Generated by: LCOV version 1.10