1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_toolkit.hxx" 30*cdf0e10cSrcweir #include <com/sun/star/awt/tree/XMutableTreeDataModel.hpp> 31*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 33*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 34*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 35*cdf0e10cSrcweir #include <rtl/ref.hxx> 36*cdf0e10cSrcweir #include <toolkit/helper/mutexandbroadcasthelper.hxx> 37*cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir using ::rtl::OUString; 40*cdf0e10cSrcweir using namespace ::com::sun::star; 41*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 42*cdf0e10cSrcweir using namespace ::com::sun::star::awt; 43*cdf0e10cSrcweir using namespace ::com::sun::star::awt::tree; 44*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir namespace toolkit 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir enum broadcast_type { nodes_changed, nodes_inserted, nodes_removed, structure_changed }; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir class MutableTreeNode; 52*cdf0e10cSrcweir class MutableTreeDataModel; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir typedef rtl::Reference< MutableTreeNode > MutableTreeNodeRef; 55*cdf0e10cSrcweir typedef std::vector< MutableTreeNodeRef > TreeNodeVector; 56*cdf0e10cSrcweir typedef rtl::Reference< MutableTreeDataModel > MutableTreeDataModelRef; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir static void implThrowIllegalArgumentException() throw( IllegalArgumentException ) 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir throw IllegalArgumentException(); 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir class MutableTreeDataModel : public ::cppu::WeakAggImplHelper2< XMutableTreeDataModel, XServiceInfo >, 64*cdf0e10cSrcweir public MutexAndBroadcastHelper 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir public: 67*cdf0e10cSrcweir MutableTreeDataModel(); 68*cdf0e10cSrcweir virtual ~MutableTreeDataModel(); 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir void broadcast( broadcast_type eType, const Reference< XTreeNode >& xParentNode, const Reference< XTreeNode >* pNodes, sal_Int32 nNodes ); 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir // XMutableTreeDataModel 73*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode > SAL_CALL createNode( const ::com::sun::star::uno::Any& DisplayValue, ::sal_Bool ChildsOnDemand ) throw (::com::sun::star::uno::RuntimeException); 74*cdf0e10cSrcweir virtual void SAL_CALL setRoot( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& RootNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir // XTreeDataModel 77*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getRoot( ) throw (::com::sun::star::uno::RuntimeException); 78*cdf0e10cSrcweir virtual void SAL_CALL addTreeDataModelListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeDataModelListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 79*cdf0e10cSrcweir virtual void SAL_CALL removeTreeDataModelListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeDataModelListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir // XComponent 82*cdf0e10cSrcweir virtual void SAL_CALL dispose( ) throw (RuntimeException); 83*cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); 84*cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // XServiceInfo 87*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); 88*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException); 89*cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir private: 92*cdf0e10cSrcweir bool mbDisposed; 93*cdf0e10cSrcweir Reference< XTreeNode > mxRootNode; 94*cdf0e10cSrcweir }; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir class MutableTreeNode: public ::cppu::WeakAggImplHelper2< XMutableTreeNode, XServiceInfo > 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir friend class MutableTreeDataModel; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir public: 101*cdf0e10cSrcweir MutableTreeNode( const MutableTreeDataModelRef& xModel, const Any& rValue, sal_Bool bChildsOnDemand ); 102*cdf0e10cSrcweir virtual ~MutableTreeNode(); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir void setParent( MutableTreeNode* pParent ); 105*cdf0e10cSrcweir void broadcast_changes(); 106*cdf0e10cSrcweir void broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // XMutableTreeNode 109*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getDataValue() throw (::com::sun::star::uno::RuntimeException); 110*cdf0e10cSrcweir virtual void SAL_CALL setDataValue( const ::com::sun::star::uno::Any& _datavalue ) throw (::com::sun::star::uno::RuntimeException); 111*cdf0e10cSrcweir virtual void SAL_CALL appendChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& ChildNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 112*cdf0e10cSrcweir virtual void SAL_CALL insertChildByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& ChildNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 113*cdf0e10cSrcweir virtual void SAL_CALL removeChildByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 114*cdf0e10cSrcweir virtual void SAL_CALL setHasChildrenOnDemand( ::sal_Bool ChildrenOnDemand ) throw (::com::sun::star::uno::RuntimeException); 115*cdf0e10cSrcweir virtual void SAL_CALL setDisplayValue( const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::uno::RuntimeException); 116*cdf0e10cSrcweir virtual void SAL_CALL setNodeGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException); 117*cdf0e10cSrcweir virtual void SAL_CALL setExpandedGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException); 118*cdf0e10cSrcweir virtual void SAL_CALL setCollapsedGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // XTreeNode 121*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getChildAt( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 122*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getChildCount( ) throw (::com::sun::star::uno::RuntimeException); 123*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException); 124*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::uno::RuntimeException); 125*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL hasChildrenOnDemand( ) throw (::com::sun::star::uno::RuntimeException); 126*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getDisplayValue( ) throw (::com::sun::star::uno::RuntimeException); 127*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getNodeGraphicURL( ) throw (::com::sun::star::uno::RuntimeException); 128*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getExpandedGraphicURL( ) throw (::com::sun::star::uno::RuntimeException); 129*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getCollapsedGraphicURL( ) throw (::com::sun::star::uno::RuntimeException); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir // XServiceInfo 132*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); 133*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException); 134*cdf0e10cSrcweir virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir static MutableTreeNode* getImplementation( const Reference< XTreeNode >& xNode, bool bThrows ) throw (IllegalArgumentException); 137*cdf0e10cSrcweir Reference< XTreeNode > getReference( MutableTreeNode* pNode ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir return Reference< XTreeNode >( pNode ); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir private: 143*cdf0e10cSrcweir TreeNodeVector maChilds; 144*cdf0e10cSrcweir Any maDisplayValue; 145*cdf0e10cSrcweir Any maDataValue; 146*cdf0e10cSrcweir sal_Bool mbHasChildsOnDemand; 147*cdf0e10cSrcweir ::osl::Mutex maMutex; 148*cdf0e10cSrcweir MutableTreeNode* mpParent; 149*cdf0e10cSrcweir MutableTreeDataModelRef mxModel; 150*cdf0e10cSrcweir OUString maNodeGraphicURL; 151*cdf0e10cSrcweir OUString maExpandedGraphicURL; 152*cdf0e10cSrcweir OUString maCollapsedGraphicURL; 153*cdf0e10cSrcweir bool mbIsInserted; 154*cdf0e10cSrcweir }; 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 157*cdf0e10cSrcweir // class MutableTreeDataModel 158*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir MutableTreeDataModel::MutableTreeDataModel() 161*cdf0e10cSrcweir : mbDisposed( false ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir //--------------------------------------------------------------------- 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir MutableTreeDataModel::~MutableTreeDataModel() 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir //--------------------------------------------------------------------- 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir void MutableTreeDataModel::broadcast( broadcast_type eType, const Reference< XTreeNode >& xParentNode, const Reference< XTreeNode >* pNodes, sal_Int32 nNodes ) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XTreeDataModelListener::static_type() ); 176*cdf0e10cSrcweir if( pIter ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); 179*cdf0e10cSrcweir const Sequence< Reference< XTreeNode > > aNodes( pNodes, nNodes ); 180*cdf0e10cSrcweir TreeDataModelEvent aEvent( xSource, aNodes, xParentNode ); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper aListIter(*pIter); 183*cdf0e10cSrcweir while(aListIter.hasMoreElements()) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir XTreeDataModelListener* pListener = static_cast<XTreeDataModelListener*>(aListIter.next()); 186*cdf0e10cSrcweir switch( eType ) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir case nodes_changed: pListener->treeNodesChanged(aEvent); break; 189*cdf0e10cSrcweir case nodes_inserted: pListener->treeNodesInserted(aEvent); break; 190*cdf0e10cSrcweir case nodes_removed: pListener->treeNodesRemoved(aEvent); break; 191*cdf0e10cSrcweir case structure_changed: pListener->treeStructureChanged(aEvent); break; 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir //--------------------------------------------------------------------- 198*cdf0e10cSrcweir // XMutableTreeDataModel 199*cdf0e10cSrcweir //--------------------------------------------------------------------- 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir Reference< XMutableTreeNode > SAL_CALL MutableTreeDataModel::createNode( const Any& aValue, sal_Bool bChildsOnDemand ) throw (RuntimeException) 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir return new MutableTreeNode( this, aValue, bChildsOnDemand ); 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir //--------------------------------------------------------------------- 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir void SAL_CALL MutableTreeDataModel::setRoot( const Reference< XMutableTreeNode >& xNode ) throw (IllegalArgumentException, RuntimeException) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir if( !xNode.is() ) 211*cdf0e10cSrcweir throw IllegalArgumentException(); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 214*cdf0e10cSrcweir if( xNode != mxRootNode ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir if( mxRootNode.is() ) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir MutableTreeNodeRef xOldImpl( dynamic_cast< MutableTreeNode* >( mxRootNode.get() ) ); 219*cdf0e10cSrcweir if( xOldImpl.is() ) 220*cdf0e10cSrcweir xOldImpl->mbIsInserted = false; 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) ); 224*cdf0e10cSrcweir if( !xImpl.is() || xImpl->mbIsInserted ) 225*cdf0e10cSrcweir throw IllegalArgumentException(); 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir xImpl->mbIsInserted = true; 228*cdf0e10cSrcweir mxRootNode.set(xImpl.get()); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir Reference< XTreeNode > xParentNode; 231*cdf0e10cSrcweir broadcast( structure_changed, xParentNode, &mxRootNode, 1 ); 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir //--------------------------------------------------------------------- 236*cdf0e10cSrcweir // XTreeDataModel 237*cdf0e10cSrcweir //--------------------------------------------------------------------- 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir Reference< XTreeNode > SAL_CALL MutableTreeDataModel::getRoot( ) throw (RuntimeException) 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 242*cdf0e10cSrcweir return mxRootNode; 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir //--------------------------------------------------------------------- 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir void SAL_CALL MutableTreeDataModel::addTreeDataModelListener( const Reference< XTreeDataModelListener >& xListener ) throw (RuntimeException) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir BrdcstHelper.addListener( XTreeDataModelListener::static_type(), xListener ); 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir //--------------------------------------------------------------------- 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir void SAL_CALL MutableTreeDataModel::removeTreeDataModelListener( const Reference< XTreeDataModelListener >& xListener ) throw (RuntimeException) 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir BrdcstHelper.removeListener( XTreeDataModelListener::static_type(), xListener ); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir //--------------------------------------------------------------------- 260*cdf0e10cSrcweir // XComponent 261*cdf0e10cSrcweir //--------------------------------------------------------------------- 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir void SAL_CALL MutableTreeDataModel::dispose() throw (RuntimeException) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir if( !mbDisposed ) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir mbDisposed = true; 270*cdf0e10cSrcweir ::com::sun::star::lang::EventObject aEvent; 271*cdf0e10cSrcweir aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) ); 272*cdf0e10cSrcweir BrdcstHelper.aLC.disposeAndClear( aEvent ); 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir //--------------------------------------------------------------------- 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir void SAL_CALL MutableTreeDataModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir BrdcstHelper.addListener( XEventListener::static_type(), xListener ); 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir //--------------------------------------------------------------------- 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir void SAL_CALL MutableTreeDataModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir BrdcstHelper.removeListener( XEventListener::static_type(), xListener ); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir //--------------------------------------------------------------------- 291*cdf0e10cSrcweir // XServiceInfo 292*cdf0e10cSrcweir //--------------------------------------------------------------------- 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir OUString SAL_CALL MutableTreeDataModel::getImplementationName( ) throw (RuntimeException) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 297*cdf0e10cSrcweir static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.MutableTreeDataModel" ) ); 298*cdf0e10cSrcweir return aImplName; 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir //--------------------------------------------------------------------- 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir sal_Bool SAL_CALL MutableTreeDataModel::supportsService( const OUString& ServiceName ) throw (RuntimeException) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 306*cdf0e10cSrcweir return ServiceName.equalsAscii( szServiceName_MutableTreeDataModel ); 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir //--------------------------------------------------------------------- 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir Sequence< OUString > SAL_CALL MutableTreeDataModel::getSupportedServiceNames( ) throw (RuntimeException) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); 314*cdf0e10cSrcweir static const OUString aServiceName( OUString::createFromAscii( szServiceName_MutableTreeDataModel ) ); 315*cdf0e10cSrcweir static const Sequence< OUString > aSeq( &aServiceName, 1 ); 316*cdf0e10cSrcweir return aSeq; 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 320*cdf0e10cSrcweir // class MutabelTreeNode 321*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir MutableTreeNode::MutableTreeNode( const MutableTreeDataModelRef& xModel, const Any& rValue, sal_Bool bChildsOnDemand ) 324*cdf0e10cSrcweir : maDisplayValue( rValue ) 325*cdf0e10cSrcweir , mbHasChildsOnDemand( bChildsOnDemand ) 326*cdf0e10cSrcweir , mpParent( 0 ) 327*cdf0e10cSrcweir , mxModel( xModel ) 328*cdf0e10cSrcweir , mbIsInserted( false ) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir //--------------------------------------------------------------------- 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir MutableTreeNode::~MutableTreeNode() 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir TreeNodeVector::iterator aIter( maChilds.begin() ); 337*cdf0e10cSrcweir while( aIter != maChilds.end() ) 338*cdf0e10cSrcweir (*aIter++)->setParent(0); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir //--------------------------------------------------------------------- 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir void MutableTreeNode::setParent( MutableTreeNode* pParent ) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir mpParent = pParent; 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir //--------------------------------------------------------------------- 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir MutableTreeNode* MutableTreeNode::getImplementation( const Reference< XTreeNode >& xNode, bool bThrows ) throw (IllegalArgumentException) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir MutableTreeNode* pImpl = dynamic_cast< MutableTreeNode* >( xNode.get() ); 353*cdf0e10cSrcweir if( bThrows && !pImpl ) 354*cdf0e10cSrcweir implThrowIllegalArgumentException(); 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir return pImpl; 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir //--------------------------------------------------------------------- 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir void MutableTreeNode::broadcast_changes() 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir if( mxModel.is() ) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir Reference< XTreeNode > xParent( getReference( mpParent ) ); 366*cdf0e10cSrcweir Reference< XTreeNode > xNode( getReference( this ) ); 367*cdf0e10cSrcweir mxModel->broadcast( nodes_changed, xParent, &xNode, 1 ); 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir //--------------------------------------------------------------------- 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir void MutableTreeNode::broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir if( mxModel.is() ) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir Reference< XTreeNode > xParent( getReference( this ) ); 378*cdf0e10cSrcweir mxModel->broadcast( bNew ? nodes_inserted : nodes_removed, xParent, &xNode, 1 ); 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir } 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir //--------------------------------------------------------------------- 383*cdf0e10cSrcweir // XMutableTreeNode 384*cdf0e10cSrcweir //--------------------------------------------------------------------- 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir Any SAL_CALL MutableTreeNode::getDataValue() throw (RuntimeException) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 389*cdf0e10cSrcweir return maDataValue; 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir //--------------------------------------------------------------------- 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::setDataValue( const Any& _datavalue ) throw (RuntimeException) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 397*cdf0e10cSrcweir maDataValue = _datavalue; 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir //--------------------------------------------------------------------- 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >& xChildNode ) throw (IllegalArgumentException, RuntimeException) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 405*cdf0e10cSrcweir Reference< XTreeNode > xNode( xChildNode.get() ); 406*cdf0e10cSrcweir MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) ); 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) ) 409*cdf0e10cSrcweir throw IllegalArgumentException(); 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir maChilds.push_back( xImpl ); 412*cdf0e10cSrcweir xImpl->setParent(this); 413*cdf0e10cSrcweir xImpl->mbIsInserted = true; 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir broadcast_changes( xNode, true ); 416*cdf0e10cSrcweir } 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir //--------------------------------------------------------------------- 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const Reference< XMutableTreeNode >& xChildNode ) throw (IllegalArgumentException, IndexOutOfBoundsException, RuntimeException) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir if( (nChildIndex < 0) || (nChildIndex > (sal_Int32)maChilds.size()) ) 425*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir Reference< XTreeNode > xNode( xChildNode.get() ); 428*cdf0e10cSrcweir MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) ); 429*cdf0e10cSrcweir if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) ) 430*cdf0e10cSrcweir throw IllegalArgumentException(); 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir xImpl->mbIsInserted = true; 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir TreeNodeVector::iterator aIter( maChilds.begin() ); 435*cdf0e10cSrcweir while( (nChildIndex-- > 0) && (aIter != maChilds.end()) ) 436*cdf0e10cSrcweir aIter++; 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir maChilds.insert( aIter, xImpl ); 439*cdf0e10cSrcweir xImpl->setParent( this ); 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir broadcast_changes( xNode, true ); 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir //--------------------------------------------------------------------- 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::removeChildByIndex( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir MutableTreeNodeRef xImpl; 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir if( (nChildIndex >= 0) && (nChildIndex < (sal_Int32)maChilds.size()) ) 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir TreeNodeVector::iterator aIter( maChilds.begin() ); 455*cdf0e10cSrcweir while( nChildIndex-- && (aIter != maChilds.end()) ) 456*cdf0e10cSrcweir aIter++; 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir if( aIter != maChilds.end() ) 459*cdf0e10cSrcweir { 460*cdf0e10cSrcweir xImpl = (*aIter); 461*cdf0e10cSrcweir maChilds.erase( aIter ); 462*cdf0e10cSrcweir } 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir if( !xImpl.is() ) 466*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir xImpl->setParent(0); 469*cdf0e10cSrcweir xImpl->mbIsInserted = false; 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir broadcast_changes( getReference( xImpl.get() ), false ); 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir //--------------------------------------------------------------------- 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::setHasChildrenOnDemand( sal_Bool bChildsOnDemand ) throw (RuntimeException) 477*cdf0e10cSrcweir { 478*cdf0e10cSrcweir bool bChanged; 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 482*cdf0e10cSrcweir bChanged = mbHasChildsOnDemand != bChildsOnDemand; 483*cdf0e10cSrcweir mbHasChildsOnDemand = bChildsOnDemand; 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir if( bChanged ) 487*cdf0e10cSrcweir broadcast_changes(); 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir //--------------------------------------------------------------------- 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::setDisplayValue( const Any& aValue ) throw (RuntimeException) 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 496*cdf0e10cSrcweir maDisplayValue = aValue; 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir broadcast_changes(); 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir //--------------------------------------------------------------------- 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::setNodeGraphicURL( const OUString& rURL ) throw (RuntimeException) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir bool bChanged; 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 510*cdf0e10cSrcweir bChanged = maNodeGraphicURL != rURL; 511*cdf0e10cSrcweir maNodeGraphicURL = rURL; 512*cdf0e10cSrcweir } 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir if( bChanged ) 515*cdf0e10cSrcweir broadcast_changes(); 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir //--------------------------------------------------------------------- 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::setExpandedGraphicURL( const OUString& rURL ) throw (RuntimeException) 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir bool bChanged; 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 526*cdf0e10cSrcweir bChanged = maExpandedGraphicURL != rURL; 527*cdf0e10cSrcweir maExpandedGraphicURL = rURL; 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir if( bChanged ) 531*cdf0e10cSrcweir broadcast_changes(); 532*cdf0e10cSrcweir } 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir //--------------------------------------------------------------------- 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir void SAL_CALL MutableTreeNode::setCollapsedGraphicURL( const OUString& rURL ) throw (RuntimeException) 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir bool bChanged; 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 542*cdf0e10cSrcweir bChanged = maCollapsedGraphicURL != rURL; 543*cdf0e10cSrcweir maCollapsedGraphicURL = rURL; 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir if( bChanged ) 547*cdf0e10cSrcweir broadcast_changes(); 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir //--------------------------------------------------------------------- 551*cdf0e10cSrcweir // XTreeNode 552*cdf0e10cSrcweir //--------------------------------------------------------------------- 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir Reference< XTreeNode > SAL_CALL MutableTreeNode::getChildAt( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException,RuntimeException) 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir if( (nChildIndex < 0) || (nChildIndex >= (sal_Int32)maChilds.size()) ) 559*cdf0e10cSrcweir throw IndexOutOfBoundsException(); 560*cdf0e10cSrcweir return getReference( maChilds[nChildIndex].get() ); 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir //--------------------------------------------------------------------- 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir sal_Int32 SAL_CALL MutableTreeNode::getChildCount( ) throw (RuntimeException) 566*cdf0e10cSrcweir { 567*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 568*cdf0e10cSrcweir return (sal_Int32)maChilds.size(); 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir //--------------------------------------------------------------------- 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir Reference< XTreeNode > SAL_CALL MutableTreeNode::getParent( ) throw (RuntimeException) 574*cdf0e10cSrcweir { 575*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 576*cdf0e10cSrcweir return getReference( mpParent ); 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir //--------------------------------------------------------------------- 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir sal_Int32 SAL_CALL MutableTreeNode::getIndex( const Reference< XTreeNode >& xNode ) throw (RuntimeException) 582*cdf0e10cSrcweir { 583*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir MutableTreeNodeRef xImpl( MutableTreeNode::getImplementation( xNode, false ) ); 586*cdf0e10cSrcweir if( xImpl.is() ) 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir sal_Int32 nChildCount = maChilds.size(); 589*cdf0e10cSrcweir while( nChildCount-- ) 590*cdf0e10cSrcweir { 591*cdf0e10cSrcweir if( maChilds[nChildCount] == xImpl ) 592*cdf0e10cSrcweir return nChildCount; 593*cdf0e10cSrcweir } 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir return -1; 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir //--------------------------------------------------------------------- 600*cdf0e10cSrcweir 601*cdf0e10cSrcweir sal_Bool SAL_CALL MutableTreeNode::hasChildrenOnDemand( ) throw (RuntimeException) 602*cdf0e10cSrcweir { 603*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 604*cdf0e10cSrcweir return mbHasChildsOnDemand; 605*cdf0e10cSrcweir } 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir //--------------------------------------------------------------------- 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir Any SAL_CALL MutableTreeNode::getDisplayValue( ) throw (RuntimeException) 610*cdf0e10cSrcweir { 611*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 612*cdf0e10cSrcweir return maDisplayValue; 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir //--------------------------------------------------------------------- 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir OUString SAL_CALL MutableTreeNode::getNodeGraphicURL( ) throw (RuntimeException) 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 620*cdf0e10cSrcweir return maNodeGraphicURL; 621*cdf0e10cSrcweir } 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir //--------------------------------------------------------------------- 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir OUString SAL_CALL MutableTreeNode::getExpandedGraphicURL( ) throw (RuntimeException) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 628*cdf0e10cSrcweir return maExpandedGraphicURL; 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir //--------------------------------------------------------------------- 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir OUString SAL_CALL MutableTreeNode::getCollapsedGraphicURL( ) throw (RuntimeException) 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 636*cdf0e10cSrcweir return maCollapsedGraphicURL; 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir //--------------------------------------------------------------------- 640*cdf0e10cSrcweir // XServiceInfo 641*cdf0e10cSrcweir //--------------------------------------------------------------------- 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir OUString SAL_CALL MutableTreeNode::getImplementationName( ) throw (RuntimeException) 644*cdf0e10cSrcweir { 645*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 646*cdf0e10cSrcweir static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.MutableTreeNode" ) ); 647*cdf0e10cSrcweir return aImplName; 648*cdf0e10cSrcweir } 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir //--------------------------------------------------------------------- 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir sal_Bool SAL_CALL MutableTreeNode::supportsService( const OUString& ServiceName ) throw (RuntimeException) 653*cdf0e10cSrcweir { 654*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 655*cdf0e10cSrcweir return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.awt.tree.MutableTreeNode" ) ); 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir //--------------------------------------------------------------------- 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir Sequence< OUString > SAL_CALL MutableTreeNode::getSupportedServiceNames( ) throw (RuntimeException) 661*cdf0e10cSrcweir { 662*cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( maMutex ); 663*cdf0e10cSrcweir static const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.tree.MutableTreeNode" ) ); 664*cdf0e10cSrcweir static const Sequence< OUString > aSeq( &aServiceName, 1 ); 665*cdf0e10cSrcweir return aSeq; 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir Reference< XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const Reference< XMultiServiceFactory >& ) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::MutableTreeDataModel ); 673*cdf0e10cSrcweir } 674