Bump for 3.6-28
[LibreOffice.git] / UnoControls / source / inc / progressmonitor.hxx
blob1f41368034b02b581b28036e703774cccda4beca
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
30 #define _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
32 //____________________________________________________________________________________________________________
33 // includes of other projects
34 //____________________________________________________________________________________________________________
36 #include <com/sun/star/awt/XFileDialog.hpp>
37 #include <com/sun/star/awt/XTextComponent.hpp>
38 #include <com/sun/star/awt/XListBox.hpp>
39 #include <com/sun/star/awt/XProgressMonitor.hpp>
40 #include <com/sun/star/awt/TextAlign.hpp>
41 #include <com/sun/star/awt/XScrollBar.hpp>
42 #include <com/sun/star/awt/XVclContainerPeer.hpp>
43 #include <com/sun/star/awt/XTabControllerModel.hpp>
44 #include <com/sun/star/awt/XMessageBox.hpp>
45 #include <com/sun/star/awt/XTextEditField.hpp>
46 #include <com/sun/star/awt/Style.hpp>
47 #include <com/sun/star/awt/XTimeField.hpp>
48 #include <com/sun/star/awt/XVclWindowPeer.hpp>
49 #include <com/sun/star/awt/XControlModel.hpp>
50 #include <com/sun/star/awt/XSpinField.hpp>
51 #include <com/sun/star/awt/XUnoControlContainer.hpp>
52 #include <com/sun/star/awt/XTextLayoutConstrains.hpp>
53 #include <com/sun/star/awt/XNumericField.hpp>
54 #include <com/sun/star/awt/XButton.hpp>
55 #include <com/sun/star/awt/XTextArea.hpp>
56 #include <com/sun/star/awt/XImageButton.hpp>
57 #include <com/sun/star/awt/XFixedText.hpp>
58 #include <com/sun/star/awt/XControlContainer.hpp>
59 #include <com/sun/star/awt/XDialog.hpp>
60 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
61 #include <com/sun/star/awt/XRadioButton.hpp>
62 #include <com/sun/star/awt/XCurrencyField.hpp>
63 #include <com/sun/star/awt/XPatternField.hpp>
64 #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
65 #include <com/sun/star/awt/XTabController.hpp>
66 #include <com/sun/star/awt/XVclContainer.hpp>
67 #include <com/sun/star/awt/XDateField.hpp>
68 #include <com/sun/star/awt/XComboBox.hpp>
69 #include <com/sun/star/awt/XControl.hpp>
70 #include <com/sun/star/awt/XCheckBox.hpp>
71 #include <com/sun/star/awt/MessageBoxCommand.hpp>
72 #include <com/sun/star/awt/XLayoutConstrains.hpp>
73 #include <com/sun/star/awt/XProgressBar.hpp>
75 #include <vector>
77 //____________________________________________________________________________________________________________
78 // includes of my own project
79 //____________________________________________________________________________________________________________
80 #include "basecontainercontrol.hxx"
82 //____________________________________________________________________________________________________________
83 // namespace
84 //____________________________________________________________________________________________________________
86 namespace unocontrols{
88 //____________________________________________________________________________________________________________
89 // defines
90 //____________________________________________________________________________________________________________
92 #define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor"
93 #define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor"
94 #define PROGRESSMONITOR_FREEBORDER 10 // border around and between the controls
95 #define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
96 #define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
97 #define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
98 #define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
99 #define CONTROLNAME_TEXT "Text" // identifier the control in container
100 #define CONTROLNAME_BUTTON "Button" // -||-
101 #define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
102 #define DEFAULT_BUTTONLABEL "Abbrechen"
103 #define PROGRESSMONITOR_DEFAULT_TOPIC "\0"
104 #define PROGRESSMONITOR_DEFAULT_TEXT "\0"
105 #define PROGRESSMONITOR_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
106 #define PROGRESSMONITOR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
107 #define PROGRESSMONITOR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
108 #define PROGRESSMONITOR_DEFAULT_WIDTH 350
109 #define PROGRESSMONITOR_DEFAULT_HEIGHT 100
111 //____________________________________________________________________________________________________________
112 // structs, types
113 //____________________________________________________________________________________________________________
115 /// Item of TextList
116 struct IMPL_TextlistItem
118 ::rtl::OUString sTopic ; /// Left site of textline in dialog
119 ::rtl::OUString sText ; /// Right site of textline in dialog
122 //____________________________________________________________________________________________________________
123 // class declaration
124 //____________________________________________________________________________________________________________
126 class ProgressMonitor : public ::com::sun::star::awt::XLayoutConstrains
127 , public ::com::sun::star::awt::XButton
128 , public ::com::sun::star::awt::XProgressMonitor
129 , public BaseContainerControl
132 //____________________________________________________________________________________________________________
133 // public methods
134 //____________________________________________________________________________________________________________
136 public:
138 //________________________________________________________________________________________________________
139 // construct/destruct
140 //________________________________________________________________________________________________________
142 /**_______________________________________________________________________________________________________
143 @short
144 @descr
146 @seealso
148 @param
150 @return
152 @onerror
155 ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
157 /**_______________________________________________________________________________________________________
158 @short
159 @descr
161 @seealso
163 @param
165 @return
167 @onerror
170 virtual ~ProgressMonitor();
172 //________________________________________________________________________________________________________
173 // XInterface
174 //________________________________________________________________________________________________________
176 /**_______________________________________________________________________________________________________
177 @short give answer, if interface is supported
178 @descr The interfaces are searched by type.
180 @seealso XInterface
182 @param "rType" is the type of searched interface.
184 @return Any information about found interface
186 @onerror A RuntimeException is thrown.
189 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
190 throw( ::com::sun::star::uno::RuntimeException );
192 /**_______________________________________________________________________________________________________
193 @short increment refcount
194 @descr -
196 @seealso XInterface
197 @seealso release()
199 @param -
201 @return -
203 @onerror A RuntimeException is thrown.
206 virtual void SAL_CALL acquire() throw();
208 /**_______________________________________________________________________________________________________
209 @short decrement refcount
210 @descr -
212 @seealso XInterface
213 @seealso acquire()
215 @param -
217 @return -
219 @onerror A RuntimeException is thrown.
222 virtual void SAL_CALL release() throw();
224 //________________________________________________________________________________________________________
225 // XTypeProvider
226 //________________________________________________________________________________________________________
228 /**_______________________________________________________________________________________________________
229 @short get information about supported interfaces
230 @descr -
232 @seealso XTypeProvider
234 @param -
236 @return Sequence of types of all supported interfaces
238 @onerror A RuntimeException is thrown.
241 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw( ::com::sun::star::uno::RuntimeException );
243 //________________________________________________________________________________________________________
244 // XAggregation
245 //________________________________________________________________________________________________________
247 /**_______________________________________________________________________________________________________
248 @short -
249 @descr -
251 @seealso -
253 @param -
255 @return -
257 @onerror -
260 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType )
261 throw( ::com::sun::star::uno::RuntimeException );
263 //________________________________________________________________________________________________________
264 // XProgressMonitor
265 //________________________________________________________________________________________________________
267 /**_______________________________________________________________________________________________________
268 @short add topic to dialog
269 @descr Add a topic with a text in right textlist (used for FixedText-member).<BR>
270 ( "beforeProgress" fix the right list ). The dialog metric is recalculated.
272 @seealso removeText(), updateText()
274 @param sTopic Name of topic<BR>
275 [sTopic != "" && sTopic != NULL]
276 @param sText Value of topic<BR>
277 [sText != "" && sText != NULL]
278 @param bbeforeProgress Position of topic<BR>
279 [True => before progressbar / False => below progressbar]
281 @return -
283 @onerror DEBUG = Assertion<BR>
284 RELEASE = nothing
287 virtual void SAL_CALL addText(
288 const ::rtl::OUString& sTopic ,
289 const ::rtl::OUString& sText ,
290 sal_Bool bbeforeProgress
291 ) throw( ::com::sun::star::uno::RuntimeException );
293 /**_______________________________________________________________________________________________________
294 @short -
295 @descr -
297 @seealso -
299 @param -
301 @return -
303 @onerror -
306 virtual void SAL_CALL removeText(
307 const ::rtl::OUString& sTopic ,
308 sal_Bool bbeforeProgress
309 ) throw( ::com::sun::star::uno::RuntimeException );
311 /**_______________________________________________________________________________________________________
312 @short -
313 @descr -
315 @seealso -
317 @param -
319 @return -
321 @onerror -
324 virtual void SAL_CALL updateText(
325 const ::rtl::OUString& sTopic ,
326 const ::rtl::OUString& sText ,
327 sal_Bool bbeforeProgress
328 ) throw( ::com::sun::star::uno::RuntimeException );
330 //________________________________________________________________________________________________________
331 // XProgressBar
332 //________________________________________________________________________________________________________
334 /**_______________________________________________________________________________________________________
335 @short -
336 @descr -
338 @seealso -
340 @param -
342 @return -
344 @onerror -
347 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException );
349 /**_______________________________________________________________________________________________________
350 @short -
351 @descr -
353 @seealso -
355 @param -
357 @return -
359 @onerror -
362 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException );
364 /**_______________________________________________________________________________________________________
365 @short -
366 @descr -
368 @seealso -
370 @param -
372 @return -
374 @onerror -
377 virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( ::com::sun::star::uno::RuntimeException );
379 /**_______________________________________________________________________________________________________
380 @short -
381 @descr -
383 @seealso -
385 @param -
387 @return -
389 @onerror -
392 virtual void SAL_CALL setRange( sal_Int32 nMin ,
393 sal_Int32 nMax ) throw( ::com::sun::star::uno::RuntimeException );
395 /**_______________________________________________________________________________________________________
396 @short -
397 @descr -
399 @seealso -
401 @param -
403 @return -
405 @onerror -
408 virtual sal_Int32 SAL_CALL getValue() throw( ::com::sun::star::uno::RuntimeException );
410 //________________________________________________________________________________________________________
411 // XButton
412 //________________________________________________________________________________________________________
414 /**_______________________________________________________________________________________________________
415 @short -
416 @descr -
418 @seealso -
420 @param -
422 @return -
424 @onerror -
427 virtual void SAL_CALL addActionListener(
428 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& xListener
429 ) throw( ::com::sun::star::uno::RuntimeException );
431 /**_______________________________________________________________________________________________________
432 @short -
433 @descr -
435 @seealso -
437 @param -
439 @return -
441 @onerror -
444 virtual void SAL_CALL removeActionListener(
445 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& xListener
446 ) throw( ::com::sun::star::uno::RuntimeException );
448 /**_______________________________________________________________________________________________________
449 @short -
450 @descr -
452 @seealso -
454 @param -
456 @return -
458 @onerror -
461 virtual void SAL_CALL setLabel( const ::rtl::OUString& sLabel ) throw( ::com::sun::star::uno::RuntimeException );
463 /**_______________________________________________________________________________________________________
464 @short -
465 @descr -
467 @seealso -
469 @param -
471 @return -
473 @onerror -
476 virtual void SAL_CALL setActionCommand( const ::rtl::OUString& sCommand )
477 throw( ::com::sun::star::uno::RuntimeException );
479 //________________________________________________________________________________________________________
480 // XLayoutConstrains
481 //________________________________________________________________________________________________________
483 /**_______________________________________________________________________________________________________
484 @short -
485 @descr -
487 @seealso -
489 @param -
491 @return -
493 @onerror -
496 virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() throw( ::com::sun::star::uno::RuntimeException );
498 /**_______________________________________________________________________________________________________
499 @short -
500 @descr -
502 @seealso -
504 @param -
506 @return -
508 @onerror -
511 virtual ::com::sun::star::awt::Size SAL_CALL getPreferredSize() throw( ::com::sun::star::uno::RuntimeException );
513 /**_______________________________________________________________________________________________________
514 @short -
515 @descr -
517 @seealso -
519 @param -
521 @return -
523 @onerror -
526 virtual ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize )
527 throw( ::com::sun::star::uno::RuntimeException );
529 //________________________________________________________________________________________________________
530 // XControl
531 //________________________________________________________________________________________________________
533 /**_______________________________________________________________________________________________________
534 @short -
535 @descr -
537 @seealso -
539 @param -
541 @return -
543 @onerror -
546 virtual void SAL_CALL createPeer(
547 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& xToolkit ,
548 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent
549 ) throw( ::com::sun::star::uno::RuntimeException );
551 /**_______________________________________________________________________________________________________
552 @short -
553 @descr -
555 @seealso -
557 @param -
559 @return -
561 @onerror -
564 virtual sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel )
565 throw( ::com::sun::star::uno::RuntimeException );
567 /**_______________________________________________________________________________________________________
568 @short -
569 @descr -
571 @seealso -
573 @param -
575 @return -
577 @onerror -
580 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel()
581 throw( ::com::sun::star::uno::RuntimeException );
583 //________________________________________________________________________________________________________
584 // XComponent
585 //________________________________________________________________________________________________________
587 /**_______________________________________________________________________________________________________
588 @short -
589 @descr -
591 @seealso -
593 @param -
595 @return -
597 @onerror -
600 virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
602 //________________________________________________________________________________________________________
603 // XWindow
604 //________________________________________________________________________________________________________
606 /**_______________________________________________________________________________________________________
607 @short -
608 @descr -
610 @seealso -
612 @param -
614 @return -
616 @onerror -
619 virtual void SAL_CALL setPosSize( sal_Int32 nX ,
620 sal_Int32 nY ,
621 sal_Int32 nWidth ,
622 sal_Int32 nHeight ,
623 sal_Int16 nFlags ) throw( ::com::sun::star::uno::RuntimeException );
625 //________________________________________________________________________________________________________
626 // BaseControl
627 //________________________________________________________________________________________________________
629 /**_______________________________________________________________________________________________________
630 @short -
631 @descr -
633 @seealso -
635 @param -
637 @return -
639 @onerror -
642 static const ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames();
644 /**_______________________________________________________________________________________________________
645 @short -
646 @descr -
648 @seealso -
650 @param -
652 @return -
654 @onerror -
657 static const ::rtl::OUString impl_getStaticImplementationName();
659 //____________________________________________________________________________________________________________
660 // protected methods
661 //____________________________________________________________________________________________________________
663 protected:
665 /**_______________________________________________________________________________________________________
666 @short -
667 @descr -
669 @seealso -
671 @param -
673 @return -
675 @onerror -
678 virtual void impl_paint( sal_Int32 nX ,
679 sal_Int32 nY ,
680 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics );
682 //____________________________________________________________________________________________________________
683 // private methods
684 //____________________________________________________________________________________________________________
686 private:
687 using BaseControl::impl_recalcLayout;
688 /**_______________________________________________________________________________________________________
689 @short -
690 @descr -
692 @seealso -
694 @param -
696 @return -
698 @onerror -
701 void impl_recalcLayout();
703 /**_______________________________________________________________________________________________________
704 @short -
705 @descr -
707 @seealso -
709 @param -
711 @return -
713 @onerror -
716 void impl_rebuildFixedText();
718 /**_______________________________________________________________________________________________________
719 @short -
720 @descr -
722 @seealso -
724 @param -
726 @return -
728 @onerror -
731 void impl_cleanMemory();
733 /**_______________________________________________________________________________________________________
734 @short -
735 @descr -
737 @seealso -
739 @param -
741 @return -
743 @onerror -
746 IMPL_TextlistItem* impl_searchTopic( const ::rtl::OUString& sTopic , sal_Bool bbeforeProgress );
748 //____________________________________________________________________________________________________________
749 // debug methods
750 //____________________________________________________________________________________________________________
752 private:
754 /**_______________________________________________________________________________________________________
755 @short -
756 @descr -
758 @seealso -
760 @param -
762 @return -
764 @onerror -
767 #ifdef DBG_UTIL
769 sal_Bool impl_debug_checkParameter( const ::rtl::OUString& sTopic, const ::rtl::OUString& sText, sal_Bool bbeforeProgress ); // addText, updateText
770 sal_Bool impl_debug_checkParameter( const ::rtl::OUString& rTopic, sal_Bool bbeforeProgress ); // removeText
772 #endif
773 //____________________________________________________________________________________________________________
774 // private variables
775 //____________________________________________________________________________________________________________
777 private:
778 ::std::vector < IMPL_TextlistItem* > maTextlist_Top; // Elements before progress
779 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText > m_xTopic_Top ; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText")
780 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText > m_xText_Top ;
782 ::std::vector < IMPL_TextlistItem* > maTextlist_Bottom; // Elements below of progress
783 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText > m_xTopic_Bottom ; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText")
784 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText > m_xText_Bottom ;
786 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XProgressBar > m_xProgressBar ;
787 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton > m_xButton ;
788 ::com::sun::star::awt::Rectangle m_a3DLine ;
790 }; // class ProgressMonitor
792 } // namespace unocontrols
794 #endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
796 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */