1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2008 by Sun Microsystems, Inc.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * $RCSfile: urltransformer.hxx,v $
10  * $Revision: 1.8 $
11  *
12  * This file is part of OpenOffice.org.
13  *
14  * OpenOffice.org is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License version 3
16  * only, as published by the Free Software Foundation.
17  *
18  * OpenOffice.org is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU Lesser General Public License version 3 for more details
22  * (a copy is included in the LICENSE file that accompanied this code).
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * version 3 along with OpenOffice.org.  If not, see
26  * <http://www.openoffice.org/license.html>
27  * for a copy of the LGPLv3 License.
28  *
29  ************************************************************************/
30 
31 #ifndef __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_
32 #define __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_
33 
34 //_________________________________________________________________________________________________________________
35 //	my own includes
36 //_________________________________________________________________________________________________________________
37 
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/generic.hxx>
40 #include <macros/debug.hxx>
41 #include <macros/xinterface.hxx>
42 #include <macros/xtypeprovider.hxx>
43 #include <macros/xserviceinfo.hxx>
44 #include <general.h>
45 #include <stdtypes.h>
46 
47 //_________________________________________________________________________________________________________________
48 //	interface includes
49 //_________________________________________________________________________________________________________________
50 
51 #include <com/sun/star/lang/XTypeProvider.hpp>
52 #include <com/sun/star/awt/XWindow.hpp>
53 #include <com/sun/star/beans/XPropertySet.hpp>
54 #include <com/sun/star/container/XNameAccess.hpp>
55 #include <com/sun/star/awt/XControlModel.hpp>
56 
57 //_________________________________________________________________________________________________________________
58 //	other includes
59 //_________________________________________________________________________________________________________________
60 
61 #include <cppuhelper/weak.hxx>
62 #include <vcl/window.hxx>
63 
64 //_________________________________________________________________________________________________________________
65 //	namespace
66 //_________________________________________________________________________________________________________________
67 
68 namespace framework{
69 
70 class IModelWin
71 {
72     public:
73         virtual void registerModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow, const css::uno::Reference< css::awt::XControlModel >& rModel ) = 0;
74         virtual void deregisterModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow ) = 0;
75 };
76 
77 class ModelWinService : public css::lang::XTypeProvider
78                      ,  public css::lang::XServiceInfo
79                      ,  public css::container::XNameAccess
80                      ,  public IModelWin
81 					 ,  public ::cppu::OWeakObject
82 {
83     public:
84         ModelWinService(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
85         virtual ~ModelWinService();
86 
87 		//---------------------------------------------------------------------------------------------------------
88 		//	XInterface, XTypeProvider, XServiceInfo
89 		//---------------------------------------------------------------------------------------------------------
90 
91 		FWK_DECLARE_XINTERFACE
92 		FWK_DECLARE_XTYPEPROVIDER
93 		DECLARE_XSERVICEINFO
94 
95         //---------------------------------------------------------------------------------------------------------
96 		//	IModelWin
97 		//---------------------------------------------------------------------------------------------------------
98         virtual void registerModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow, const css::uno::Reference< css::awt::XControlModel >& rModel );
99         virtual void deregisterModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow );
100 
101         //---------------------------------------------------------------------------------------------------------
102 		//	XNameAccess
103 		//---------------------------------------------------------------------------------------------------------
104     	virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName ) throw(	css::container::NoSuchElementException	,
105 																						css::lang::WrappedTargetException		,
106 																						css::uno::RuntimeException				);
107     	virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw( css::uno::RuntimeException );
108     	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException );
109 
110 		//---------------------------------------------------------------------------------------------------------
111 		//	XElementAccess
112 		//---------------------------------------------------------------------------------------------------------
113 		virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException );
114     	virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException );
115 
116     private:
117         css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager;
118 };
119 
120 }
121 
122 #endif // __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_
123