LibreOffice Module UnoControls (master) 1
statusindicator.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
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>
27
28namespace com::sun::star::awt { class XControlModel; }
29namespace com::sun::star::awt { class XFixedText; }
30namespace com::sun::star::awt { class XGraphics; }
31namespace com::sun::star::awt { class XToolkit; }
32namespace com::sun::star::awt { class XWindowPeer; }
33
34namespace unocontrols {
35
36class ProgressBar;
37
38constexpr auto STATUSINDICATOR_FREEBORDER = 5; // border around and between the controls
39constexpr auto STATUSINDICATOR_DEFAULT_WIDTH = 300;
41constexpr sal_Int32 STATUSINDICATOR_BACKGROUNDCOLOR = sal_Int32(COL_LIGHTGRAY);
42constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_BRIGHT = sal_Int32(COL_WHITE);
43constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_SHADOW = sal_Int32(COL_BLACK);
44
45class StatusIndicator final : public css::awt::XLayoutConstrains
46 , public css::task::XStatusIndicator
48{
49public:
50 StatusIndicator( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
51
52 virtual ~StatusIndicator() override;
53
54 // XInterface
55
69 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
70
78 virtual void SAL_CALL acquire() noexcept override;
79
87 virtual void SAL_CALL release() noexcept override;
88
89 // XTypeProvider
90
99 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
100
101 // XStatusIndicator
102
103 virtual void SAL_CALL start(
104 const OUString& sText ,
105 sal_Int32 nRange
106 ) override;
107
108 virtual void SAL_CALL end() override;
109
110 virtual void SAL_CALL reset() override;
111
112 virtual void SAL_CALL setText( const OUString& sText ) override;
113
114 virtual void SAL_CALL setValue( sal_Int32 nValue ) override;
115
116 // XLayoutConstrains
117
118 virtual css::awt::Size SAL_CALL getMinimumSize() override;
119
120 virtual css::awt::Size SAL_CALL getPreferredSize() override;
121
122 virtual css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
123
124 // XControl
125
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;
130
131 virtual sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& xModel ) override;
132
133 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override;
134
135 // XComponent
136
137 virtual void SAL_CALL dispose() override;
138
139 // XWindow
140
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;
146
147private:
148 virtual css::awt::WindowDescriptor impl_getWindowDescriptor(
149 const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
150 ) override;
151
152 virtual void impl_paint (
153 sal_Int32 nX,
154 sal_Int32 nY,
155 const css::uno::Reference< css::awt::XGraphics > & rGraphics
156 ) override;
157
158 virtual void impl_recalcLayout( const css::awt::WindowEvent& aEvent ) override;
159
160 css::uno::Reference< css::awt::XFixedText > m_xText;
162
163};
164
165}
166
167
168/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override
virtual void SAL_CALL acquire() noexcept override
increment refcount @seealso XInterface @seealso release() @onerror A RuntimeException is thrown.
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
get information about supported interfaces @seealso XTypeProvider
virtual void SAL_CALL reset() override
virtual void SAL_CALL setText(const OUString &sText) override
virtual void SAL_CALL setValue(sal_Int32 nValue) override
virtual void SAL_CALL release() noexcept override
decrement refcount @seealso XInterface @seealso acquire() @onerror A RuntimeException is thrown.
virtual ~StatusIndicator() override
virtual sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel > &xModel) override
virtual void SAL_CALL setPosSize(sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags) override
virtual void SAL_CALL start(const OUString &sText, sal_Int32 nRange) override
virtual css::awt::Size SAL_CALL getPreferredSize() override
StatusIndicator(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
css::uno::Reference< css::awt::XFixedText > m_xText
virtual css::awt::Size SAL_CALL calcAdjustedSize(const css::awt::Size &aNewSize) override
virtual css::awt::Size SAL_CALL getMinimumSize() override
virtual void impl_paint(sal_Int32 nX, sal_Int32 nY, const css::uno::Reference< css::awt::XGraphics > &rGraphics) override
virtual css::awt::WindowDescriptor impl_getWindowDescriptor(const css::uno::Reference< css::awt::XWindowPeer > &xParentPeer) override
virtual void SAL_CALL dispose() override
virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > &xToolkit, const css::uno::Reference< css::awt::XWindowPeer > &xParent) override
virtual void SAL_CALL end() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
give answer, if interface is supported @descr The interfaces are searched by type.
rtl::Reference< ProgressBar > m_xProgressBar
virtual void impl_recalcLayout(const css::awt::WindowEvent &aEvent) override
Type
constexpr auto STATUSINDICATOR_FREEBORDER
constexpr auto STATUSINDICATOR_DEFAULT_WIDTH
constexpr auto STATUSINDICATOR_DEFAULT_HEIGHT
constexpr sal_Int32 STATUSINDICATOR_BACKGROUNDCOLOR
constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_SHADOW
constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_BRIGHT
unsigned char sal_Bool