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