Update ooo320-m1
[ooovba.git] / framework / inc / services / task.hxx
blob13181a110253b180aaba5364d307a1fdd01c1630
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: task.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
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.
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).
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.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_SERVICES_TASK_HXX_
32 #define __FRAMEWORK_SERVICES_TASK_HXX_
34 //_________________________________________________________________________________________________________________
35 // my own includes
36 //_________________________________________________________________________________________________________________
38 #include <services/frame.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>
45 //_________________________________________________________________________________________________________________
46 // interface includes
47 //_________________________________________________________________________________________________________________
48 #include <com/sun/star/frame/XTask.hpp>
49 #include <com/sun/star/awt/Point.hpp>
50 #include <com/sun/star/awt/Size.hpp>
52 //_________________________________________________________________________________________________________________
53 // other includes
54 //_________________________________________________________________________________________________________________
55 #include <cppuhelper/weak.hxx>
56 #include <cppuhelper/propshlp.hxx>
58 #include <tools/link.hxx>
59 #include <vcl/evntpost.hxx>
61 //_________________________________________________________________________________________________________________
62 // namespace
63 //_________________________________________________________________________________________________________________
65 namespace framework{
67 //_________________________________________________________________________________________________________________
68 // exported const
69 //_________________________________________________________________________________________________________________
71 //_________________________________________________________________________________________________________________
72 // exported definitions
73 //_________________________________________________________________________________________________________________
75 /*-************************************************************************************************************//**
76 @short implements an special frame - a task frame
78 @descr -
80 @implements XTask
82 @base Frame
83 OPropertySet
84 *//*-*************************************************************************************************************/
86 class Task : public css::frame::XTask , // => XFrame => XComponent
87 public Frame // Order of baseclasses is neccessary for right initialization!
89 //-------------------------------------------------------------------------------------------------------------
90 // public methods
91 //-------------------------------------------------------------------------------------------------------------
93 public:
95 //---------------------------------------------------------------------------------------------------------
96 // constructor / destructor
97 //---------------------------------------------------------------------------------------------------------
99 /*-****************************************************************************************************//**
100 @short standard constructor to create instance
102 @descr This constructor initialize a new instance of this class,
103 and will be set valid values on his member and baseclasses.
105 @seealso -
107 @param -
109 @return -
111 @onerror -
112 *//*-*****************************************************************************************************/
114 Task( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
116 /*-****************************************************************************************************//**
117 @short standard destructor
119 @descr This method destruct an instance of this class and clear some member.
121 @seealso -
123 @param -
125 @return -
127 @onerror -
128 *//*-*****************************************************************************************************/
130 virtual ~Task();
132 //---------------------------------------------------------------------------------------------------------
133 // XInterface, XTypeProvider, XServiceInfo
134 //---------------------------------------------------------------------------------------------------------
136 DECLARE_XINTERFACE
137 DECLARE_XTYPEPROVIDER
138 DECLARE_XSERVICEINFO
140 //---------------------------------------------------------------------------------------------------------
141 // XTask
142 //---------------------------------------------------------------------------------------------------------
144 /*-****************************************************************************************************//**
145 @short -
147 @descr -
149 @seealso -
151 @param -
153 @return -
155 @onerror -
156 *//*-*****************************************************************************************************/
158 virtual sal_Bool SAL_CALL close() throw( css::uno::RuntimeException );
160 /*-****************************************************************************************************//**
161 @short -
163 @descr -
165 @seealso -
167 @param -
169 @return -
171 @onerror -
172 *//*-*****************************************************************************************************/
174 virtual void SAL_CALL tileWindows() throw( css::uno::RuntimeException );
176 /*-****************************************************************************************************//**
177 @short -
179 @descr -
181 @seealso -
183 @param -
185 @return -
187 @onerror -
188 *//*-*****************************************************************************************************/
190 virtual void SAL_CALL arrangeWindowsVertical() throw( css::uno::RuntimeException );
192 /*-****************************************************************************************************//**
193 @short -
195 @descr -
197 @seealso -
199 @param -
201 @return -
203 @onerror -
204 *//*-*****************************************************************************************************/
206 virtual void SAL_CALL arrangeWindowsHorizontal() throw( css::uno::RuntimeException );
208 //---------------------------------------------------------------------------------------------------------
209 // XComponent
210 //---------------------------------------------------------------------------------------------------------
212 /*-****************************************************************************************************//**
213 @short -
215 @descr We must overwrite this method, because baseclass Frame implements XFrame and XComponent.
216 XTask is derived from these classes to! The compiler don't know, which base is the right one.
218 @seealso -
220 @param -
222 @return -
224 @onerror -
225 *//*-*****************************************************************************************************/
227 virtual void SAL_CALL dispose() throw( css::uno::RuntimeException )
229 Frame::dispose();
232 /*-*******************************************************************************************************/
233 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException )
235 Frame::addEventListener( xListener );
238 /*-*******************************************************************************************************/
239 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException )
241 Frame::removeEventListener( xListener );
244 //---------------------------------------------------------------------------------------------------------
245 // XFrame
246 //---------------------------------------------------------------------------------------------------------
248 /*-****************************************************************************************************//**
249 @short -
251 @descr We must overwrite this method, because baseclass Frame implements XFrame and XComponent.
252 XTask is derived from these classes to! The compiler don't know, which base is right.
254 @seealso -
256 @param -
258 @return -
260 @onerror -
261 *//*-*****************************************************************************************************/
263 virtual void SAL_CALL initialize( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException )
265 Frame::initialize( xWindow );
268 virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow() throw( css::uno::RuntimeException )
270 return Frame::getContainerWindow();
273 virtual void SAL_CALL setCreator( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException )
275 Frame::setCreator( xCreator );
278 virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator() throw( css::uno::RuntimeException )
280 return Frame::getCreator();
283 virtual ::rtl::OUString SAL_CALL getName() throw( css::uno::RuntimeException )
285 return Frame::getName();
288 virtual void SAL_CALL setName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException )
290 Frame::setName( sName );
293 virtual sal_Bool SAL_CALL isTop() throw( css::uno::RuntimeException )
295 return Frame::isTop();
298 virtual void SAL_CALL activate() throw( css::uno::RuntimeException )
300 Frame::activate();
303 virtual void SAL_CALL deactivate() throw( css::uno::RuntimeException )
305 Frame::deactivate();
308 virtual sal_Bool SAL_CALL isActive() throw( css::uno::RuntimeException )
310 return Frame::isActive();
313 virtual sal_Bool SAL_CALL setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow ,
314 const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException )
316 return Frame::setComponent( xComponentWindow, xController );
319 virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() throw( css::uno::RuntimeException )
321 return Frame::getComponentWindow();
324 virtual css::uno::Reference< css::frame::XController > SAL_CALL getController() throw( css::uno::RuntimeException )
326 return Frame::getController();
329 virtual void SAL_CALL contextChanged() throw( css::uno::RuntimeException )
331 Frame::contextChanged();
334 virtual void SAL_CALL addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException )
336 Frame::addFrameActionListener( xListener );
339 virtual void SAL_CALL removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException )
341 Frame::removeFrameActionListener( xListener );
344 virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame( const ::rtl::OUString& sTargetFrameName ,
345 sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
347 //---------------------------------------------------------------------------------------------------------
348 // XTopWindowListener
349 //---------------------------------------------------------------------------------------------------------
351 /*-****************************************************************************************************//**
352 @short -
354 @descr -
356 @seealso -
357 @seealso -
359 @param -
361 @return -
363 @onerror -
364 *//*-*****************************************************************************************************/
366 virtual void SAL_CALL windowClosing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
368 /*-****************************************************************************************************//**
369 @short -
371 @descr -
373 @seealso -
374 @seealso -
376 @param -
378 @return -
380 @onerror -
381 *//*-*****************************************************************************************************/
383 virtual void SAL_CALL windowActivated( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
385 /*-****************************************************************************************************//**
386 @short -
388 @descr -
390 @seealso -
391 @seealso -
393 @param -
395 @return -
397 @onerror -
398 *//*-*****************************************************************************************************/
400 virtual void SAL_CALL windowDeactivated( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
402 //---------------------------------------------------------------------------------------------------------
403 // XEventListener
404 //---------------------------------------------------------------------------------------------------------
406 /*-****************************************************************************************************//**
407 @short -
409 @descr This object is forced to release all references to the interfaces given
410 by the parameter Source.
412 @seealso -
414 @param -
416 @return -
418 @onerror -
419 *//*-*****************************************************************************************************/
421 virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
423 //-------------------------------------------------------------------------------------------------------------
424 // protected methods
425 //-------------------------------------------------------------------------------------------------------------
427 protected:
429 //---------------------------------------------------------------------------
430 // OPropertySetHelper
431 //---------------------------------------------------------------------------
433 /*-****************************************************************************************************//**
434 @short try to convert a property value
435 @descr This method is calling from helperclass "OPropertySetHelper".
436 Don't use this directly!
437 You must try to convert the value of given propertyhandle and
438 return results of this operation. This will be use to ask vetoable
439 listener. If no listener have a veto, we will change value realy!
440 ( in method setFastPropertyValue_NoBroadcast(...) )
442 @seealso OPropertySetHelper
443 @seealso setFastPropertyValue_NoBroadcast()
445 @param "aConvertedValue" new converted value of property
446 @param "aOldValue" old value of property
447 @param "nHandle" handle of property
448 @param "aValue" new value of property
450 @return sal_True if value will be changed, sal_FALSE otherway
452 @onerror IllegalArgumentException, if you call this with an invalid argument
453 *//*-*****************************************************************************************************/
455 virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& aConvertedValue ,
456 css::uno::Any& aOldValue ,
457 sal_Int32 nHandle ,
458 const css::uno::Any& aValue ) throw( css::lang::IllegalArgumentException );
460 /*-****************************************************************************************************//**
461 @short set value of a transient property
462 @descr This method is calling from helperclass "OPropertySetHelper".
463 Don't use this directly!
464 Handle and value are valid everyway! You must set the new value only.
465 After this, baseclass send messages to all listener automaticly.
467 @seealso OPropertySetHelper
469 @param "nHandle" handle of property to change
470 @param "aValue" new value of property
472 @return -
474 @onerror An exception is thrown.
475 *//*-*****************************************************************************************************/
477 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
478 const css::uno::Any& aValue ) throw( css::uno::Exception );
480 /*-****************************************************************************************************//**
481 @short get value of a transient property
482 @descr This method is calling from helperclass "OPropertySetHelper".
483 Don't use this directly!
485 @seealso OPropertySetHelper
487 @param "nHandle" handle of property to change
488 @param "aValue" current value of property
490 @return -
492 @onerror -
493 *//*-*****************************************************************************************************/
495 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& aValue ,
496 sal_Int32 nHandle ) const;
498 /*-****************************************************************************************************//**
499 @short return structure and information about transient properties
500 @descr This method is calling from helperclass "OPropertySetHelper".
501 Don't use this directly!
503 @seealso OPropertySetHelper
505 @param -
507 @return structure with property-informations
509 @onerror -
510 *//*-*****************************************************************************************************/
512 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
514 /*-****************************************************************************************************//**
515 @short return propertysetinfo
516 @descr You can call this method to get information about transient properties
517 of this object.
519 @seealso OPropertySetHelper
520 @seealso XPropertySet
521 @seealso XMultiPropertySet
523 @param -
525 @return reference to object with information [XPropertySetInfo]
527 @onerror -
528 *//*-*****************************************************************************************************/
530 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo();
532 //-------------------------------------------------------------------------------------------------------------
533 // private methods
534 //-------------------------------------------------------------------------------------------------------------
536 private:
538 DECL_LINK( Close_Impl, void* );
540 // void impl_SaveWindowAttributes();
542 /* sal_Bool impl_tryToChangeProperty( sal_Bool bProperty ,
543 const css::uno::Any& aValue ,
544 css::uno::Any& aOldValue ,
545 css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException );
546 sal_Bool impl_tryToChangeProperty( const ::rtl::OUString& sProperty ,
547 const css::uno::Any& aValue ,
548 css::uno::Any& aOldValue ,
549 css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException );
550 sal_Bool impl_tryToChangeProperty( const css::awt::Point& aProperty ,
551 const css::uno::Any& aValue ,
552 css::uno::Any& aOldValue ,
553 css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException );
554 sal_Bool impl_tryToChangeProperty( const css::awt::Size& aProperty ,
555 const css::uno::Any& aValue ,
556 css::uno::Any& aOldValue ,
557 css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException );
559 static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor();
562 //-------------------------------------------------------------------------------------------------------------
563 // debug methods
564 // (should be private everyway!)
565 //-------------------------------------------------------------------------------------------------------------
567 /*-****************************************************************************************************//**
568 @short debug-method to check incoming parameter of some other mehods of this class
569 @descr The following methods are used to check parameters for other methods
570 of this class. The return value is used directly for an ASSERT(...).
572 @seealso ASSERTs in implementation!
574 @param references to checking variables
575 @return sal_False on invalid parameter<BR>
576 sal_True otherway
578 @onerror -
579 *//*-*****************************************************************************************************/
581 #ifdef ENABLE_ASSERTIONS
583 private:
585 // Not used in the moment!
587 #endif // #ifdef ENABLE_ASSERTIONS
589 //-------------------------------------------------------------------------------------------------------------
590 // variables
591 // (should be private everyway!)
592 //-------------------------------------------------------------------------------------------------------------
594 protected:
596 // But some values are neede by derived classes!
597 // sal_Bool m_bIsPlugIn ; /// In objects of these class this member is set to FALSE.
598 /// But in derived class PlugInFrame it's overwrited with TRUE!
600 private:
602 // Properties
603 sal_Bool m_bIsAlwaysVisible ;
604 sal_Bool m_bIsFloating ;
605 css::awt::Point m_aPosition ;
606 css::awt::Size m_aSize ;
607 ::vcl::EventPoster m_aPoster ;
609 }; // class Tasks
611 } // namespace framework
613 #endif // #ifndef __FRAMEWORK_SERVICES_TASKS_HXX_