1*50e6b072SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*50e6b072SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*50e6b072SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*50e6b072SAndrew Rist  * distributed with this work for additional information
6*50e6b072SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*50e6b072SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*50e6b072SAndrew Rist  * "License"); you may not use this file except in compliance
9*50e6b072SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*50e6b072SAndrew Rist  *
11*50e6b072SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*50e6b072SAndrew Rist  *
13*50e6b072SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*50e6b072SAndrew Rist  * software distributed under the License is distributed on an
15*50e6b072SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*50e6b072SAndrew Rist  * KIND, either express or implied.  See the License for the
17*50e6b072SAndrew Rist  * specific language governing permissions and limitations
18*50e6b072SAndrew Rist  * under the License.
19*50e6b072SAndrew Rist  *
20*50e6b072SAndrew Rist  *************************************************************/
21*50e6b072SAndrew Rist 
22*50e6b072SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef TOOLKIT_TREE_CONTROL_HXX
25cdf0e10cSrcweir #define TOOLKIT_TREE_CONTROL_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/awt/tree/XTreeControl.hpp>
28cdf0e10cSrcweir #include <toolkit/controls/unocontrols.hxx>
29cdf0e10cSrcweir #include <toolkit/controls/unocontrolmodel.hxx>
30cdf0e10cSrcweir #include <toolkit/helper/servicenames.hxx>
31cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <toolkit/helper/listenermultiplexer.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace toolkit {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir using namespace ::com::sun::star::uno;
38cdf0e10cSrcweir using namespace ::com::sun::star::awt;
39cdf0e10cSrcweir using namespace ::com::sun::star::lang;
40cdf0e10cSrcweir using namespace ::com::sun::star::beans;
41cdf0e10cSrcweir using namespace ::com::sun::star::container;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir // ===================================================================
44cdf0e10cSrcweir // = UnoTreeModel
45cdf0e10cSrcweir // ===================================================================
46cdf0e10cSrcweir class UnoTreeModel : public UnoControlModel
47cdf0e10cSrcweir {
48cdf0e10cSrcweir protected:
49cdf0e10cSrcweir 	Any		ImplGetDefaultValue( sal_uInt16 nPropId ) const;
50cdf0e10cSrcweir 	::cppu::IPropertyArrayHelper&	SAL_CALL getInfoHelper();
51cdf0e10cSrcweir 
52cdf0e10cSrcweir public:
53cdf0e10cSrcweir 	UnoTreeModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
54cdf0e10cSrcweir 	UnoTreeModel( const UnoTreeModel& rModel );
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	UnoControlModel* Clone() const;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	// ::com::sun::star::beans::XMultiPropertySet
59cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	// ::com::sun::star::io::XPersistObject
62cdf0e10cSrcweir     ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	// XServiceInfo
65cdf0e10cSrcweir 	DECLIMPL_SERVICEINFO_DERIVED( UnoTreeModel, UnoControlModel, szServiceName_TreeControlModel )
66cdf0e10cSrcweir };
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir // ===================================================================
70cdf0e10cSrcweir // = UnoTreeControl
71cdf0e10cSrcweir // ===================================================================
72cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::tree::XTreeControl > UnoTreeControl_Base;
73cdf0e10cSrcweir class UnoTreeControl : public UnoTreeControl_Base
74cdf0e10cSrcweir {
75cdf0e10cSrcweir public:
76cdf0e10cSrcweir 	UnoTreeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
77cdf0e10cSrcweir 	::rtl::OUString				GetComponentServiceName();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	// ::com::sun::star::lang::XComponent
80cdf0e10cSrcweir     void SAL_CALL dispose(  ) throw(::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	// ::com::sun::star::awt::XControl
83cdf0e10cSrcweir     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);
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	// ::com::sun::star::view::XSelectionSupplier
86cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
87cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getSelection(  ) throw (::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir     virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir     virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	// ::com::sun::star::view::XMultiSelectionSupplier
92cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL addSelection( const ::com::sun::star::uno::Any& Selection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir     virtual void SAL_CALL removeSelection( const ::com::sun::star::uno::Any& Selection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir     virtual void SAL_CALL clearSelection(  ) throw (::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getSelectionCount(  ) throw (::com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createSelectionEnumeration(  ) throw (::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createReverseSelectionEnumeration(  ) throw (::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     // ::com::sun::star::awt::XTreeControl
100cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getDefaultExpandedGraphicURL() throw (::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir     virtual void SAL_CALL setDefaultExpandedGraphicURL( const ::rtl::OUString& _defaultexpandedgraphicurl ) throw (::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getDefaultCollapsedGraphicURL() throw (::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir     virtual void SAL_CALL setDefaultCollapsedGraphicURL( const ::rtl::OUString& _defaultcollapsedgraphicurl ) throw (::com::sun::star::uno::RuntimeException);
104cdf0e10cSrcweir     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);
105cdf0e10cSrcweir     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);
106cdf0e10cSrcweir     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);
107cdf0e10cSrcweir     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);
108cdf0e10cSrcweir     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);
109cdf0e10cSrcweir     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);
110cdf0e10cSrcweir     virtual void SAL_CALL addTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir     virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
112cdf0e10cSrcweir     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);
113cdf0e10cSrcweir     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);
114cdf0e10cSrcweir     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);
115cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL isEditing(  ) throw (::com::sun::star::uno::RuntimeException);
116cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL stopEditing(  ) throw (::com::sun::star::uno::RuntimeException);
117cdf0e10cSrcweir     virtual void SAL_CALL cancelEditing(  ) throw (::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir     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);
119cdf0e10cSrcweir     virtual void SAL_CALL addTreeEditListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeEditListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
120cdf0e10cSrcweir     virtual void SAL_CALL removeTreeEditListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeEditListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	// ::com::sun::star::lang::XServiceInfo
123cdf0e10cSrcweir 	DECLIMPL_SERVICEINFO_DERIVED( UnoTreeControl, UnoControlBase, szServiceName_TreeControl )
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	using UnoControl::getPeer;
126cdf0e10cSrcweir private:
127cdf0e10cSrcweir 	TreeSelectionListenerMultiplexer maSelectionListeners;
128cdf0e10cSrcweir 	TreeExpansionListenerMultiplexer maTreeExpansionListeners;
129cdf0e10cSrcweir 	TreeEditListenerMultiplexer maTreeEditListeners;
130cdf0e10cSrcweir };
131cdf0e10cSrcweir 
132cdf0e10cSrcweir } // toolkit
133cdf0e10cSrcweir 
134cdf0e10cSrcweir #endif // _TOOLKIT_TREE_CONTROL_HXX
135