xref: /trunk/main/UnoControls/source/inc/framecontrol.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
29 #define _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
30 
31 //______________________________________________________________________________________________________________
32 //  includes of other projects
33 //______________________________________________________________________________________________________________
34 
35 #include <com/sun/star/frame/XFrameActionListener.hpp>
36 #include <com/sun/star/frame/XComponentLoader.hpp>
37 #include <com/sun/star/frame/XFrame.hpp>
38 #include <com/sun/star/frame/FrameActionEvent.hpp>
39 #include <com/sun/star/frame/FrameAction.hpp>
40 #include <com/sun/star/lang/XServiceName.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/lang/XConnectionPointContainer.hpp>
43 #include <cppuhelper/propshlp.hxx>
44 
45 //______________________________________________________________________________________________________________
46 //  includes of my own project
47 //______________________________________________________________________________________________________________
48 #include "basecontrol.hxx"
49 #include "OConnectionPointContainerHelper.hxx"
50 
51 //______________________________________________________________________________________________________________
52 //  namespaces
53 //______________________________________________________________________________________________________________
54 
55 namespace unocontrols{
56 
57 #define UNO3_ANY                                        ::com::sun::star::uno::Any
58 #define UNO3_ILLEGALARGUMENTEXCEPTION                   ::com::sun::star::lang::IllegalArgumentException
59 #define UNO3_IPROPERTYARRAYHELPER                       ::cppu::IPropertyArrayHelper
60 #define UNO3_OBROADCASTHELPER                           ::cppu::OBroadcastHelper
61 #define UNO3_OCONNECTIONPOINTCONTAINERHELPER            OConnectionPointContainerHelper
62 #define UNO3_OMULTITYPEINTERFACECONTAINERHELPER         ::cppu::OMultiTypeInterfaceContainerHelper
63 #define UNO3_OPROPERTYSETHELPER                         ::cppu::OPropertySetHelper
64 #define UNO3_OUSTRING                                   ::rtl::OUString
65 #define UNO3_PROPERTY                                   ::com::sun::star::beans::Property
66 #define UNO3_PROPERTYVALUE                              ::com::sun::star::beans::PropertyValue
67 #define UNO3_REFERENCE                                  ::com::sun::star::uno::Reference
68 #define UNO3_RUNTIMEEXCEPTION                           ::com::sun::star::uno::RuntimeException
69 #define UNO3_SEQUENCE                                   ::com::sun::star::uno::Sequence
70 #define UNO3_TYPE                                       ::com::sun::star::uno::Type
71 #define UNO3_WINDOWDESCRIPTOR                           ::com::sun::star::awt::WindowDescriptor
72 #define UNO3_XCONNECTIONPOINT                           ::com::sun::star::lang::XConnectionPoint
73 #define UNO3_XCONNECTIONPOINTCONTAINER                  ::com::sun::star::lang::XConnectionPointContainer
74 #define UNO3_XCONTROLMODEL                              ::com::sun::star::awt::XControlModel
75 #define UNO3_XFRAME                                     ::com::sun::star::frame::XFrame
76 #define UNO3_XGRAPHICS                                  ::com::sun::star::awt::XGraphics
77 #define UNO3_XINTERFACE                                 ::com::sun::star::uno::XInterface
78 #define UNO3_XMULTISERVICEFACTORY                       ::com::sun::star::lang::XMultiServiceFactory
79 #define UNO3_XPROPERTYSETINFO                           ::com::sun::star::beans::XPropertySetInfo
80 #define UNO3_XTOOLKIT                                   ::com::sun::star::awt::XToolkit
81 #define UNO3_XWINDOWPEER                                ::com::sun::star::awt::XWindowPeer
82 
83 //______________________________________________________________________________________________________________
84 //  defines
85 //______________________________________________________________________________________________________________
86 
87 #define SERVICENAME_FRAMECONTROL                        "com.sun.star.frame.FrameControl"
88 #define IMPLEMENTATIONNAME_FRAMECONTROL                 "stardiv.UnoControls.FrameControl"
89 #define PROPERTYNAME_LOADERARGUMENTS                    "LoaderArguments"
90 #define PROPERTYNAME_COMPONENTURL                       "ComponentURL"
91 #define PROPERTYNAME_FRAME                              "Frame"
92 #define ERRORTEXT_VOSENSHURE                            "This is an invalid property handle."
93 #define PROPERTY_COUNT                                  3                                                       // you must count the propertys
94 #define PROPERTYHANDLE_COMPONENTURL                     0                                                       // Id must be the index into the array
95 #define PROPERTYHANDLE_FRAME                            1
96 #define PROPERTYHANDLE_LOADERARGUMENTS                  2
97 
98 //______________________________________________________________________________________________________________
99 //  class
100 //______________________________________________________________________________________________________________
101 
102 class FrameControl  : public UNO3_XCONTROLMODEL
103                     , public UNO3_XCONNECTIONPOINTCONTAINER
104                     , public BaseControl                                // This order is neccessary for right initialization of m_aMutex!
105                     , public UNO3_OBROADCASTHELPER
106                     , public UNO3_OPROPERTYSETHELPER
107 {
108 
109 //______________________________________________________________________________________________________________
110 //  public methods
111 //______________________________________________________________________________________________________________
112 
113 public:
114 
115     //__________________________________________________________________________________________________________
116     //  construct/destruct
117     //__________________________________________________________________________________________________________
118 
119     /**_________________________________________________________________________________________________________
120         @short
121         @descr
122 
123         @seealso
124 
125         @param
126 
127         @return
128 
129         @onerror
130     */
131 
132     FrameControl( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
133 
134     /**_________________________________________________________________________________________________________
135         @short
136         @descr
137 
138         @seealso
139 
140         @param
141 
142         @return
143 
144         @onerror
145     */
146 
147     virtual ~FrameControl();
148 
149     //__________________________________________________________________________________________________________
150     //  XInterface
151     //__________________________________________________________________________________________________________
152 
153     /**_________________________________________________________________________________________________________
154         @short
155         @descr
156 
157         @seealso
158 
159         @param
160 
161         @return
162 
163         @onerror
164     */
165 
166     virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
167 
168     /**_______________________________________________________________________________________________________
169         @short      increment refcount
170         @descr      -
171 
172         @seealso    XInterface
173         @seealso    release()
174 
175         @param      -
176 
177         @return     -
178 
179         @onerror    A RuntimeException is thrown.
180     */
181 
182     virtual void SAL_CALL acquire() throw();
183 
184     /**_______________________________________________________________________________________________________
185         @short      decrement refcount
186         @descr      -
187 
188         @seealso    XInterface
189         @seealso    acquire()
190 
191         @param      -
192 
193         @return     -
194 
195         @onerror    A RuntimeException is thrown.
196     */
197 
198     virtual void SAL_CALL release() throw();
199 
200     //__________________________________________________________________________________________________________
201     //  XTypeProvider
202     //__________________________________________________________________________________________________________
203 
204     /**_________________________________________________________________________________________________________
205         @short
206         @descr
207 
208         @seealso
209 
210         @param
211 
212         @return
213 
214         @onerror
215     */
216 
217     virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
218 
219     //__________________________________________________________________________________________________________
220     //  XAggregation
221     //__________________________________________________________________________________________________________
222 
223     /**_________________________________________________________________________________________________________
224         @short
225         @descr
226 
227         @seealso
228 
229         @param
230 
231         @return
232 
233         @onerror
234     */
235 
236     UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
237 
238     //__________________________________________________________________________________________________________
239     //  XControl
240     //__________________________________________________________________________________________________________
241 
242     /**_________________________________________________________________________________________________________
243         @short
244         @descr
245 
246         @seealso
247 
248         @param
249 
250         @return
251 
252         @onerror
253     */
254 
255     virtual void SAL_CALL createPeer(   const   UNO3_REFERENCE< UNO3_XTOOLKIT >&    xToolkit    ,
256                                         const   UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent     ) throw( UNO3_RUNTIMEEXCEPTION );
257 
258     /**_________________________________________________________________________________________________________
259         @short
260         @descr
261 
262         @seealso
263 
264         @param
265 
266         @return
267 
268         @onerror
269     */
270 
271     virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
272 
273     /**_________________________________________________________________________________________________________
274         @short
275         @descr
276 
277         @seealso
278 
279         @param
280 
281         @return
282 
283         @onerror
284     */
285 
286     virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
287 
288     //__________________________________________________________________________________________________________
289     //  XComponent
290     //__________________________________________________________________________________________________________
291 
292     /**_________________________________________________________________________________________________________
293         @short
294         @descr
295 
296         @seealso
297 
298         @param
299 
300         @return
301 
302         @onerror
303     */
304 
305     virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
306 
307     //__________________________________________________________________________________________________________
308     //  XView
309     //__________________________________________________________________________________________________________
310 
311     /**_________________________________________________________________________________________________________
312         @short
313         @descr
314 
315         @seealso
316 
317         @param
318 
319         @return
320 
321         @onerror
322     */
323 
324     virtual sal_Bool SAL_CALL setGraphics( const UNO3_REFERENCE< UNO3_XGRAPHICS >& xDevice ) throw( UNO3_RUNTIMEEXCEPTION );
325 
326     /**_________________________________________________________________________________________________________
327         @short
328         @descr
329 
330         @seealso
331 
332         @param
333 
334         @return
335 
336         @onerror
337     */
338 
339     virtual UNO3_REFERENCE< UNO3_XGRAPHICS > SAL_CALL getGraphics() throw( UNO3_RUNTIMEEXCEPTION );
340 
341     //__________________________________________________________________________________________________________
342     //  XConnectionPointContainer
343     //__________________________________________________________________________________________________________
344 
345     /**_________________________________________________________________________________________________________
346         @short
347         @descr
348 
349         @seealso
350 
351         @param
352 
353         @return
354 
355         @onerror
356     */
357 
358     virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getConnectionPointTypes() throw( UNO3_RUNTIMEEXCEPTION );
359 
360     /**_________________________________________________________________________________________________________
361         @short
362         @descr
363 
364         @seealso
365 
366         @param
367 
368         @return
369 
370         @onerror
371     */
372 
373     virtual UNO3_REFERENCE< UNO3_XCONNECTIONPOINT > SAL_CALL queryConnectionPoint( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
374 
375     /**_________________________________________________________________________________________________________
376         @short
377         @descr
378 
379         @seealso
380 
381         @param
382 
383         @return
384 
385         @onerror
386     */
387 
388     virtual void SAL_CALL advise(   const   UNO3_TYPE&                          aType       ,
389                                     const   UNO3_REFERENCE< UNO3_XINTERFACE >&  xListener   ) throw( UNO3_RUNTIMEEXCEPTION );
390 
391     /**_________________________________________________________________________________________________________
392         @short
393         @descr
394 
395         @seealso
396 
397         @param
398 
399         @return
400 
401         @onerror
402     */
403 
404     virtual void SAL_CALL unadvise( const   UNO3_TYPE&                          aType       ,
405                                     const   UNO3_REFERENCE< UNO3_XINTERFACE >&  xListener   ) throw( UNO3_RUNTIMEEXCEPTION );
406 
407     //__________________________________________________________________________________________________________
408     //  impl but public methods to register service!
409     //__________________________________________________________________________________________________________
410 
411     /**_________________________________________________________________________________________________________
412         @short
413         @descr
414 
415         @seealso
416 
417         @param
418 
419         @return
420 
421         @onerror
422     */
423 
424     static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
425 
426     /**_________________________________________________________________________________________________________
427         @short
428         @descr
429 
430         @seealso
431 
432         @param
433 
434         @return
435 
436         @onerror
437     */
438 
439     static const UNO3_OUSTRING impl_getStaticImplementationName();
440 
441 //______________________________________________________________________________________________________________
442 //  protected methods
443 //______________________________________________________________________________________________________________
444 
445 protected:
446     using OPropertySetHelper::getFastPropertyValue;
447     //__________________________________________________________________________________________________________
448     //  OPropertySetHelper
449     //__________________________________________________________________________________________________________
450 
451     /**_________________________________________________________________________________________________________
452         @short
453         @descr
454 
455         @seealso
456 
457         @param
458 
459         @return
460 
461         @onerror
462     */
463 
464     virtual sal_Bool SAL_CALL convertFastPropertyValue(         UNO3_ANY&   rConvertedValue ,
465                                                                 UNO3_ANY&   rOldValue       ,
466                                                                 sal_Int32   nHandle         ,
467                                                         const   UNO3_ANY&   rValue          ) throw( UNO3_ILLEGALARGUMENTEXCEPTION );
468 
469     /**_________________________________________________________________________________________________________
470         @short
471         @descr
472 
473         @seealso
474 
475         @param
476 
477         @return
478 
479         @onerror
480     */
481 
482     virtual void SAL_CALL setFastPropertyValue_NoBroadcast(         sal_Int32   nHandle ,
483                                                             const   UNO3_ANY&   rValue  ) throw ( ::com::sun::star::uno::Exception );
484 
485     /**_________________________________________________________________________________________________________
486         @short
487         @descr
488 
489         @seealso
490 
491         @param
492 
493         @return
494 
495         @onerror
496     */
497 
498     virtual void SAL_CALL getFastPropertyValue( UNO3_ANY&   rValue  ,
499                                                 sal_Int32   nHandle ) const ;
500 
501     /**_________________________________________________________________________________________________________
502         @short
503         @descr
504 
505         @seealso
506 
507         @param
508 
509         @return
510 
511         @onerror
512     */
513 
514     virtual UNO3_IPROPERTYARRAYHELPER& SAL_CALL getInfoHelper();
515 
516     //__________________________________________________________________________________________________________
517     //  XPropertySet
518     //__________________________________________________________________________________________________________
519 
520     /**_________________________________________________________________________________________________________
521         @short
522         @descr
523 
524         @seealso
525 
526         @param
527 
528         @return
529 
530         @onerror
531     */
532 
533     UNO3_REFERENCE< UNO3_XPROPERTYSETINFO > SAL_CALL getPropertySetInfo() throw( UNO3_RUNTIMEEXCEPTION );
534 
535     //__________________________________________________________________________________________________________
536     //  BaseControl
537     //__________________________________________________________________________________________________________
538 
539     /**_________________________________________________________________________________________________________
540         @short
541         @descr
542 
543         @seealso
544 
545         @param
546 
547         @return
548 
549         @onerror
550     */
551 
552     virtual UNO3_WINDOWDESCRIPTOR* impl_getWindowDescriptor( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParentPeer );
553 
554 //______________________________________________________________________________________________________________
555 //  private methods
556 //______________________________________________________________________________________________________________
557 
558 private:
559 
560     /**_________________________________________________________________________________________________________
561         @short
562         @descr
563 
564         @seealso
565 
566         @param
567 
568         @return
569 
570         @onerror
571     */
572 
573     void impl_createFrame(  const   UNO3_REFERENCE< UNO3_XWINDOWPEER >&     xPeer           ,
574                             const   UNO3_OUSTRING&                          sURL            ,
575                             const   UNO3_SEQUENCE< UNO3_PROPERTYVALUE >&    seqArguments    );
576 
577     /**_________________________________________________________________________________________________________
578         @short
579         @descr
580 
581         @seealso
582 
583         @param
584 
585         @return
586 
587         @onerror
588     */
589 
590     void impl_deleteFrame();
591 
592     /**_________________________________________________________________________________________________________
593         @short
594         @descr
595 
596         @seealso
597 
598         @param
599 
600         @return
601 
602         @onerror
603     */
604 
605     static const UNO3_SEQUENCE< UNO3_PROPERTY > impl_getStaticPropertyDescriptor();
606 
607 
608 //______________________________________________________________________________________________________________
609 //  private variables
610 //______________________________________________________________________________________________________________
611 
612 private:
613 
614     UNO3_REFERENCE< UNO3_XFRAME >               m_xFrame                    ;
615     UNO3_OUSTRING                               m_sComponentURL             ;
616     UNO3_SEQUENCE< UNO3_PROPERTYVALUE >         m_seqLoaderArguments        ;
617     UNO3_OMULTITYPEINTERFACECONTAINERHELPER     m_aInterfaceContainer       ;
618     UNO3_OCONNECTIONPOINTCONTAINERHELPER        m_aConnectionPointContainer ;
619 
620 };  // class FrameControl
621 
622 }   // namespace unocontrols
623 
624 #endif  // #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
625