1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski #ifndef __FRAMEWORK_SERVICES_PLUGINFRAME_HXX_
25*b1cdbd2cSJim Jagielski #define __FRAMEWORK_SERVICES_PLUGINFRAME_HXX_
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
28*b1cdbd2cSJim Jagielski //	my own includes
29*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
30*b1cdbd2cSJim Jagielski 
31*b1cdbd2cSJim Jagielski #include <services/frame.hxx>
32*b1cdbd2cSJim Jagielski 
33*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
34*b1cdbd2cSJim Jagielski //	interface includes
35*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
36*b1cdbd2cSJim Jagielski #include <com/sun/star/mozilla/XPluginInstance.hpp>
37*b1cdbd2cSJim Jagielski #include <com/sun/star/mozilla/XPluginInstancePeer.hpp>
38*b1cdbd2cSJim Jagielski #include <com/sun/star/mozilla/XPluginWindowPeer.hpp>
39*b1cdbd2cSJim Jagielski #include <com/sun/star/io/XInputStream.hpp>
40*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XInitialization.hpp>
41*b1cdbd2cSJim Jagielski #include <com/sun/star/awt/XWindow.hpp>
42*b1cdbd2cSJim Jagielski #include <com/sun/star/frame/XDispatchResultListener.hpp>
43*b1cdbd2cSJim Jagielski #include <com/sun/star/frame/FeatureStateEvent.hpp>
44*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/EventObject.hpp>
45*b1cdbd2cSJim Jagielski 
46*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
47*b1cdbd2cSJim Jagielski //	other includes
48*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
49*b1cdbd2cSJim Jagielski 
50*b1cdbd2cSJim Jagielski #ifndef _VCL_ATOM_HXX
51*b1cdbd2cSJim Jagielski #include <vcl/threadex.hxx>
52*b1cdbd2cSJim Jagielski #endif
53*b1cdbd2cSJim Jagielski #include <unotools/cmdoptions.hxx>
54*b1cdbd2cSJim Jagielski 
55*b1cdbd2cSJim Jagielski 
56*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
57*b1cdbd2cSJim Jagielski //	namespace
58*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
59*b1cdbd2cSJim Jagielski 
60*b1cdbd2cSJim Jagielski namespace framework{
61*b1cdbd2cSJim Jagielski 
62*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
63*b1cdbd2cSJim Jagielski //	exported const
64*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
65*b1cdbd2cSJim Jagielski 
66*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
67*b1cdbd2cSJim Jagielski //	exported definitions
68*b1cdbd2cSJim Jagielski //_________________________________________________________________________________________________________________
69*b1cdbd2cSJim Jagielski 
70*b1cdbd2cSJim Jagielski /*-************************************************************************************************************//**
71*b1cdbd2cSJim Jagielski 	@short		implements an special frame - a plugin frame
72*b1cdbd2cSJim Jagielski 	@descr		-
73*b1cdbd2cSJim Jagielski 
74*b1cdbd2cSJim Jagielski 	@implements	XInitialization
75*b1cdbd2cSJim Jagielski 				XPluginInstance
76*b1cdbd2cSJim Jagielski                 XDispatchResultListener
77*b1cdbd2cSJim Jagielski     @base       Frame
78*b1cdbd2cSJim Jagielski *//*-*************************************************************************************************************/
79*b1cdbd2cSJim Jagielski 
80*b1cdbd2cSJim Jagielski class PlugInFrame   :   public css::lang::XInitialization           ,
81*b1cdbd2cSJim Jagielski                         public css::mozilla::XPluginInstance        ,
82*b1cdbd2cSJim Jagielski                         public css::frame::XDispatchResultListener  ,   // => XEVENTLISTENER
83*b1cdbd2cSJim Jagielski                         public Frame                                    // Order of baseclasses is neccessary for right initialization!
84*b1cdbd2cSJim Jagielski {
85*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
86*b1cdbd2cSJim Jagielski 	//	public methods
87*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
88*b1cdbd2cSJim Jagielski 
89*b1cdbd2cSJim Jagielski 	public:
90*b1cdbd2cSJim Jagielski 
91*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
92*b1cdbd2cSJim Jagielski 		//	constructor / destructor
93*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
94*b1cdbd2cSJim Jagielski 
95*b1cdbd2cSJim Jagielski 		/*-****************************************************************************************************//**
96*b1cdbd2cSJim Jagielski 			@short		standard constructor to create instance
97*b1cdbd2cSJim Jagielski 			@descr		This constructor initialize a new instance of this class,
98*b1cdbd2cSJim Jagielski 						and will be set valid values on his member and baseclasses.
99*b1cdbd2cSJim Jagielski 
100*b1cdbd2cSJim Jagielski 			@seealso	-
101*b1cdbd2cSJim Jagielski 
102*b1cdbd2cSJim Jagielski 			@param		-
103*b1cdbd2cSJim Jagielski 			@return		-
104*b1cdbd2cSJim Jagielski 
105*b1cdbd2cSJim Jagielski 			@onerror	-
106*b1cdbd2cSJim Jagielski 		*//*-*****************************************************************************************************/
107*b1cdbd2cSJim Jagielski 
108*b1cdbd2cSJim Jagielski 	 	PlugInFrame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
109*b1cdbd2cSJim Jagielski 
110*b1cdbd2cSJim Jagielski 		/*-****************************************************************************************************//**
111*b1cdbd2cSJim Jagielski 			@short		standard destructor
112*b1cdbd2cSJim Jagielski 			@descr		This method destruct an instance of this class and clear some member.
113*b1cdbd2cSJim Jagielski 
114*b1cdbd2cSJim Jagielski 			@seealso	-
115*b1cdbd2cSJim Jagielski 
116*b1cdbd2cSJim Jagielski 			@param		-
117*b1cdbd2cSJim Jagielski 			@return		-
118*b1cdbd2cSJim Jagielski 
119*b1cdbd2cSJim Jagielski 			@onerror	-
120*b1cdbd2cSJim Jagielski 		*//*-*****************************************************************************************************/
121*b1cdbd2cSJim Jagielski 
122*b1cdbd2cSJim Jagielski 		virtual	~PlugInFrame();
123*b1cdbd2cSJim Jagielski 
124*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
125*b1cdbd2cSJim Jagielski 		//	XInterface, XTypeProvider, XServiceInfo
126*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
127*b1cdbd2cSJim Jagielski 
128*b1cdbd2cSJim Jagielski 		DECLARE_XINTERFACE
129*b1cdbd2cSJim Jagielski 		DECLARE_XTYPEPROVIDER
130*b1cdbd2cSJim Jagielski 		DECLARE_XSERVICEINFO
131*b1cdbd2cSJim Jagielski 
132*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
133*b1cdbd2cSJim Jagielski 		//	XInitialization
134*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
135*b1cdbd2cSJim Jagielski 
136*b1cdbd2cSJim Jagielski 		void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& seqArguments ) throw(	css::uno::Exception			,
137*b1cdbd2cSJim Jagielski 					 																				css::uno::RuntimeException	);
138*b1cdbd2cSJim Jagielski 
139*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
140*b1cdbd2cSJim Jagielski 		//	XPluginInstance
141*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
142*b1cdbd2cSJim Jagielski 
143*b1cdbd2cSJim Jagielski 		void SAL_CALL start			() throw( css::uno::RuntimeException );
144*b1cdbd2cSJim Jagielski 		void SAL_CALL implcb_start	() throw( css::uno::RuntimeException );
145*b1cdbd2cSJim Jagielski 		void SAL_CALL stop			() throw( css::uno::RuntimeException );
146*b1cdbd2cSJim Jagielski 		void SAL_CALL implcb_stop	() throw( css::uno::RuntimeException );
147*b1cdbd2cSJim Jagielski 		void SAL_CALL destroy		() throw( css::uno::RuntimeException );
148*b1cdbd2cSJim Jagielski 		void SAL_CALL implcb_destroy() throw( css::uno::RuntimeException );
149*b1cdbd2cSJim Jagielski 		void SAL_CALL createWindow			(	const	css::uno::Any&		aPlatformWindowHandle	,
150*b1cdbd2cSJim Jagielski 														sal_Bool			bEmbedded				) throw( css::uno::RuntimeException );
151*b1cdbd2cSJim Jagielski 		void SAL_CALL implcb_createWindow	(	const	css::uno::Any&		aPlatformWindowHandle	,
152*b1cdbd2cSJim Jagielski 														sal_Bool			bEmbedded				) throw( css::uno::RuntimeException );
153*b1cdbd2cSJim Jagielski 		void SAL_CALL newStream		(	const	::rtl::OUString&								sMIMEDescription,
154*b1cdbd2cSJim Jagielski 										const	::rtl::OUString&								sURL			,
155*b1cdbd2cSJim Jagielski 										const	::rtl::OUString&								sFilter			,
156*b1cdbd2cSJim Jagielski 										const	css::uno::Reference< css::io::XInputStream >&	xStream			,
157*b1cdbd2cSJim Jagielski 										const	css::uno::Any&									aSessionId		) throw( css::uno::RuntimeException );
158*b1cdbd2cSJim Jagielski 	    void SAL_CALL implcb_newStream
159*b1cdbd2cSJim Jagielski 		                            (	const	::rtl::OUString&								sMIMEDescription,
160*b1cdbd2cSJim Jagielski 										const	::rtl::OUString&								sURL			,
161*b1cdbd2cSJim Jagielski 										const	::rtl::OUString&								sFilter			,
162*b1cdbd2cSJim Jagielski 										const	css::uno::Reference< css::io::XInputStream >&	xStream			,
163*b1cdbd2cSJim Jagielski 										const	css::uno::Any&									aSessionId		) throw( css::uno::RuntimeException );
164*b1cdbd2cSJim Jagielski 		void SAL_CALL newURL		(	const	::rtl::OUString&	sMIMEDescription,
165*b1cdbd2cSJim Jagielski 										const	::rtl::OUString&	sURL			,
166*b1cdbd2cSJim Jagielski 										const	::rtl::OUString&	sFilter			,
167*b1cdbd2cSJim Jagielski 										const	css::uno::Any&		aSessionId		) throw( css::uno::RuntimeException );
168*b1cdbd2cSJim Jagielski 		void SAL_CALL implcb_newURL	(	const	::rtl::OUString&	sMIMEDescription,
169*b1cdbd2cSJim Jagielski 										const	::rtl::OUString&	sURL			,
170*b1cdbd2cSJim Jagielski 										const	::rtl::OUString&	sFilter			,
171*b1cdbd2cSJim Jagielski 										const	css::uno::Any&		aSessionId		) throw( css::uno::RuntimeException );
172*b1cdbd2cSJim Jagielski     	virtual void SAL_CALL getHttpServerURL(	::rtl::OUString&	sHost	,
173*b1cdbd2cSJim Jagielski 												sal_uInt16&			nPort	,
174*b1cdbd2cSJim Jagielski 												::rtl::OUString&	sPrefix	) throw( css::uno::RuntimeException );
175*b1cdbd2cSJim Jagielski 
176*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
177*b1cdbd2cSJim Jagielski 		//	 XDispatchProvider
178*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
179*b1cdbd2cSJim Jagielski 
180*b1cdbd2cSJim Jagielski 		virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(	const	css::util::URL&	 	aURL			,
181*b1cdbd2cSJim Jagielski 																						const	::rtl::OUString&	sTargetFrameName,
182*b1cdbd2cSJim Jagielski 																								sal_Int32			nSearchFlags	) throw( css::uno::RuntimeException );
183*b1cdbd2cSJim Jagielski 		virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException );
184*b1cdbd2cSJim Jagielski 
185*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
186*b1cdbd2cSJim Jagielski         //   XDispatchResultListener
187*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
188*b1cdbd2cSJim Jagielski 
189*b1cdbd2cSJim Jagielski         virtual void SAL_CALL dispatchFinished      ( const css::frame::DispatchResultEvent&                    aEvent     ) throw( css::uno::RuntimeException );
190*b1cdbd2cSJim Jagielski 
191*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
192*b1cdbd2cSJim Jagielski 		//	 XEventListener
193*b1cdbd2cSJim Jagielski 		//---------------------------------------------------------------------------------------------------------
194*b1cdbd2cSJim Jagielski 
195*b1cdbd2cSJim Jagielski 		void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
196*b1cdbd2cSJim Jagielski 
197*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
198*b1cdbd2cSJim Jagielski 	//	protected methods
199*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
200*b1cdbd2cSJim Jagielski 
201*b1cdbd2cSJim Jagielski 	protected:
202*b1cdbd2cSJim Jagielski 
203*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
204*b1cdbd2cSJim Jagielski 	//	private methods
205*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
206*b1cdbd2cSJim Jagielski 
207*b1cdbd2cSJim Jagielski 	private:
208*b1cdbd2cSJim Jagielski 
209*b1cdbd2cSJim Jagielski 		void impl_tryToLoadDocument();
210*b1cdbd2cSJim Jagielski         sal_Bool impl_registerRemoteFactories( const css::uno::Reference< css::lang::XMultiServiceFactory >& xRemoteServiceManager );
211*b1cdbd2cSJim Jagielski 
212*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
213*b1cdbd2cSJim Jagielski 	//	debug methods
214*b1cdbd2cSJim Jagielski 	//	(should be private everyway!)
215*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
216*b1cdbd2cSJim Jagielski 
217*b1cdbd2cSJim Jagielski 		/*-****************************************************************************************************//**
218*b1cdbd2cSJim Jagielski 			@short		debug-method to check incoming parameter of some other mehods of this class
219*b1cdbd2cSJim Jagielski 			@descr		The following methods are used to check parameters for other methods
220*b1cdbd2cSJim Jagielski 						of this class. The return value is used directly for an ASSERT(...).
221*b1cdbd2cSJim Jagielski 
222*b1cdbd2cSJim Jagielski 			@seealso	ASSERTs in implementation!
223*b1cdbd2cSJim Jagielski 
224*b1cdbd2cSJim Jagielski 			@param		references to checking variables
225*b1cdbd2cSJim Jagielski 			@return		sal_False on invalid parameter<BR>
226*b1cdbd2cSJim Jagielski 						sal_True  otherway
227*b1cdbd2cSJim Jagielski 
228*b1cdbd2cSJim Jagielski 			@onerror	-
229*b1cdbd2cSJim Jagielski 		*//*-*****************************************************************************************************/
230*b1cdbd2cSJim Jagielski 
231*b1cdbd2cSJim Jagielski 	#ifdef ENABLE_ASSERTIONS
232*b1cdbd2cSJim Jagielski 
233*b1cdbd2cSJim Jagielski 	private:
234*b1cdbd2cSJim Jagielski 
235*b1cdbd2cSJim Jagielski 		static sal_Bool impldbg_checkParameter_initialize			(	const	css::uno::Sequence< css::uno::Any >&					seqArguments			);
236*b1cdbd2cSJim Jagielski 		static sal_Bool impldbg_checkParameter_createWindow			(	const	css::uno::Any&											aPlatformWindowHandle	,
237*b1cdbd2cSJim Jagielski 																				sal_Bool												bEmbedded				);
238*b1cdbd2cSJim Jagielski 		static sal_Bool impldbg_checkParameter_newStream			(	const	::rtl::OUString&										sMIMEDescription		,
239*b1cdbd2cSJim Jagielski 																		const	::rtl::OUString&										sURL					,
240*b1cdbd2cSJim Jagielski 																		const	::rtl::OUString&										sFilter					,
241*b1cdbd2cSJim Jagielski 																		const	css::uno::Reference< css::io::XInputStream >&			xStream					);
242*b1cdbd2cSJim Jagielski 		static sal_Bool impldbg_checkParameter_newURL				(	const	::rtl::OUString&										sMIMEDescription		,
243*b1cdbd2cSJim Jagielski 																		const	::rtl::OUString&										sURL					,
244*b1cdbd2cSJim Jagielski 																		const	::rtl::OUString&										sFilter					);
245*b1cdbd2cSJim Jagielski     	static sal_Bool impldbg_checkParameter_getHttpServerURL		(			::rtl::OUString&										sHost					,
246*b1cdbd2cSJim Jagielski 																				sal_uInt16&												nPort					,
247*b1cdbd2cSJim Jagielski 																				::rtl::OUString&										sPrefix					);
248*b1cdbd2cSJim Jagielski 		static sal_Bool impldbg_checkParameter_queryDispatch		(	const	css::util::URL&	 										aURL					,
249*b1cdbd2cSJim Jagielski 																		const	::rtl::OUString&										sTargetFrameName		,
250*b1cdbd2cSJim Jagielski 																				sal_Int32												nSearchFlags			);
251*b1cdbd2cSJim Jagielski 		static sal_Bool impldbg_checkParameter_queryDispatches		(	const	css::uno::Sequence< css::frame::DispatchDescriptor >&	seqDescripts			);
252*b1cdbd2cSJim Jagielski 		static sal_Bool impldbg_checkParameter_statusChanged		(	const	css::frame::FeatureStateEvent&							aEvent					);
253*b1cdbd2cSJim Jagielski 		static sal_Bool impldbg_checkParameter_disposing			(	const	css::lang::EventObject&									aEvent					);
254*b1cdbd2cSJim Jagielski 
255*b1cdbd2cSJim Jagielski 	#endif	// #ifdef ENABLE_ASSERTIONS
256*b1cdbd2cSJim Jagielski 
257*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
258*b1cdbd2cSJim Jagielski 	//	variables
259*b1cdbd2cSJim Jagielski 	//	(should be private everyway!)
260*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
261*b1cdbd2cSJim Jagielski 
262*b1cdbd2cSJim Jagielski 	private:
263*b1cdbd2cSJim Jagielski 
264*b1cdbd2cSJim Jagielski 		css::uno::Reference< css::mozilla::XPluginInstancePeer >			m_xPlugInInstancePeer	;	/// Reference to UNO interface of PlugIn dll for communication with browser
265*b1cdbd2cSJim Jagielski 		css::uno::Reference< css::mozilla::XPluginWindowPeer >				m_xPlugInWindowPeer		;	/// Reference to set child window at plugin window
266*b1cdbd2cSJim Jagielski 		css::uno::Sequence< css::beans::PropertyValue >						m_seqProperties			;	/// Sequence of properties as arguments for load document
267*b1cdbd2cSJim Jagielski 		css::util::URL														m_aURL					;	/// URL for document to load
268*b1cdbd2cSJim Jagielski 		sal_Bool															m_bILoad				;	/// PlugInFrame has a valid loader which load the document and wait for finished/cancelled
269*b1cdbd2cSJim Jagielski 		sal_Bool															m_bIHaveDocument		;	/// We have a document loaded successful.
270*b1cdbd2cSJim Jagielski 		css::uno::Reference< css::frame::XDispatchProvider >				m_xPlugInDispatcher		;	/// Dispatcher to forward dispatches to browser
271*b1cdbd2cSJim Jagielski         static sal_Bool                                                     m_bRemoteFactoriesExist ;   /// indicates, if remote factories was already registered (neccessary one times only!)
272*b1cdbd2cSJim Jagielski 		SvtCommandOptions													m_aCommandOptions		;	/// ref counted class to support disabling commands defined by configuration file
273*b1cdbd2cSJim Jagielski 
274*b1cdbd2cSJim Jagielski };		//	class PlugInFrame
275*b1cdbd2cSJim Jagielski 
276*b1cdbd2cSJim Jagielski /*-************************************************************************************************************//**
277*b1cdbd2cSJim Jagielski 	@short		used to forward all asynchronous calls which use VCL internal to the main thread
278*b1cdbd2cSJim Jagielski 	@descr		We need this asynchronous mechanism to prevent us against dead locks. Sometimes our main thread
279*b1cdbd2cSJim Jagielski 				can call us for event handling like FOCUS, ACTIVATE and something else. But at the same time we will call
280*b1cdbd2cSJim Jagielski 				the main thread to CREATE A WINDOW, SET IT VISIBLE ... Then we have a problem. We must send us himself a event
281*b1cdbd2cSJim Jagielski 				to run our code synchronized with our main thread!
282*b1cdbd2cSJim Jagielski 
283*b1cdbd2cSJim Jagielski 	@implements
284*b1cdbd2cSJim Jagielski 	@base		-
285*b1cdbd2cSJim Jagielski *//*-*************************************************************************************************************/
286*b1cdbd2cSJim Jagielski 
287*b1cdbd2cSJim Jagielski enum eIMPL_PluginCommand
288*b1cdbd2cSJim Jagielski {
289*b1cdbd2cSJim Jagielski 	START			,
290*b1cdbd2cSJim Jagielski 	STOP			,
291*b1cdbd2cSJim Jagielski 	CREATEWINDOW	,
292*b1cdbd2cSJim Jagielski 	DESTROY         ,
293*b1cdbd2cSJim Jagielski 	NEWSTREAM       ,
294*b1cdbd2cSJim Jagielski 	NEWURL
295*b1cdbd2cSJim Jagielski };
296*b1cdbd2cSJim Jagielski 
297*b1cdbd2cSJim Jagielski class cIMPL_MainThreadExecutorRequest
298*b1cdbd2cSJim Jagielski {
299*b1cdbd2cSJim Jagielski 	public:
300*b1cdbd2cSJim Jagielski 		cIMPL_MainThreadExecutorRequest(	eIMPL_PluginCommand								eCommand				,
301*b1cdbd2cSJim Jagielski 											PlugInFrame*									pPluginInstance			);
302*b1cdbd2cSJim Jagielski 
303*b1cdbd2cSJim Jagielski 		cIMPL_MainThreadExecutorRequest(	eIMPL_PluginCommand								eCommand				,
304*b1cdbd2cSJim Jagielski 											PlugInFrame*									pPluginInstance			,
305*b1cdbd2cSJim Jagielski 									const	css::uno::Any&									aPlatformWindowHandle	,
306*b1cdbd2cSJim Jagielski 											sal_Bool										bEmbedded				);
307*b1cdbd2cSJim Jagielski 
308*b1cdbd2cSJim Jagielski 	    cIMPL_MainThreadExecutorRequest(	eIMPL_PluginCommand								eCommand				,
309*b1cdbd2cSJim Jagielski 											PlugInFrame*									pPluginInstance			,
310*b1cdbd2cSJim Jagielski 									const   ::rtl::OUString&								sMIMEDescription		,
311*b1cdbd2cSJim Jagielski 									const	::rtl::OUString&								sURL		    		,
312*b1cdbd2cSJim Jagielski 									const	::rtl::OUString&								sFilter		    		,
313*b1cdbd2cSJim Jagielski 									const	css::uno::Reference< css::io::XInputStream >&	xStream     			,
314*b1cdbd2cSJim Jagielski 									const	css::uno::Any&									aSessionId				);
315*b1cdbd2cSJim Jagielski 
316*b1cdbd2cSJim Jagielski 		/*-****************************************************************************************************//**
317*b1cdbd2cSJim Jagielski 			@short		-
318*b1cdbd2cSJim Jagielski 			@descr		-
319*b1cdbd2cSJim Jagielski 
320*b1cdbd2cSJim Jagielski 			@seealso	-
321*b1cdbd2cSJim Jagielski 
322*b1cdbd2cSJim Jagielski 			@param		-
323*b1cdbd2cSJim Jagielski 			@return		-
324*b1cdbd2cSJim Jagielski 
325*b1cdbd2cSJim Jagielski 			@onerror	-
326*b1cdbd2cSJim Jagielski 		*//*-*****************************************************************************************************/
327*b1cdbd2cSJim Jagielski 
328*b1cdbd2cSJim Jagielski 		virtual long doIt();
329*b1cdbd2cSJim Jagielski 
330*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
331*b1cdbd2cSJim Jagielski 	//	private variables
332*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
333*b1cdbd2cSJim Jagielski 	private:
334*b1cdbd2cSJim Jagielski 
335*b1cdbd2cSJim Jagielski 		eIMPL_PluginCommand								m_eCommand				;	/// switch to specify forward function
336*b1cdbd2cSJim Jagielski 		PlugInFrame*									m_pPluginInstance		;	/// instance wich has started this swicth mechanism and wish to called back from us
337*b1cdbd2cSJim Jagielski 		css::uno::Reference< css::uno::XInterface >		m_xPluginInstance		;	/// reference to our plugin frame to prevent that plugin frame dies before we call back
338*b1cdbd2cSJim Jagielski 		css::uno::Any									m_aPlatformWindowHandle	;	///	parameter for XPluginInstance->createWindow()
339*b1cdbd2cSJim Jagielski 		sal_Bool										m_bEmbedded				;	///	parameter for XPluginInstance->createWindow()
340*b1cdbd2cSJim Jagielski 	    ::rtl::OUString				    				m_sMIMEDescription		;	/// parameter for XPluginInstance->newStream()/newURL()
341*b1cdbd2cSJim Jagielski 		::rtl::OUString			        				m_sURL					;	/// parameter for XPluginInstance->newStream()/newURL()
342*b1cdbd2cSJim Jagielski 		::rtl::OUString									m_sFilter				;	/// parameter for XPluginInstance->newStream()/newURL()
343*b1cdbd2cSJim Jagielski 		css::uno::Reference< css::io::XInputStream >	m_xStream				;	/// parameter for XPluginInstance->newStream()/newURL()
344*b1cdbd2cSJim Jagielski 		css::uno::Any      								m_aSessionId			;	/// parameter for XPluginInstance->newStream()/newURL()
345*b1cdbd2cSJim Jagielski };
346*b1cdbd2cSJim Jagielski 
347*b1cdbd2cSJim Jagielski class cIMPL_MainThreadExecutor
348*b1cdbd2cSJim Jagielski {
349*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
350*b1cdbd2cSJim Jagielski 	//	public methods
351*b1cdbd2cSJim Jagielski 	//-------------------------------------------------------------------------------------------------------------
352*b1cdbd2cSJim Jagielski 	public:
353*b1cdbd2cSJim Jagielski 		static void execute( cIMPL_MainThreadExecutorRequest* pRequest );
354*b1cdbd2cSJim Jagielski 
355*b1cdbd2cSJim Jagielski 		/*-****************************************************************************************************//**
356*b1cdbd2cSJim Jagielski 			@short		-
357*b1cdbd2cSJim Jagielski 			@descr		-
358*b1cdbd2cSJim Jagielski 
359*b1cdbd2cSJim Jagielski 			@seealso	-
360*b1cdbd2cSJim Jagielski 
361*b1cdbd2cSJim Jagielski 			@param		-
362*b1cdbd2cSJim Jagielski 			@return		-
363*b1cdbd2cSJim Jagielski 
364*b1cdbd2cSJim Jagielski 			@onerror	-
365*b1cdbd2cSJim Jagielski 		*//*-*****************************************************************************************************/
366*b1cdbd2cSJim Jagielski 		DECL_STATIC_LINK( cIMPL_MainThreadExecutor, worker, cIMPL_MainThreadExecutorRequest* );
367*b1cdbd2cSJim Jagielski };
368*b1cdbd2cSJim Jagielski 
369*b1cdbd2cSJim Jagielski }		//	namespace framework
370*b1cdbd2cSJim Jagielski 
371*b1cdbd2cSJim Jagielski #endif	//	#ifndef __FRAMEWORK_SERVICES_PLUGINFRAME_HXX_
372