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 INCLUDED_UNOCONTROLS_SOURCE_INC_STATUSINDICATOR_HXX
21 #define INCLUDED_UNOCONTROLS_SOURCE_INC_STATUSINDICATOR_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>
32 #include <rtl/ref.hxx>
34 #include <basecontainercontrol.hxx>
36 namespace unocontrols
{
40 #define STATUSINDICATOR_FREEBORDER 5 // border around and between the controls
41 #define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
42 #define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
43 #define CONTROLNAME_TEXT "Text" // identifier the control in container
44 #define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
45 #define STATUSINDICATOR_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray
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
55 class StatusIndicator
: public css::awt::XLayoutConstrains
56 , public css::task::XStatusIndicator
57 , public BaseContainerControl
62 StatusIndicator( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
64 virtual ~StatusIndicator() override
;
68 /**_______________________________________________________________________________________________________
69 @short give answer, if interface is supported
70 @descr The interfaces are searched by type.
74 @param "rType" is the type of searched interface.
76 @return Any information about found interface
78 @onerror A RuntimeException is thrown.
81 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) override
;
83 /**_______________________________________________________________________________________________________
84 @short increment refcount
87 @onerror A RuntimeException is thrown.
90 virtual void SAL_CALL
acquire() throw() override
;
92 /**_______________________________________________________________________________________________________
93 @short decrement refcount
96 @onerror A RuntimeException is thrown.
99 virtual void SAL_CALL
release() throw() override
;
103 /**_______________________________________________________________________________________________________
104 @short get information about supported interfaces
105 @seealso XTypeProvider
106 @return Sequence of types of all supported interfaces
108 @onerror A RuntimeException is thrown.
111 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
115 virtual css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& aType
) override
;
119 virtual void SAL_CALL
start(
120 const OUString
& sText
,
124 virtual void SAL_CALL
end() override
;
126 virtual void SAL_CALL
reset() override
;
128 virtual void SAL_CALL
setText( const OUString
& sText
) override
;
130 virtual void SAL_CALL
setValue( sal_Int32 nValue
) override
;
134 virtual css::awt::Size SAL_CALL
getMinimumSize() override
;
136 virtual css::awt::Size SAL_CALL
getPreferredSize() override
;
138 virtual css::awt::Size SAL_CALL
calcAdjustedSize( const css::awt::Size
& aNewSize
) override
;
142 virtual void SAL_CALL
createPeer(
143 const css::uno::Reference
< css::awt::XToolkit
>& xToolkit
,
144 const css::uno::Reference
< css::awt::XWindowPeer
>& xParent
147 virtual sal_Bool SAL_CALL
setModel( const css::uno::Reference
< css::awt::XControlModel
>& xModel
) override
;
149 virtual css::uno::Reference
< css::awt::XControlModel
> SAL_CALL
getModel() override
;
153 virtual void SAL_CALL
dispose() override
;
157 virtual void SAL_CALL
setPosSize( sal_Int32 nX
,
161 sal_Int16 nFlags
) override
;
165 static const css::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
167 static const OUString
impl_getStaticImplementationName();
171 virtual css::awt::WindowDescriptor
* impl_getWindowDescriptor(
172 const css::uno::Reference
< css::awt::XWindowPeer
>& xParentPeer
175 virtual void impl_paint (
178 const css::uno::Reference
< css::awt::XGraphics
> & rGraphics
181 virtual void impl_recalcLayout( const css::awt::WindowEvent
& aEvent
) override
;
185 css::uno::Reference
< css::awt::XFixedText
> m_xText
;
186 rtl::Reference
<ProgressBar
> m_xProgressBar
;
188 }; // class StatusIndicator
190 } // namespace unocontrols
192 #endif // INCLUDED_UNOCONTROLS_SOURCE_INC_STATUSINDICATOR_HXX
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */