1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: task.hxx,v $
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 //_________________________________________________________________________________________________________________
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 //_________________________________________________________________________________________________________________
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 //_________________________________________________________________________________________________________________
54 //_________________________________________________________________________________________________________________
55 #include <cppuhelper/weak.hxx>
56 #include <cppuhelper/propshlp.hxx>
58 #include <tools/link.hxx>
59 #include <vcl/evntpost.hxx>
61 //_________________________________________________________________________________________________________________
63 //_________________________________________________________________________________________________________________
67 //_________________________________________________________________________________________________________________
69 //_________________________________________________________________________________________________________________
71 //_________________________________________________________________________________________________________________
72 // exported definitions
73 //_________________________________________________________________________________________________________________
75 /*-************************************************************************************************************//**
76 @short implements an special frame - a task frame
84 *//*-*************************************************************************************************************/
86 class Task
: public css::frame::XTask
, // => XFrame => XComponent
87 public Frame
// Order of baseclasses is neccessary for right initialization!
89 //-------------------------------------------------------------------------------------------------------------
91 //-------------------------------------------------------------------------------------------------------------
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.
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.
128 *//*-*****************************************************************************************************/
132 //---------------------------------------------------------------------------------------------------------
133 // XInterface, XTypeProvider, XServiceInfo
134 //---------------------------------------------------------------------------------------------------------
137 DECLARE_XTYPEPROVIDER
140 //---------------------------------------------------------------------------------------------------------
142 //---------------------------------------------------------------------------------------------------------
144 /*-****************************************************************************************************//**
156 *//*-*****************************************************************************************************/
158 virtual sal_Bool SAL_CALL
close() throw( css::uno::RuntimeException
);
160 /*-****************************************************************************************************//**
172 *//*-*****************************************************************************************************/
174 virtual void SAL_CALL
tileWindows() throw( css::uno::RuntimeException
);
176 /*-****************************************************************************************************//**
188 *//*-*****************************************************************************************************/
190 virtual void SAL_CALL
arrangeWindowsVertical() throw( css::uno::RuntimeException
);
192 /*-****************************************************************************************************//**
204 *//*-*****************************************************************************************************/
206 virtual void SAL_CALL
arrangeWindowsHorizontal() throw( css::uno::RuntimeException
);
208 //---------------------------------------------------------------------------------------------------------
210 //---------------------------------------------------------------------------------------------------------
212 /*-****************************************************************************************************//**
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.
225 *//*-*****************************************************************************************************/
227 virtual void SAL_CALL
dispose() throw( css::uno::RuntimeException
)
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 //---------------------------------------------------------------------------------------------------------
246 //---------------------------------------------------------------------------------------------------------
248 /*-****************************************************************************************************//**
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.
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
)
303 virtual void SAL_CALL
deactivate() throw( css::uno::RuntimeException
)
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 /*-****************************************************************************************************//**
364 *//*-*****************************************************************************************************/
366 virtual void SAL_CALL
windowClosing( const css::lang::EventObject
& aEvent
) throw( css::uno::RuntimeException
);
368 /*-****************************************************************************************************//**
381 *//*-*****************************************************************************************************/
383 virtual void SAL_CALL
windowActivated( const css::lang::EventObject
& aEvent
) throw( css::uno::RuntimeException
);
385 /*-****************************************************************************************************//**
398 *//*-*****************************************************************************************************/
400 virtual void SAL_CALL
windowDeactivated( const css::lang::EventObject
& aEvent
) throw( css::uno::RuntimeException
);
402 //---------------------------------------------------------------------------------------------------------
404 //---------------------------------------------------------------------------------------------------------
406 /*-****************************************************************************************************//**
409 @descr This object is forced to release all references to the interfaces given
410 by the parameter Source.
419 *//*-*****************************************************************************************************/
421 virtual void SAL_CALL
disposing( const css::lang::EventObject
& aEvent
) throw( css::uno::RuntimeException
);
423 //-------------------------------------------------------------------------------------------------------------
425 //-------------------------------------------------------------------------------------------------------------
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 ,
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
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
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
507 @return structure with property-informations
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
519 @seealso OPropertySetHelper
520 @seealso XPropertySet
521 @seealso XMultiPropertySet
525 @return reference to object with information [XPropertySetInfo]
528 *//*-*****************************************************************************************************/
530 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo();
532 //-------------------------------------------------------------------------------------------------------------
534 //-------------------------------------------------------------------------------------------------------------
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 //-------------------------------------------------------------------------------------------------------------
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>
579 *//*-*****************************************************************************************************/
581 #ifdef ENABLE_ASSERTIONS
585 // Not used in the moment!
587 #endif // #ifdef ENABLE_ASSERTIONS
589 //-------------------------------------------------------------------------------------------------------------
591 // (should be private everyway!)
592 //-------------------------------------------------------------------------------------------------------------
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!
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
;
611 } // namespace framework
613 #endif // #ifndef __FRAMEWORK_SERVICES_TASKS_HXX_