Update ooo320-m1
[ooovba.git] / UnoControls / source / inc / progressmonitor.hxx
blob3cbf633ae77958f61ac848ff74eacd874efcb1cc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: progressmonitor.hxx,v $
10 * $Revision: 1.5 $
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 //____________________________________________________________________________________________________________
83 // namespace
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 //____________________________________________________________________________________________________________
109 // defines
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!!!
132 #undef DEFAULT_WIDTH
133 #undef DEFAULT_HEIGHT
134 #define DEFAULT_WIDTH 350
135 #define DEFAULT_HEIGHT 100
137 //____________________________________________________________________________________________________________
138 // structs, types
139 //____________________________________________________________________________________________________________
141 /// Item of TextList
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 //____________________________________________________________________________________________________________
153 // class declaration
154 //____________________________________________________________________________________________________________
156 class ProgressMonitor : public UNO3_XLAYOUTCONSTRAINS
157 , public UNO3_XBUTTON
158 , public UNO3_XPROGRESSMONITOR
159 , public BaseContainerControl
162 //____________________________________________________________________________________________________________
163 // public methods
164 //____________________________________________________________________________________________________________
166 public:
168 //________________________________________________________________________________________________________
169 // construct/destruct
170 //________________________________________________________________________________________________________
172 /**_______________________________________________________________________________________________________
173 @short
174 @descr
176 @seealso
178 @param
180 @return
182 @onerror
185 ProgressMonitor( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
187 /**_______________________________________________________________________________________________________
188 @short
189 @descr
191 @seealso
193 @param
195 @return
197 @onerror
200 virtual ~ProgressMonitor();
202 //________________________________________________________________________________________________________
203 // XInterface
204 //________________________________________________________________________________________________________
206 /**_______________________________________________________________________________________________________
207 @short give answer, if interface is supported
208 @descr The interfaces are searched by type.
210 @seealso XInterface
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
223 @descr -
225 @seealso XInterface
226 @seealso release()
228 @param -
230 @return -
232 @onerror A RuntimeException is thrown.
235 virtual void SAL_CALL acquire() throw();
237 /**_______________________________________________________________________________________________________
238 @short decrement refcount
239 @descr -
241 @seealso XInterface
242 @seealso acquire()
244 @param -
246 @return -
248 @onerror A RuntimeException is thrown.
251 virtual void SAL_CALL release() throw();
253 //________________________________________________________________________________________________________
254 // XTypeProvider
255 //________________________________________________________________________________________________________
257 /**_______________________________________________________________________________________________________
258 @short get information about supported interfaces
259 @descr -
261 @seealso XTypeProvider
263 @param -
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 //________________________________________________________________________________________________________
273 // XAggregation
274 //________________________________________________________________________________________________________
276 /**_______________________________________________________________________________________________________
277 @short -
278 @descr -
280 @seealso -
282 @param -
284 @return -
286 @onerror -
289 virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
291 //________________________________________________________________________________________________________
292 // XProgressMonitor
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]
309 @return -
311 @onerror DEBUG = Assertion<BR>
312 RELEASE = nothing
315 virtual void SAL_CALL addText( const UNO3_OUSTRING& sTopic ,
316 const UNO3_OUSTRING& sText ,
317 sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
319 /**_______________________________________________________________________________________________________
320 @short -
321 @descr -
323 @seealso -
325 @param -
327 @return -
329 @onerror -
332 virtual void SAL_CALL removeText( const UNO3_OUSTRING& sTopic ,
333 sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
335 /**_______________________________________________________________________________________________________
336 @short -
337 @descr -
339 @seealso -
341 @param -
343 @return -
345 @onerror -
348 virtual void SAL_CALL updateText( const UNO3_OUSTRING& sTopic ,
349 const UNO3_OUSTRING& sText ,
350 sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
352 //________________________________________________________________________________________________________
353 // XProgressBar
354 //________________________________________________________________________________________________________
356 /**_______________________________________________________________________________________________________
357 @short -
358 @descr -
360 @seealso -
362 @param -
364 @return -
366 @onerror -
369 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
371 /**_______________________________________________________________________________________________________
372 @short -
373 @descr -
375 @seealso -
377 @param -
379 @return -
381 @onerror -
384 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
386 /**_______________________________________________________________________________________________________
387 @short -
388 @descr -
390 @seealso -
392 @param -
394 @return -
396 @onerror -
399 virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION );
401 /**_______________________________________________________________________________________________________
402 @short -
403 @descr -
405 @seealso -
407 @param -
409 @return -
411 @onerror -
414 virtual void SAL_CALL setRange( sal_Int32 nMin ,
415 sal_Int32 nMax ) throw( UNO3_RUNTIMEEXCEPTION );
417 /**_______________________________________________________________________________________________________
418 @short -
419 @descr -
421 @seealso -
423 @param -
425 @return -
427 @onerror -
430 virtual sal_Int32 SAL_CALL getValue() throw( UNO3_RUNTIMEEXCEPTION );
432 //________________________________________________________________________________________________________
433 // XButton
434 //________________________________________________________________________________________________________
436 /**_______________________________________________________________________________________________________
437 @short -
438 @descr -
440 @seealso -
442 @param -
444 @return -
446 @onerror -
449 virtual void SAL_CALL addActionListener( const UNO3_REFERENCE< UNO3_XACTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
451 /**_______________________________________________________________________________________________________
452 @short -
453 @descr -
455 @seealso -
457 @param -
459 @return -
461 @onerror -
464 virtual void SAL_CALL removeActionListener( const UNO3_REFERENCE< UNO3_XACTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
466 /**_______________________________________________________________________________________________________
467 @short -
468 @descr -
470 @seealso -
472 @param -
474 @return -
476 @onerror -
479 virtual void SAL_CALL setLabel( const UNO3_OUSTRING& sLabel ) throw( UNO3_RUNTIMEEXCEPTION );
481 /**_______________________________________________________________________________________________________
482 @short -
483 @descr -
485 @seealso -
487 @param -
489 @return -
491 @onerror -
494 virtual void SAL_CALL setActionCommand( const UNO3_OUSTRING& sCommand ) throw( UNO3_RUNTIMEEXCEPTION );
496 //________________________________________________________________________________________________________
497 // XLayoutConstrains
498 //________________________________________________________________________________________________________
500 /**_______________________________________________________________________________________________________
501 @short -
502 @descr -
504 @seealso -
506 @param -
508 @return -
510 @onerror -
513 virtual UNO3_SIZE SAL_CALL getMinimumSize() throw( UNO3_RUNTIMEEXCEPTION );
515 /**_______________________________________________________________________________________________________
516 @short -
517 @descr -
519 @seealso -
521 @param -
523 @return -
525 @onerror -
528 virtual UNO3_SIZE SAL_CALL getPreferredSize() throw( UNO3_RUNTIMEEXCEPTION );
530 /**_______________________________________________________________________________________________________
531 @short -
532 @descr -
534 @seealso -
536 @param -
538 @return -
540 @onerror -
543 virtual UNO3_SIZE SAL_CALL calcAdjustedSize( const UNO3_SIZE& aNewSize ) throw( UNO3_RUNTIMEEXCEPTION );
545 //________________________________________________________________________________________________________
546 // XControl
547 //________________________________________________________________________________________________________
549 /**_______________________________________________________________________________________________________
550 @short -
551 @descr -
553 @seealso -
555 @param -
557 @return -
559 @onerror -
562 virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit ,
563 const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION );
565 /**_______________________________________________________________________________________________________
566 @short -
567 @descr -
569 @seealso -
571 @param -
573 @return -
575 @onerror -
578 virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
580 /**_______________________________________________________________________________________________________
581 @short -
582 @descr -
584 @seealso -
586 @param -
588 @return -
590 @onerror -
593 virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
595 //________________________________________________________________________________________________________
596 // XComponent
597 //________________________________________________________________________________________________________
599 /**_______________________________________________________________________________________________________
600 @short -
601 @descr -
603 @seealso -
605 @param -
607 @return -
609 @onerror -
612 virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
614 //________________________________________________________________________________________________________
615 // XWindow
616 //________________________________________________________________________________________________________
618 /**_______________________________________________________________________________________________________
619 @short -
620 @descr -
622 @seealso -
624 @param -
626 @return -
628 @onerror -
631 virtual void SAL_CALL setPosSize( sal_Int32 nX ,
632 sal_Int32 nY ,
633 sal_Int32 nWidth ,
634 sal_Int32 nHeight ,
635 sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION );
637 //________________________________________________________________________________________________________
638 // BaseControl
639 //________________________________________________________________________________________________________
641 /**_______________________________________________________________________________________________________
642 @short -
643 @descr -
645 @seealso -
647 @param -
649 @return -
651 @onerror -
654 static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
656 /**_______________________________________________________________________________________________________
657 @short -
658 @descr -
660 @seealso -
662 @param -
664 @return -
666 @onerror -
669 static const UNO3_OUSTRING impl_getStaticImplementationName();
671 //____________________________________________________________________________________________________________
672 // protected methods
673 //____________________________________________________________________________________________________________
675 protected:
677 /**_______________________________________________________________________________________________________
678 @short -
679 @descr -
681 @seealso -
683 @param -
685 @return -
687 @onerror -
690 virtual void impl_paint( sal_Int32 nX ,
691 sal_Int32 nY ,
692 const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
694 //____________________________________________________________________________________________________________
695 // private methods
696 //____________________________________________________________________________________________________________
698 private:
699 using BaseControl::impl_recalcLayout;
700 /**_______________________________________________________________________________________________________
701 @short -
702 @descr -
704 @seealso -
706 @param -
708 @return -
710 @onerror -
713 void impl_recalcLayout();
715 /**_______________________________________________________________________________________________________
716 @short -
717 @descr -
719 @seealso -
721 @param -
723 @return -
725 @onerror -
728 void impl_rebuildFixedText();
730 /**_______________________________________________________________________________________________________
731 @short -
732 @descr -
734 @seealso -
736 @param -
738 @return -
740 @onerror -
743 void impl_cleanMemory();
745 /**_______________________________________________________________________________________________________
746 @short -
747 @descr -
749 @seealso -
751 @param -
753 @return -
755 @onerror -
758 IMPL_TextlistItem* impl_searchTopic( const UNO3_OUSTRING& sTopic ,
759 sal_Bool bbeforeProgress );
761 //____________________________________________________________________________________________________________
762 // debug methods
763 //____________________________________________________________________________________________________________
765 private:
767 /**_______________________________________________________________________________________________________
768 @short -
769 @descr -
771 @seealso -
773 @param -
775 @return -
777 @onerror -
780 #ifdef DBG_UTIL
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
785 #endif
786 //____________________________________________________________________________________________________________
787 // private variables
788 //____________________________________________________________________________________________________________
790 private:
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