GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / UnoControls / source / inc / progressmonitor.hxx
blob48bc2b9749b25829a6c88f9effc07b83c7b31ed5
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/XLayoutConstrains.hpp>
59 #include <com/sun/star/awt/XProgressBar.hpp>
61 #include <vector>
63 #include "basecontainercontrol.hxx"
65 namespace unocontrols{
67 #define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor"
68 #define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor"
69 #define PROGRESSMONITOR_FREEBORDER 10 // border around and between the controls
70 #define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
71 #define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
72 #define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
73 #define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
74 #define CONTROLNAME_TEXT "Text" // identifier the control in container
75 #define CONTROLNAME_BUTTON "Button" // -||-
76 #define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
77 #define DEFAULT_BUTTONLABEL "Abbrechen"
78 #define PROGRESSMONITOR_DEFAULT_TOPIC "\0"
79 #define PROGRESSMONITOR_DEFAULT_TEXT "\0"
80 #define PROGRESSMONITOR_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
81 #define PROGRESSMONITOR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
82 #define PROGRESSMONITOR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
83 #define PROGRESSMONITOR_DEFAULT_WIDTH 350
84 #define PROGRESSMONITOR_DEFAULT_HEIGHT 100
86 //____________________________________________________________________________________________________________
87 // structs, types
88 //____________________________________________________________________________________________________________
90 /// Item of TextList
91 struct IMPL_TextlistItem
93 OUString sTopic ; /// Left site of textline in dialog
94 OUString sText ; /// Right site of textline in dialog
97 //____________________________________________________________________________________________________________
98 // class declaration
99 //____________________________________________________________________________________________________________
101 class ProgressMonitor : public ::com::sun::star::awt::XLayoutConstrains
102 , public ::com::sun::star::awt::XButton
103 , public ::com::sun::star::awt::XProgressMonitor
104 , public BaseContainerControl
107 //____________________________________________________________________________________________________________
108 // public methods
109 //____________________________________________________________________________________________________________
111 public:
113 //________________________________________________________________________________________________________
114 // construct/destruct
115 //________________________________________________________________________________________________________
117 /**_______________________________________________________________________________________________________
118 @short
119 @descr
121 @seealso
123 @param
125 @return
127 @onerror
130 ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
132 /**_______________________________________________________________________________________________________
133 @short
134 @descr
136 @seealso
138 @param
140 @return
142 @onerror
145 virtual ~ProgressMonitor();
147 //________________________________________________________________________________________________________
148 // XInterface
149 //________________________________________________________________________________________________________
151 /**_______________________________________________________________________________________________________
152 @short give answer, if interface is supported
153 @descr The interfaces are searched by type.
155 @seealso XInterface
157 @param "rType" is the type of searched interface.
159 @return Any information about found interface
161 @onerror A RuntimeException is thrown.
164 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
165 throw( ::com::sun::star::uno::RuntimeException );
167 /**_______________________________________________________________________________________________________
168 @short increment refcount
169 @descr -
171 @seealso XInterface
172 @seealso release()
174 @param -
176 @return -
178 @onerror A RuntimeException is thrown.
181 virtual void SAL_CALL acquire() throw();
183 /**_______________________________________________________________________________________________________
184 @short decrement refcount
185 @descr -
187 @seealso XInterface
188 @seealso acquire()
190 @param -
192 @return -
194 @onerror A RuntimeException is thrown.
197 virtual void SAL_CALL release() throw();
199 //________________________________________________________________________________________________________
200 // XTypeProvider
201 //________________________________________________________________________________________________________
203 /**_______________________________________________________________________________________________________
204 @short get information about supported interfaces
205 @descr -
207 @seealso XTypeProvider
209 @param -
211 @return Sequence of types of all supported interfaces
213 @onerror A RuntimeException is thrown.
216 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw( ::com::sun::star::uno::RuntimeException );
218 //________________________________________________________________________________________________________
219 // XAggregation
220 //________________________________________________________________________________________________________
222 /**_______________________________________________________________________________________________________
223 @short -
224 @descr -
226 @seealso -
228 @param -
230 @return -
232 @onerror -
235 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType )
236 throw( ::com::sun::star::uno::RuntimeException );
238 //________________________________________________________________________________________________________
239 // XProgressMonitor
240 //________________________________________________________________________________________________________
242 /**_______________________________________________________________________________________________________
243 @short add topic to dialog
244 @descr Add a topic with a text in right textlist (used for FixedText-member).<BR>
245 ( "beforeProgress" fix the right list ). The dialog metric is recalculated.
247 @seealso removeText(), updateText()
249 @param sTopic Name of topic<BR>
250 [sTopic != "" && sTopic != NULL]
251 @param sText Value of topic<BR>
252 [sText != "" && sText != NULL]
253 @param bbeforeProgress Position of topic<BR>
254 [True => before progressbar / False => below progressbar]
256 @return -
258 @onerror DEBUG = Assertion<BR>
259 RELEASE = nothing
262 virtual void SAL_CALL addText(
263 const OUString& sTopic ,
264 const OUString& sText ,
265 sal_Bool bbeforeProgress
266 ) throw( ::com::sun::star::uno::RuntimeException );
268 /**_______________________________________________________________________________________________________
269 @short -
270 @descr -
272 @seealso -
274 @param -
276 @return -
278 @onerror -
281 virtual void SAL_CALL removeText(
282 const OUString& sTopic ,
283 sal_Bool bbeforeProgress
284 ) throw( ::com::sun::star::uno::RuntimeException );
286 /**_______________________________________________________________________________________________________
287 @short -
288 @descr -
290 @seealso -
292 @param -
294 @return -
296 @onerror -
299 virtual void SAL_CALL updateText(
300 const OUString& sTopic ,
301 const OUString& sText ,
302 sal_Bool bbeforeProgress
303 ) throw( ::com::sun::star::uno::RuntimeException );
305 //________________________________________________________________________________________________________
306 // XProgressBar
307 //________________________________________________________________________________________________________
309 /**_______________________________________________________________________________________________________
310 @short -
311 @descr -
313 @seealso -
315 @param -
317 @return -
319 @onerror -
322 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException );
324 /**_______________________________________________________________________________________________________
325 @short -
326 @descr -
328 @seealso -
330 @param -
332 @return -
334 @onerror -
337 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException );
339 /**_______________________________________________________________________________________________________
340 @short -
341 @descr -
343 @seealso -
345 @param -
347 @return -
349 @onerror -
352 virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( ::com::sun::star::uno::RuntimeException );
354 /**_______________________________________________________________________________________________________
355 @short -
356 @descr -
358 @seealso -
360 @param -
362 @return -
364 @onerror -
367 virtual void SAL_CALL setRange( sal_Int32 nMin ,
368 sal_Int32 nMax ) throw( ::com::sun::star::uno::RuntimeException );
370 /**_______________________________________________________________________________________________________
371 @short -
372 @descr -
374 @seealso -
376 @param -
378 @return -
380 @onerror -
383 virtual sal_Int32 SAL_CALL getValue() throw( ::com::sun::star::uno::RuntimeException );
385 //________________________________________________________________________________________________________
386 // XButton
387 //________________________________________________________________________________________________________
389 /**_______________________________________________________________________________________________________
390 @short -
391 @descr -
393 @seealso -
395 @param -
397 @return -
399 @onerror -
402 virtual void SAL_CALL addActionListener(
403 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& xListener
404 ) throw( ::com::sun::star::uno::RuntimeException );
406 /**_______________________________________________________________________________________________________
407 @short -
408 @descr -
410 @seealso -
412 @param -
414 @return -
416 @onerror -
419 virtual void SAL_CALL removeActionListener(
420 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& xListener
421 ) throw( ::com::sun::star::uno::RuntimeException );
423 /**_______________________________________________________________________________________________________
424 @short -
425 @descr -
427 @seealso -
429 @param -
431 @return -
433 @onerror -
436 virtual void SAL_CALL setLabel( const OUString& sLabel ) throw( ::com::sun::star::uno::RuntimeException );
438 /**_______________________________________________________________________________________________________
439 @short -
440 @descr -
442 @seealso -
444 @param -
446 @return -
448 @onerror -
451 virtual void SAL_CALL setActionCommand( const OUString& sCommand )
452 throw( ::com::sun::star::uno::RuntimeException );
454 //________________________________________________________________________________________________________
455 // XLayoutConstrains
456 //________________________________________________________________________________________________________
458 /**_______________________________________________________________________________________________________
459 @short -
460 @descr -
462 @seealso -
464 @param -
466 @return -
468 @onerror -
471 virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() throw( ::com::sun::star::uno::RuntimeException );
473 /**_______________________________________________________________________________________________________
474 @short -
475 @descr -
477 @seealso -
479 @param -
481 @return -
483 @onerror -
486 virtual ::com::sun::star::awt::Size SAL_CALL getPreferredSize() throw( ::com::sun::star::uno::RuntimeException );
488 /**_______________________________________________________________________________________________________
489 @short -
490 @descr -
492 @seealso -
494 @param -
496 @return -
498 @onerror -
501 virtual ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize )
502 throw( ::com::sun::star::uno::RuntimeException );
504 //________________________________________________________________________________________________________
505 // XControl
506 //________________________________________________________________________________________________________
508 /**_______________________________________________________________________________________________________
509 @short -
510 @descr -
512 @seealso -
514 @param -
516 @return -
518 @onerror -
521 virtual void SAL_CALL createPeer(
522 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& xToolkit ,
523 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent
524 ) throw( ::com::sun::star::uno::RuntimeException );
526 /**_______________________________________________________________________________________________________
527 @short -
528 @descr -
530 @seealso -
532 @param -
534 @return -
536 @onerror -
539 virtual sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel )
540 throw( ::com::sun::star::uno::RuntimeException );
542 /**_______________________________________________________________________________________________________
543 @short -
544 @descr -
546 @seealso -
548 @param -
550 @return -
552 @onerror -
555 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel()
556 throw( ::com::sun::star::uno::RuntimeException );
558 //________________________________________________________________________________________________________
559 // XComponent
560 //________________________________________________________________________________________________________
562 /**_______________________________________________________________________________________________________
563 @short -
564 @descr -
566 @seealso -
568 @param -
570 @return -
572 @onerror -
575 virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
577 //________________________________________________________________________________________________________
578 // XWindow
579 //________________________________________________________________________________________________________
581 /**_______________________________________________________________________________________________________
582 @short -
583 @descr -
585 @seealso -
587 @param -
589 @return -
591 @onerror -
594 virtual void SAL_CALL setPosSize( sal_Int32 nX ,
595 sal_Int32 nY ,
596 sal_Int32 nWidth ,
597 sal_Int32 nHeight ,
598 sal_Int16 nFlags ) throw( ::com::sun::star::uno::RuntimeException );
600 //________________________________________________________________________________________________________
601 // BaseControl
602 //________________________________________________________________________________________________________
604 /**_______________________________________________________________________________________________________
605 @short -
606 @descr -
608 @seealso -
610 @param -
612 @return -
614 @onerror -
617 static const ::com::sun::star::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
619 /**_______________________________________________________________________________________________________
620 @short -
621 @descr -
623 @seealso -
625 @param -
627 @return -
629 @onerror -
632 static const OUString impl_getStaticImplementationName();
634 //____________________________________________________________________________________________________________
635 // protected methods
636 //____________________________________________________________________________________________________________
638 protected:
640 /**_______________________________________________________________________________________________________
641 @short -
642 @descr -
644 @seealso -
646 @param -
648 @return -
650 @onerror -
653 virtual void impl_paint( sal_Int32 nX ,
654 sal_Int32 nY ,
655 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics );
657 //____________________________________________________________________________________________________________
658 // private methods
659 //____________________________________________________________________________________________________________
661 private:
662 using BaseControl::impl_recalcLayout;
663 /**_______________________________________________________________________________________________________
664 @short -
665 @descr -
667 @seealso -
669 @param -
671 @return -
673 @onerror -
676 void impl_recalcLayout();
678 /**_______________________________________________________________________________________________________
679 @short -
680 @descr -
682 @seealso -
684 @param -
686 @return -
688 @onerror -
691 void impl_rebuildFixedText();
693 /**_______________________________________________________________________________________________________
694 @short -
695 @descr -
697 @seealso -
699 @param -
701 @return -
703 @onerror -
706 void impl_cleanMemory();
708 /**_______________________________________________________________________________________________________
709 @short -
710 @descr -
712 @seealso -
714 @param -
716 @return -
718 @onerror -
721 IMPL_TextlistItem* impl_searchTopic( const OUString& sTopic , sal_Bool bbeforeProgress );
723 //____________________________________________________________________________________________________________
724 // debug methods
725 //____________________________________________________________________________________________________________
727 private:
729 /**_______________________________________________________________________________________________________
730 @short -
731 @descr -
733 @seealso -
735 @param -
737 @return -
739 @onerror -
742 #ifdef DBG_UTIL
744 sal_Bool impl_debug_checkParameter( const OUString& sTopic, const OUString& sText, sal_Bool bbeforeProgress ); // addText, updateText
745 sal_Bool impl_debug_checkParameter( const OUString& rTopic, sal_Bool bbeforeProgress ); // removeText
747 #endif
748 //____________________________________________________________________________________________________________
749 // private variables
750 //____________________________________________________________________________________________________________
752 private:
753 ::std::vector < IMPL_TextlistItem* > maTextlist_Top; // Elements before progress
754 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText > m_xTopic_Top ; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText")
755 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText > m_xText_Top ;
757 ::std::vector < IMPL_TextlistItem* > maTextlist_Bottom; // Elements below of progress
758 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText > m_xTopic_Bottom ; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText")
759 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText > m_xText_Bottom ;
761 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XProgressBar > m_xProgressBar ;
762 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton > m_xButton ;
763 ::com::sun::star::awt::Rectangle m_a3DLine ;
765 }; // class ProgressMonitor
767 } // namespace unocontrols
769 #endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
771 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */