1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_
25 #define _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_
26 
27 
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/awt/XTabController.hpp>
30 #include <com/sun/star/awt/XControl.hpp>
31 #include <com/sun/star/awt/XControlContainer.hpp>
32 #include <com/sun/star/lang/XTypeProvider.hpp>
33 #include <cppuhelper/weakagg.hxx>
34 #include <osl/mutex.hxx>
35 #include <toolkit/helper/macros.hxx>
36 #include <toolkit/helper/servicenames.hxx>
37 
38 
39 class StdTabController : 	public ::com::sun::star::awt::XTabController,
40 					        public ::com::sun::star::lang::XServiceInfo,
41 							public ::com::sun::star::lang::XTypeProvider,
42 							public ::cppu::OWeakAggObject
43 {
44 private:
45 	::osl::Mutex			maMutex;
46 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >	mxModel;
47 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > 	mxControlContainer;
48 
49 protected:
GetMutex()50 	::osl::Mutex&				GetMutex() { return maMutex; }
51 	sal_Bool					ImplCreateComponentSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rControls, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rModels, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& rComponents, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>* pTabStops, sal_Bool bPeerComponent ) const;
52 	// wenn rModels kuerzer als rControls ist, werden nur die rModels entsprechenden Elemente geliefert und die korrespondierenden Elemente aus rControls entfernt
53 	void						ImplActivateControl( sal_Bool bFirst ) const;
54 
55 public:
56 							StdTabController();
57 							~StdTabController();
58 
59 	static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >	FindControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rCtrls, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rxCtrlModel );
60 
61 	// ::com::sun::star::uno::XInterface
queryInterface(const::com::sun::star::uno::Type & rType)62 	::com::sun::star::uno::Any	SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
acquire()63 	void						SAL_CALL acquire() throw()	{ OWeakAggObject::acquire(); }
release()64 	void						SAL_CALL release() throw()	{ OWeakAggObject::release(); }
65 
66     ::com::sun::star::uno::Any	SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
67 
68 	// ::com::sun::star::lang::XTypeProvider
69 	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >	SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
70 	::com::sun::star::uno::Sequence< sal_Int8 >						SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
71 
72 	// XTabController
73     void SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
74     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > SAL_CALL getModel(  ) throw(::com::sun::star::uno::RuntimeException);
75     void SAL_CALL setContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& Container ) throw(::com::sun::star::uno::RuntimeException);
76     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > SAL_CALL getContainer(  ) throw(::com::sun::star::uno::RuntimeException);
77     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls(  ) throw(::com::sun::star::uno::RuntimeException);
78     void SAL_CALL autoTabOrder(  ) throw(::com::sun::star::uno::RuntimeException);
79     void SAL_CALL activateTabOrder(  ) throw(::com::sun::star::uno::RuntimeException);
80     void SAL_CALL activateFirst(  ) throw(::com::sun::star::uno::RuntimeException);
81     void SAL_CALL activateLast(  ) throw(::com::sun::star::uno::RuntimeException);
82 
83     // XServiceInfo
84 	DECLIMPL_SERVICEINFO( StdTabController, szServiceName2_TabController )
85 };
86 
87 
88 
89 #endif // _TOOLKIT_AWT_STDTABCONTROLLER_HXX_
90 
91