1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _UNOCONTROLS_STATUSINDICATOR_CTRL_HXX
21 #define _UNOCONTROLS_STATUSINDICATOR_CTRL_HXX
23 #include <com/sun/star/awt/XControlModel.hpp>
24 #include <com/sun/star/awt/XFixedText.hpp>
25 #include <com/sun/star/awt/XGraphics.hpp>
26 #include <com/sun/star/awt/XLayoutConstrains.hpp>
27 #include <com/sun/star/awt/XProgressBar.hpp>
28 #include <com/sun/star/task/XStatusIndicator.hpp>
29 #include <com/sun/star/awt/XToolkit.hpp>
30 #include <com/sun/star/awt/XWindowPeer.hpp>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include "basecontainercontrol.hxx"
35 namespace unocontrols
{
37 #define SERVICENAME_STATUSINDICATOR "com.sun.star.task.XStatusIndicator"
38 #define IMPLEMENTATIONNAME_STATUSINDICATOR "stardiv.UnoControls.StatusIndicator"
39 #define STATUSINDICATOR_FREEBORDER 5 // border around and between the controls
40 #define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
41 #define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
42 #define CONTROLNAME_TEXT "Text" // identifier the control in container
43 #define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
44 #define STATUSINDICATOR_DEFAULT_TEXT "\0"
45 #define STATUSINDICATOR_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
46 #define STATUSINDICATOR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
47 #define STATUSINDICATOR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
48 #define STATUSINDICATOR_DEFAULT_WIDTH 300
49 #define STATUSINDICATOR_DEFAULT_HEIGHT 25
51 //____________________________________________________________________________________________________________
53 //____________________________________________________________________________________________________________
55 //____________________________________________________________________________________________________________
57 //____________________________________________________________________________________________________________
59 class StatusIndicator
: public ::com::sun::star::awt::XLayoutConstrains
60 , public ::com::sun::star::task::XStatusIndicator
61 , public BaseContainerControl
64 //-------------------------------------------------------------------------------------------------------------
66 //-------------------------------------------------------------------------------------------------------------
70 //---------------------------------------------------------------------------------------------------------
72 //---------------------------------------------------------------------------------------------------------
74 /**_______________________________________________________________________________________________________
87 StatusIndicator( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
89 /**_______________________________________________________________________________________________________
102 virtual ~StatusIndicator();
104 //---------------------------------------------------------------------------------------------------------
106 //---------------------------------------------------------------------------------------------------------
108 /**_______________________________________________________________________________________________________
109 @short give answer, if interface is supported
110 @descr The interfaces are searched by type.
114 @param "rType" is the type of searched interface.
116 @return Any information about found interface
118 @onerror A RuntimeException is thrown.
121 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
)
122 throw( ::com::sun::star::uno::RuntimeException
);
124 /**_______________________________________________________________________________________________________
125 @short increment refcount
135 @onerror A RuntimeException is thrown.
138 virtual void SAL_CALL
acquire() throw();
140 /**_______________________________________________________________________________________________________
141 @short decrement refcount
151 @onerror A RuntimeException is thrown.
154 virtual void SAL_CALL
release() throw();
156 //---------------------------------------------------------------------------------------------------------
158 //---------------------------------------------------------------------------------------------------------
160 /**_______________________________________________________________________________________________________
161 @short get information about supported interfaces
164 @seealso XTypeProvider
168 @return Sequence of types of all supported interfaces
170 @onerror A RuntimeException is thrown.
173 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
174 throw( ::com::sun::star::uno::RuntimeException
);
176 //---------------------------------------------------------------------------------------------------------
178 //---------------------------------------------------------------------------------------------------------
180 /**_______________________________________________________________________________________________________
193 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& aType
)
194 throw( ::com::sun::star::uno::RuntimeException
);
196 //---------------------------------------------------------------------------------------------------------
198 //---------------------------------------------------------------------------------------------------------
200 /*-****************************************************************************************************//**
211 *//*-*****************************************************************************************************/
213 virtual void SAL_CALL
start(
214 const OUString
& sText
,
216 ) throw( ::com::sun::star::uno::RuntimeException
);
218 /*-****************************************************************************************************//**
229 *//*-*****************************************************************************************************/
231 virtual void SAL_CALL
end() throw( ::com::sun::star::uno::RuntimeException
);
233 /*-****************************************************************************************************//**
244 *//*-*****************************************************************************************************/
246 virtual void SAL_CALL
reset() throw( ::com::sun::star::uno::RuntimeException
);
248 /*-****************************************************************************************************//**
259 *//*-*****************************************************************************************************/
261 virtual void SAL_CALL
setText( const OUString
& sText
) throw( ::com::sun::star::uno::RuntimeException
);
263 /*-****************************************************************************************************//**
274 *//*-*****************************************************************************************************/
276 virtual void SAL_CALL
setValue( sal_Int32 nValue
) throw( ::com::sun::star::uno::RuntimeException
);
278 //---------------------------------------------------------------------------------------------------------
280 //---------------------------------------------------------------------------------------------------------
282 /**_______________________________________________________________________________________________________
295 virtual ::com::sun::star::awt::Size SAL_CALL
getMinimumSize() throw( ::com::sun::star::uno::RuntimeException
);
297 /**_______________________________________________________________________________________________________
310 virtual ::com::sun::star::awt::Size SAL_CALL
getPreferredSize() throw( ::com::sun::star::uno::RuntimeException
);
312 /**_______________________________________________________________________________________________________
325 virtual ::com::sun::star::awt::Size SAL_CALL
calcAdjustedSize( const ::com::sun::star::awt::Size
& aNewSize
)
326 throw( ::com::sun::star::uno::RuntimeException
);
328 //---------------------------------------------------------------------------------------------------------
330 //---------------------------------------------------------------------------------------------------------
332 /**_______________________________________________________________________________________________________
345 virtual void SAL_CALL
createPeer(
346 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
>& xToolkit
,
347 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParent
348 ) throw( ::com::sun::star::uno::RuntimeException
);
350 /**_______________________________________________________________________________________________________
363 virtual sal_Bool SAL_CALL
setModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& xModel
)
364 throw( ::com::sun::star::uno::RuntimeException
);
366 /**_______________________________________________________________________________________________________
379 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> SAL_CALL
getModel()
380 throw( ::com::sun::star::uno::RuntimeException
);
382 //---------------------------------------------------------------------------------------------------------
384 //---------------------------------------------------------------------------------------------------------
386 /**_______________________________________________________________________________________________________
399 virtual void SAL_CALL
dispose() throw( ::com::sun::star::uno::RuntimeException
);
401 //---------------------------------------------------------------------------------------------------------
403 //---------------------------------------------------------------------------------------------------------
405 /**_______________________________________________________________________________________________________
418 virtual void SAL_CALL
setPosSize( sal_Int32 nX
,
422 sal_Int16 nFlags
) throw( ::com::sun::star::uno::RuntimeException
);
424 //---------------------------------------------------------------------------------------------------------
426 //---------------------------------------------------------------------------------------------------------
428 /**_______________________________________________________________________________________________________
441 static const ::com::sun::star::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
443 /**_______________________________________________________________________________________________________
456 static const OUString
impl_getStaticImplementationName();
458 //____________________________________________________________________________________________________________
460 //____________________________________________________________________________________________________________
464 /**_______________________________________________________________________________________________________
477 virtual ::com::sun::star::awt::WindowDescriptor
* impl_getWindowDescriptor(
478 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParentPeer
481 /**_______________________________________________________________________________________________________
494 virtual void impl_paint (
497 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
> & rGraphics
500 /**_______________________________________________________________________________________________________
513 virtual void impl_recalcLayout( const ::com::sun::star::awt::WindowEvent
& aEvent
);
515 //____________________________________________________________________________________________________________
517 //____________________________________________________________________________________________________________
521 /**_______________________________________________________________________________________________________
534 //____________________________________________________________________________________________________________
536 //____________________________________________________________________________________________________________
540 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xText
;
541 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XProgressBar
> m_xProgressBar
;
543 }; // class StatusIndicator
545 } // namespace unocontrols
547 #endif // #ifndef _UNOCONTROLS_STATUSINDICATOR_CTRL_HXX
549 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */