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