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 
26 #include <basecontainercontrol.hxx>
27 
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; }
33 
34 namespace unocontrols {
35 
36 class ProgressBar;
37 
38 #define STATUSINDICATOR_FREEBORDER 5 // border around and between the controls
39 #define STATUSINDICATOR_BACKGROUNDCOLOR sal_Int32(Color( 0xC0, 0xC0, 0xC0 )) // lightgray
40 #define STATUSINDICATOR_LINECOLOR_BRIGHT sal_Int32(Color( 0xFF, 0xFF, 0xFF )) // white
41 #define STATUSINDICATOR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00 )) // black
42 #define STATUSINDICATOR_DEFAULT_WIDTH 300
43 #define STATUSINDICATOR_DEFAULT_HEIGHT 25
44 
45 class StatusIndicator final : public css::awt::XLayoutConstrains
46  , public css::task::XStatusIndicator
47  , public BaseContainerControl
48 {
49 public:
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  // XAggregation
102 
103  virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
104 
105  // XStatusIndicator
106 
107  virtual void SAL_CALL start(
108  const OUString& sText ,
109  sal_Int32 nRange
110  ) override;
111 
112  virtual void SAL_CALL end() override;
113 
114  virtual void SAL_CALL reset() override;
115 
116  virtual void SAL_CALL setText( const OUString& sText ) override;
117 
118  virtual void SAL_CALL setValue( sal_Int32 nValue ) override;
119 
120  // XLayoutConstrains
121 
122  virtual css::awt::Size SAL_CALL getMinimumSize() override;
123 
124  virtual css::awt::Size SAL_CALL getPreferredSize() override;
125 
126  virtual css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
127 
128  // XControl
129 
130  virtual void SAL_CALL createPeer(
131  const css::uno::Reference< css::awt::XToolkit >& xToolkit ,
132  const css::uno::Reference< css::awt::XWindowPeer >& xParent
133  ) override;
134 
135  virtual sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& xModel ) override;
136 
137  virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override;
138 
139  // XComponent
140 
141  virtual void SAL_CALL dispose() override;
142 
143  // XWindow
144 
145  virtual void SAL_CALL setPosSize( sal_Int32 nX ,
146  sal_Int32 nY ,
147  sal_Int32 nWidth ,
148  sal_Int32 nHeight ,
149  sal_Int16 nFlags ) override;
150 
151 private:
152  virtual css::awt::WindowDescriptor impl_getWindowDescriptor(
153  const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
154  ) override;
155 
156  virtual void impl_paint (
157  sal_Int32 nX,
158  sal_Int32 nY,
159  const css::uno::Reference< css::awt::XGraphics > & rGraphics
160  ) override;
161 
162  virtual void impl_recalcLayout( const css::awt::WindowEvent& aEvent ) override;
163 
164  css::uno::Reference< css::awt::XFixedText > m_xText;
166 
167 };
168 
169 }
170 
171 
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::awt::Size SAL_CALL getPreferredSize() override
css::uno::Reference< css::awt::XFixedText > m_xText
virtual ~StatusIndicator() override
rtl::Reference< ProgressBar > m_xProgressBar
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &aType) override
virtual void SAL_CALL setValue(sal_Int32 nValue) override
virtual void SAL_CALL end() override
virtual void SAL_CALL setText(const OUString &sText) override
virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override
virtual void impl_recalcLayout(const css::awt::WindowEvent &aEvent) override
virtual void SAL_CALL release() noexcept override
decrement refcount XInterface acquire() A RuntimeException is thrown.
virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > &xToolkit, const css::uno::Reference< css::awt::XWindowPeer > &xParent) override
unsigned char sal_Bool
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::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
give answer, if interface is supported The interfaces are searched by type.
StatusIndicator(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel > &xModel) override
virtual void SAL_CALL start(const OUString &sText, sal_Int32 nRange) override
virtual css::awt::Size SAL_CALL calcAdjustedSize(const css::awt::Size &aNewSize) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
get information about supported interfaces XTypeProvider
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 acquire() noexcept override
increment refcount XInterface release() A RuntimeException is thrown.
Reference< XModel > xModel
virtual void SAL_CALL reset() override
AnyEventRef aEvent
sal_Int16 nValue
virtual void SAL_CALL setPosSize(sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags) override