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/XLayoutConstrains.hpp>
59 #include <com/sun/star/awt/XProgressBar.hpp>
63 #include "basecontainercontrol.hxx"
65 namespace unocontrols
{
67 #define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor"
68 #define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor"
69 #define PROGRESSMONITOR_FREEBORDER 10 // border around and between the controls
70 #define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
71 #define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
72 #define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
73 #define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
74 #define CONTROLNAME_TEXT "Text" // identifier the control in container
75 #define CONTROLNAME_BUTTON "Button" // -||-
76 #define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
77 #define DEFAULT_BUTTONLABEL "Abbrechen"
78 #define PROGRESSMONITOR_DEFAULT_TOPIC "\0"
79 #define PROGRESSMONITOR_DEFAULT_TEXT "\0"
80 #define PROGRESSMONITOR_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
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 //____________________________________________________________________________________________________________
88 //____________________________________________________________________________________________________________
91 struct IMPL_TextlistItem
93 OUString sTopic
; /// Left site of textline in dialog
94 OUString sText
; /// Right site of textline in dialog
97 //____________________________________________________________________________________________________________
99 //____________________________________________________________________________________________________________
101 class ProgressMonitor
: public ::com::sun::star::awt::XLayoutConstrains
102 , public ::com::sun::star::awt::XButton
103 , public ::com::sun::star::awt::XProgressMonitor
104 , public BaseContainerControl
107 //____________________________________________________________________________________________________________
109 //____________________________________________________________________________________________________________
113 //________________________________________________________________________________________________________
114 // construct/destruct
115 //________________________________________________________________________________________________________
117 /**_______________________________________________________________________________________________________
130 ProgressMonitor( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
132 /**_______________________________________________________________________________________________________
145 virtual ~ProgressMonitor();
147 //________________________________________________________________________________________________________
149 //________________________________________________________________________________________________________
151 /**_______________________________________________________________________________________________________
152 @short give answer, if interface is supported
153 @descr The interfaces are searched by type.
157 @param "rType" is the type of searched interface.
159 @return Any information about found interface
161 @onerror A RuntimeException is thrown.
164 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
)
165 throw( ::com::sun::star::uno::RuntimeException
);
167 /**_______________________________________________________________________________________________________
168 @short increment refcount
178 @onerror A RuntimeException is thrown.
181 virtual void SAL_CALL
acquire() throw();
183 /**_______________________________________________________________________________________________________
184 @short decrement refcount
194 @onerror A RuntimeException is thrown.
197 virtual void SAL_CALL
release() throw();
199 //________________________________________________________________________________________________________
201 //________________________________________________________________________________________________________
203 /**_______________________________________________________________________________________________________
204 @short get information about supported interfaces
207 @seealso XTypeProvider
211 @return Sequence of types of all supported interfaces
213 @onerror A RuntimeException is thrown.
216 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw( ::com::sun::star::uno::RuntimeException
);
218 //________________________________________________________________________________________________________
220 //________________________________________________________________________________________________________
222 /**_______________________________________________________________________________________________________
235 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& aType
)
236 throw( ::com::sun::star::uno::RuntimeException
);
238 //________________________________________________________________________________________________________
240 //________________________________________________________________________________________________________
242 /**_______________________________________________________________________________________________________
243 @short add topic to dialog
244 @descr Add a topic with a text in right textlist (used for FixedText-member).<BR>
245 ( "beforeProgress" fix the right list ). The dialog metric is recalculated.
247 @seealso removeText(), updateText()
249 @param sTopic Name of topic<BR>
250 [sTopic != "" && sTopic != NULL]
251 @param sText Value of topic<BR>
252 [sText != "" && sText != NULL]
253 @param bbeforeProgress Position of topic<BR>
254 [True => before progressbar / False => below progressbar]
258 @onerror DEBUG = Assertion<BR>
262 virtual void SAL_CALL
addText(
263 const OUString
& sTopic
,
264 const OUString
& sText
,
265 sal_Bool bbeforeProgress
266 ) throw( ::com::sun::star::uno::RuntimeException
);
268 /**_______________________________________________________________________________________________________
281 virtual void SAL_CALL
removeText(
282 const OUString
& sTopic
,
283 sal_Bool bbeforeProgress
284 ) throw( ::com::sun::star::uno::RuntimeException
);
286 /**_______________________________________________________________________________________________________
299 virtual void SAL_CALL
updateText(
300 const OUString
& sTopic
,
301 const OUString
& sText
,
302 sal_Bool bbeforeProgress
303 ) throw( ::com::sun::star::uno::RuntimeException
);
305 //________________________________________________________________________________________________________
307 //________________________________________________________________________________________________________
309 /**_______________________________________________________________________________________________________
322 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
) throw( ::com::sun::star::uno::RuntimeException
);
324 /**_______________________________________________________________________________________________________
337 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
) throw( ::com::sun::star::uno::RuntimeException
);
339 /**_______________________________________________________________________________________________________
352 virtual void SAL_CALL
setValue( sal_Int32 nValue
) throw( ::com::sun::star::uno::RuntimeException
);
354 /**_______________________________________________________________________________________________________
367 virtual void SAL_CALL
setRange( sal_Int32 nMin
,
368 sal_Int32 nMax
) throw( ::com::sun::star::uno::RuntimeException
);
370 /**_______________________________________________________________________________________________________
383 virtual sal_Int32 SAL_CALL
getValue() throw( ::com::sun::star::uno::RuntimeException
);
385 //________________________________________________________________________________________________________
387 //________________________________________________________________________________________________________
389 /**_______________________________________________________________________________________________________
402 virtual void SAL_CALL
addActionListener(
403 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
>& xListener
404 ) throw( ::com::sun::star::uno::RuntimeException
);
406 /**_______________________________________________________________________________________________________
419 virtual void SAL_CALL
removeActionListener(
420 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XActionListener
>& xListener
421 ) throw( ::com::sun::star::uno::RuntimeException
);
423 /**_______________________________________________________________________________________________________
436 virtual void SAL_CALL
setLabel( const OUString
& sLabel
) throw( ::com::sun::star::uno::RuntimeException
);
438 /**_______________________________________________________________________________________________________
451 virtual void SAL_CALL
setActionCommand( const OUString
& sCommand
)
452 throw( ::com::sun::star::uno::RuntimeException
);
454 //________________________________________________________________________________________________________
456 //________________________________________________________________________________________________________
458 /**_______________________________________________________________________________________________________
471 virtual ::com::sun::star::awt::Size SAL_CALL
getMinimumSize() throw( ::com::sun::star::uno::RuntimeException
);
473 /**_______________________________________________________________________________________________________
486 virtual ::com::sun::star::awt::Size SAL_CALL
getPreferredSize() throw( ::com::sun::star::uno::RuntimeException
);
488 /**_______________________________________________________________________________________________________
501 virtual ::com::sun::star::awt::Size SAL_CALL
calcAdjustedSize( const ::com::sun::star::awt::Size
& aNewSize
)
502 throw( ::com::sun::star::uno::RuntimeException
);
504 //________________________________________________________________________________________________________
506 //________________________________________________________________________________________________________
508 /**_______________________________________________________________________________________________________
521 virtual void SAL_CALL
createPeer(
522 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
>& xToolkit
,
523 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParent
524 ) throw( ::com::sun::star::uno::RuntimeException
);
526 /**_______________________________________________________________________________________________________
539 virtual sal_Bool SAL_CALL
setModel( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& xModel
)
540 throw( ::com::sun::star::uno::RuntimeException
);
542 /**_______________________________________________________________________________________________________
555 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> SAL_CALL
getModel()
556 throw( ::com::sun::star::uno::RuntimeException
);
558 //________________________________________________________________________________________________________
560 //________________________________________________________________________________________________________
562 /**_______________________________________________________________________________________________________
575 virtual void SAL_CALL
dispose() throw( ::com::sun::star::uno::RuntimeException
);
577 //________________________________________________________________________________________________________
579 //________________________________________________________________________________________________________
581 /**_______________________________________________________________________________________________________
594 virtual void SAL_CALL
setPosSize( sal_Int32 nX
,
598 sal_Int16 nFlags
) throw( ::com::sun::star::uno::RuntimeException
);
600 //________________________________________________________________________________________________________
602 //________________________________________________________________________________________________________
604 /**_______________________________________________________________________________________________________
617 static const ::com::sun::star::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
619 /**_______________________________________________________________________________________________________
632 static const OUString
impl_getStaticImplementationName();
634 //____________________________________________________________________________________________________________
636 //____________________________________________________________________________________________________________
640 /**_______________________________________________________________________________________________________
653 virtual void impl_paint( sal_Int32 nX
,
655 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& xGraphics
);
657 //____________________________________________________________________________________________________________
659 //____________________________________________________________________________________________________________
662 using BaseControl::impl_recalcLayout
;
663 /**_______________________________________________________________________________________________________
676 void impl_recalcLayout();
678 /**_______________________________________________________________________________________________________
691 void impl_rebuildFixedText();
693 /**_______________________________________________________________________________________________________
706 void impl_cleanMemory();
708 /**_______________________________________________________________________________________________________
721 IMPL_TextlistItem
* impl_searchTopic( const OUString
& sTopic
, sal_Bool bbeforeProgress
);
723 //____________________________________________________________________________________________________________
725 //____________________________________________________________________________________________________________
729 /**_______________________________________________________________________________________________________
744 sal_Bool
impl_debug_checkParameter( const OUString
& sTopic
, const OUString
& sText
, sal_Bool bbeforeProgress
); // addText, updateText
745 sal_Bool
impl_debug_checkParameter( const OUString
& rTopic
, sal_Bool bbeforeProgress
); // removeText
748 //____________________________________________________________________________________________________________
750 //____________________________________________________________________________________________________________
753 ::std::vector
< IMPL_TextlistItem
* > maTextlist_Top
; // Elements before progress
754 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xTopic_Top
; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText")
755 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xText_Top
;
757 ::std::vector
< IMPL_TextlistItem
* > maTextlist_Bottom
; // Elements below of progress
758 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xTopic_Bottom
; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText")
759 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XFixedText
> m_xText_Bottom
;
761 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XProgressBar
> m_xProgressBar
;
762 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XButton
> m_xButton
;
763 ::com::sun::star::awt::Rectangle m_a3DLine
;
765 }; // class ProgressMonitor
767 } // namespace unocontrols
769 #endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
771 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */