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