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_STATUSINDICATOR_CTRL_HXX
29 #define _UNOCONTROLS_STATUSINDICATOR_CTRL_HXX
30 
31 //____________________________________________________________________________________________________________
32 //	includes of other projects
33 //____________________________________________________________________________________________________________
34 
35 #include <com/sun/star/awt/XControlModel.hpp>
36 #include <com/sun/star/awt/XFixedText.hpp>
37 #include <com/sun/star/awt/XGraphics.hpp>
38 #include <com/sun/star/awt/XLayoutConstrains.hpp>
39 #include <com/sun/star/awt/XProgressBar.hpp>
40 #include <com/sun/star/task/XStatusIndicator.hpp>
41 #include <com/sun/star/awt/XToolkit.hpp>
42 #include <com/sun/star/awt/XWindowPeer.hpp>
43 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44 
45 //____________________________________________________________________________________________________________
46 //	includes of my own project
47 //____________________________________________________________________________________________________________
48 #include "basecontainercontrol.hxx"
49 
50 //____________________________________________________________________________________________________________
51 //	namespace
52 //____________________________________________________________________________________________________________
53 
54 namespace unocontrols{
55 
56 #define	UNO3_ANY										::com::sun::star::uno::Any
57 #define	UNO3_OUSTRING									::rtl::OUString
58 #define	UNO3_RECTANGLE									::com::sun::star::awt::Rectangle
59 #define	UNO3_REFERENCE									::com::sun::star::uno::Reference
60 #define	UNO3_RUNTIMEEXCEPTION							::com::sun::star::uno::RuntimeException
61 #define	UNO3_SEQUENCE									::com::sun::star::uno::Sequence
62 #define	UNO3_SIZE										::com::sun::star::awt::Size
63 #define	UNO3_TYPE										::com::sun::star::uno::Type
64 #define	UNO3_XCONTROLMODEL								::com::sun::star::awt::XControlModel
65 #define	UNO3_XFIXEDTEXT									::com::sun::star::awt::XFixedText
66 #define	UNO3_XGRAPHICS									::com::sun::star::awt::XGraphics
67 #define	UNO3_XLAYOUTCONSTRAINS							::com::sun::star::awt::XLayoutConstrains
68 #define	UNO3_XMULTISERVICEFACTORY						::com::sun::star::lang::XMultiServiceFactory
69 #define	UNO3_XPROGRESSBAR								::com::sun::star::awt::XProgressBar
70 #define	UNO3_XSTATUSINDICATOR							::com::sun::star::task::XStatusIndicator
71 #define	UNO3_XTOOLKIT									::com::sun::star::awt::XToolkit
72 #define	UNO3_XWINDOWPEER								::com::sun::star::awt::XWindowPeer
73 
74 //____________________________________________________________________________________________________________
75 //	defines
76 //____________________________________________________________________________________________________________
77 
78 #define	SERVICENAME_STATUSINDICATOR						"com.sun.star.task.XStatusIndicator"
79 #define	IMPLEMENTATIONNAME_STATUSINDICATOR				"stardiv.UnoControls.StatusIndicator"
80 #undef  FREEBORDER
81 #define FREEBORDER                                      5                                                       // border around and between the controls
82 #define FIXEDTEXT_SERVICENAME							"com.sun.star.awt.UnoControlFixedText"
83 #define	FIXEDTEXT_MODELNAME								"com.sun.star.awt.UnoControlFixedTextModel"
84 #define	CONTROLNAME_TEXT								"Text"													// identifier the control in container
85 #define	CONTROLNAME_PROGRESSBAR							"ProgressBar"											//  			-||-
86 #define	DEFAULT_TEXT									"\0"
87 #define	BACKGROUNDCOLOR									TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 )				// lighgray
88 #define	LINECOLOR_BRIGHT								TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF )				// white
89 #define	LINECOLOR_SHADOW								TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 )				// black
90 // Overwrite defines from basecontrol.hxx!!!
91 #undef	DEFAULT_WIDTH
92 #undef	DEFAULT_HEIGHT
93 #define DEFAULT_WIDTH 									300
94 #define DEFAULT_HEIGHT                                   25
95 
96 //____________________________________________________________________________________________________________
97 //	structs, types
98 //____________________________________________________________________________________________________________
99 
100 //____________________________________________________________________________________________________________
101 //	class declaration
102 //____________________________________________________________________________________________________________
103 
104 class StatusIndicator	: public UNO3_XLAYOUTCONSTRAINS
105 						, public UNO3_XSTATUSINDICATOR
106 						, public BaseContainerControl
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 		StatusIndicator( 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	~StatusIndicator();
148 
149 		//---------------------------------------------------------------------------------------------------------
150 		//	XInterface
151 		//---------------------------------------------------------------------------------------------------------
152 
153 		/**_______________________________________________________________________________________________________
154 			@short		give answer, if interface is supported
155 			@descr		The interfaces are searched by type.
156 
157 			@seealso	XInterface
158 
159 			@param      "rType" is the type of searched interface.
160 
161 			@return		Any		information about found interface
162 
163 			@onerror	A RuntimeException is thrown.
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		get information about supported interfaces
206 			@descr      -
207 
208 			@seealso	XTypeProvider
209 
210 			@param      -
211 
212 			@return		Sequence of types of all supported interfaces
213 
214 			@onerror	A RuntimeException is thrown.
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 		virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
237 
238 		//---------------------------------------------------------------------------------------------------------
239 		//	XStatusIndicator
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 start(	const	UNO3_OUSTRING&	sText	,
256 												sal_Int32		nRange	) 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 void SAL_CALL end() 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 void SAL_CALL reset() throw( UNO3_RUNTIMEEXCEPTION );
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 setText( const UNO3_OUSTRING& sText ) throw( UNO3_RUNTIMEEXCEPTION );
302 
303 		/*-****************************************************************************************************//**
304 			@short		-
305 			@descr		-
306 
307 			@seealso	-
308 
309 			@param		-
310 
311 			@return		-
312 
313 			@onerror	-
314 		*//*-*****************************************************************************************************/
315 
316     	virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION );
317 
318 		//---------------------------------------------------------------------------------------------------------
319 		// 	XLayoutConstrains
320 		//---------------------------------------------------------------------------------------------------------
321 
322 		/**_______________________________________________________________________________________________________
323 			@short		-
324 			@descr		-
325 
326 			@seealso	-
327 
328 			@param		-
329 
330 			@return		-
331 
332 			@onerror	-
333 		*/
334 
335     	virtual UNO3_SIZE SAL_CALL getMinimumSize() throw( UNO3_RUNTIMEEXCEPTION );
336 
337 		/**_______________________________________________________________________________________________________
338 			@short		-
339 			@descr		-
340 
341 			@seealso	-
342 
343 			@param		-
344 
345 			@return		-
346 
347 			@onerror	-
348 		*/
349 
350     	virtual UNO3_SIZE SAL_CALL getPreferredSize() throw( UNO3_RUNTIMEEXCEPTION );
351 
352 		/**_______________________________________________________________________________________________________
353 			@short		-
354 			@descr		-
355 
356 			@seealso	-
357 
358 			@param		-
359 
360 			@return		-
361 
362 			@onerror	-
363 		*/
364 
365     	virtual UNO3_SIZE SAL_CALL calcAdjustedSize( const UNO3_SIZE& aNewSize ) throw( UNO3_RUNTIMEEXCEPTION );
366 
367 		//---------------------------------------------------------------------------------------------------------
368 		//	XControl
369 		//---------------------------------------------------------------------------------------------------------
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 createPeer(	const	UNO3_REFERENCE< UNO3_XTOOLKIT >&	xToolkit	,
385 											const	UNO3_REFERENCE< UNO3_XWINDOWPEER >&	xParent		) 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 sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
401 
402 		/**_______________________________________________________________________________________________________
403 			@short		-
404 			@descr		-
405 
406 			@seealso	-
407 
408 			@param		-
409 
410 			@return		-
411 
412 			@onerror	-
413 		*/
414 
415     	virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
416 
417 		//---------------------------------------------------------------------------------------------------------
418 		//	XComponent
419 		//---------------------------------------------------------------------------------------------------------
420 
421 		/**_______________________________________________________________________________________________________
422 			@short		-
423 			@descr		-
424 
425 			@seealso	-
426 
427 			@param		-
428 
429 			@return		-
430 
431 			@onerror	-
432 		*/
433 
434 		virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
435 
436 		//---------------------------------------------------------------------------------------------------------
437 		//	XWindow
438 		//---------------------------------------------------------------------------------------------------------
439 
440 		/**_______________________________________________________________________________________________________
441 			@short		-
442 			@descr		-
443 
444 			@seealso	-
445 
446 			@param		-
447 
448 			@return		-
449 
450 			@onerror	-
451 		*/
452 
453 		virtual void SAL_CALL setPosSize(	sal_Int32	nX		,
454 											sal_Int32	nY		,
455 											sal_Int32	nWidth	,
456 											sal_Int32	nHeight	,
457 											sal_Int16	nFlags	) throw( UNO3_RUNTIMEEXCEPTION );
458 
459 		//---------------------------------------------------------------------------------------------------------
460 		//	BaseControl
461 		//---------------------------------------------------------------------------------------------------------
462 
463 		/**_______________________________________________________________________________________________________
464 			@short		-
465 			@descr		-
466 
467 			@seealso	-
468 
469 			@param		-
470 
471 			@return		-
472 
473 			@onerror	-
474 		*/
475 
476     	static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
477 
478 		/**_______________________________________________________________________________________________________
479 			@short		-
480 			@descr		-
481 
482 			@seealso	-
483 
484 			@param		-
485 
486 			@return		-
487 
488 			@onerror	-
489 		*/
490 
491     	static const UNO3_OUSTRING impl_getStaticImplementationName();
492 
493 //____________________________________________________________________________________________________________
494 //	protected methods
495 //____________________________________________________________________________________________________________
496 
497 protected:
498 
499 		/**_______________________________________________________________________________________________________
500 			@short		-
501 			@descr		-
502 
503 			@seealso	-
504 
505 			@param		-
506 
507 			@return		-
508 
509 			@onerror	-
510 		*/
511 
512 		virtual UNO3_WINDOWDESCRIPTOR* impl_getWindowDescriptor( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParentPeer );
513 
514 		/**_______________________________________________________________________________________________________
515 			@short		-
516 			@descr		-
517 
518 			@seealso	-
519 
520 			@param		-
521 
522 			@return		-
523 
524 			@onerror	-
525 		*/
526 
527 		virtual void impl_paint ( sal_Int32 nX, sal_Int32 nY, const UNO3_REFERENCE< UNO3_XGRAPHICS > & rGraphics );
528 
529 		/**_______________________________________________________________________________________________________
530 			@short		-
531 			@descr		-
532 
533 			@seealso	-
534 
535 			@param		-
536 
537 			@return		-
538 
539 			@onerror	-
540 		*/
541 
542 		virtual void impl_recalcLayout( const UNO3_WINDOWEVENT& aEvent );
543 
544 //____________________________________________________________________________________________________________
545 // debug methods
546 //____________________________________________________________________________________________________________
547 
548 private:
549 
550 	/**_______________________________________________________________________________________________________
551 		@short		-
552 		@descr		-
553 
554 		@seealso	-
555 
556 		@param		-
557 
558 		@return		-
559 
560 		@onerror	-
561 	*/
562 
563     #if OSL_DEBUG_LEVEL > 1
564 
565 	#endif
566 
567 //____________________________________________________________________________________________________________
568 // private variables
569 //____________________________________________________________________________________________________________
570 
571 private:
572 
573 	UNO3_REFERENCE< UNO3_XFIXEDTEXT > 		m_xText			;
574 	UNO3_REFERENCE< UNO3_XPROGRESSBAR > 	m_xProgressBar	;
575 
576 };	// class StatusIndicator
577 
578 }	// namespace unocontrols
579 
580 #endif	// #ifndef _UNOCONTROLS_STATUSINDICATOR_CTRL_HXX
581