Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / UnoControls / source / inc / statusindicator.hxx
blob5f18f135d2ef0cfec188bb978218b696dada0241
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <com/sun/star/awt/XLayoutConstrains.hpp>
23 #include <com/sun/star/task/XStatusIndicator.hpp>
24 #include <rtl/ref.hxx>
25 #include <tools/color.hxx>
26 #include <basecontainercontrol.hxx>
28 namespace com::sun::star::awt { class XControlModel; }
29 namespace com::sun::star::awt { class XFixedText; }
30 namespace com::sun::star::awt { class XGraphics; }
31 namespace com::sun::star::awt { class XToolkit; }
32 namespace com::sun::star::awt { class XWindowPeer; }
34 namespace unocontrols {
36 class ProgressBar;
38 constexpr auto STATUSINDICATOR_FREEBORDER = 5; // border around and between the controls
39 constexpr auto STATUSINDICATOR_DEFAULT_WIDTH = 300;
40 constexpr auto STATUSINDICATOR_DEFAULT_HEIGHT = 25;
41 constexpr sal_Int32 STATUSINDICATOR_BACKGROUNDCOLOR = sal_Int32(COL_LIGHTGRAY);
42 constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_BRIGHT = sal_Int32(COL_WHITE);
43 constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_SHADOW = sal_Int32(COL_BLACK);
45 class StatusIndicator final : public css::awt::XLayoutConstrains
46 , public css::task::XStatusIndicator
47 , public BaseContainerControl
49 public:
50 StatusIndicator( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
52 virtual ~StatusIndicator() override;
54 // XInterface
56 /**
57 @short give answer, if interface is supported
58 @descr The interfaces are searched by type.
60 @seealso XInterface
62 @param "rType" is the type of searched interface.
64 @return Any information about found interface
66 @onerror A RuntimeException is thrown.
69 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
71 /**
72 @short increment refcount
73 @seealso XInterface
74 @seealso release()
75 @onerror A RuntimeException is thrown.
78 virtual void SAL_CALL acquire() noexcept override;
80 /**
81 @short decrement refcount
82 @seealso XInterface
83 @seealso acquire()
84 @onerror A RuntimeException is thrown.
87 virtual void SAL_CALL release() noexcept override;
89 // XTypeProvider
91 /**
92 @short get information about supported interfaces
93 @seealso XTypeProvider
94 @return Sequence of types of all supported interfaces
96 @onerror A RuntimeException is thrown.
99 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
101 // XStatusIndicator
103 virtual void SAL_CALL start(
104 const OUString& sText ,
105 sal_Int32 nRange
106 ) override;
108 virtual void SAL_CALL end() override;
110 virtual void SAL_CALL reset() override;
112 virtual void SAL_CALL setText( const OUString& sText ) override;
114 virtual void SAL_CALL setValue( sal_Int32 nValue ) override;
116 // XLayoutConstrains
118 virtual css::awt::Size SAL_CALL getMinimumSize() override;
120 virtual css::awt::Size SAL_CALL getPreferredSize() override;
122 virtual css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
124 // XControl
126 virtual void SAL_CALL createPeer(
127 const css::uno::Reference< css::awt::XToolkit >& xToolkit ,
128 const css::uno::Reference< css::awt::XWindowPeer >& xParent
129 ) override;
131 virtual sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& xModel ) override;
133 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override;
135 // XComponent
137 virtual void SAL_CALL dispose() override;
139 // XWindow
141 virtual void SAL_CALL setPosSize( sal_Int32 nX ,
142 sal_Int32 nY ,
143 sal_Int32 nWidth ,
144 sal_Int32 nHeight ,
145 sal_Int16 nFlags ) override;
147 private:
148 virtual css::awt::WindowDescriptor impl_getWindowDescriptor(
149 const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
150 ) override;
152 virtual void impl_paint (
153 sal_Int32 nX,
154 sal_Int32 nY,
155 const css::uno::Reference< css::awt::XGraphics > & rGraphics
156 ) override;
158 virtual void impl_recalcLayout( const css::awt::WindowEvent& aEvent ) override;
160 css::uno::Reference< css::awt::XFixedText > m_xText;
161 rtl::Reference<ProgressBar> m_xProgressBar;
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */