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_BASECONTAINERCONTROL_CTRL_HXX
25 #define _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
26 
27 //____________________________________________________________________________________________________________
28 //	includes of other projects
29 //____________________________________________________________________________________________________________
30 
31 #include <com/sun/star/lang/XServiceName.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/container/XContainer.hpp>
34 #include <com/sun/star/container/XIndexContainer.hpp>
35 #include <com/sun/star/container/XNameReplace.hpp>
36 #include <com/sun/star/container/XContainerListener.hpp>
37 #include <com/sun/star/container/XSet.hpp>
38 #include <com/sun/star/container/ContainerEvent.hpp>
39 #include <com/sun/star/container/XIndexReplace.hpp>
40 #include <com/sun/star/container/XNameContainer.hpp>
41 #include <tools/list.hxx>
42 
43 //____________________________________________________________________________________________________________
44 //	includes of my own project
45 //____________________________________________________________________________________________________________
46 #include "basecontrol.hxx"
47 
48 //____________________________________________________________________________________________________________
49 //	"namespaces"
50 //____________________________________________________________________________________________________________
51 
52 namespace unocontrols{
53 
54 #define	UNO3_REFERENCE								::com::sun::star::uno::Reference
55 #define	UNO3_XCONTROL								::com::sun::star::awt::XControl
56 #define	UNO3_OUSTRING								::rtl::OUString
57 #define	UNO3_XCONTROLMODEL							::com::sun::star::awt::XControlModel
58 #define	UNO3_XCONTROLCONTAINER						::com::sun::star::awt::XControlContainer
59 #define	UNO3_XMULTISERVICEFACTORY					::com::sun::star::lang::XMultiServiceFactory
60 #define	UNO3_TYPE									::com::sun::star::uno::Type
61 #define	UNO3_RUNTIMEEXCEPTION						::com::sun::star::uno::RuntimeException
62 #define	UNO3_XTOOLKIT								::com::sun::star::awt::XToolkit
63 #define	UNO3_XWINDOWPEER							::com::sun::star::awt::XWindowPeer
64 #define	UNO3_EVENTOBJECT							::com::sun::star::lang::EventObject
65 #define	UNO3_SEQUENCE								::com::sun::star::uno::Sequence
66 #define	UNO3_XCONTAINERLISTENER						::com::sun::star::container::XContainerListener
67 #define	UNO3_ANY									::com::sun::star::uno::Any
68 #define	UNO3_XTABCONTROLLER							::com::sun::star::awt::XTabController
69 #define	UNO3_WINDOWDESCRIPTOR						::com::sun::star::awt::WindowDescriptor
70 #define	UNO3_XGRAPHICS								::com::sun::star::awt::XGraphics
71 #define	UNO3_OMULTITYPEINTERFACECONTAINERHELPER		::cppu::OMultiTypeInterfaceContainerHelper
72 #define	UNO3_ILLEGALARGUMENTEXCEPTION				::com::sun::star::lang::IllegalArgumentException
73 
74 //____________________________________________________________________________________________________________
75 //	structs, types, forwards
76 //____________________________________________________________________________________________________________
77 
78 struct IMPL_ControlInfo
79 {
80 	UNO3_REFERENCE< UNO3_XCONTROL > 	xControl	;
81 	UNO3_OUSTRING						sName		;
82 };
83 
84 // makro define a list-class for struct IMPL_ControlInfo!
85 class IMPL_ControlInfoList ;
86 DECLARE_LIST( IMPL_ControlInfoList, IMPL_ControlInfo* )
87 
88 //____________________________________________________________________________________________________________
89 //	classes
90 //____________________________________________________________________________________________________________
91 
92 class BaseContainerControl	: public UNO3_XCONTROLMODEL
93 							, public UNO3_XCONTROLCONTAINER
94 							, public BaseControl
95 {
96 
97 //____________________________________________________________________________________________________________
98 //	public methods
99 //____________________________________________________________________________________________________________
100 
101 public:
102 
103 	//________________________________________________________________________________________________________
104 	//	construct/destruct
105 	//________________________________________________________________________________________________________
106 
107 	/**_______________________________________________________________________________________________________
108 		@short		-
109 		@descr		-
110 
111 		@seealso	-
112 
113 		@param		-
114 
115 		@return		-
116 
117 		@onerror	-
118 	*/
119 
120    	BaseContainerControl( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
121 
122 	/**_______________________________________________________________________________________________________
123 		@short		-
124 		@descr		-
125 
126 		@seealso	-
127 
128 		@param		-
129 
130 		@return		-
131 
132 		@onerror	-
133 	*/
134 
135 	virtual	~BaseContainerControl();
136 
137 	//________________________________________________________________________________________________________
138 	//	XInterface
139 	//________________________________________________________________________________________________________
140 
141 	/**_______________________________________________________________________________________________________
142 		@short		give answer, if interface is supported
143 		@descr		The interfaces are searched by type.
144 
145 		@seealso	XInterface
146 
147 		@param      "rType" is the type of searched interface.
148 
149 		@return		Any		information about found interface
150 
151 		@onerror	A RuntimeException is thrown.
152 	*/
153 
154 	virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
155 
156 	//________________________________________________________________________________________________________
157 	//	XTypeProvider
158 	//________________________________________________________________________________________________________
159 
160 	/**_______________________________________________________________________________________________________
161 		@short		get information about supported interfaces
162 		@descr      -
163 
164 		@seealso	XTypeProvider
165 
166 		@param      -
167 
168 		@return		Sequence of types of all supported interfaces
169 
170 		@onerror	A RuntimeException is thrown.
171 	*/
172 
173 	virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
174 
175 	//________________________________________________________________________________________________________
176 	//	XAggregation
177 	//________________________________________________________________________________________________________
178 
179 	/**_______________________________________________________________________________________________________
180 		@short		-
181 		@descr		-
182 
183 		@seealso	-
184 
185 		@param		-
186 
187 		@return		-
188 
189 		@onerror	-
190 	*/
191 
192 	virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
193 
194 	//________________________________________________________________________________________________________
195 	//	XControl
196 	//________________________________________________________________________________________________________
197 
198 	/**_______________________________________________________________________________________________________
199 		@short		-
200 		@descr		-
201 
202 		@seealso	-
203 
204 		@param		-
205 
206 		@return		-
207 
208 		@onerror	-
209 	*/
210 
211 	virtual void SAL_CALL createPeer(	const	UNO3_REFERENCE< UNO3_XTOOLKIT >&	xToolkit	,
212 										const	UNO3_REFERENCE< UNO3_XWINDOWPEER >&	xParent		) throw( UNO3_RUNTIMEEXCEPTION );
213 
214 	/**_______________________________________________________________________________________________________
215 		@short		-
216 		@descr		-
217 
218 		@seealso	-
219 
220 		@param		-
221 
222 		@return		-
223 
224 		@onerror	-
225 	*/
226 
227     virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
228 
229 	/**_______________________________________________________________________________________________________
230 		@short		-
231 		@descr		-
232 
233 		@seealso	-
234 
235 		@param		-
236 
237 		@return		-
238 
239 		@onerror	-
240 	*/
241 
242     virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
243 
244 	//________________________________________________________________________________________________________
245 	//	XComponent
246 	//________________________________________________________________________________________________________
247 
248 	/**_______________________________________________________________________________________________________
249 		@short		-
250 		@descr		-
251 
252 		@seealso	-
253 
254 		@param		-
255 
256 		@return		-
257 
258 		@onerror	-
259 	*/
260 
261 	virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
262 
263 	//________________________________________________________________________________________________________
264 	//	XEventListener
265 	//________________________________________________________________________________________________________
266 
267 	/**_______________________________________________________________________________________________________
268 		@short		-
269 		@descr		-
270 
271 		@seealso	-
272 
273 		@param		-
274 
275 		@return		-
276 
277 		@onerror	-
278 	*/
279 
280     virtual void SAL_CALL disposing( const UNO3_EVENTOBJECT& rEvent ) throw( UNO3_RUNTIMEEXCEPTION );
281 
282 	//________________________________________________________________________________________________________
283 	//	XControlContainer
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 addControl(	const	UNO3_OUSTRING&						sName		,
300 										const	UNO3_REFERENCE< UNO3_XCONTROL >&	xControl	) throw( UNO3_RUNTIMEEXCEPTION	);
301 
302 	/**_______________________________________________________________________________________________________
303 		@short		-
304 		@descr		-
305 
306 		@seealso	-
307 
308 		@param		-
309 
310 		@return		-
311 
312 		@onerror	-
313 	*/
314 
315 	virtual	void SAL_CALL addContainerListener( const UNO3_REFERENCE< UNO3_XCONTAINERLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
316 
317 	/**_______________________________________________________________________________________________________
318 		@short		-
319 		@descr		-
320 
321 		@seealso	-
322 
323 		@param		-
324 
325 		@return		-
326 
327 		@onerror	-
328 	*/
329 
330     virtual void SAL_CALL removeControl( const UNO3_REFERENCE< UNO3_XCONTROL >& xControl ) throw( UNO3_RUNTIMEEXCEPTION );
331 
332 	/**_______________________________________________________________________________________________________
333 		@short		-
334 		@descr		-
335 
336 		@seealso	-
337 
338 		@param		-
339 
340 		@return		-
341 
342 		@onerror	-
343 	*/
344 
345     virtual void SAL_CALL removeContainerListener( const UNO3_REFERENCE< UNO3_XCONTAINERLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
346 
347 	/**_______________________________________________________________________________________________________
348 		@short		-
349 		@descr		-
350 
351 		@seealso	-
352 
353 		@param		-
354 
355 		@return		-
356 
357 		@onerror	-
358 	*/
359 
360     virtual void SAL_CALL setStatusText( const UNO3_OUSTRING& sStatusText ) throw( UNO3_RUNTIMEEXCEPTION );
361 
362 	/**_______________________________________________________________________________________________________
363 		@short		-
364 		@descr		-
365 
366 		@seealso	-
367 
368 		@param		-
369 
370 		@return		-
371 
372 		@onerror	-
373 	*/
374 
375     virtual UNO3_REFERENCE< UNO3_XCONTROL > SAL_CALL getControl( const UNO3_OUSTRING& sName) throw( UNO3_RUNTIMEEXCEPTION );
376 
377 	/**_______________________________________________________________________________________________________
378 		@short		-
379 		@descr		-
380 
381 		@seealso	-
382 
383 		@param		-
384 
385 		@return		-
386 
387 		@onerror	-
388 	*/
389 
390     virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XCONTROL > > SAL_CALL getControls() throw( UNO3_RUNTIMEEXCEPTION );
391 
392 	//________________________________________________________________________________________________________
393 	//	XUnoControlContainer
394 	//________________________________________________________________________________________________________
395 
396 	/**_______________________________________________________________________________________________________
397 		@short		-
398 		@descr		-
399 
400 		@seealso	-
401 
402 		@param		-
403 
404 		@return		-
405 
406 		@onerror	-
407 	*/
408 
409     virtual void SAL_CALL addTabController( const UNO3_REFERENCE< UNO3_XTABCONTROLLER >& xTabController ) throw( UNO3_RUNTIMEEXCEPTION );
410 
411 	/**_______________________________________________________________________________________________________
412 		@short		-
413 		@descr		-
414 
415 		@seealso	-
416 
417 		@param		-
418 
419 		@return		-
420 
421 		@onerror	-
422 	*/
423 
424     virtual void SAL_CALL removeTabController( const UNO3_REFERENCE< UNO3_XTABCONTROLLER >& xTabController ) throw( UNO3_RUNTIMEEXCEPTION );
425 
426 	/**_______________________________________________________________________________________________________
427 		@short		-
428 		@descr		-
429 
430 		@seealso	-
431 
432 		@param		-
433 
434 		@return		-
435 
436 		@onerror	-
437 	*/
438 
439     virtual void SAL_CALL setTabControllers( const UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > >& xTabControllers ) throw( UNO3_RUNTIMEEXCEPTION );
440 
441 	/**_______________________________________________________________________________________________________
442 		@short		-
443 		@descr		-
444 
445 		@seealso	-
446 
447 		@param		-
448 
449 		@return		-
450 
451 		@onerror	-
452 	*/
453 
454     virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > > SAL_CALL getTabControllers() throw( UNO3_RUNTIMEEXCEPTION );
455 
456 	//________________________________________________________________________________________________________
457 	//	XWindow
458 	//________________________________________________________________________________________________________
459 
460 	/**_______________________________________________________________________________________________________
461 		@short		-
462 		@descr		-
463 
464 		@seealso	-
465 
466 		@param		-
467 
468 		@return		-
469 
470 		@onerror	-
471 	*/
472 
473 	virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( UNO3_RUNTIMEEXCEPTION );
474 
475 //____________________________________________________________________________________________________________
476 //	protected methods
477 //____________________________________________________________________________________________________________
478 
479 protected:
480     using OComponentHelper::disposing;
481 	/**_______________________________________________________________________________________________________
482 		@short
483 		@descr
484 
485 		@seealso
486 
487 		@param
488 
489 		@return
490 
491 		@onerror
492 	*/
493 
494 	virtual UNO3_WINDOWDESCRIPTOR* impl_getWindowDescriptor( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParentPeer );
495 
496 	/**_______________________________________________________________________________________________________
497 		@short
498 		@descr
499 
500 		@seealso
501 
502 		@param
503 
504 		@return
505 
506 		@onerror
507 	*/
508 
509 	virtual void impl_paint(		sal_Int32							nX			,
510 									sal_Int32							nY			,
511 							const	UNO3_REFERENCE< UNO3_XGRAPHICS >&	xGraphics	);
512 
513 //____________________________________________________________________________________________________________
514 //	private methods
515 //____________________________________________________________________________________________________________
516 
517 private:
518 
519 	/**_______________________________________________________________________________________________________
520 		@short
521 		@descr
522 
523 		@seealso
524 
525 		@param
526 
527 		@return
528 
529 		@onerror
530 	*/
531 
532 	void impl_activateTabControllers();
533 
534 	/**_______________________________________________________________________________________________________
535 		@short
536 		@descr
537 
538 		@seealso
539 
540 		@param
541 
542 		@return
543 
544 		@onerror
545 	*/
546 
547 	void impl_cleanMemory();
548 
549 //____________________________________________________________________________________________________________
550 //	private variables
551 //____________________________________________________________________________________________________________
552 
553 private:
554 
555 	IMPL_ControlInfoList*									m_pControlInfoList		;	/// list of pointer of "struct IMPL_ControlInfo" to hold child-controls
556 	UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > >	m_xTabControllerList	;	/// list of references of XTabController to hold tab-order in this container
557 	UNO3_OMULTITYPEINTERFACECONTAINERHELPER					m_aListeners			;
558 
559 };	// class BaseContainerControl
560 
561 }	// namespace unocontrols
562 
563 #endif	// ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
564