1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: progressmonitor.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
32 #define _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
34 //____________________________________________________________________________________________________________
35 // includes of other projects
36 //____________________________________________________________________________________________________________
38 #include <com/sun/star/awt/XFileDialog.hpp>
39 #include <com/sun/star/awt/XTextComponent.hpp>
40 #include <com/sun/star/awt/XListBox.hpp>
41 #include <com/sun/star/awt/XProgressMonitor.hpp>
42 #include <com/sun/star/awt/TextAlign.hpp>
43 #include <com/sun/star/awt/XScrollBar.hpp>
44 #include <com/sun/star/awt/XVclContainerPeer.hpp>
45 #include <com/sun/star/awt/XTabControllerModel.hpp>
46 #include <com/sun/star/awt/XMessageBox.hpp>
47 #include <com/sun/star/awt/XTextEditField.hpp>
48 #include <com/sun/star/awt/Style.hpp>
49 #include <com/sun/star/awt/XTimeField.hpp>
50 #include <com/sun/star/awt/XVclWindowPeer.hpp>
51 #include <com/sun/star/awt/XControlModel.hpp>
52 #include <com/sun/star/awt/XSpinField.hpp>
53 #include <com/sun/star/awt/XUnoControlContainer.hpp>
54 #include <com/sun/star/awt/XTextLayoutConstrains.hpp>
55 #include <com/sun/star/awt/XNumericField.hpp>
56 #include <com/sun/star/awt/XButton.hpp>
57 #include <com/sun/star/awt/XTextArea.hpp>
58 #include <com/sun/star/awt/XImageButton.hpp>
59 #include <com/sun/star/awt/XFixedText.hpp>
60 #include <com/sun/star/awt/XControlContainer.hpp>
61 #include <com/sun/star/awt/XDialog.hpp>
62 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
63 #include <com/sun/star/awt/XRadioButton.hpp>
64 #include <com/sun/star/awt/XCurrencyField.hpp>
65 #include <com/sun/star/awt/XPatternField.hpp>
66 #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
67 #include <com/sun/star/awt/XTabController.hpp>
68 #include <com/sun/star/awt/XVclContainer.hpp>
69 #include <com/sun/star/awt/XDateField.hpp>
70 #include <com/sun/star/awt/XComboBox.hpp>
71 #include <com/sun/star/awt/XControl.hpp>
72 #include <com/sun/star/awt/XCheckBox.hpp>
73 #include <com/sun/star/awt/MessageBoxCommand.hpp>
74 #include <com/sun/star/awt/XLayoutConstrains.hpp>
75 #include <com/sun/star/awt/XProgressBar.hpp>
77 //____________________________________________________________________________________________________________
78 // includes of my own project
79 //____________________________________________________________________________________________________________
80 #include "basecontainercontrol.hxx"
82 //____________________________________________________________________________________________________________
84 //____________________________________________________________________________________________________________
86 namespace unocontrols
{
88 #define UNO3_ANY ::com::sun::star::uno::Any
89 #define UNO3_OUSTRING ::rtl::OUString
90 #define UNO3_RECTANGLE ::com::sun::star::awt::Rectangle
91 #define UNO3_REFERENCE ::com::sun::star::uno::Reference
92 #define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
93 #define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
94 #define UNO3_SIZE ::com::sun::star::awt::Size
95 #define UNO3_TYPE ::com::sun::star::uno::Type
96 #define UNO3_XACTIONLISTENER ::com::sun::star::awt::XActionListener
97 #define UNO3_XBUTTON ::com::sun::star::awt::XButton
98 #define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
99 #define UNO3_XFIXEDTEXT ::com::sun::star::awt::XFixedText
100 #define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
101 #define UNO3_XLAYOUTCONSTRAINS ::com::sun::star::awt::XLayoutConstrains
102 #define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
103 #define UNO3_XPROGRESSBAR ::com::sun::star::awt::XProgressBar
104 #define UNO3_XPROGRESSMONITOR ::com::sun::star::awt::XProgressMonitor
105 #define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
106 #define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
108 //____________________________________________________________________________________________________________
110 //____________________________________________________________________________________________________________
112 #define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor"
113 #define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor"
114 #define FREEBORDER 10 // border around and between the controls
115 #define WIDTH_RELATION 4 // reserve 1/4 for button width and rest for progressbar width
116 #define HEIGHT_RELATION 5 // reserve 1/5 for button and progressbar heigth and rest for text height
117 #define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
118 #define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
119 #define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
120 #define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
121 #define CONTROLNAME_TEXT "Text" // identifier the control in container
122 #define CONTROLNAME_BUTTON "Button" // -||-
123 #define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
124 #define DEFAULT_BUTTONLABEL "Abbrechen"
125 #define DEFAULT_TOPIC "\0"
126 #define DEFAULT_TEXT "\0"
127 #define BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
128 #define LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
129 #define LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
130 #define HEIGHT_PROGRESSBAR 15
131 // Overwrite defines from basecontrol.hxx!!!
133 #undef DEFAULT_HEIGHT
134 #define DEFAULT_WIDTH 350
135 #define DEFAULT_HEIGHT 100
137 //____________________________________________________________________________________________________________
139 //____________________________________________________________________________________________________________
142 struct IMPL_TextlistItem
144 UNO3_OUSTRING sTopic
; /// Left site of textline in dialog
145 UNO3_OUSTRING sText
; /// Right site of textline in dialog
148 /// Define a list-class for struct IMPL_TextlistItem
149 class IMPL_Textlist
;
150 DECLARE_LIST( IMPL_Textlist
, IMPL_TextlistItem
* )
152 //____________________________________________________________________________________________________________
154 //____________________________________________________________________________________________________________
156 class ProgressMonitor
: public UNO3_XLAYOUTCONSTRAINS
157 , public UNO3_XBUTTON
158 , public UNO3_XPROGRESSMONITOR
159 , public BaseContainerControl
162 //____________________________________________________________________________________________________________
164 //____________________________________________________________________________________________________________
168 //________________________________________________________________________________________________________
169 // construct/destruct
170 //________________________________________________________________________________________________________
172 /**_______________________________________________________________________________________________________
185 ProgressMonitor( const UNO3_REFERENCE
< UNO3_XMULTISERVICEFACTORY
>& xFactory
);
187 /**_______________________________________________________________________________________________________
200 virtual ~ProgressMonitor();
202 //________________________________________________________________________________________________________
204 //________________________________________________________________________________________________________
206 /**_______________________________________________________________________________________________________
207 @short give answer, if interface is supported
208 @descr The interfaces are searched by type.
212 @param "rType" is the type of searched interface.
214 @return Any information about found interface
216 @onerror A RuntimeException is thrown.
219 virtual UNO3_ANY SAL_CALL
queryInterface( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
221 /**_______________________________________________________________________________________________________
222 @short increment refcount
232 @onerror A RuntimeException is thrown.
235 virtual void SAL_CALL
acquire() throw();
237 /**_______________________________________________________________________________________________________
238 @short decrement refcount
248 @onerror A RuntimeException is thrown.
251 virtual void SAL_CALL
release() throw();
253 //________________________________________________________________________________________________________
255 //________________________________________________________________________________________________________
257 /**_______________________________________________________________________________________________________
258 @short get information about supported interfaces
261 @seealso XTypeProvider
265 @return Sequence of types of all supported interfaces
267 @onerror A RuntimeException is thrown.
270 virtual UNO3_SEQUENCE
< UNO3_TYPE
> SAL_CALL
getTypes() throw( UNO3_RUNTIMEEXCEPTION
);
272 //________________________________________________________________________________________________________
274 //________________________________________________________________________________________________________
276 /**_______________________________________________________________________________________________________
289 virtual UNO3_ANY SAL_CALL
queryAggregation( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
291 //________________________________________________________________________________________________________
293 //________________________________________________________________________________________________________
295 /**_______________________________________________________________________________________________________
296 @short add topic to dialog
297 @descr Add a topic with a text in right textlist (used for FixedText-member).<BR>
298 ( "beforeProgress" fix the right list ). The dialog metric is recalculated.
300 @seealso removeText(), updateText()
302 @param sTopic Name of topic<BR>
303 [sTopic != "" && sTopic != NULL]
304 @param sText Value of topic<BR>
305 [sText != "" && sText != NULL]
306 @param bbeforeProgress Position of topic<BR>
307 [True => before progressbar / False => below progressbar]
311 @onerror DEBUG = Assertion<BR>
315 virtual void SAL_CALL
addText( const UNO3_OUSTRING
& sTopic
,
316 const UNO3_OUSTRING
& sText
,
317 sal_Bool bbeforeProgress
) throw( UNO3_RUNTIMEEXCEPTION
);
319 /**_______________________________________________________________________________________________________
332 virtual void SAL_CALL
removeText( const UNO3_OUSTRING
& sTopic
,
333 sal_Bool bbeforeProgress
) throw( UNO3_RUNTIMEEXCEPTION
);
335 /**_______________________________________________________________________________________________________
348 virtual void SAL_CALL
updateText( const UNO3_OUSTRING
& sTopic
,
349 const UNO3_OUSTRING
& sText
,
350 sal_Bool bbeforeProgress
) throw( UNO3_RUNTIMEEXCEPTION
);
352 //________________________________________________________________________________________________________
354 //________________________________________________________________________________________________________
356 /**_______________________________________________________________________________________________________
369 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
) throw( UNO3_RUNTIMEEXCEPTION
);
371 /**_______________________________________________________________________________________________________
384 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
) throw( UNO3_RUNTIMEEXCEPTION
);
386 /**_______________________________________________________________________________________________________
399 virtual void SAL_CALL
setValue( sal_Int32 nValue
) throw( UNO3_RUNTIMEEXCEPTION
);
401 /**_______________________________________________________________________________________________________
414 virtual void SAL_CALL
setRange( sal_Int32 nMin
,
415 sal_Int32 nMax
) throw( UNO3_RUNTIMEEXCEPTION
);
417 /**_______________________________________________________________________________________________________
430 virtual sal_Int32 SAL_CALL
getValue() throw( UNO3_RUNTIMEEXCEPTION
);
432 //________________________________________________________________________________________________________
434 //________________________________________________________________________________________________________
436 /**_______________________________________________________________________________________________________
449 virtual void SAL_CALL
addActionListener( const UNO3_REFERENCE
< UNO3_XACTIONLISTENER
>& xListener
) throw( UNO3_RUNTIMEEXCEPTION
);
451 /**_______________________________________________________________________________________________________
464 virtual void SAL_CALL
removeActionListener( const UNO3_REFERENCE
< UNO3_XACTIONLISTENER
>& xListener
) throw( UNO3_RUNTIMEEXCEPTION
);
466 /**_______________________________________________________________________________________________________
479 virtual void SAL_CALL
setLabel( const UNO3_OUSTRING
& sLabel
) throw( UNO3_RUNTIMEEXCEPTION
);
481 /**_______________________________________________________________________________________________________
494 virtual void SAL_CALL
setActionCommand( const UNO3_OUSTRING
& sCommand
) throw( UNO3_RUNTIMEEXCEPTION
);
496 //________________________________________________________________________________________________________
498 //________________________________________________________________________________________________________
500 /**_______________________________________________________________________________________________________
513 virtual UNO3_SIZE SAL_CALL
getMinimumSize() throw( UNO3_RUNTIMEEXCEPTION
);
515 /**_______________________________________________________________________________________________________
528 virtual UNO3_SIZE SAL_CALL
getPreferredSize() throw( UNO3_RUNTIMEEXCEPTION
);
530 /**_______________________________________________________________________________________________________
543 virtual UNO3_SIZE SAL_CALL
calcAdjustedSize( const UNO3_SIZE
& aNewSize
) throw( UNO3_RUNTIMEEXCEPTION
);
545 //________________________________________________________________________________________________________
547 //________________________________________________________________________________________________________
549 /**_______________________________________________________________________________________________________
562 virtual void SAL_CALL
createPeer( const UNO3_REFERENCE
< UNO3_XTOOLKIT
>& xToolkit
,
563 const UNO3_REFERENCE
< UNO3_XWINDOWPEER
>& xParent
) throw( UNO3_RUNTIMEEXCEPTION
);
565 /**_______________________________________________________________________________________________________
578 virtual sal_Bool SAL_CALL
setModel( const UNO3_REFERENCE
< UNO3_XCONTROLMODEL
>& xModel
) throw( UNO3_RUNTIMEEXCEPTION
);
580 /**_______________________________________________________________________________________________________
593 virtual UNO3_REFERENCE
< UNO3_XCONTROLMODEL
> SAL_CALL
getModel() throw( UNO3_RUNTIMEEXCEPTION
);
595 //________________________________________________________________________________________________________
597 //________________________________________________________________________________________________________
599 /**_______________________________________________________________________________________________________
612 virtual void SAL_CALL
dispose() throw( UNO3_RUNTIMEEXCEPTION
);
614 //________________________________________________________________________________________________________
616 //________________________________________________________________________________________________________
618 /**_______________________________________________________________________________________________________
631 virtual void SAL_CALL
setPosSize( sal_Int32 nX
,
635 sal_Int16 nFlags
) throw( UNO3_RUNTIMEEXCEPTION
);
637 //________________________________________________________________________________________________________
639 //________________________________________________________________________________________________________
641 /**_______________________________________________________________________________________________________
654 static const UNO3_SEQUENCE
< UNO3_OUSTRING
> impl_getStaticSupportedServiceNames();
656 /**_______________________________________________________________________________________________________
669 static const UNO3_OUSTRING
impl_getStaticImplementationName();
671 //____________________________________________________________________________________________________________
673 //____________________________________________________________________________________________________________
677 /**_______________________________________________________________________________________________________
690 virtual void impl_paint( sal_Int32 nX
,
692 const UNO3_REFERENCE
< UNO3_XGRAPHICS
>& xGraphics
);
694 //____________________________________________________________________________________________________________
696 //____________________________________________________________________________________________________________
699 using BaseControl::impl_recalcLayout
;
700 /**_______________________________________________________________________________________________________
713 void impl_recalcLayout();
715 /**_______________________________________________________________________________________________________
728 void impl_rebuildFixedText();
730 /**_______________________________________________________________________________________________________
743 void impl_cleanMemory();
745 /**_______________________________________________________________________________________________________
758 IMPL_TextlistItem
* impl_searchTopic( const UNO3_OUSTRING
& sTopic
,
759 sal_Bool bbeforeProgress
);
761 //____________________________________________________________________________________________________________
763 //____________________________________________________________________________________________________________
767 /**_______________________________________________________________________________________________________
782 sal_Bool
impl_debug_checkParameter( const UNO3_OUSTRING
& sTopic
, const UNO3_OUSTRING
& sText
, sal_Bool bbeforeProgress
); // addText, updateText
783 sal_Bool
impl_debug_checkParameter( const UNO3_OUSTRING
& rTopic
, sal_Bool bbeforeProgress
); // removeText
786 //____________________________________________________________________________________________________________
788 //____________________________________________________________________________________________________________
792 IMPL_Textlist
* m_pTextlist_Top
; // Elements before progress
793 UNO3_REFERENCE
< UNO3_XFIXEDTEXT
> m_xTopic_Top
; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText")
794 UNO3_REFERENCE
< UNO3_XFIXEDTEXT
> m_xText_Top
;
796 IMPL_Textlist
* m_pTextlist_Bottom
; // Elements below of progress
797 UNO3_REFERENCE
< UNO3_XFIXEDTEXT
> m_xTopic_Bottom
; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText")
798 UNO3_REFERENCE
< UNO3_XFIXEDTEXT
> m_xText_Bottom
;
800 UNO3_REFERENCE
< UNO3_XPROGRESSBAR
> m_xProgressBar
;
801 UNO3_REFERENCE
< UNO3_XBUTTON
> m_xButton
;
802 UNO3_RECTANGLE m_a3DLine
;
804 }; // class ProgressMonitor
806 } // namespace unocontrols
808 #endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX