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