Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
21 : #define _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
22 :
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>
61 :
62 : #include <vector>
63 :
64 : #include "basecontainercontrol.hxx"
65 :
66 : namespace unocontrols{
67 :
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
86 :
87 : //____________________________________________________________________________________________________________
88 : // structs, types
89 : //____________________________________________________________________________________________________________
90 :
91 : /// Item of TextList
92 0 : struct IMPL_TextlistItem
93 : {
94 : OUString sTopic ; /// Left site of textline in dialog
95 : OUString sText ; /// Right site of textline in dialog
96 : };
97 :
98 : //____________________________________________________________________________________________________________
99 : // class declaration
100 : //____________________________________________________________________________________________________________
101 :
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
106 : {
107 :
108 : //____________________________________________________________________________________________________________
109 : // public methods
110 : //____________________________________________________________________________________________________________
111 :
112 : public:
113 :
114 : //________________________________________________________________________________________________________
115 : // construct/destruct
116 : //________________________________________________________________________________________________________
117 :
118 : /**_______________________________________________________________________________________________________
119 : @short
120 : @descr
121 :
122 : @seealso
123 :
124 : @param
125 :
126 : @return
127 :
128 : @onerror
129 : */
130 :
131 : ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
132 :
133 : /**_______________________________________________________________________________________________________
134 : @short
135 : @descr
136 :
137 : @seealso
138 :
139 : @param
140 :
141 : @return
142 :
143 : @onerror
144 : */
145 :
146 : virtual ~ProgressMonitor();
147 :
148 : //________________________________________________________________________________________________________
149 : // XInterface
150 : //________________________________________________________________________________________________________
151 :
152 : /**_______________________________________________________________________________________________________
153 : @short give answer, if interface is supported
154 : @descr The interfaces are searched by type.
155 :
156 : @seealso XInterface
157 :
158 : @param "rType" is the type of searched interface.
159 :
160 : @return Any information about found interface
161 :
162 : @onerror A RuntimeException is thrown.
163 : */
164 :
165 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
166 : throw( ::com::sun::star::uno::RuntimeException );
167 :
168 : /**_______________________________________________________________________________________________________
169 : @short increment refcount
170 : @descr -
171 :
172 : @seealso XInterface
173 : @seealso release()
174 :
175 : @param -
176 :
177 : @return -
178 :
179 : @onerror A RuntimeException is thrown.
180 : */
181 :
182 : virtual void SAL_CALL acquire() throw();
183 :
184 : /**_______________________________________________________________________________________________________
185 : @short decrement refcount
186 : @descr -
187 :
188 : @seealso XInterface
189 : @seealso acquire()
190 :
191 : @param -
192 :
193 : @return -
194 :
195 : @onerror A RuntimeException is thrown.
196 : */
197 :
198 : virtual void SAL_CALL release() throw();
199 :
200 : //________________________________________________________________________________________________________
201 : // XTypeProvider
202 : //________________________________________________________________________________________________________
203 :
204 : /**_______________________________________________________________________________________________________
205 : @short get information about supported interfaces
206 : @descr -
207 :
208 : @seealso XTypeProvider
209 :
210 : @param -
211 :
212 : @return Sequence of types of all supported interfaces
213 :
214 : @onerror A RuntimeException is thrown.
215 : */
216 :
217 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw( ::com::sun::star::uno::RuntimeException );
218 :
219 : //________________________________________________________________________________________________________
220 : // XAggregation
221 : //________________________________________________________________________________________________________
222 :
223 : /**_______________________________________________________________________________________________________
224 : @short -
225 : @descr -
226 :
227 : @seealso -
228 :
229 : @param -
230 :
231 : @return -
232 :
233 : @onerror -
234 : */
235 :
236 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType )
237 : throw( ::com::sun::star::uno::RuntimeException );
238 :
239 : //________________________________________________________________________________________________________
240 : // XProgressMonitor
241 : //________________________________________________________________________________________________________
242 :
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.
247 :
248 : @seealso removeText(), updateText()
249 :
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]
256 :
257 : @return -
258 :
259 : @onerror DEBUG = Assertion<BR>
260 : RELEASE = nothing
261 : */
262 :
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 );
268 :
269 : /**_______________________________________________________________________________________________________
270 : @short -
271 : @descr -
272 :
273 : @seealso -
274 :
275 : @param -
276 :
277 : @return -
278 :
279 : @onerror -
280 : */
281 :
282 : virtual void SAL_CALL removeText(
283 : const OUString& sTopic ,
284 : sal_Bool bbeforeProgress
285 : ) throw( ::com::sun::star::uno::RuntimeException );
286 :
287 : /**_______________________________________________________________________________________________________
288 : @short -
289 : @descr -
290 :
291 : @seealso -
292 :
293 : @param -
294 :
295 : @return -
296 :
297 : @onerror -
298 : */
299 :
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 );
305 :
306 : //________________________________________________________________________________________________________
307 : // XProgressBar
308 : //________________________________________________________________________________________________________
309 :
310 : /**_______________________________________________________________________________________________________
311 : @short -
312 : @descr -
313 :
314 : @seealso -
315 :
316 : @param -
317 :
318 : @return -
319 :
320 : @onerror -
321 : */
322 :
323 : virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException );
324 :
325 : /**_______________________________________________________________________________________________________
326 : @short -
327 : @descr -
328 :
329 : @seealso -
330 :
331 : @param -
332 :
333 : @return -
334 :
335 : @onerror -
336 : */
337 :
338 : virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException );
339 :
340 : /**_______________________________________________________________________________________________________
341 : @short -
342 : @descr -
343 :
344 : @seealso -
345 :
346 : @param -
347 :
348 : @return -
349 :
350 : @onerror -
351 : */
352 :
353 : virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( ::com::sun::star::uno::RuntimeException );
354 :
355 : /**_______________________________________________________________________________________________________
356 : @short -
357 : @descr -
358 :
359 : @seealso -
360 :
361 : @param -
362 :
363 : @return -
364 :
365 : @onerror -
366 : */
367 :
368 : virtual void SAL_CALL setRange( sal_Int32 nMin ,
369 : sal_Int32 nMax ) throw( ::com::sun::star::uno::RuntimeException );
370 :
371 : /**_______________________________________________________________________________________________________
372 : @short -
373 : @descr -
374 :
375 : @seealso -
376 :
377 : @param -
378 :
379 : @return -
380 :
381 : @onerror -
382 : */
383 :
384 : virtual sal_Int32 SAL_CALL getValue() throw( ::com::sun::star::uno::RuntimeException );
385 :
386 : //________________________________________________________________________________________________________
387 : // XButton
388 : //________________________________________________________________________________________________________
389 :
390 : /**_______________________________________________________________________________________________________
391 : @short -
392 : @descr -
393 :
394 : @seealso -
395 :
396 : @param -
397 :
398 : @return -
399 :
400 : @onerror -
401 : */
402 :
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 );
406 :
407 : /**_______________________________________________________________________________________________________
408 : @short -
409 : @descr -
410 :
411 : @seealso -
412 :
413 : @param -
414 :
415 : @return -
416 :
417 : @onerror -
418 : */
419 :
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 );
423 :
424 : /**_______________________________________________________________________________________________________
425 : @short -
426 : @descr -
427 :
428 : @seealso -
429 :
430 : @param -
431 :
432 : @return -
433 :
434 : @onerror -
435 : */
436 :
437 : virtual void SAL_CALL setLabel( const OUString& sLabel ) throw( ::com::sun::star::uno::RuntimeException );
438 :
439 : /**_______________________________________________________________________________________________________
440 : @short -
441 : @descr -
442 :
443 : @seealso -
444 :
445 : @param -
446 :
447 : @return -
448 :
449 : @onerror -
450 : */
451 :
452 : virtual void SAL_CALL setActionCommand( const OUString& sCommand )
453 : throw( ::com::sun::star::uno::RuntimeException );
454 :
455 : //________________________________________________________________________________________________________
456 : // XLayoutConstrains
457 : //________________________________________________________________________________________________________
458 :
459 : /**_______________________________________________________________________________________________________
460 : @short -
461 : @descr -
462 :
463 : @seealso -
464 :
465 : @param -
466 :
467 : @return -
468 :
469 : @onerror -
470 : */
471 :
472 : virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() throw( ::com::sun::star::uno::RuntimeException );
473 :
474 : /**_______________________________________________________________________________________________________
475 : @short -
476 : @descr -
477 :
478 : @seealso -
479 :
480 : @param -
481 :
482 : @return -
483 :
484 : @onerror -
485 : */
486 :
487 : virtual ::com::sun::star::awt::Size SAL_CALL getPreferredSize() throw( ::com::sun::star::uno::RuntimeException );
488 :
489 : /**_______________________________________________________________________________________________________
490 : @short -
491 : @descr -
492 :
493 : @seealso -
494 :
495 : @param -
496 :
497 : @return -
498 :
499 : @onerror -
500 : */
501 :
502 : virtual ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize )
503 : throw( ::com::sun::star::uno::RuntimeException );
504 :
505 : //________________________________________________________________________________________________________
506 : // XControl
507 : //________________________________________________________________________________________________________
508 :
509 : /**_______________________________________________________________________________________________________
510 : @short -
511 : @descr -
512 :
513 : @seealso -
514 :
515 : @param -
516 :
517 : @return -
518 :
519 : @onerror -
520 : */
521 :
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 );
526 :
527 : /**_______________________________________________________________________________________________________
528 : @short -
529 : @descr -
530 :
531 : @seealso -
532 :
533 : @param -
534 :
535 : @return -
536 :
537 : @onerror -
538 : */
539 :
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 );
542 :
543 : /**_______________________________________________________________________________________________________
544 : @short -
545 : @descr -
546 :
547 : @seealso -
548 :
549 : @param -
550 :
551 : @return -
552 :
553 : @onerror -
554 : */
555 :
556 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel()
557 : throw( ::com::sun::star::uno::RuntimeException );
558 :
559 : //________________________________________________________________________________________________________
560 : // XComponent
561 : //________________________________________________________________________________________________________
562 :
563 : /**_______________________________________________________________________________________________________
564 : @short -
565 : @descr -
566 :
567 : @seealso -
568 :
569 : @param -
570 :
571 : @return -
572 :
573 : @onerror -
574 : */
575 :
576 : virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
577 :
578 : //________________________________________________________________________________________________________
579 : // XWindow
580 : //________________________________________________________________________________________________________
581 :
582 : /**_______________________________________________________________________________________________________
583 : @short -
584 : @descr -
585 :
586 : @seealso -
587 :
588 : @param -
589 :
590 : @return -
591 :
592 : @onerror -
593 : */
594 :
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 );
600 :
601 : //________________________________________________________________________________________________________
602 : // BaseControl
603 : //________________________________________________________________________________________________________
604 :
605 : /**_______________________________________________________________________________________________________
606 : @short -
607 : @descr -
608 :
609 : @seealso -
610 :
611 : @param -
612 :
613 : @return -
614 :
615 : @onerror -
616 : */
617 :
618 : static const ::com::sun::star::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
619 :
620 : /**_______________________________________________________________________________________________________
621 : @short -
622 : @descr -
623 :
624 : @seealso -
625 :
626 : @param -
627 :
628 : @return -
629 :
630 : @onerror -
631 : */
632 :
633 : static const OUString impl_getStaticImplementationName();
634 :
635 : //____________________________________________________________________________________________________________
636 : // protected methods
637 : //____________________________________________________________________________________________________________
638 :
639 : protected:
640 :
641 : /**_______________________________________________________________________________________________________
642 : @short -
643 : @descr -
644 :
645 : @seealso -
646 :
647 : @param -
648 :
649 : @return -
650 :
651 : @onerror -
652 : */
653 :
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 );
657 :
658 : //____________________________________________________________________________________________________________
659 : // private methods
660 : //____________________________________________________________________________________________________________
661 :
662 : private:
663 : using BaseControl::impl_recalcLayout;
664 : /**_______________________________________________________________________________________________________
665 : @short -
666 : @descr -
667 :
668 : @seealso -
669 :
670 : @param -
671 :
672 : @return -
673 :
674 : @onerror -
675 : */
676 :
677 : void impl_recalcLayout();
678 :
679 : /**_______________________________________________________________________________________________________
680 : @short -
681 : @descr -
682 :
683 : @seealso -
684 :
685 : @param -
686 :
687 : @return -
688 :
689 : @onerror -
690 : */
691 :
692 : void impl_rebuildFixedText();
693 :
694 : /**_______________________________________________________________________________________________________
695 : @short -
696 : @descr -
697 :
698 : @seealso -
699 :
700 : @param -
701 :
702 : @return -
703 :
704 : @onerror -
705 : */
706 :
707 : void impl_cleanMemory();
708 :
709 : /**_______________________________________________________________________________________________________
710 : @short -
711 : @descr -
712 :
713 : @seealso -
714 :
715 : @param -
716 :
717 : @return -
718 :
719 : @onerror -
720 : */
721 :
722 : IMPL_TextlistItem* impl_searchTopic( const OUString& sTopic , sal_Bool bbeforeProgress );
723 :
724 : //____________________________________________________________________________________________________________
725 : // debug methods
726 : //____________________________________________________________________________________________________________
727 :
728 : private:
729 :
730 : /**_______________________________________________________________________________________________________
731 : @short -
732 : @descr -
733 :
734 : @seealso -
735 :
736 : @param -
737 :
738 : @return -
739 :
740 : @onerror -
741 : */
742 :
743 : #ifdef DBG_UTIL
744 :
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
747 :
748 : #endif
749 : //____________________________________________________________________________________________________________
750 : // private variables
751 : //____________________________________________________________________________________________________________
752 :
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 ;
757 :
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 ;
761 :
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 ;
765 :
766 : }; // class ProgressMonitor
767 :
768 : } // namespace unocontrols
769 :
770 : #endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
771 :
772 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|