bump product version to 4.1.6.2
[LibreOffice.git] / UnoControls / source / inc / progressmonitor.hxx
blob163dc0963626fc67471b1c891b6ac641ee499439
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
62 #include <vector>
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 //____________________________________________________________________________________________________________
88 // structs, types
89 //____________________________________________________________________________________________________________
91 /// Item of TextList
92 struct IMPL_TextlistItem
94 OUString sTopic ; /// Left site of textline in dialog
95 OUString sText ; /// Right site of textline in dialog
98 //____________________________________________________________________________________________________________
99 // class declaration
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 //____________________________________________________________________________________________________________
109 // public methods
110 //____________________________________________________________________________________________________________
112 public:
114 //________________________________________________________________________________________________________
115 // construct/destruct
116 //________________________________________________________________________________________________________
118 /**_______________________________________________________________________________________________________
119 @short
120 @descr
122 @seealso
124 @param
126 @return
128 @onerror
131 ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
133 /**_______________________________________________________________________________________________________
134 @short
135 @descr
137 @seealso
139 @param
141 @return
143 @onerror
146 virtual ~ProgressMonitor();
148 //________________________________________________________________________________________________________
149 // XInterface
150 //________________________________________________________________________________________________________
152 /**_______________________________________________________________________________________________________
153 @short give answer, if interface is supported
154 @descr The interfaces are searched by type.
156 @seealso XInterface
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
170 @descr -
172 @seealso XInterface
173 @seealso release()
175 @param -
177 @return -
179 @onerror A RuntimeException is thrown.
182 virtual void SAL_CALL acquire() throw();
184 /**_______________________________________________________________________________________________________
185 @short decrement refcount
186 @descr -
188 @seealso XInterface
189 @seealso acquire()
191 @param -
193 @return -
195 @onerror A RuntimeException is thrown.
198 virtual void SAL_CALL release() throw();
200 //________________________________________________________________________________________________________
201 // XTypeProvider
202 //________________________________________________________________________________________________________
204 /**_______________________________________________________________________________________________________
205 @short get information about supported interfaces
206 @descr -
208 @seealso XTypeProvider
210 @param -
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 //________________________________________________________________________________________________________
220 // XAggregation
221 //________________________________________________________________________________________________________
223 /**_______________________________________________________________________________________________________
224 @short -
225 @descr -
227 @seealso -
229 @param -
231 @return -
233 @onerror -
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 //________________________________________________________________________________________________________
240 // XProgressMonitor
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]
257 @return -
259 @onerror DEBUG = Assertion<BR>
260 RELEASE = nothing
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 /**_______________________________________________________________________________________________________
270 @short -
271 @descr -
273 @seealso -
275 @param -
277 @return -
279 @onerror -
282 virtual void SAL_CALL removeText(
283 const OUString& sTopic ,
284 sal_Bool bbeforeProgress
285 ) throw( ::com::sun::star::uno::RuntimeException );
287 /**_______________________________________________________________________________________________________
288 @short -
289 @descr -
291 @seealso -
293 @param -
295 @return -
297 @onerror -
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 //________________________________________________________________________________________________________
307 // XProgressBar
308 //________________________________________________________________________________________________________
310 /**_______________________________________________________________________________________________________
311 @short -
312 @descr -
314 @seealso -
316 @param -
318 @return -
320 @onerror -
323 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException );
325 /**_______________________________________________________________________________________________________
326 @short -
327 @descr -
329 @seealso -
331 @param -
333 @return -
335 @onerror -
338 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException );
340 /**_______________________________________________________________________________________________________
341 @short -
342 @descr -
344 @seealso -
346 @param -
348 @return -
350 @onerror -
353 virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( ::com::sun::star::uno::RuntimeException );
355 /**_______________________________________________________________________________________________________
356 @short -
357 @descr -
359 @seealso -
361 @param -
363 @return -
365 @onerror -
368 virtual void SAL_CALL setRange( sal_Int32 nMin ,
369 sal_Int32 nMax ) throw( ::com::sun::star::uno::RuntimeException );
371 /**_______________________________________________________________________________________________________
372 @short -
373 @descr -
375 @seealso -
377 @param -
379 @return -
381 @onerror -
384 virtual sal_Int32 SAL_CALL getValue() throw( ::com::sun::star::uno::RuntimeException );
386 //________________________________________________________________________________________________________
387 // XButton
388 //________________________________________________________________________________________________________
390 /**_______________________________________________________________________________________________________
391 @short -
392 @descr -
394 @seealso -
396 @param -
398 @return -
400 @onerror -
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 /**_______________________________________________________________________________________________________
408 @short -
409 @descr -
411 @seealso -
413 @param -
415 @return -
417 @onerror -
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 /**_______________________________________________________________________________________________________
425 @short -
426 @descr -
428 @seealso -
430 @param -
432 @return -
434 @onerror -
437 virtual void SAL_CALL setLabel( const OUString& sLabel ) throw( ::com::sun::star::uno::RuntimeException );
439 /**_______________________________________________________________________________________________________
440 @short -
441 @descr -
443 @seealso -
445 @param -
447 @return -
449 @onerror -
452 virtual void SAL_CALL setActionCommand( const OUString& sCommand )
453 throw( ::com::sun::star::uno::RuntimeException );
455 //________________________________________________________________________________________________________
456 // XLayoutConstrains
457 //________________________________________________________________________________________________________
459 /**_______________________________________________________________________________________________________
460 @short -
461 @descr -
463 @seealso -
465 @param -
467 @return -
469 @onerror -
472 virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() throw( ::com::sun::star::uno::RuntimeException );
474 /**_______________________________________________________________________________________________________
475 @short -
476 @descr -
478 @seealso -
480 @param -
482 @return -
484 @onerror -
487 virtual ::com::sun::star::awt::Size SAL_CALL getPreferredSize() throw( ::com::sun::star::uno::RuntimeException );
489 /**_______________________________________________________________________________________________________
490 @short -
491 @descr -
493 @seealso -
495 @param -
497 @return -
499 @onerror -
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 //________________________________________________________________________________________________________
506 // XControl
507 //________________________________________________________________________________________________________
509 /**_______________________________________________________________________________________________________
510 @short -
511 @descr -
513 @seealso -
515 @param -
517 @return -
519 @onerror -
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 /**_______________________________________________________________________________________________________
528 @short -
529 @descr -
531 @seealso -
533 @param -
535 @return -
537 @onerror -
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 /**_______________________________________________________________________________________________________
544 @short -
545 @descr -
547 @seealso -
549 @param -
551 @return -
553 @onerror -
556 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel()
557 throw( ::com::sun::star::uno::RuntimeException );
559 //________________________________________________________________________________________________________
560 // XComponent
561 //________________________________________________________________________________________________________
563 /**_______________________________________________________________________________________________________
564 @short -
565 @descr -
567 @seealso -
569 @param -
571 @return -
573 @onerror -
576 virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
578 //________________________________________________________________________________________________________
579 // XWindow
580 //________________________________________________________________________________________________________
582 /**_______________________________________________________________________________________________________
583 @short -
584 @descr -
586 @seealso -
588 @param -
590 @return -
592 @onerror -
595 virtual void SAL_CALL setPosSize( sal_Int32 nX ,
596 sal_Int32 nY ,
597 sal_Int32 nWidth ,
598 sal_Int32 nHeight ,
599 sal_Int16 nFlags ) throw( ::com::sun::star::uno::RuntimeException );
601 //________________________________________________________________________________________________________
602 // BaseControl
603 //________________________________________________________________________________________________________
605 /**_______________________________________________________________________________________________________
606 @short -
607 @descr -
609 @seealso -
611 @param -
613 @return -
615 @onerror -
618 static const ::com::sun::star::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
620 /**_______________________________________________________________________________________________________
621 @short -
622 @descr -
624 @seealso -
626 @param -
628 @return -
630 @onerror -
633 static const OUString impl_getStaticImplementationName();
635 //____________________________________________________________________________________________________________
636 // protected methods
637 //____________________________________________________________________________________________________________
639 protected:
641 /**_______________________________________________________________________________________________________
642 @short -
643 @descr -
645 @seealso -
647 @param -
649 @return -
651 @onerror -
654 virtual void impl_paint( sal_Int32 nX ,
655 sal_Int32 nY ,
656 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics );
658 //____________________________________________________________________________________________________________
659 // private methods
660 //____________________________________________________________________________________________________________
662 private:
663 using BaseControl::impl_recalcLayout;
664 /**_______________________________________________________________________________________________________
665 @short -
666 @descr -
668 @seealso -
670 @param -
672 @return -
674 @onerror -
677 void impl_recalcLayout();
679 /**_______________________________________________________________________________________________________
680 @short -
681 @descr -
683 @seealso -
685 @param -
687 @return -
689 @onerror -
692 void impl_rebuildFixedText();
694 /**_______________________________________________________________________________________________________
695 @short -
696 @descr -
698 @seealso -
700 @param -
702 @return -
704 @onerror -
707 void impl_cleanMemory();
709 /**_______________________________________________________________________________________________________
710 @short -
711 @descr -
713 @seealso -
715 @param -
717 @return -
719 @onerror -
722 IMPL_TextlistItem* impl_searchTopic( const OUString& sTopic , sal_Bool bbeforeProgress );
724 //____________________________________________________________________________________________________________
725 // debug methods
726 //____________________________________________________________________________________________________________
728 private:
730 /**_______________________________________________________________________________________________________
731 @short -
732 @descr -
734 @seealso -
736 @param -
738 @return -
740 @onerror -
743 #ifdef DBG_UTIL
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
748 #endif
749 //____________________________________________________________________________________________________________
750 // private variables
751 //____________________________________________________________________________________________________________
753 private:
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: */