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>
77 //____________________________________________________________________________________________________________
78 // includes of my own project
79 //____________________________________________________________________________________________________________
80 #include "basecontainercontrol.hxx"
82 //____________________________________________________________________________________________________________
84 //____________________________________________________________________________________________________________
86 namespace unocontrols
{
88 //____________________________________________________________________________________________________________
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 //____________________________________________________________________________________________________________
113 //____________________________________________________________________________________________________________
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 //____________________________________________________________________________________________________________
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 //____________________________________________________________________________________________________________
134 //____________________________________________________________________________________________________________
138 //________________________________________________________________________________________________________
139 // construct/destruct
140 //________________________________________________________________________________________________________
142 /**_______________________________________________________________________________________________________
155 ProgressMonitor( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xFactory
);
157 /**_______________________________________________________________________________________________________
170 virtual ~ProgressMonitor();
172 //________________________________________________________________________________________________________
174 //________________________________________________________________________________________________________
176 /**_______________________________________________________________________________________________________
177 @short give answer, if interface is supported
178 @descr The interfaces are searched by type.
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
203 @onerror A RuntimeException is thrown.
206 virtual void SAL_CALL
acquire() throw();
208 /**_______________________________________________________________________________________________________
209 @short decrement refcount
219 @onerror A RuntimeException is thrown.
222 virtual void SAL_CALL
release() throw();
224 //________________________________________________________________________________________________________
226 //________________________________________________________________________________________________________
228 /**_______________________________________________________________________________________________________
229 @short get information about supported interfaces
232 @seealso XTypeProvider
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 //________________________________________________________________________________________________________
245 //________________________________________________________________________________________________________
247 /**_______________________________________________________________________________________________________
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 //________________________________________________________________________________________________________
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]
283 @onerror DEBUG = Assertion<BR>
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 /**_______________________________________________________________________________________________________
306 virtual void SAL_CALL
removeText(
307 const ::rtl::OUString
& sTopic
,
308 sal_Bool bbeforeProgress
309 ) throw( ::com::sun::star::uno::RuntimeException
);
311 /**_______________________________________________________________________________________________________
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 //________________________________________________________________________________________________________
332 //________________________________________________________________________________________________________
334 /**_______________________________________________________________________________________________________
347 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
) throw( ::com::sun::star::uno::RuntimeException
);
349 /**_______________________________________________________________________________________________________
362 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
) throw( ::com::sun::star::uno::RuntimeException
);
364 /**_______________________________________________________________________________________________________
377 virtual void SAL_CALL
setValue( sal_Int32 nValue
) throw( ::com::sun::star::uno::RuntimeException
);
379 /**_______________________________________________________________________________________________________
392 virtual void SAL_CALL
setRange( sal_Int32 nMin
,
393 sal_Int32 nMax
) throw( ::com::sun::star::uno::RuntimeException
);
395 /**_______________________________________________________________________________________________________
408 virtual sal_Int32 SAL_CALL
getValue() throw( ::com::sun::star::uno::RuntimeException
);
410 //________________________________________________________________________________________________________
412 //________________________________________________________________________________________________________
414 /**_______________________________________________________________________________________________________
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 /**_______________________________________________________________________________________________________
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 /**_______________________________________________________________________________________________________
461 virtual void SAL_CALL
setLabel( const ::rtl::OUString
& sLabel
) throw( ::com::sun::star::uno::RuntimeException
);
463 /**_______________________________________________________________________________________________________
476 virtual void SAL_CALL
setActionCommand( const ::rtl::OUString
& sCommand
)
477 throw( ::com::sun::star::uno::RuntimeException
);
479 //________________________________________________________________________________________________________
481 //________________________________________________________________________________________________________
483 /**_______________________________________________________________________________________________________
496 virtual ::com::sun::star::awt::Size SAL_CALL
getMinimumSize() throw( ::com::sun::star::uno::RuntimeException
);
498 /**_______________________________________________________________________________________________________
511 virtual ::com::sun::star::awt::Size SAL_CALL
getPreferredSize() throw( ::com::sun::star::uno::RuntimeException
);
513 /**_______________________________________________________________________________________________________
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 //________________________________________________________________________________________________________
531 //________________________________________________________________________________________________________
533 /**_______________________________________________________________________________________________________
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 /**_______________________________________________________________________________________________________
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 /**_______________________________________________________________________________________________________
580 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> SAL_CALL
getModel()
581 throw( ::com::sun::star::uno::RuntimeException
);
583 //________________________________________________________________________________________________________
585 //________________________________________________________________________________________________________
587 /**_______________________________________________________________________________________________________
600 virtual void SAL_CALL
dispose() throw( ::com::sun::star::uno::RuntimeException
);
602 //________________________________________________________________________________________________________
604 //________________________________________________________________________________________________________
606 /**_______________________________________________________________________________________________________
619 virtual void SAL_CALL
setPosSize( sal_Int32 nX
,
623 sal_Int16 nFlags
) throw( ::com::sun::star::uno::RuntimeException
);
625 //________________________________________________________________________________________________________
627 //________________________________________________________________________________________________________
629 /**_______________________________________________________________________________________________________
642 static const ::com::sun::star::uno::Sequence
< ::rtl::OUString
> impl_getStaticSupportedServiceNames();
644 /**_______________________________________________________________________________________________________
657 static const ::rtl::OUString
impl_getStaticImplementationName();
659 //____________________________________________________________________________________________________________
661 //____________________________________________________________________________________________________________
665 /**_______________________________________________________________________________________________________
678 virtual void impl_paint( sal_Int32 nX
,
680 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& xGraphics
);
682 //____________________________________________________________________________________________________________
684 //____________________________________________________________________________________________________________
687 using BaseControl::impl_recalcLayout
;
688 /**_______________________________________________________________________________________________________
701 void impl_recalcLayout();
703 /**_______________________________________________________________________________________________________
716 void impl_rebuildFixedText();
718 /**_______________________________________________________________________________________________________
731 void impl_cleanMemory();
733 /**_______________________________________________________________________________________________________
746 IMPL_TextlistItem
* impl_searchTopic( const ::rtl::OUString
& sTopic
, sal_Bool bbeforeProgress
);
748 //____________________________________________________________________________________________________________
750 //____________________________________________________________________________________________________________
754 /**_______________________________________________________________________________________________________
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
773 //____________________________________________________________________________________________________________
775 //____________________________________________________________________________________________________________
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: */