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 #ifndef TOOLKIT_TREE_CONTROL_HXX 29*cdf0e10cSrcweir #define TOOLKIT_TREE_CONTROL_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/awt/tree/XTreeControl.hpp> 32*cdf0e10cSrcweir #include <toolkit/controls/unocontrols.hxx> 33*cdf0e10cSrcweir #include <toolkit/controls/unocontrolmodel.hxx> 34*cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx> 35*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include <toolkit/helper/listenermultiplexer.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir namespace toolkit { 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 42*cdf0e10cSrcweir using namespace ::com::sun::star::awt; 43*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 44*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 45*cdf0e10cSrcweir using namespace ::com::sun::star::container; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir // =================================================================== 48*cdf0e10cSrcweir // = UnoTreeModel 49*cdf0e10cSrcweir // =================================================================== 50*cdf0e10cSrcweir class UnoTreeModel : public UnoControlModel 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir protected: 53*cdf0e10cSrcweir Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; 54*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir public: 57*cdf0e10cSrcweir UnoTreeModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 58*cdf0e10cSrcweir UnoTreeModel( const UnoTreeModel& rModel ); 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir UnoControlModel* Clone() const; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir // ::com::sun::star::beans::XMultiPropertySet 63*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir // ::com::sun::star::io::XPersistObject 66*cdf0e10cSrcweir ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir // XServiceInfo 69*cdf0e10cSrcweir DECLIMPL_SERVICEINFO_DERIVED( UnoTreeModel, UnoControlModel, szServiceName_TreeControlModel ) 70*cdf0e10cSrcweir }; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir // =================================================================== 74*cdf0e10cSrcweir // = UnoTreeControl 75*cdf0e10cSrcweir // =================================================================== 76*cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::tree::XTreeControl > UnoTreeControl_Base; 77*cdf0e10cSrcweir class UnoTreeControl : public UnoTreeControl_Base 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir public: 80*cdf0e10cSrcweir UnoTreeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ); 81*cdf0e10cSrcweir ::rtl::OUString GetComponentServiceName(); 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir // ::com::sun::star::lang::XComponent 84*cdf0e10cSrcweir void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir // ::com::sun::star::awt::XControl 87*cdf0e10cSrcweir void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir // ::com::sun::star::view::XSelectionSupplier 90*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 91*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException); 92*cdf0e10cSrcweir virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 93*cdf0e10cSrcweir virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir // ::com::sun::star::view::XMultiSelectionSupplier 96*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL addSelection( const ::com::sun::star::uno::Any& Selection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 97*cdf0e10cSrcweir virtual void SAL_CALL removeSelection( const ::com::sun::star::uno::Any& Selection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 98*cdf0e10cSrcweir virtual void SAL_CALL clearSelection( ) throw (::com::sun::star::uno::RuntimeException); 99*cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getSelectionCount( ) throw (::com::sun::star::uno::RuntimeException); 100*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createSelectionEnumeration( ) throw (::com::sun::star::uno::RuntimeException); 101*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createReverseSelectionEnumeration( ) throw (::com::sun::star::uno::RuntimeException); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir // ::com::sun::star::awt::XTreeControl 104*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getDefaultExpandedGraphicURL() throw (::com::sun::star::uno::RuntimeException); 105*cdf0e10cSrcweir virtual void SAL_CALL setDefaultExpandedGraphicURL( const ::rtl::OUString& _defaultexpandedgraphicurl ) throw (::com::sun::star::uno::RuntimeException); 106*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getDefaultCollapsedGraphicURL() throw (::com::sun::star::uno::RuntimeException); 107*cdf0e10cSrcweir virtual void SAL_CALL setDefaultCollapsedGraphicURL( const ::rtl::OUString& _defaultcollapsedgraphicurl ) throw (::com::sun::star::uno::RuntimeException); 108*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isNodeExpanded( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 109*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isNodeCollapsed( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 110*cdf0e10cSrcweir virtual void SAL_CALL makeNodeVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException); 111*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isNodeVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 112*cdf0e10cSrcweir virtual void SAL_CALL expandNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException); 113*cdf0e10cSrcweir virtual void SAL_CALL collapseNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException); 114*cdf0e10cSrcweir virtual void SAL_CALL addTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 115*cdf0e10cSrcweir virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 116*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException); 117*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException); 118*cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 119*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException); 120*cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException); 121*cdf0e10cSrcweir virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException); 122*cdf0e10cSrcweir virtual void SAL_CALL startEditingAtNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 123*cdf0e10cSrcweir virtual void SAL_CALL addTreeEditListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeEditListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 124*cdf0e10cSrcweir virtual void SAL_CALL removeTreeEditListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeEditListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo 127*cdf0e10cSrcweir DECLIMPL_SERVICEINFO_DERIVED( UnoTreeControl, UnoControlBase, szServiceName_TreeControl ) 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir using UnoControl::getPeer; 130*cdf0e10cSrcweir private: 131*cdf0e10cSrcweir TreeSelectionListenerMultiplexer maSelectionListeners; 132*cdf0e10cSrcweir TreeExpansionListenerMultiplexer maTreeExpansionListeners; 133*cdf0e10cSrcweir TreeEditListenerMultiplexer maTreeEditListeners; 134*cdf0e10cSrcweir }; 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir } // toolkit 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir #endif // _TOOLKIT_TREE_CONTROL_HXX 139