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 __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_
25 #define __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <threadhelp/threadhelpbase.hxx>
32 #include <macros/generic.hxx>
33 #include <macros/debug.hxx>
34 #include <macros/xinterface.hxx>
35 #include <macros/xtypeprovider.hxx>
36 #include <macros/xserviceinfo.hxx>
37 #include <general.h>
38 #include <stdtypes.h>
39 
40 //_________________________________________________________________________________________________________________
41 //	interface includes
42 //_________________________________________________________________________________________________________________
43 
44 #include <com/sun/star/lang/XTypeProvider.hpp>
45 #include <com/sun/star/awt/XWindow.hpp>
46 #include <com/sun/star/beans/XPropertySet.hpp>
47 #include <com/sun/star/container/XNameAccess.hpp>
48 #include <com/sun/star/awt/XControlModel.hpp>
49 
50 //_________________________________________________________________________________________________________________
51 //	other includes
52 //_________________________________________________________________________________________________________________
53 
54 #include <cppuhelper/weak.hxx>
55 #include <vcl/window.hxx>
56 
57 //_________________________________________________________________________________________________________________
58 //	namespace
59 //_________________________________________________________________________________________________________________
60 
61 namespace framework{
62 
63 class IModelWin
64 {
65     public:
66         virtual void registerModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow, const css::uno::Reference< css::awt::XControlModel >& rModel ) = 0;
67         virtual void deregisterModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow ) = 0;
68 };
69 
70 class ModelWinService : public css::lang::XTypeProvider
71                      ,  public css::lang::XServiceInfo
72                      ,  public css::container::XNameAccess
73                      ,  public IModelWin
74 					 ,  public ::cppu::OWeakObject
75 {
76     public:
77         ModelWinService(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
78         virtual ~ModelWinService();
79 
80 		//---------------------------------------------------------------------------------------------------------
81 		//	XInterface, XTypeProvider, XServiceInfo
82 		//---------------------------------------------------------------------------------------------------------
83 
84 		FWK_DECLARE_XINTERFACE
85 		FWK_DECLARE_XTYPEPROVIDER
86 		DECLARE_XSERVICEINFO
87 
88         //---------------------------------------------------------------------------------------------------------
89 		//	IModelWin
90 		//---------------------------------------------------------------------------------------------------------
91         virtual void registerModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow, const css::uno::Reference< css::awt::XControlModel >& rModel );
92         virtual void deregisterModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow );
93 
94         //---------------------------------------------------------------------------------------------------------
95 		//	XNameAccess
96 		//---------------------------------------------------------------------------------------------------------
97     	virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName ) throw(	css::container::NoSuchElementException	,
98 																						css::lang::WrappedTargetException		,
99 																						css::uno::RuntimeException				);
100     	virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw( css::uno::RuntimeException );
101     	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException );
102 
103 		//---------------------------------------------------------------------------------------------------------
104 		//	XElementAccess
105 		//---------------------------------------------------------------------------------------------------------
106 		virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException );
107     	virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException );
108 
109     private:
110         css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager;
111 };
112 
113 }
114 
115 #endif // __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_
116