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