1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _LAYOUT_HXX 29 #define _LAYOUT_HXX 30 31 #include <com/sun/star/awt/XLayoutContainer.hpp> 32 #include <com/sun/star/uno/XInterface.hpp> 33 #include <com/sun/star/util/Color.hpp> 34 #include <i18npool/lang.h> 35 #include <toolkit/dllapi.h> 36 #include <tools/gen.hxx> 37 #include <tools/link.hxx> 38 #include <tools/string.hxx> 39 #include <vcl/bitmap.hxx> 40 #include <vcl/combobox.h> 41 #include <tools/fldunit.hxx> 42 #include <vcl/lstbox.h> 43 #include <tools/wintypes.hxx> 44 45 class Button; 46 class ComboBox; 47 class Color; 48 class Control; 49 class Dialog; 50 class Edit; 51 class Font; 52 class Image; 53 class ListBox; 54 class MapMode; 55 class MultiListBox; 56 class NotifyEvent; 57 class Pointer; 58 class PushButton; 59 class RadioButton; 60 class ResId; 61 struct SfxChildWinInfo; 62 //class SvxFontListBox; 63 //class SvxLanguageBox; 64 class TabControl; 65 class TabPage; 66 class VCLXRadioButton; 67 class VCLXWindow; 68 class Window; 69 70 namespace layoutimpl 71 { 72 class VCLXTabControl; 73 } 74 75 class VCLXTabControl; 76 77 namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } } 78 79 namespace layout 80 { 81 82 namespace css = ::com::sun::star; 83 84 typedef css::uno::Reference< css::uno::XInterface > PeerHandle; 85 class ContextImpl; 86 class TOOLKIT_DLLPUBLIC Context 87 { 88 ContextImpl *pImpl; 89 public: 90 Context( char const* pPath ); 91 virtual ~Context(); 92 PeerHandle GetPeerHandle( char const* id, sal_uInt32 nId = 0 ) const; 93 void setToplevel( PeerHandle xToplevel ); 94 PeerHandle getToplevel(); 95 PeerHandle getRoot(); 96 }; 97 98 // make declaring wrappers easier ... 99 #define DECL_CONSTRUCTORS(t,par,defaultWinBit) \ 100 protected: \ 101 explicit t( WindowImpl *pImpl ) : \ 102 par( pImpl ) {} \ 103 char const* GetUnoName() const; \ 104 public: \ 105 t( Context *context, char const* id, sal_uInt32 nId = 0 ); \ 106 t( Window *parent, WinBits nStyle = defaultWinBit ); \ 107 t (Window *parent, ResId const &res) 108 #define DECL_GET_IMPL(t) \ 109 inline t##Impl &getImpl() const 110 111 #define DECL_GET_WINDOW( cls ) ::cls* Get##cls() const 112 #define IMPL_GET_WINDOW( cls ) ::cls* cls::Get##cls() const { return dynamic_cast< ::cls*>( GetWindow() ); } 113 114 #define DECL_GET_VCLXWINDOW( cls ) ::VCLX##cls* GetVCLX##cls() const 115 #define IMPL_GET_VCLXWINDOW( cls ) ::VCLX##cls* cls::Get##VCLX##cls() const { return dynamic_cast< ::VCLX##cls*>( GetVCLXWindow() ); } 116 117 #define DECL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* GetVCLX##cls() const 118 #define IMPL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* cls::Get##VCLX##cls() const { return dynamic_cast< ::layoutimpl::VCLX##cls*>( GetVCLXWindow() ); } 119 120 // follows the VCL inheritance hierarchy ... 121 122 class WindowImpl; 123 class TOOLKIT_DLLPUBLIC Window 124 { 125 protected: 126 friend class WindowImpl; 127 WindowImpl *mpImpl; 128 static PeerHandle CreatePeer( Window *parent, WinBits nStyle, 129 char const* pName); 130 131 virtual void setRes (ResId const& res); 132 133 public: 134 DECL_GET_IMPL( Window ); 135 explicit Window( WindowImpl *pImpl ); 136 virtual ~Window(); 137 138 PeerHandle GetPeer() const; 139 Context *getContext(); 140 141 void Enable( bool bEnable = true ); 142 inline void Disable() { Enable( false ); } 143 void Show( bool bVisible = true ); 144 inline void Hide() { Show( false ); } 145 void GrabFocus(); 146 void FreeResource() {} 147 148 void SetParent( ::Window *parent ); 149 virtual void ParentSet (Window *window); 150 void SetParent( Window *parent ); 151 152 css::uno::Reference<css::awt::XWindow> GetRef() const; 153 VCLXWindow* GetVCLXWindow() const; 154 ::Window* GetWindow() const; 155 ::Window* GetParent() const; 156 157 void SetPointer( Pointer const& pointer ); 158 Pointer const& GetPointer() const; 159 WinBits GetStyle(); 160 void SetText( rtl::OUString const& str ); 161 String GetText() const; 162 void SetStyle( WinBits style ); 163 void SetUpdateMode( bool mode ); 164 void SetHelpId( const rtl::OString& id ); 165 const rtl::OString& GetHelpId() const; 166 void EnterWait (); 167 void LeaveWait (); 168 bool IsWait () const; 169 //void Enable (bool enable=true, bool child=true); 170 //void Disable (bool child=true); 171 bool IsEnabled () const; 172 void EnableInput (bool enable=true, bool child=true); 173 bool IsInputEnabled () const; 174 175 bool IsVisible () const; 176 bool HasChildPathFocus (bool systemWindow=false) const; 177 void SetPosPixel (Point const&); 178 Point GetPosPixel () const; 179 void SetSizePixel (Size const&); 180 Size GetSizePixel () const; 181 void SetPosSizePixel (Point const&, Size const&); 182 sal_Int32 GetCtrlTextWidth (rtl::OUString const& str) const; 183 sal_Int32 GetTextHeight () const; 184 185 Size LogicToPixel( Size const& size ) const; 186 Size LogicToPixel( Size const& size, MapMode const& mapMode ) const; 187 188 bool HasFocus () const; 189 Font& GetFont () const; 190 void SetFont (Font const& font); 191 virtual void Invalidate (sal_uInt8 flags=0); 192 }; 193 194 class ControlImpl; 195 class TOOLKIT_DLLPUBLIC Control : public Window 196 { 197 DECL_GET_IMPL( Control ); 198 DECL_CONSTRUCTORS( Control, Window, 0 ); 199 200 public: 201 ~Control (); 202 void SetGetFocusHdl (Link const& link); 203 Link& GetGetFocusHdl (); 204 void SetLoseFocusHdl (Link const& link); 205 Link& GetLoseFocusHdl (); 206 }; 207 208 class FixedLineImpl; 209 class TOOLKIT_DLLPUBLIC FixedLine : public Control 210 { 211 DECL_GET_IMPL( FixedLine ); 212 DECL_CONSTRUCTORS( FixedLine, Control, WB_HORZ ); 213 214 public: 215 bool IsEnabled() const; 216 }; 217 218 class FixedTextImpl; 219 class TOOLKIT_DLLPUBLIC FixedText : public Control 220 { 221 DECL_GET_IMPL( FixedText ); 222 DECL_CONSTRUCTORS( FixedText, Control, 0 ); 223 224 public: 225 ~FixedText (); 226 void SetText( rtl::OUString const& rStr ); 227 }; 228 229 class FixedImageImpl; 230 class TOOLKIT_DLLPUBLIC FixedImage : public Control 231 { 232 DECL_GET_IMPL( FixedImage ); 233 DECL_CONSTRUCTORS( FixedImage, Control, 0 ); 234 public: 235 void setImage( ::Image const& ); 236 }; 237 238 class FixedInfoImpl; 239 class TOOLKIT_DLLPUBLIC FixedInfo : public FixedText 240 { 241 DECL_GET_IMPL( FixedInfo ); 242 DECL_CONSTRUCTORS( FixedInfo, FixedText, 0 ); 243 }; 244 245 class ImageImpl; 246 class TOOLKIT_DLLPUBLIC Image 247 { 248 ImageImpl *pImpl; 249 public: 250 Image( char const* pName ); 251 ~Image(); 252 ImageImpl &getImpl() const { return *pImpl; } 253 }; 254 255 class ButtonImpl; 256 class TOOLKIT_DLLPUBLIC Button : public Control 257 { 258 DECL_GET_IMPL( Button ); 259 DECL_CONSTRUCTORS( Button, Control, 0 ); 260 DECL_GET_WINDOW (Button); 261 262 public: 263 ~Button (); 264 static String GetStandardText (sal_uInt16 button_type); 265 void SetText( rtl::OUString const& rStr ); 266 bool SetModeImage (Image const& image); 267 bool SetModeImage (::Image const& image, BmpColorMode mode=BMP_COLOR_NORMAL); 268 void SetImageAlign( ImageAlign eAlign ); 269 270 void SetClickHdl( Link const& rLink ); 271 virtual void Click() /* pure virtual? */; 272 Link& GetClickHdl (); 273 }; 274 275 class PushButtonImpl; 276 class TOOLKIT_DLLPUBLIC PushButton : public Button 277 { 278 DECL_GET_IMPL( PushButton ); 279 DECL_CONSTRUCTORS( PushButton, Button, 0 ); 280 DECL_GET_WINDOW (PushButton); 281 282 public: 283 ~PushButton (); 284 void Check( bool bCheck=true ); 285 bool IsChecked() const; 286 287 void Toggle(); 288 void SetToggleHdl( Link const& rLink ); 289 }; 290 291 class TOOLKIT_DLLPUBLIC OKButton : public PushButton 292 { 293 DECL_CONSTRUCTORS( OKButton, PushButton, WB_DEFBUTTON ); 294 }; 295 class TOOLKIT_DLLPUBLIC CancelButton : public PushButton 296 { 297 DECL_CONSTRUCTORS( CancelButton, PushButton, 0 ); 298 }; 299 class TOOLKIT_DLLPUBLIC YesButton : public PushButton 300 { 301 DECL_CONSTRUCTORS( YesButton, PushButton, WB_DEFBUTTON ); 302 }; 303 class TOOLKIT_DLLPUBLIC NoButton : public PushButton 304 { 305 DECL_CONSTRUCTORS( NoButton, PushButton, 0 ); 306 }; 307 class TOOLKIT_DLLPUBLIC RetryButton : public PushButton 308 { 309 DECL_CONSTRUCTORS( RetryButton, PushButton, 0 ); 310 }; 311 class TOOLKIT_DLLPUBLIC IgnoreButton : public PushButton 312 { 313 DECL_CONSTRUCTORS( IgnoreButton, PushButton, 0 ); 314 }; 315 class TOOLKIT_DLLPUBLIC ResetButton : public PushButton 316 { 317 DECL_CONSTRUCTORS( ResetButton, PushButton, 0 ); 318 }; 319 class TOOLKIT_DLLPUBLIC ApplyButton : public PushButton 320 { 321 DECL_CONSTRUCTORS( ApplyButton, PushButton, 0 ); 322 }; 323 class TOOLKIT_DLLPUBLIC HelpButton : public PushButton 324 { 325 DECL_CONSTRUCTORS( HelpButton, PushButton, 0 ); 326 }; 327 class TOOLKIT_DLLPUBLIC ImageButton : public PushButton 328 { 329 DECL_CONSTRUCTORS( ImageButton, PushButton, 0 ); 330 }; 331 332 class AdvancedButtonImpl; 333 class TOOLKIT_DLLPUBLIC AdvancedButton : public PushButton 334 { 335 DECL_CONSTRUCTORS( AdvancedButton, PushButton, 0 ); 336 DECL_GET_IMPL( AdvancedButton ); 337 338 void AddAdvanced( Window* w ); 339 void AddSimple( Window* w ); 340 void RemoveAdvanced( Window* w ); 341 void RemoveSimple( Window* w ); 342 343 void SetAdvancedText (rtl::OUString const& text); 344 void SetSimpleText (rtl::OUString const& text); 345 rtl::OUString GetAdvancedText () const; 346 rtl::OUString GetSimpleText () const; 347 void SetDelta (int); 348 }; 349 350 class MoreButtonImpl; 351 class TOOLKIT_DLLPUBLIC MoreButton : public AdvancedButton 352 { 353 DECL_CONSTRUCTORS( MoreButton, AdvancedButton, 0 ); 354 DECL_GET_IMPL( MoreButton ); 355 void AddWindow( Window* w ); 356 void RemoveWindow( Window* w ); 357 358 void SetMoreText (rtl::OUString const& text); 359 void SetLessText (rtl::OUString const& text); 360 rtl::OUString GetMoreText () const; 361 rtl::OUString GetLessText () const; 362 }; 363 364 class RadioButtonImpl; 365 class TOOLKIT_DLLPUBLIC RadioButton : public Button 366 { 367 DECL_GET_IMPL( RadioButton ); 368 DECL_CONSTRUCTORS( RadioButton, Button, 0 ); 369 DECL_GET_WINDOW( RadioButton ); 370 DECL_GET_VCLXWINDOW( RadioButton ); 371 public: 372 ~RadioButton (); 373 void Check( bool bCheck=true ); 374 bool IsChecked() const; 375 376 void Toggle(); 377 void SetToggleHdl( Link const& rLink ); 378 }; 379 380 class CheckBoxImpl; 381 class TOOLKIT_DLLPUBLIC CheckBox : public Button 382 { 383 DECL_GET_IMPL( CheckBox ); 384 DECL_CONSTRUCTORS( CheckBox, Button, 0 ); 385 386 public: 387 ~CheckBox (); 388 void Check( bool bCheck=true ); 389 bool IsChecked() const; 390 391 void Toggle(); 392 void SetToggleHdl( Link const& rLink ); 393 }; 394 395 class EditImpl; 396 class TOOLKIT_DLLPUBLIC Edit : public Control 397 { 398 DECL_GET_IMPL( Edit ); 399 DECL_CONSTRUCTORS( Edit, Control, WB_BORDER ); 400 DECL_GET_WINDOW (Edit); 401 402 public: 403 ~Edit (); 404 void SetText( rtl::OUString const& rStr ); 405 String GetText() const; 406 void SetModifyHdl( Link const& rLink ); 407 void SetSelection( Selection const& rSelection ); 408 }; 409 410 class MultiLineEditImpl; 411 class TOOLKIT_DLLPUBLIC MultiLineEdit : public Edit 412 { 413 DECL_GET_IMPL( MultiLineEdit ); 414 DECL_CONSTRUCTORS( MultiLineEdit, Edit, WB_LEFT|WB_BORDER ); 415 }; 416 417 class SpinFieldImpl; 418 class TOOLKIT_DLLPUBLIC SpinField : public Edit 419 { 420 DECL_GET_IMPL( SpinField ); 421 DECL_CONSTRUCTORS( SpinField, Edit, 0 ); 422 }; 423 424 class FormatterBaseImpl; 425 class TOOLKIT_DLLPUBLIC FormatterBase 426 { 427 protected: 428 FormatterBaseImpl *mpFormatImpl; 429 FormatterBase( FormatterBaseImpl *pFormatImpl ); 430 }; 431 432 class NumericFormatterImpl; 433 class TOOLKIT_DLLPUBLIC NumericFormatter : public FormatterBase 434 { 435 protected: 436 explicit NumericFormatter( FormatterBaseImpl *pImpl ); 437 NumericFormatterImpl &getFormatImpl() const; 438 public: 439 void SetMin( sal_Int64 nNewMin ); 440 void SetMax( sal_Int64 nNewMax ); 441 void SetFirst( sal_Int64 nNewFirst ); 442 void SetLast( sal_Int64 nNewLast ); 443 void SetSpinSize( sal_Int64 nNewSize ); 444 445 void SetValue( sal_Int64 nNewValue ); 446 sal_Int64 GetValue() const; 447 }; 448 449 class NumericFieldImpl; 450 class TOOLKIT_DLLPUBLIC NumericField : public SpinField, public NumericFormatter 451 { 452 DECL_GET_IMPL( NumericField ); 453 public: 454 NumericField( Context *context, char const* id, sal_uInt32 nId=0 ); 455 NumericField( Window *parent, WinBits nStyle ); 456 }; 457 458 class MetricFormatterImpl; 459 // Different inheritance to save code 460 class TOOLKIT_DLLPUBLIC MetricFormatter : public FormatterBase 461 { 462 protected: 463 explicit MetricFormatter( FormatterBaseImpl *pImpl ); 464 MetricFormatterImpl &getFormatImpl() const; 465 public: 466 void SetMin( sal_Int64 nNewMin, FieldUnit nUnit=FUNIT_NONE ); 467 void SetMax( sal_Int64 nNewMax, FieldUnit nUnit=FUNIT_NONE ); 468 void SetFirst( sal_Int64 nNewFirst, FieldUnit nUnit=FUNIT_NONE ); 469 void SetLast( sal_Int64 nNewLast, FieldUnit nUnit=FUNIT_NONE ); 470 void SetValue( sal_Int64 nNewValue, FieldUnit nUnit=FUNIT_NONE ); 471 sal_Int64 GetValue( FieldUnit nUnit=FUNIT_NONE ) const; 472 473 void SetSpinSize( sal_Int64 nNewSize ); 474 }; 475 476 class MetricFieldImpl; 477 class TOOLKIT_DLLPUBLIC MetricField : public SpinField, public MetricFormatter 478 { 479 DECL_GET_IMPL( MetricField ); 480 public: 481 MetricField( Context *context, char const* id, sal_uInt32 nId=0 ); 482 MetricField( Window *parent, WinBits nStyle ); 483 }; 484 485 class ComboBoxImpl; 486 class TOOLKIT_DLLPUBLIC ComboBox : public Edit 487 { 488 DECL_GET_IMPL( ComboBox ); 489 DECL_GET_WINDOW (ComboBox ); 490 DECL_CONSTRUCTORS( ComboBox, Edit, 0 ); 491 492 public: 493 ~ComboBox (); 494 sal_uInt16 InsertEntry( String const& rStr, sal_uInt16 nPos=COMBOBOX_APPEND ); 495 void RemoveEntry( String const& rStr ); 496 void RemoveEntry( sal_uInt16 nPos ); 497 void Clear(); 498 499 sal_uInt16 GetEntryPos( String const& rStr ) const; 500 String GetEntry( sal_uInt16 nPos ) const; 501 sal_uInt16 GetEntryCount() const; 502 503 void SetClickHdl( Link const& rLink ); 504 void SetSelectHdl( Link const& rLink ); 505 void EnableAutocomplete (bool enable, bool matchCase=false ); 506 }; 507 508 class ListBoxImpl; 509 class TOOLKIT_DLLPUBLIC ListBox : public Control 510 { 511 DECL_GET_IMPL( ListBox ); 512 DECL_CONSTRUCTORS( ListBox, Control, WB_BORDER ); 513 DECL_GET_WINDOW (ListBox); 514 515 public: 516 ~ListBox (); 517 sal_uInt16 InsertEntry( String const& rStr, sal_uInt16 nPos=LISTBOX_APPEND ); 518 519 void RemoveEntry( String const& rStr ); 520 void RemoveEntry( sal_uInt16 nPos ); 521 void Clear(); 522 523 sal_uInt16 GetEntryPos( String const& rStr ) const; 524 String GetEntry( sal_uInt16 nPos ) const; 525 sal_uInt16 GetEntryCount() const; 526 527 void SelectEntry( String const& rStr, bool bSelect=true ); 528 void SelectEntryPos( sal_uInt16 nPos, bool bSelect=true ); 529 530 sal_uInt16 GetSelectEntryCount() const; 531 String GetSelectEntry( sal_uInt16 nSelIndex=0 ) const; 532 sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex=0 ) const; 533 534 void SetSelectHdl (Link const& link); 535 Link& GetSelectHdl (); 536 537 void SetClickHdl (Link const& link); 538 Link& GetClickHdl (); 539 540 void SetDoubleClickHdl (Link const& link); 541 Link& GetDoubleClickHdl (); 542 543 void SetEntryData (sal_uInt16 pos, void* data); 544 void* GetEntryData (sal_uInt16 pos) const; 545 546 virtual void SetNoSelection (); 547 }; 548 549 class MultiListBoxImpl; 550 class TOOLKIT_DLLPUBLIC MultiListBox : public ListBox 551 { 552 DECL_GET_IMPL( MultiListBox ); 553 DECL_CONSTRUCTORS( MultiListBox, ListBox, 0 ); 554 DECL_GET_WINDOW( MultiListBox ); 555 }; 556 557 class DialogImpl; 558 class TOOLKIT_DLLPUBLIC Dialog : public Context, public Window 559 { 560 DECL_GET_WINDOW (Dialog); 561 562 public: 563 DECL_GET_IMPL (Dialog); 564 Dialog( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); 565 Dialog( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); 566 ~Dialog (); 567 virtual short Execute(); 568 void EndDialog( long nResult=0 ); 569 void SetText( rtl::OUString const& rStr ); 570 void SetTitle (rtl::OUString const& rStr ); 571 bool Close (); 572 long Notify (NotifyEvent & event); 573 574 // Sxf*Dialog 575 bool bConstruct; 576 void Initialize (SfxChildWinInfo*); 577 }; 578 579 #define DECL_MESSAGE_BOX_CTORS(Name)\ 580 public:\ 581 Name##Box (::Window *parent, char const* message,\ 582 char const* yes=0, char const* no=0, const rtl::OString& help_id=rtl::OString(),\ 583 char const* xml_file="message-box.xml", char const* id="message-box");\ 584 Name##Box (::Window *parent, rtl::OUString const& message,\ 585 rtl::OUString yes=String (),\ 586 rtl::OUString no=String (),\ 587 const rtl::OString& help_id=rtl::OString(),\ 588 char const* xml_file="message-box.xml", char const* id="message-box");\ 589 Name##Box (::Window *parent, WinBits, char const* message,\ 590 char const* yes=0, char const* no=0, const rtl::OString& help_id=rtl::OString(),\ 591 char const* xml_file="message-box.xml", char const* id="message-box");\ 592 Name##Box (::Window *parent, WinBits, rtl::OUString const& message,\ 593 rtl::OUString yes=String (),\ 594 rtl::OUString no=String (),\ 595 const rtl::OString& help_id=rtl::OString(),\ 596 char const* xml_file="message-box.xml", char const* id="message-box")\ 597 598 class TOOLKIT_DLLPUBLIC MessageBox : public Dialog 599 { 600 DECL_MESSAGE_BOX_CTORS(Message); 601 602 protected: 603 FixedImage imageError; 604 FixedImage imageInfo; 605 FixedImage imageQuery; 606 FixedImage imageWarning; 607 FixedText messageText; 608 CancelButton cancelButton; 609 HelpButton helpButton; 610 IgnoreButton ignoreButton; 611 NoButton noButton; 612 RetryButton retryButton; 613 YesButton yesButton; 614 615 void bits_init (WinBits bits, rtl::OUString const& message, 616 rtl::OUString yes, rtl::OUString, const rtl::OString& help_id); 617 void init (rtl::OUString const& message, 618 rtl::OUString const& yes, rtl::OUString const& no, const rtl::OString& help_id); 619 void init (char const* message, char const* yes, char const* no, const rtl::OString& help_id); 620 }; 621 622 #define CLASS_MESSAGE_BOX(Name)\ 623 class TOOLKIT_DLLPUBLIC Name##Box : public MessageBox\ 624 {\ 625 DECL_MESSAGE_BOX_CTORS (Name);\ 626 } 627 628 //CLASS_MESSAGE_BOX (Mess); 629 typedef MessageBox MessBox; 630 CLASS_MESSAGE_BOX (Error); 631 CLASS_MESSAGE_BOX (Info); 632 CLASS_MESSAGE_BOX (Query); 633 CLASS_MESSAGE_BOX (Warning); 634 635 #undef CLASS_MESSAGE_BOX 636 637 #undef TAB_APPEND 638 639 class TabControlImpl; 640 class TOOLKIT_DLLPUBLIC TabControl : public Control 641 { 642 //#ifndef TAB_APPEND 643 #define TAB_APPEND 0xFFFF 644 //#endif /* !TAB_APPEND */ 645 646 DECL_GET_IMPL (TabControl); 647 DECL_CONSTRUCTORS (TabControl, Control, 0); 648 DECL_GET_WINDOW (TabControl); 649 DECL_GET_LAYOUT_VCLXWINDOW (TabControl); 650 651 public: 652 ~TabControl (); 653 void InsertPage (sal_uInt16 id, rtl::OUString const& title, sal_uInt16 pos=TAB_APPEND); 654 void RemovePage (sal_uInt16 id); 655 sal_uInt16 GetPageCount () const; 656 sal_uInt16 GetPageId (sal_uInt16 pos) const; 657 sal_uInt16 GetPagePos (sal_uInt16 id) const; 658 void SetCurPageId (sal_uInt16 id); 659 sal_uInt16 GetCurPageId () const; 660 void SetTabPage (sal_uInt16 id, ::TabPage* page); 661 ::TabPage* GetTabPage (sal_uInt16 id) const; 662 void SetActivatePageHdl (Link const& link); 663 Link& GetActivatePageHdl () const; 664 void SetDeactivatePageHdl (Link const& link); 665 Link& GetDeactivatePageHdl () const; 666 void SetTabPageSizePixel (Size const& size); 667 Size GetTabPageSizePixel () const; 668 }; 669 670 class TabPageImpl; 671 class TOOLKIT_DLLPUBLIC TabPage : public Context, public Window 672 { 673 DECL_GET_IMPL( TabPage ); 674 public: 675 static ::Window* global_parent; 676 static TabControl* global_tabcontrol; 677 678 TabPage( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); 679 TabPage( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 ); 680 ~TabPage(); 681 DECL_GET_WINDOW( TabPage ); 682 virtual void ActivatePage(); 683 virtual void DeactivatePage(); 684 }; 685 686 class ProgressBarImpl; 687 class TOOLKIT_DLLPUBLIC ProgressBar : public Control 688 { 689 DECL_GET_IMPL( ProgressBar ); 690 DECL_CONSTRUCTORS( ProgressBar, Control, WB_BORDER ); 691 public: 692 void SetForegroundColor( css::util::Color color ); 693 void SetBackgroundColor( css::util::Color color ); 694 void SetValue( sal_Int32 i ); 695 void SetRange( sal_Int32 min, sal_Int32 max ); 696 sal_Int32 GetValue(); 697 }; 698 699 // ----------------------------------------------------------------- 700 // layout container / helper wrappers 701 // ----------------------------------------------------------------- 702 703 class TOOLKIT_DLLPUBLIC Container 704 { 705 protected: 706 css::uno::Reference< css::awt::XLayoutContainer > mxContainer; 707 Container( rtl::OUString const& rName, sal_Int32 nBorder ); 708 public: 709 Container( Context const* context, char const* id ); 710 711 void Add( Window *pWindow ); 712 void Add( Container *pContainer ); 713 714 void Remove( Window *pWindow ); 715 void Remove( Container *pContainer ); 716 void Clear(); 717 // we can't really do a GetChildren() as they don't have a common class, 718 // besides we would need to keep track of children, uh 719 720 void ShowAll( bool bVisible ); 721 void Show(); 722 void Hide(); 723 724 css::uno::Reference< css::awt::XLayoutContainer > getImpl() 725 { return mxContainer; } 726 }; 727 728 class TOOLKIT_DLLPUBLIC Table : public Container 729 { 730 protected: 731 Table( sal_Int32 nBorder, sal_Int32 nColumns ); 732 public: 733 Table( Context const* context, char const* id ); 734 void Add( Window *pWindow, bool bXExpand, bool bYExpand, 735 sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 ); 736 void Add( Container *pContainer, bool bXExpand, bool bYExpand, 737 sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 ); 738 739 private: 740 void setProps( css::uno::Reference< css::awt::XLayoutConstrains > xChild, 741 bool bXExpand, bool bYExpand, sal_Int32 nXSpan, sal_Int32 nYSpan ); 742 }; 743 744 class TOOLKIT_DLLPUBLIC Box : public Container 745 { 746 protected: 747 Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous ); 748 public: 749 Box( Context const* context, char const* id ); 750 void Add( Window *pWindow, bool bExpand, bool bFill, sal_Int32 nPadding); 751 void Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding); 752 753 private: 754 void setProps( css::uno::Reference< css::awt::XLayoutConstrains > xChild, 755 bool bXExpand, bool bYExpand, sal_Int32 nPadding ); 756 }; 757 758 class TOOLKIT_DLLPUBLIC HBox : public Box 759 { 760 public: 761 HBox( Context const* context, char const* id ); 762 HBox( sal_Int32 nBorder, bool bHomogeneous ); 763 }; 764 class TOOLKIT_DLLPUBLIC VBox : public Box 765 { 766 public: 767 VBox( Context const* context, char const* id ); 768 VBox( sal_Int32 nBorder, bool bHomogeneous ); 769 }; 770 771 class PluginImpl; 772 class TOOLKIT_DLLPUBLIC Plugin : public Control 773 { 774 DECL_GET_IMPL( Plugin ); 775 //DECL_CONSTRUCTORS( Plugin, Control, 0 ); 776 public: 777 ::Control *mpPlugin; 778 Plugin( Context *context, char const* id, ::Control *plugin ); 779 }; 780 781 class LocalizedStringImpl; 782 class TOOLKIT_DLLPUBLIC LocalizedString : public Window 783 { 784 DECL_GET_IMPL( LocalizedString ); 785 786 public: 787 LocalizedString( Context *context, char const* id ); 788 789 rtl::OUString operator= (rtl::OUString const&); 790 rtl::OUString operator+= (sal_Unicode ); 791 rtl::OUString operator+= (rtl::OUString const&); 792 793 operator rtl::OUString (); 794 operator rtl::OUString const& (); 795 operator String(); 796 String getString (); 797 rtl::OUString getOUString (); 798 String GetToken (sal_uInt16 i, sal_Char c); 799 }; 800 801 class InPlugImpl; 802 class TOOLKIT_DLLPUBLIC InPlug : public Context, public Window 803 { 804 DECL_GET_IMPL (InPlug); 805 806 public: 807 InPlug ( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0); 808 InPlug ( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0); 809 810 void ParentSet (Window *window); 811 }; 812 813 } // end namespace layout 814 815 #if ENABLE_LAYOUT 816 #define LAYOUT_NS layout:: 817 #define LAYOUT_DIALOG_PARENT\ 818 VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ) )->GetWindow() 819 #define LAYOUT_THIS_WINDOW( this ) this->GetWindow () 820 #else /* !ENABLE_LAYOUT */ 821 #define LAYOUT_NS 822 #define LAYOUT_DIALOG_PARENT this 823 #define LAYOUT_THIS_WINDOW( this ) this 824 #endif /* !ENABLE_LAYOUT */ 825 826 #endif /* _LAYOUT_HXX */ 827