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