1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX 25 #define _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX 26 27 //____________________________________________________________________________________________________________ 28 // includes of other projects 29 //____________________________________________________________________________________________________________ 30 31 #include <com/sun/star/awt/XFileDialog.hpp> 32 #include <com/sun/star/awt/XTextComponent.hpp> 33 #include <com/sun/star/awt/XListBox.hpp> 34 #include <com/sun/star/awt/XProgressMonitor.hpp> 35 #include <com/sun/star/awt/TextAlign.hpp> 36 #include <com/sun/star/awt/XScrollBar.hpp> 37 #include <com/sun/star/awt/XVclContainerPeer.hpp> 38 #include <com/sun/star/awt/XTabControllerModel.hpp> 39 #include <com/sun/star/awt/XMessageBox.hpp> 40 #include <com/sun/star/awt/XTextEditField.hpp> 41 #include <com/sun/star/awt/Style.hpp> 42 #include <com/sun/star/awt/XTimeField.hpp> 43 #include <com/sun/star/awt/XVclWindowPeer.hpp> 44 #include <com/sun/star/awt/XControlModel.hpp> 45 #include <com/sun/star/awt/XSpinField.hpp> 46 #include <com/sun/star/awt/XUnoControlContainer.hpp> 47 #include <com/sun/star/awt/XTextLayoutConstrains.hpp> 48 #include <com/sun/star/awt/XNumericField.hpp> 49 #include <com/sun/star/awt/XButton.hpp> 50 #include <com/sun/star/awt/XTextArea.hpp> 51 #include <com/sun/star/awt/XImageButton.hpp> 52 #include <com/sun/star/awt/XFixedText.hpp> 53 #include <com/sun/star/awt/XControlContainer.hpp> 54 #include <com/sun/star/awt/XDialog.hpp> 55 #include <com/sun/star/awt/ScrollBarOrientation.hpp> 56 #include <com/sun/star/awt/XRadioButton.hpp> 57 #include <com/sun/star/awt/XCurrencyField.hpp> 58 #include <com/sun/star/awt/XPatternField.hpp> 59 #include <com/sun/star/awt/VclWindowPeerAttribute.hpp> 60 #include <com/sun/star/awt/XTabController.hpp> 61 #include <com/sun/star/awt/XVclContainer.hpp> 62 #include <com/sun/star/awt/XDateField.hpp> 63 #include <com/sun/star/awt/XComboBox.hpp> 64 #include <com/sun/star/awt/XControl.hpp> 65 #include <com/sun/star/awt/XCheckBox.hpp> 66 #include <com/sun/star/awt/MessageBoxCommand.hpp> 67 #include <com/sun/star/awt/XLayoutConstrains.hpp> 68 #include <com/sun/star/awt/XProgressBar.hpp> 69 70 //____________________________________________________________________________________________________________ 71 // includes of my own project 72 //____________________________________________________________________________________________________________ 73 #include "basecontainercontrol.hxx" 74 75 //____________________________________________________________________________________________________________ 76 // namespace 77 //____________________________________________________________________________________________________________ 78 79 namespace unocontrols{ 80 81 #define UNO3_ANY ::com::sun::star::uno::Any 82 #define UNO3_OUSTRING ::rtl::OUString 83 #define UNO3_RECTANGLE ::com::sun::star::awt::Rectangle 84 #define UNO3_REFERENCE ::com::sun::star::uno::Reference 85 #define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException 86 #define UNO3_SEQUENCE ::com::sun::star::uno::Sequence 87 #define UNO3_SIZE ::com::sun::star::awt::Size 88 #define UNO3_TYPE ::com::sun::star::uno::Type 89 #define UNO3_XACTIONLISTENER ::com::sun::star::awt::XActionListener 90 #define UNO3_XBUTTON ::com::sun::star::awt::XButton 91 #define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel 92 #define UNO3_XFIXEDTEXT ::com::sun::star::awt::XFixedText 93 #define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics 94 #define UNO3_XLAYOUTCONSTRAINS ::com::sun::star::awt::XLayoutConstrains 95 #define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory 96 #define UNO3_XPROGRESSBAR ::com::sun::star::awt::XProgressBar 97 #define UNO3_XPROGRESSMONITOR ::com::sun::star::awt::XProgressMonitor 98 #define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit 99 #define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer 100 101 //____________________________________________________________________________________________________________ 102 // defines 103 //____________________________________________________________________________________________________________ 104 105 #define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor" 106 #define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor" 107 #define FREEBORDER 10 // border around and between the controls 108 #define WIDTH_RELATION 4 // reserve 1/4 for button width and rest for progressbar width 109 #define HEIGHT_RELATION 5 // reserve 1/5 for button and progressbar heigth and rest for text height 110 #define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText" 111 #define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton" 112 #define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel" 113 #define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel" 114 #define CONTROLNAME_TEXT "Text" // identifier the control in container 115 #define CONTROLNAME_BUTTON "Button" // -||- 116 #define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||- 117 #define DEFAULT_BUTTONLABEL "Abbrechen" 118 #define DEFAULT_TOPIC "\0" 119 #define DEFAULT_TEXT "\0" 120 #define BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray 121 #define LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white 122 #define LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black 123 #define HEIGHT_PROGRESSBAR 15 124 // Overwrite defines from basecontrol.hxx!!! 125 #undef DEFAULT_WIDTH 126 #undef DEFAULT_HEIGHT 127 #define DEFAULT_WIDTH 350 128 #define DEFAULT_HEIGHT 100 129 130 //____________________________________________________________________________________________________________ 131 // structs, types 132 //____________________________________________________________________________________________________________ 133 134 /// Item of TextList 135 struct IMPL_TextlistItem 136 { 137 UNO3_OUSTRING sTopic ; /// Left site of textline in dialog 138 UNO3_OUSTRING sText ; /// Right site of textline in dialog 139 }; 140 141 /// Define a list-class for struct IMPL_TextlistItem 142 class IMPL_Textlist ; 143 DECLARE_LIST( IMPL_Textlist, IMPL_TextlistItem* ) 144 145 //____________________________________________________________________________________________________________ 146 // class declaration 147 //____________________________________________________________________________________________________________ 148 149 class ProgressMonitor : public UNO3_XLAYOUTCONSTRAINS 150 , public UNO3_XBUTTON 151 , public UNO3_XPROGRESSMONITOR 152 , public BaseContainerControl 153 { 154 155 //____________________________________________________________________________________________________________ 156 // public methods 157 //____________________________________________________________________________________________________________ 158 159 public: 160 161 //________________________________________________________________________________________________________ 162 // construct/destruct 163 //________________________________________________________________________________________________________ 164 165 /**_______________________________________________________________________________________________________ 166 @short 167 @descr 168 169 @seealso 170 171 @param 172 173 @return 174 175 @onerror 176 */ 177 178 ProgressMonitor( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory ); 179 180 /**_______________________________________________________________________________________________________ 181 @short 182 @descr 183 184 @seealso 185 186 @param 187 188 @return 189 190 @onerror 191 */ 192 193 virtual ~ProgressMonitor(); 194 195 //________________________________________________________________________________________________________ 196 // XInterface 197 //________________________________________________________________________________________________________ 198 199 /**_______________________________________________________________________________________________________ 200 @short give answer, if interface is supported 201 @descr The interfaces are searched by type. 202 203 @seealso XInterface 204 205 @param "rType" is the type of searched interface. 206 207 @return Any information about found interface 208 209 @onerror A RuntimeException is thrown. 210 */ 211 212 virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION ); 213 214 /**_______________________________________________________________________________________________________ 215 @short increment refcount 216 @descr - 217 218 @seealso XInterface 219 @seealso release() 220 221 @param - 222 223 @return - 224 225 @onerror A RuntimeException is thrown. 226 */ 227 228 virtual void SAL_CALL acquire() throw(); 229 230 /**_______________________________________________________________________________________________________ 231 @short decrement refcount 232 @descr - 233 234 @seealso XInterface 235 @seealso acquire() 236 237 @param - 238 239 @return - 240 241 @onerror A RuntimeException is thrown. 242 */ 243 244 virtual void SAL_CALL release() throw(); 245 246 //________________________________________________________________________________________________________ 247 // XTypeProvider 248 //________________________________________________________________________________________________________ 249 250 /**_______________________________________________________________________________________________________ 251 @short get information about supported interfaces 252 @descr - 253 254 @seealso XTypeProvider 255 256 @param - 257 258 @return Sequence of types of all supported interfaces 259 260 @onerror A RuntimeException is thrown. 261 */ 262 263 virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION ); 264 265 //________________________________________________________________________________________________________ 266 // XAggregation 267 //________________________________________________________________________________________________________ 268 269 /**_______________________________________________________________________________________________________ 270 @short - 271 @descr - 272 273 @seealso - 274 275 @param - 276 277 @return - 278 279 @onerror - 280 */ 281 282 virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION ); 283 284 //________________________________________________________________________________________________________ 285 // XProgressMonitor 286 //________________________________________________________________________________________________________ 287 288 /**_______________________________________________________________________________________________________ 289 @short add topic to dialog 290 @descr Add a topic with a text in right textlist (used for FixedText-member).<BR> 291 ( "beforeProgress" fix the right list ). The dialog metric is recalculated. 292 293 @seealso removeText(), updateText() 294 295 @param sTopic Name of topic<BR> 296 [sTopic != "" && sTopic != NULL] 297 @param sText Value of topic<BR> 298 [sText != "" && sText != NULL] 299 @param bbeforeProgress Position of topic<BR> 300 [True => before progressbar / False => below progressbar] 301 302 @return - 303 304 @onerror DEBUG = Assertion<BR> 305 RELEASE = nothing 306 */ 307 308 virtual void SAL_CALL addText( const UNO3_OUSTRING& sTopic , 309 const UNO3_OUSTRING& sText , 310 sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION ); 311 312 /**_______________________________________________________________________________________________________ 313 @short - 314 @descr - 315 316 @seealso - 317 318 @param - 319 320 @return - 321 322 @onerror - 323 */ 324 325 virtual void SAL_CALL removeText( const UNO3_OUSTRING& sTopic , 326 sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION ); 327 328 /**_______________________________________________________________________________________________________ 329 @short - 330 @descr - 331 332 @seealso - 333 334 @param - 335 336 @return - 337 338 @onerror - 339 */ 340 341 virtual void SAL_CALL updateText( const UNO3_OUSTRING& sTopic , 342 const UNO3_OUSTRING& sText , 343 sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION ); 344 345 //________________________________________________________________________________________________________ 346 // XProgressBar 347 //________________________________________________________________________________________________________ 348 349 /**_______________________________________________________________________________________________________ 350 @short - 351 @descr - 352 353 @seealso - 354 355 @param - 356 357 @return - 358 359 @onerror - 360 */ 361 362 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION ); 363 364 /**_______________________________________________________________________________________________________ 365 @short - 366 @descr - 367 368 @seealso - 369 370 @param - 371 372 @return - 373 374 @onerror - 375 */ 376 377 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION ); 378 379 /**_______________________________________________________________________________________________________ 380 @short - 381 @descr - 382 383 @seealso - 384 385 @param - 386 387 @return - 388 389 @onerror - 390 */ 391 392 virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION ); 393 394 /**_______________________________________________________________________________________________________ 395 @short - 396 @descr - 397 398 @seealso - 399 400 @param - 401 402 @return - 403 404 @onerror - 405 */ 406 407 virtual void SAL_CALL setRange( sal_Int32 nMin , 408 sal_Int32 nMax ) throw( UNO3_RUNTIMEEXCEPTION ); 409 410 /**_______________________________________________________________________________________________________ 411 @short - 412 @descr - 413 414 @seealso - 415 416 @param - 417 418 @return - 419 420 @onerror - 421 */ 422 423 virtual sal_Int32 SAL_CALL getValue() throw( UNO3_RUNTIMEEXCEPTION ); 424 425 //________________________________________________________________________________________________________ 426 // XButton 427 //________________________________________________________________________________________________________ 428 429 /**_______________________________________________________________________________________________________ 430 @short - 431 @descr - 432 433 @seealso - 434 435 @param - 436 437 @return - 438 439 @onerror - 440 */ 441 442 virtual void SAL_CALL addActionListener( const UNO3_REFERENCE< UNO3_XACTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); 443 444 /**_______________________________________________________________________________________________________ 445 @short - 446 @descr - 447 448 @seealso - 449 450 @param - 451 452 @return - 453 454 @onerror - 455 */ 456 457 virtual void SAL_CALL removeActionListener( const UNO3_REFERENCE< UNO3_XACTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION ); 458 459 /**_______________________________________________________________________________________________________ 460 @short - 461 @descr - 462 463 @seealso - 464 465 @param - 466 467 @return - 468 469 @onerror - 470 */ 471 472 virtual void SAL_CALL setLabel( const UNO3_OUSTRING& sLabel ) throw( UNO3_RUNTIMEEXCEPTION ); 473 474 /**_______________________________________________________________________________________________________ 475 @short - 476 @descr - 477 478 @seealso - 479 480 @param - 481 482 @return - 483 484 @onerror - 485 */ 486 487 virtual void SAL_CALL setActionCommand( const UNO3_OUSTRING& sCommand ) throw( UNO3_RUNTIMEEXCEPTION ); 488 489 //________________________________________________________________________________________________________ 490 // XLayoutConstrains 491 //________________________________________________________________________________________________________ 492 493 /**_______________________________________________________________________________________________________ 494 @short - 495 @descr - 496 497 @seealso - 498 499 @param - 500 501 @return - 502 503 @onerror - 504 */ 505 506 virtual UNO3_SIZE SAL_CALL getMinimumSize() throw( UNO3_RUNTIMEEXCEPTION ); 507 508 /**_______________________________________________________________________________________________________ 509 @short - 510 @descr - 511 512 @seealso - 513 514 @param - 515 516 @return - 517 518 @onerror - 519 */ 520 521 virtual UNO3_SIZE SAL_CALL getPreferredSize() throw( UNO3_RUNTIMEEXCEPTION ); 522 523 /**_______________________________________________________________________________________________________ 524 @short - 525 @descr - 526 527 @seealso - 528 529 @param - 530 531 @return - 532 533 @onerror - 534 */ 535 536 virtual UNO3_SIZE SAL_CALL calcAdjustedSize( const UNO3_SIZE& aNewSize ) throw( UNO3_RUNTIMEEXCEPTION ); 537 538 //________________________________________________________________________________________________________ 539 // XControl 540 //________________________________________________________________________________________________________ 541 542 /**_______________________________________________________________________________________________________ 543 @short - 544 @descr - 545 546 @seealso - 547 548 @param - 549 550 @return - 551 552 @onerror - 553 */ 554 555 virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit , 556 const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION ); 557 558 /**_______________________________________________________________________________________________________ 559 @short - 560 @descr - 561 562 @seealso - 563 564 @param - 565 566 @return - 567 568 @onerror - 569 */ 570 571 virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION ); 572 573 /**_______________________________________________________________________________________________________ 574 @short - 575 @descr - 576 577 @seealso - 578 579 @param - 580 581 @return - 582 583 @onerror - 584 */ 585 586 virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION ); 587 588 //________________________________________________________________________________________________________ 589 // XComponent 590 //________________________________________________________________________________________________________ 591 592 /**_______________________________________________________________________________________________________ 593 @short - 594 @descr - 595 596 @seealso - 597 598 @param - 599 600 @return - 601 602 @onerror - 603 */ 604 605 virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION ); 606 607 //________________________________________________________________________________________________________ 608 // XWindow 609 //________________________________________________________________________________________________________ 610 611 /**_______________________________________________________________________________________________________ 612 @short - 613 @descr - 614 615 @seealso - 616 617 @param - 618 619 @return - 620 621 @onerror - 622 */ 623 624 virtual void SAL_CALL setPosSize( sal_Int32 nX , 625 sal_Int32 nY , 626 sal_Int32 nWidth , 627 sal_Int32 nHeight , 628 sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION ); 629 630 //________________________________________________________________________________________________________ 631 // BaseControl 632 //________________________________________________________________________________________________________ 633 634 /**_______________________________________________________________________________________________________ 635 @short - 636 @descr - 637 638 @seealso - 639 640 @param - 641 642 @return - 643 644 @onerror - 645 */ 646 647 static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames(); 648 649 /**_______________________________________________________________________________________________________ 650 @short - 651 @descr - 652 653 @seealso - 654 655 @param - 656 657 @return - 658 659 @onerror - 660 */ 661 662 static const UNO3_OUSTRING impl_getStaticImplementationName(); 663 664 //____________________________________________________________________________________________________________ 665 // protected methods 666 //____________________________________________________________________________________________________________ 667 668 protected: 669 670 /**_______________________________________________________________________________________________________ 671 @short - 672 @descr - 673 674 @seealso - 675 676 @param - 677 678 @return - 679 680 @onerror - 681 */ 682 683 virtual void impl_paint( sal_Int32 nX , 684 sal_Int32 nY , 685 const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics ); 686 687 //____________________________________________________________________________________________________________ 688 // private methods 689 //____________________________________________________________________________________________________________ 690 691 private: 692 using BaseControl::impl_recalcLayout; 693 /**_______________________________________________________________________________________________________ 694 @short - 695 @descr - 696 697 @seealso - 698 699 @param - 700 701 @return - 702 703 @onerror - 704 */ 705 706 void impl_recalcLayout(); 707 708 /**_______________________________________________________________________________________________________ 709 @short - 710 @descr - 711 712 @seealso - 713 714 @param - 715 716 @return - 717 718 @onerror - 719 */ 720 721 void impl_rebuildFixedText(); 722 723 /**_______________________________________________________________________________________________________ 724 @short - 725 @descr - 726 727 @seealso - 728 729 @param - 730 731 @return - 732 733 @onerror - 734 */ 735 736 void impl_cleanMemory(); 737 738 /**_______________________________________________________________________________________________________ 739 @short - 740 @descr - 741 742 @seealso - 743 744 @param - 745 746 @return - 747 748 @onerror - 749 */ 750 751 IMPL_TextlistItem* impl_searchTopic( const UNO3_OUSTRING& sTopic , 752 sal_Bool bbeforeProgress ); 753 754 //____________________________________________________________________________________________________________ 755 // debug methods 756 //____________________________________________________________________________________________________________ 757 758 private: 759 760 /**_______________________________________________________________________________________________________ 761 @short - 762 @descr - 763 764 @seealso - 765 766 @param - 767 768 @return - 769 770 @onerror - 771 */ 772 773 #ifdef DBG_UTIL 774 775 sal_Bool impl_debug_checkParameter( const UNO3_OUSTRING& sTopic, const UNO3_OUSTRING& sText, sal_Bool bbeforeProgress ); // addText, updateText 776 sal_Bool impl_debug_checkParameter( const UNO3_OUSTRING& rTopic, sal_Bool bbeforeProgress ); // removeText 777 778 #endif 779 //____________________________________________________________________________________________________________ 780 // private variables 781 //____________________________________________________________________________________________________________ 782 783 private: 784 785 IMPL_Textlist* m_pTextlist_Top ; // Elements before progress 786 UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xTopic_Top ; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText") 787 UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xText_Top ; 788 789 IMPL_Textlist* m_pTextlist_Bottom ; // Elements below of progress 790 UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xTopic_Bottom ; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText") 791 UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xText_Bottom ; 792 793 UNO3_REFERENCE< UNO3_XPROGRESSBAR > m_xProgressBar ; 794 UNO3_REFERENCE< UNO3_XBUTTON > m_xButton ; 795 UNO3_RECTANGLE m_a3DLine ; 796 797 }; // class ProgressMonitor 798 799 } // namespace unocontrols 800 801 #endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX 802