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 _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
21 #define _UNOCONTROLS_PROGRESSMONITOR_CTRL_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/MessageBoxCommand.hpp>
59 #include <com/sun/star/awt/XLayoutConstrains.hpp>
60 #include <com/sun/star/awt/XProgressBar.hpp>
64 #include "basecontainercontrol.hxx"
66 namespace unocontrols
{
68 #define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor"
69 #define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor"
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 "\0"
80 #define PROGRESSMONITOR_DEFAULT_TEXT "\0"
81 #define PROGRESSMONITOR_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
82 #define PROGRESSMONITOR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
83 #define PROGRESSMONITOR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
84 #define PROGRESSMONITOR_DEFAULT_WIDTH 350
85 #define PROGRESSMONITOR_DEFAULT_HEIGHT 100
87 //____________________________________________________________________________________________________________
89 //____________________________________________________________________________________________________________
92 struct IMPL_TextlistItem
94 OUString sTopic
; /// Left site of textline in dialog
95 OUString sText
; /// Right site of textline in dialog
98 //____________________________________________________________________________________________________________
100 //____________________________________________________________________________________________________________
102 class ProgressMonitor
: public ::com::sun::star::awt::XLayoutConstrains
103 , public ::com::sun::star::awt::XButton
104 , public ::com::sun::star::awt::XProgressMonitor
105 , public BaseContainerControl
108 //____________________________________________________________________________________________________________
110 //____________________________________________________________________________________________________________
114 //________________________________________________________________________________________________________
115 // construct/destruct
116 //________________________________________________________________________________________________________
118 /**_______________________________________________________________________________________________________
131 ProgressMonitor( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
133 /**_______________________________________________________________________________________________________
146 virtual ~ProgressMonitor();
148 //________________________________________________________________________________________________________
150 //________________________________________________________________________________________________________
152 /**_______________________________________________________________________________________________________
153 @short give answer, if interface is supported
154 @descr The interfaces are searched by type.
158 @param "rType" is the type of searched interface.
160 @return Any information about found interface
162 @onerror A RuntimeException is thrown.
165 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
)
166 throw( ::com::sun::star::uno::RuntimeException
);
168 /**_______________________________________________________________________________________________________
169 @short increment refcount
179 @onerror A RuntimeException is thrown.
182 virtual void SAL_CALL
acquire() throw();
184 /**_______________________________________________________________________________________________________
185 @short decrement refcount
195 @onerror A RuntimeException is thrown.
198 virtual void SAL_CALL
release() throw();
200 //________________________________________________________________________________________________________
202 //________________________________________________________________________________________________________
204 /**_______________________________________________________________________________________________________
205 @short get information about supported interfaces
208 @seealso XTypeProvider
212 @return Sequence of types of all supported interfaces
214 @onerror A RuntimeException is thrown.
217 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw( ::com::sun::star::uno::RuntimeException
);
219 //________________________________________________________________________________________________________
221 //________________________________________________________________________________________________________
223 /**_______________________________________________________________________________________________________
236 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& aType
)
237 throw( ::com::sun::star::uno::RuntimeException
);
239 //________________________________________________________________________________________________________
241 //________________________________________________________________________________________________________
243 /**_______________________________________________________________________________________________________
244 @short add topic to dialog
245 @descr Add a topic with a text in right textlist (used for FixedText-member).<BR>
246 ( "beforeProgress" fix the right list ). The dialog metric is recalculated.
248 @seealso removeText(), updateText()
250 @param sTopic Name of topic<BR>
251 [sTopic != "" && sTopic != NULL]
252 @param sText Value of topic<BR>
253 [sText != "" && sText != NULL]
254 @param bbeforeProgress Position of topic<BR>
255 [True => before progressbar / False => below progressbar]
259 @onerror DEBUG = Assertion<BR>
263 virtual void SAL_CALL
addText(
264 const OUString
& sTopic
,
265 const OUString
& sText
,
266 sal_Bool bbeforeProgress
267 ) throw( ::com::sun::star::uno::RuntimeException
);
269 /**_______________________________________________________________________________________________________
282 virtual void SAL_CALL
removeText(
283 const OUString
& sTopic
,
284 sal_Bool bbeforeProgress
285 ) throw( ::com::sun::star::uno::RuntimeException
);
287 /**_______________________________________________________________________________________________________
300 virtual void SAL_CALL
updateText(
301 const OUString
& sTopic
,
302 const OUString
& sText
,
303 sal_Bool bbeforeProgress
304 ) throw( ::com::sun::star::uno::RuntimeException
);
306 //________________________________________________________________________________________________________
308 //________________________________________________________________________________________________________
310 /**_______________________________________________________________________________________________________
323 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
) throw( ::com::sun::star::uno::RuntimeException
);
325 /**_______________________________________________________________________________________________________
338 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
) throw( ::com::sun::star::uno::RuntimeException
);
340 /**_______________________________________________________________________________________________________
353 virtual void SAL_CALL
setValue( sal_Int32 nValue
) throw( ::com::sun::star::uno::RuntimeException
);
355 /**_______________________________________________________________________________________________________
368 virtual void SAL_CALL
setRange( sal_Int32 nMin
,
369 sal_Int32 nMax
) throw( ::com::sun::star::uno::RuntimeException
);
371 /**_______________________________________________________________________________________________________
384 virtual sal_Int32 SAL_CALL
getValue() throw( ::com::sun::star::uno::RuntimeException
);
386 //________________________________________________________________________________________________________
388 //________________________________________________________________________________________________________
390 /**_______________________________________________________________________________________________________
403 virtual void SAL_CALL
addActionListener(
404 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
>& xListener
405 ) throw( ::com::sun::star::uno::RuntimeException
);
407 /**_______________________________________________________________________________________________________
420 virtual void SAL_CALL
removeActionListener(
421 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
>& xListener
422 ) throw( ::com::sun::star::uno::RuntimeException
);
424 /**_______________________________________________________________________________________________________
437 virtual void SAL_CALL
setLabel( const OUString
& sLabel
) throw( ::com::sun::star::uno::RuntimeException
);
439 /**_______________________________________________________________________________________________________
452 virtual void SAL_CALL
setActionCommand( const OUString
& sCommand
)
453 throw( ::com::sun::star::uno::RuntimeException
);
455 //________________________________________________________________________________________________________
457 //________________________________________________________________________________________________________
459 /**_______________________________________________________________________________________________________
472 virtual ::com::sun::star::awt::Size SAL_CALL
getMinimumSize() throw( ::com::sun::star::uno::RuntimeException
);
474 /**_______________________________________________________________________________________________________
487 virtual ::com::sun::star::awt::Size SAL_CALL
getPreferredSize() throw( ::com::sun::star::uno::RuntimeException
);
489 /**_______________________________________________________________________________________________________
502 virtual ::com::sun::star::awt::Size SAL_CALL
calcAdjustedSize( const ::com::sun::star::awt::Size
& aNewSize
)
503 throw( ::com::sun::star::uno::RuntimeException
);
505 //________________________________________________________________________________________________________
507 //________________________________________________________________________________________________________
509 /**_______________________________________________________________________________________________________
522 virtual void SAL_CALL
createPeer(
523 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
>& xToolkit
,
524 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParent
525 ) throw( ::com::sun::star::uno::RuntimeException
);
527 /**_______________________________________________________________________________________________________
540 virtual sal_Bool SAL_CALL
setModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& xModel
)
541 throw( ::com::sun::star::uno::RuntimeException
);
543 /**_______________________________________________________________________________________________________
556 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> SAL_CALL
getModel()
557 throw( ::com::sun::star::uno::RuntimeException
);
559 //________________________________________________________________________________________________________
561 //________________________________________________________________________________________________________
563 /**_______________________________________________________________________________________________________
576 virtual void SAL_CALL
dispose() throw( ::com::sun::star::uno::RuntimeException
);
578 //________________________________________________________________________________________________________
580 //________________________________________________________________________________________________________
582 /**_______________________________________________________________________________________________________
595 virtual void SAL_CALL
setPosSize( sal_Int32 nX
,
599 sal_Int16 nFlags
) throw( ::com::sun::star::uno::RuntimeException
);
601 //________________________________________________________________________________________________________
603 //________________________________________________________________________________________________________
605 /**_______________________________________________________________________________________________________
618 static const ::com::sun::star::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
620 /**_______________________________________________________________________________________________________
633 static const OUString
impl_getStaticImplementationName();
635 //____________________________________________________________________________________________________________
637 //____________________________________________________________________________________________________________
641 /**_______________________________________________________________________________________________________
654 virtual void impl_paint( sal_Int32 nX
,
656 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& xGraphics
);
658 //____________________________________________________________________________________________________________
660 //____________________________________________________________________________________________________________
663 using BaseControl::impl_recalcLayout
;
664 /**_______________________________________________________________________________________________________
677 void impl_recalcLayout();
679 /**_______________________________________________________________________________________________________
692 void impl_rebuildFixedText();
694 /**_______________________________________________________________________________________________________
707 void impl_cleanMemory();
709 /**_______________________________________________________________________________________________________
722 IMPL_TextlistItem
* impl_searchTopic( const OUString
& sTopic
, sal_Bool bbeforeProgress
);
724 //____________________________________________________________________________________________________________
726 //____________________________________________________________________________________________________________
730 /**_______________________________________________________________________________________________________
745 sal_Bool
impl_debug_checkParameter( const OUString
& sTopic
, const OUString
& sText
, sal_Bool bbeforeProgress
); // addText, updateText
746 sal_Bool
impl_debug_checkParameter( const OUString
& rTopic
, sal_Bool bbeforeProgress
); // removeText
749 //____________________________________________________________________________________________________________
751 //____________________________________________________________________________________________________________
754 ::std::vector
< IMPL_TextlistItem
* > maTextlist_Top
; // Elements before progress
755 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xTopic_Top
; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText")
756 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xText_Top
;
758 ::std::vector
< IMPL_TextlistItem
* > maTextlist_Bottom
; // Elements below of progress
759 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xTopic_Bottom
; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText")
760 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xText_Bottom
;
762 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XProgressBar
> m_xProgressBar
;
763 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XButton
> m_xButton
;
764 ::com::sun::star::awt::Rectangle m_a3DLine
;
766 }; // class ProgressMonitor
768 } // namespace unocontrols
770 #endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
772 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */