Bump version to 6.0-36
[LibreOffice.git] / UnoControls / source / inc / progressmonitor.hxx
blob75b84e0217b4bafb27fc8dd00ca43c06f04ecba2
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 #ifndef INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSMONITOR_HXX
21 #define INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSMONITOR_HXX
23 #include <com/sun/star/awt/XFileDialog.hpp>
24 #include <com/sun/star/awt/XTextComponent.hpp>
25 #include <com/sun/star/awt/XListBox.hpp>
26 #include <com/sun/star/awt/XProgressMonitor.hpp>
27 #include <com/sun/star/awt/TextAlign.hpp>
28 #include <com/sun/star/awt/XScrollBar.hpp>
29 #include <com/sun/star/awt/XVclContainerPeer.hpp>
30 #include <com/sun/star/awt/XTabControllerModel.hpp>
31 #include <com/sun/star/awt/XMessageBox.hpp>
32 #include <com/sun/star/awt/XTextEditField.hpp>
33 #include <com/sun/star/awt/Style.hpp>
34 #include <com/sun/star/awt/XTimeField.hpp>
35 #include <com/sun/star/awt/XVclWindowPeer.hpp>
36 #include <com/sun/star/awt/XControlModel.hpp>
37 #include <com/sun/star/awt/XSpinField.hpp>
38 #include <com/sun/star/awt/XUnoControlContainer.hpp>
39 #include <com/sun/star/awt/XTextLayoutConstrains.hpp>
40 #include <com/sun/star/awt/XNumericField.hpp>
41 #include <com/sun/star/awt/XButton.hpp>
42 #include <com/sun/star/awt/XTextArea.hpp>
43 #include <com/sun/star/awt/XImageButton.hpp>
44 #include <com/sun/star/awt/XFixedText.hpp>
45 #include <com/sun/star/awt/XControlContainer.hpp>
46 #include <com/sun/star/awt/XDialog.hpp>
47 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
48 #include <com/sun/star/awt/XRadioButton.hpp>
49 #include <com/sun/star/awt/XCurrencyField.hpp>
50 #include <com/sun/star/awt/XPatternField.hpp>
51 #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
52 #include <com/sun/star/awt/XTabController.hpp>
53 #include <com/sun/star/awt/XVclContainer.hpp>
54 #include <com/sun/star/awt/XDateField.hpp>
55 #include <com/sun/star/awt/XComboBox.hpp>
56 #include <com/sun/star/awt/XControl.hpp>
57 #include <com/sun/star/awt/XCheckBox.hpp>
58 #include <com/sun/star/awt/XLayoutConstrains.hpp>
59 #include <com/sun/star/awt/XProgressBar.hpp>
60 #include <rtl/ref.hxx>
62 #include <vector>
64 #include <basecontainercontrol.hxx>
66 namespace unocontrols{
68 class ProgressBar;
70 #define PROGRESSMONITOR_FREEBORDER 10 // border around and between the controls
71 #define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
72 #define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
73 #define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
74 #define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
75 #define CONTROLNAME_TEXT "Text" // identifier the control in container
76 #define CONTROLNAME_BUTTON "Button" // -||-
77 #define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
78 #define DEFAULT_BUTTONLABEL "Abbrechen"
79 #define PROGRESSMONITOR_DEFAULT_TOPIC ""
80 #define PROGRESSMONITOR_DEFAULT_TEXT ""
81 #define PROGRESSMONITOR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
82 #define PROGRESSMONITOR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
83 #define PROGRESSMONITOR_DEFAULT_WIDTH 350
84 #define PROGRESSMONITOR_DEFAULT_HEIGHT 100
86 // structs, types
88 /// Item of TextList
89 struct IMPL_TextlistItem
91 OUString sTopic; /// Left site of textline in dialog
92 OUString sText; /// Right site of textline in dialog
95 // class declaration
97 class ProgressMonitor : public css::awt::XLayoutConstrains
98 , public css::awt::XButton
99 , public css::awt::XProgressMonitor
100 , public BaseContainerControl
103 public:
105 ProgressMonitor( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
107 virtual ~ProgressMonitor() override;
109 // XInterface
111 /**_______________________________________________________________________________________________________
112 @short give answer, if interface is supported
113 @descr The interfaces are searched by type.
115 @seealso XInterface
117 @param "rType" is the type of searched interface.
119 @return Any information about found interface
121 @onerror A RuntimeException is thrown.
124 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
126 /**_______________________________________________________________________________________________________
127 @short increment refcount
128 @seealso XInterface
129 @seealso release()
130 @onerror A RuntimeException is thrown.
133 virtual void SAL_CALL acquire() throw() override;
135 /**_______________________________________________________________________________________________________
136 @short decrement refcount
137 @seealso XInterface
138 @seealso acquire()
139 @onerror A RuntimeException is thrown.
142 virtual void SAL_CALL release() throw() override;
144 // XTypeProvider
146 /**_______________________________________________________________________________________________________
147 @short get information about supported interfaces
148 @seealso XTypeProvider
149 @return Sequence of types of all supported interfaces
151 @onerror A RuntimeException is thrown.
154 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
156 // XAggregation
158 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
160 // XProgressMonitor
162 /**_______________________________________________________________________________________________________
163 @short add topic to dialog
164 @descr Add a topic with a text in right textlist (used for FixedText-member).<BR>
165 ( "beforeProgress" fix the right list ). The dialog metric is recalculated.
167 @seealso removeText(), updateText()
169 @param sTopic Name of topic<BR>
170 [sTopic != "" && sTopic != NULL]
171 @param sText Value of topic<BR>
172 [sText != "" && sText != NULL]
173 @param bbeforeProgress Position of topic<BR>
174 [True => before progressbar / False => below progressbar]
175 @onerror DEBUG = Assertion<BR>
176 RELEASE = nothing
179 virtual void SAL_CALL addText(
180 const OUString& sTopic ,
181 const OUString& sText ,
182 sal_Bool bbeforeProgress
183 ) override;
185 virtual void SAL_CALL removeText(
186 const OUString& sTopic ,
187 sal_Bool bbeforeProgress
188 ) override;
190 virtual void SAL_CALL updateText(
191 const OUString& sTopic ,
192 const OUString& sText ,
193 sal_Bool bbeforeProgress
194 ) override;
196 // XProgressBar
198 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) override;
200 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) override;
202 virtual void SAL_CALL setValue( sal_Int32 nValue ) override;
204 virtual void SAL_CALL setRange( sal_Int32 nMin ,
205 sal_Int32 nMax ) override;
207 virtual sal_Int32 SAL_CALL getValue() override;
209 // XButton
211 virtual void SAL_CALL addActionListener(
212 const css::uno::Reference< css::awt::XActionListener >& xListener
213 ) override;
215 virtual void SAL_CALL removeActionListener(
216 const css::uno::Reference< css::awt::XActionListener >& xListener
217 ) override;
219 virtual void SAL_CALL setLabel( const OUString& sLabel ) override;
221 virtual void SAL_CALL setActionCommand( const OUString& sCommand ) override;
223 // XLayoutConstrains
225 virtual css::awt::Size SAL_CALL getMinimumSize() override;
227 virtual css::awt::Size SAL_CALL getPreferredSize() override;
229 virtual css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override;
231 // XControl
233 virtual void SAL_CALL createPeer(
234 const css::uno::Reference< css::awt::XToolkit >& xToolkit ,
235 const css::uno::Reference< css::awt::XWindowPeer >& xParent
236 ) override;
238 virtual sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& xModel ) override;
240 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override;
242 // XComponent
244 virtual void SAL_CALL dispose() override;
246 // XWindow
248 virtual void SAL_CALL setPosSize( sal_Int32 nX ,
249 sal_Int32 nY ,
250 sal_Int32 nWidth ,
251 sal_Int32 nHeight ,
252 sal_Int16 nFlags ) override;
254 // BaseControl
256 static const css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
258 static const OUString impl_getStaticImplementationName();
260 protected:
262 virtual void impl_paint( sal_Int32 nX ,
263 sal_Int32 nY ,
264 const css::uno::Reference< css::awt::XGraphics >& xGraphics ) override;
266 private:
267 using BaseControl::impl_recalcLayout;
269 void impl_recalcLayout();
271 void impl_rebuildFixedText();
273 void impl_cleanMemory();
275 IMPL_TextlistItem* impl_searchTopic( const OUString& sTopic , bool bbeforeProgress );
277 // debug methods
279 private:
281 static bool impl_debug_checkParameter( const OUString& sTopic, const OUString& sText ); // addText, updateText
282 static bool impl_debug_checkParameter( const OUString& rTopic ); // removeText
284 // private variables
286 private:
287 ::std::vector < IMPL_TextlistItem* > maTextlist_Top; // Elements before progress
288 css::uno::Reference< css::awt::XFixedText > m_xTopic_Top; // (used, if parameter "beforeProgress"=true in "addText, updateText, removeText")
289 css::uno::Reference< css::awt::XFixedText > m_xText_Top;
291 ::std::vector < IMPL_TextlistItem* > maTextlist_Bottom; // Elements below of progress
292 css::uno::Reference< css::awt::XFixedText > m_xTopic_Bottom; // (used, if parameter "beforeProgress"=false in "addText, updateText, removeText")
293 css::uno::Reference< css::awt::XFixedText > m_xText_Bottom;
295 rtl::Reference<ProgressBar> m_xProgressBar;
296 css::uno::Reference< css::awt::XButton > m_xButton;
297 css::awt::Rectangle m_a3DLine;
299 }; // class ProgressMonitor
301 } // namespace unocontrols
303 #endif // INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSMONITOR_HXX
305 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */