xref: /aoo41x/main/framework/inc/services/task.hxx (revision f8e07b45)
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_TASK_HXX_
25 #define __FRAMEWORK_SERVICES_TASK_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <services/frame.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 
38 //_________________________________________________________________________________________________________________
39 //	interface includes
40 //_________________________________________________________________________________________________________________
41 #include <com/sun/star/frame/XTask.hpp>
42 #include <com/sun/star/awt/Point.hpp>
43 #include <com/sun/star/awt/Size.hpp>
44 
45 //_________________________________________________________________________________________________________________
46 //	other includes
47 //_________________________________________________________________________________________________________________
48 #include <cppuhelper/weak.hxx>
49 #include <cppuhelper/propshlp.hxx>
50 
51 #include <tools/link.hxx>
52 #include <vcl/evntpost.hxx>
53 
54 //_________________________________________________________________________________________________________________
55 //	namespace
56 //_________________________________________________________________________________________________________________
57 
58 namespace framework{
59 
60 //_________________________________________________________________________________________________________________
61 //	exported const
62 //_________________________________________________________________________________________________________________
63 
64 //_________________________________________________________________________________________________________________
65 //	exported definitions
66 //_________________________________________________________________________________________________________________
67 
68 /*-************************************************************************************************************//**
69 	@short		implements an special frame - a task frame
70 
71 	@descr		-
72 
73 	@implements	XTask
74 
75 	@base		Frame
76 				OPropertySet
77 *//*-*************************************************************************************************************/
78 
79 class Task  :   public css::frame::XTask    ,   // => XFrame => XComponent
80                 public Frame                    // Order of baseclasses is neccessary for right initialization!
81 {
82 	//-------------------------------------------------------------------------------------------------------------
83 	//	public methods
84 	//-------------------------------------------------------------------------------------------------------------
85 
86 	public:
87 
88 		//---------------------------------------------------------------------------------------------------------
89 		//	constructor / destructor
90 		//---------------------------------------------------------------------------------------------------------
91 
92 		/*-****************************************************************************************************//**
93 			@short		standard constructor to create instance
94 
95 			@descr		This constructor initialize a new instance of this class,
96 						and will be set valid values on his member and baseclasses.
97 
98 			@seealso	-
99 
100 			@param		-
101 
102 			@return		-
103 
104 			@onerror	-
105 		*//*-*****************************************************************************************************/
106 
107 	 	Task( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
108 
109 		/*-****************************************************************************************************//**
110 			@short		standard destructor
111 
112 			@descr		This method destruct an instance of this class and clear some member.
113 
114 			@seealso	-
115 
116 			@param		-
117 
118 			@return		-
119 
120 			@onerror	-
121 		*//*-*****************************************************************************************************/
122 
123 		virtual	~Task();
124 
125 		//---------------------------------------------------------------------------------------------------------
126 		//	XInterface, XTypeProvider, XServiceInfo
127 		//---------------------------------------------------------------------------------------------------------
128 
129 		DECLARE_XINTERFACE
130 		DECLARE_XTYPEPROVIDER
131 		DECLARE_XSERVICEINFO
132 
133 		//---------------------------------------------------------------------------------------------------------
134 		//	XTask
135 		//---------------------------------------------------------------------------------------------------------
136 
137 		/*-****************************************************************************************************//**
138 			@short		-
139 
140 			@descr		-
141 
142 			@seealso	-
143 
144 			@param		-
145 
146 			@return		-
147 
148 			@onerror	-
149 		*//*-*****************************************************************************************************/
150 
151 		virtual sal_Bool SAL_CALL close() throw( css::uno::RuntimeException );
152 
153 		/*-****************************************************************************************************//**
154 			@short		-
155 
156 			@descr		-
157 
158 			@seealso	-
159 
160 			@param		-
161 
162 			@return		-
163 
164 			@onerror	-
165 		*//*-*****************************************************************************************************/
166 
167     	virtual void SAL_CALL tileWindows() throw( css::uno::RuntimeException );
168 
169 		/*-****************************************************************************************************//**
170 			@short		-
171 
172 			@descr		-
173 
174 			@seealso	-
175 
176 			@param		-
177 
178 			@return		-
179 
180 			@onerror	-
181 		*//*-*****************************************************************************************************/
182 
183     	virtual void SAL_CALL arrangeWindowsVertical() throw( css::uno::RuntimeException );
184 
185 		/*-****************************************************************************************************//**
186 			@short		-
187 
188 			@descr		-
189 
190 			@seealso	-
191 
192 			@param		-
193 
194 			@return		-
195 
196 			@onerror	-
197 		*//*-*****************************************************************************************************/
198 
199     	virtual void SAL_CALL arrangeWindowsHorizontal() throw( css::uno::RuntimeException );
200 
201 		//---------------------------------------------------------------------------------------------------------
202 		//	 XComponent
203 		//---------------------------------------------------------------------------------------------------------
204 
205 		/*-****************************************************************************************************//**
206 			@short		-
207 
208 			@descr		We must overwrite this method, because baseclass Frame implements XFrame and XComponent.
209 						XTask is derived from these classes to! The compiler don't know, which base is the right one.
210 
211 			@seealso	-
212 
213 			@param		-
214 
215 			@return		-
216 
217 			@onerror	-
218 		*//*-*****************************************************************************************************/
219 
dispose()220     	virtual void SAL_CALL dispose() throw( css::uno::RuntimeException )
221 		{
222 			Frame::dispose();
223 		}
224 
225 		/*-*******************************************************************************************************/
addEventListener(const css::uno::Reference<css::lang::XEventListener> & xListener)226     	virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException )
227 		{
228 			Frame::addEventListener( xListener );
229 		}
230 
231 		/*-*******************************************************************************************************/
removeEventListener(const css::uno::Reference<css::lang::XEventListener> & xListener)232     	virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException )
233 		{
234 			Frame::removeEventListener( xListener );
235 		}
236 
237 		//---------------------------------------------------------------------------------------------------------
238 		//	 XFrame
239 		//---------------------------------------------------------------------------------------------------------
240 
241 		/*-****************************************************************************************************//**
242 			@short		-
243 
244 			@descr		We must overwrite this method, because baseclass Frame implements XFrame and XComponent.
245 						XTask is derived from these classes to! The compiler don't know, which base is right.
246 
247 			@seealso	-
248 
249 			@param		-
250 
251 			@return		-
252 
253 			@onerror	-
254 		*//*-*****************************************************************************************************/
255 
initialize(const css::uno::Reference<css::awt::XWindow> & xWindow)256     	virtual void SAL_CALL initialize( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException )
257 		{
258 			Frame::initialize( xWindow );
259 		}
260 
getContainerWindow()261     	virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow() throw( css::uno::RuntimeException )
262 		{
263 			return Frame::getContainerWindow();
264 		}
265 
setCreator(const css::uno::Reference<css::frame::XFramesSupplier> & xCreator)266     	virtual void SAL_CALL setCreator( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException )
267 		{
268 			Frame::setCreator( xCreator );
269 		}
270 
getCreator()271     	virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator() throw( css::uno::RuntimeException )
272 		{
273 			return Frame::getCreator();
274 		}
275 
getName()276     	virtual ::rtl::OUString SAL_CALL getName() throw( css::uno::RuntimeException )
277 		{
278 			return Frame::getName();
279 		}
280 
setName(const::rtl::OUString & sName)281     	virtual void SAL_CALL setName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException )
282 		{
283 			Frame::setName( sName );
284 		}
285 
isTop()286     	virtual sal_Bool SAL_CALL isTop() throw( css::uno::RuntimeException )
287 		{
288 			return Frame::isTop();
289 		}
290 
activate()291     	virtual void SAL_CALL activate() throw( css::uno::RuntimeException )
292 		{
293 			Frame::activate();
294 		}
295 
deactivate()296     	virtual void SAL_CALL deactivate() throw( css::uno::RuntimeException )
297 		{
298 			Frame::deactivate();
299 		}
300 
isActive()301     	virtual sal_Bool SAL_CALL isActive() throw( css::uno::RuntimeException )
302 		{
303 			return Frame::isActive();
304 		}
305 
setComponent(const css::uno::Reference<css::awt::XWindow> & xComponentWindow,const css::uno::Reference<css::frame::XController> & xController)306     	virtual sal_Bool SAL_CALL setComponent(	const	css::uno::Reference< css::awt::XWindow >&		xComponentWindow	,
307 												const	css::uno::Reference< css::frame::XController >&	xController			) throw( css::uno::RuntimeException )
308 		{
309 			return Frame::setComponent( xComponentWindow, xController );
310 		}
311 
getComponentWindow()312     	virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() throw( css::uno::RuntimeException )
313 		{
314 			return Frame::getComponentWindow();
315 		}
316 
getController()317     	virtual css::uno::Reference< css::frame::XController > SAL_CALL getController() throw( css::uno::RuntimeException )
318 		{
319 			return Frame::getController();
320 		}
321 
contextChanged()322     	virtual void SAL_CALL contextChanged() throw( css::uno::RuntimeException )
323 		{
324 			Frame::contextChanged();
325 		}
326 
addFrameActionListener(const css::uno::Reference<css::frame::XFrameActionListener> & xListener)327     	virtual void SAL_CALL addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException )
328 		{
329 			Frame::addFrameActionListener( xListener );
330 		}
331 
removeFrameActionListener(const css::uno::Reference<css::frame::XFrameActionListener> & xListener)332     	virtual void SAL_CALL removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException )
333 		{
334 			Frame::removeFrameActionListener( xListener );
335 		}
336 
337     	virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame(	const	::rtl::OUString&	sTargetFrameName	,
338 													   									sal_Int32			nSearchFlags		) throw( css::uno::RuntimeException );
339 
340 		//---------------------------------------------------------------------------------------------------------
341 		//	 XTopWindowListener
342 		//---------------------------------------------------------------------------------------------------------
343 
344 		/*-****************************************************************************************************//**
345 			@short		-
346 
347 			@descr		-
348 
349 			@seealso	-
350 			@seealso	-
351 
352 			@param		-
353 
354 			@return		-
355 
356 			@onerror	-
357 		*//*-*****************************************************************************************************/
358 
359 		virtual void SAL_CALL windowClosing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
360 
361 		/*-****************************************************************************************************//**
362 			@short		-
363 
364 			@descr		-
365 
366 			@seealso	-
367 			@seealso	-
368 
369 			@param		-
370 
371 			@return		-
372 
373 			@onerror	-
374 		*//*-*****************************************************************************************************/
375 
376 		virtual void SAL_CALL windowActivated( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
377 
378 		/*-****************************************************************************************************//**
379 			@short		-
380 
381 			@descr		-
382 
383 			@seealso	-
384 			@seealso	-
385 
386 			@param		-
387 
388 			@return		-
389 
390 			@onerror	-
391 		*//*-*****************************************************************************************************/
392 
393     	virtual void SAL_CALL windowDeactivated( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
394 
395 		//---------------------------------------------------------------------------------------------------------
396 		//	 XEventListener
397 		//---------------------------------------------------------------------------------------------------------
398 
399 		/*-****************************************************************************************************//**
400 			@short		-
401 
402 			@descr		This object is forced to release all references to the interfaces given
403 						by the parameter Source.
404 
405 			@seealso	-
406 
407 			@param		-
408 
409 			@return		-
410 
411 			@onerror	-
412 		*//*-*****************************************************************************************************/
413 
414 	    virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
415 
416 	//-------------------------------------------------------------------------------------------------------------
417 	//	protected methods
418 	//-------------------------------------------------------------------------------------------------------------
419 
420 	protected:
421 
422 		//---------------------------------------------------------------------------
423 		//	OPropertySetHelper
424 		//---------------------------------------------------------------------------
425 
426 		/*-****************************************************************************************************//**
427 			@short		try to convert a property value
428 			@descr		This method is calling from helperclass "OPropertySetHelper".
429 						Don't use this directly!
430 						You must try to convert the value of given propertyhandle and
431 						return results of this operation. This will be use to ask vetoable
432 						listener. If no listener have a veto, we will change value realy!
433 						( in method setFastPropertyValue_NoBroadcast(...) )
434 
435 			@seealso	OPropertySetHelper
436 			@seealso	setFastPropertyValue_NoBroadcast()
437 
438 			@param		"aConvertedValue"	new converted value of property
439 			@param		"aOldValue"			old value of property
440 			@param		"nHandle"			handle of property
441 			@param		"aValue"			new value of property
442 
443 			@return		sal_True if value will be changed, sal_FALSE otherway
444 
445 			@onerror	IllegalArgumentException, if you call this with an invalid argument
446 		*//*-*****************************************************************************************************/
447 /*
448 		virtual sal_Bool SAL_CALL convertFastPropertyValue(			css::uno::Any&		aConvertedValue	,
449 								  									css::uno::Any&		aOldValue		,
450 																	sal_Int32			nHandle			,
451 															const	css::uno::Any&		aValue			) throw( css::lang::IllegalArgumentException );
452 */
453 		/*-****************************************************************************************************//**
454 			@short		set value of a transient property
455 			@descr		This method is calling from helperclass "OPropertySetHelper".
456 						Don't use this directly!
457 						Handle and value are valid everyway! You must set the new value only.
458 						After this, baseclass send messages to all listener automaticly.
459 
460 			@seealso	OPropertySetHelper
461 
462 			@param      "nHandle"	handle of property to change
463 			@param      "aValue"	new value of property
464 
465 			@return		-
466 
467 			@onerror	An exception is thrown.
468 		*//*-*****************************************************************************************************/
469 /*
470 		virtual void SAL_CALL setFastPropertyValue_NoBroadcast(			sal_Int32		nHandle	,
471 							  									const	css::uno::Any&	aValue	) throw( css::uno::Exception );
472 */
473 		/*-****************************************************************************************************//**
474 			@short		get value of a transient property
475 			@descr		This method is calling from helperclass "OPropertySetHelper".
476 						Don't use this directly!
477 
478 			@seealso	OPropertySetHelper
479 
480 			@param      "nHandle"	handle of property to change
481 			@param      "aValue"	current value of property
482 
483 			@return		-
484 
485 			@onerror	-
486 		*//*-*****************************************************************************************************/
487 /*
488 		virtual void SAL_CALL getFastPropertyValue(	css::uno::Any&	aValue	,
489 							  						sal_Int32		nHandle	) const;
490 */
491 		/*-****************************************************************************************************//**
492 			@short      return structure and information about transient properties
493 			@descr		This method is calling from helperclass "OPropertySetHelper".
494 						Don't use this directly!
495 
496 			@seealso	OPropertySetHelper
497 
498 			@param		-
499 
500 			@return		structure with property-informations
501 
502 			@onerror	-
503 		*//*-*****************************************************************************************************/
504 /*
505 		virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
506 */
507 		/*-****************************************************************************************************//**
508 			@short		return propertysetinfo
509 			@descr		You can call this method to get information about transient properties
510 						of this object.
511 
512 			@seealso	OPropertySetHelper
513 			@seealso	XPropertySet
514 			@seealso	XMultiPropertySet
515 
516 			@param		-
517 
518 			@return		reference to object with information [XPropertySetInfo]
519 
520 			@onerror	-
521 		*//*-*****************************************************************************************************/
522 /*
523 		virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo();
524 */
525 	//-------------------------------------------------------------------------------------------------------------
526 	//	private methods
527 	//-------------------------------------------------------------------------------------------------------------
528 
529 	private:
530 
531         DECL_LINK( Close_Impl, void* );
532 
533 //        void    impl_SaveWindowAttributes();
534 
535 /*		sal_Bool impl_tryToChangeProperty(			sal_Bool			bProperty		,
536 											const	css::uno::Any&		aValue			,
537 													css::uno::Any&		aOldValue		,
538 													css::uno::Any&		aConvertedValue	) throw( css::lang::IllegalArgumentException );
539 		sal_Bool impl_tryToChangeProperty(	const	::rtl::OUString&	sProperty		,
540 											const	css::uno::Any&		aValue			,
541 													css::uno::Any&		aOldValue		,
542 													css::uno::Any&		aConvertedValue	) throw( css::lang::IllegalArgumentException );
543 		sal_Bool impl_tryToChangeProperty(	const	css::awt::Point&	aProperty		,
544 											const	css::uno::Any&		aValue			,
545 													css::uno::Any&		aOldValue		,
546 													css::uno::Any&		aConvertedValue	) throw( css::lang::IllegalArgumentException );
547 		sal_Bool impl_tryToChangeProperty(	const	css::awt::Size&		aProperty		,
548 											const	css::uno::Any&		aValue			,
549 													css::uno::Any&		aOldValue		,
550 													css::uno::Any&		aConvertedValue	) throw( css::lang::IllegalArgumentException );
551 
552 		static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor();
553 */
554 
555 	//-------------------------------------------------------------------------------------------------------------
556 	//	debug methods
557 	//	(should be private everyway!)
558 	//-------------------------------------------------------------------------------------------------------------
559 
560 		/*-****************************************************************************************************//**
561 			@short		debug-method to check incoming parameter of some other mehods of this class
562 			@descr		The following methods are used to check parameters for other methods
563 						of this class. The return value is used directly for an ASSERT(...).
564 
565 			@seealso	ASSERTs in implementation!
566 
567 			@param		references to checking variables
568 			@return		sal_False on invalid parameter<BR>
569 						sal_True  otherway
570 
571 			@onerror	-
572 		*//*-*****************************************************************************************************/
573 
574 	#ifdef ENABLE_ASSERTIONS
575 
576 	private:
577 
578 		// Not used in the moment!
579 
580 	#endif	// #ifdef ENABLE_ASSERTIONS
581 
582 	//-------------------------------------------------------------------------------------------------------------
583 	//	variables
584 	//	(should be private everyway!)
585 	//-------------------------------------------------------------------------------------------------------------
586 
587 	protected:
588 
589 		// But some values are neede by derived classes!
590 //        sal_Bool            m_bIsPlugIn         ;   /// In objects of these class this member is set to sal_False.
591 													/// But in derived class PlugInFrame it's overwrited with sal_True!
592 
593 	private:
594 
595 		// Properties
596         sal_Bool            m_bIsAlwaysVisible  ;
597         sal_Bool            m_bIsFloating       ;
598         css::awt::Point		m_aPosition         ;
599         css::awt::Size		m_aSize             ;
600         ::vcl::EventPoster  m_aPoster           ;
601 
602 };		//	class Tasks
603 
604 }		//	namespace framework
605 
606 #endif	//	#ifndef __FRAMEWORK_SERVICES_TASKS_HXX_
607