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 _SV_MENU_HXX 25 #define _SV_MENU_HXX 26 27 #include <vcl/sv.h> 28 #include <vcl/dllapi.h> 29 #include <tools/rc.hxx> 30 #include <tools/resid.hxx> 31 #include <vcl/bitmapex.hxx> 32 #include <tools/color.hxx> 33 #include <vcl/vclevent.hxx> 34 #include <com/sun/star/uno/Reference.hxx> 35 36 struct MenuItemData; 37 class Point; 38 class Size; 39 class Rectangle; 40 class Menu; 41 class MenuItemList; 42 class HelpEvent; 43 class Image; 44 class PopupMenu; 45 class KeyCode; 46 class KeyEvent; 47 class AppBarWindow; 48 class MenuFloatingWindow; 49 class Window; 50 class SalMenu; 51 struct SystemMenuData; 52 53 namespace com { 54 namespace sun { 55 namespace star { 56 namespace accessibility { 57 class XAccessible; 58 }}}} 59 60 namespace vcl { struct MenuLayoutData; } 61 62 // -------------- 63 // - Menu-Types - 64 // -------------- 65 66 #define MENU_APPEND ((sal_uInt16)0xFFFF) 67 #define MENU_ITEM_NOTFOUND ((sal_uInt16)0xFFFF) 68 69 #define POPUPMENU_EXECUTE_DOWN ((sal_uInt16)0x0001) 70 #define POPUPMENU_EXECUTE_UP ((sal_uInt16)0x0002) 71 #define POPUPMENU_EXECUTE_LEFT ((sal_uInt16)0x0004) 72 #define POPUPMENU_EXECUTE_RIGHT ((sal_uInt16)0x0008) 73 74 #define POPUPMENU_NOMOUSEUPCLOSE ((sal_uInt16)0x0010) 75 76 // By changes you must also change: rsc/vclrsc.hxx 77 enum MenuItemType { MENUITEM_DONTKNOW, MENUITEM_STRING, MENUITEM_IMAGE, 78 MENUITEM_STRINGIMAGE, MENUITEM_SEPARATOR }; 79 80 // By changes you must also change: rsc/vclrsc.hxx 81 typedef sal_uInt16 MenuItemBits; 82 #define MIB_CHECKABLE ((MenuItemBits)0x0001) 83 #define MIB_RADIOCHECK ((MenuItemBits)0x0002) 84 #define MIB_AUTOCHECK ((MenuItemBits)0x0004) 85 #define MIB_ABOUT ((MenuItemBits)0x0008) 86 #define MIB_HELP ((MenuItemBits)0x0010) 87 #define MIB_POPUPSELECT ((MenuItemBits)0x0020) 88 // not in rsc/vclsrc.hxx because only a prelimitary solution 89 #define MIB_NOSELECT ((MenuItemBits)0x0040) 90 #define MIB_ICON ((MenuItemBits)0x0080) 91 #define MIB_TEXT ((MenuItemBits)0x0100) 92 93 #define MENU_FLAG_NOAUTOMNEMONICS 0x0001 94 #define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002 95 96 // overrides default hiding of disabled entries in popup menus 97 #define MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES 0x0004 98 99 // forces images & toggle visibility for toolbar config popup 100 #define MENU_FLAG_SHOWCHECKIMAGES 0x0008 101 102 struct ImplMenuDelData 103 { 104 ImplMenuDelData* mpNext; 105 const Menu* mpMenu; 106 107 ImplMenuDelData( const Menu* pMenu ); 108 ~ImplMenuDelData(); 109 110 bool isDeleted() const { return mpMenu == 0; } 111 }; 112 113 // -------- 114 // - Menu - 115 // -------- 116 117 struct MenuLogo 118 { 119 BitmapEx aBitmap; 120 Color aStartColor; 121 Color aEndColor; 122 }; 123 124 class VCL_DLLPUBLIC Menu : public Resource 125 { 126 friend class MenuBar; 127 friend class MenuBarWindow; 128 friend class MenuFloatingWindow; 129 friend class PopupMenu; 130 friend class SystemWindow; 131 friend struct ImplMenuDelData; 132 private: 133 ImplMenuDelData* mpFirstDel; 134 MenuItemList* pItemList; // Liste mit den MenuItems 135 MenuLogo* pLogo; 136 Menu* pStartedFrom; 137 Window* pWindow; 138 139 Link aActivateHdl; // Active-Handler 140 Link aDeactivateHdl; // Deactivate-Handler 141 Link aHighlightHdl; // Highlight-Handler 142 Link aSelectHdl; // Highlight-Handler 143 144 VclEventListeners maEventListeners; 145 VclEventListeners maChildEventListeners; 146 147 XubString aTitleText; // PopupMenu-Text 148 149 sal_uLong nEventId; 150 sal_uInt16 mnHighlightedItemPos; // for native menues: keeps track of the highlighted item 151 sal_uInt16 nMenuFlags; 152 sal_uInt16 nDefaultItem; // Id vom Default-Item 153 sal_uInt16 nSelectedId; 154 155 // Fuer Ausgabe: 156 sal_uInt16 nCheckPos; 157 sal_uInt16 nImagePos; 158 sal_uInt16 nTextPos; 159 160 sal_Bool bIsMenuBar : 1, // Handelt es sich um den MenuBar 161 bCanceled : 1, // Waehrend eines Callbacks abgebrochen 162 bInCallback : 1, // In Activate/Deactivate 163 bKilled : 1; // Gekillt... 164 165 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible; 166 mutable vcl::MenuLayoutData* mpLayoutData; 167 SalMenu* mpSalMenu; 168 169 protected: 170 SAL_DLLPRIVATE void ImplInit(); 171 SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 172 SAL_DLLPRIVATE Menu* ImplGetStartMenu(); 173 SAL_DLLPRIVATE Menu* ImplFindSelectMenu(); 174 SAL_DLLPRIVATE Menu* ImplFindMenu( sal_uInt16 nId ); 175 SAL_DLLPRIVATE Size ImplCalcSize( Window* pWin ); 176 SAL_DLLPRIVATE sal_Bool ImplIsVisible( sal_uInt16 nPos ) const; 177 SAL_DLLPRIVATE sal_Bool ImplIsSelectable( sal_uInt16 nPos ) const; 178 SAL_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const; 179 SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisible() const; 180 SAL_DLLPRIVATE sal_uInt16 ImplGetPrevVisible( sal_uInt16 nPos ) const; 181 SAL_DLLPRIVATE sal_uInt16 ImplGetNextVisible( sal_uInt16 nPos ) const; 182 SAL_DLLPRIVATE void ImplPaint( Window* pWin, sal_uInt16 nBorder, long nOffY = 0, MenuItemData* pThisDataOnly = 0, sal_Bool bHighlighted = sal_False, bool bLayout = false ) const; 183 SAL_DLLPRIVATE void ImplSelect(); 184 SAL_DLLPRIVATE void ImplCallHighlight( sal_uInt16 nHighlightItem ); 185 SAL_DLLPRIVATE void ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos ); 186 DECL_DLLPRIVATE_LINK( ImplCallSelect, Menu* ); 187 188 SAL_DLLPRIVATE void ImplFillLayoutData() const; 189 SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu; } 190 SAL_DLLPRIVATE void ImplSetSalMenu( SalMenu *pMenu ); 191 SAL_DLLPRIVATE const XubString& ImplGetHelpText( sal_uInt16 nItemId ) const; 192 193 // returns native check and option menu symbol height; 194 // return value is Max( rCheckHeight, rRadioHeight ) 195 SAL_DLLPRIVATE long ImplGetNativeCheckAndRadioSize( Window*, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) const; 196 197 SAL_DLLPRIVATE void ImplAddDel( ImplMenuDelData &rDel ); 198 SAL_DLLPRIVATE void ImplRemoveDel( ImplMenuDelData &rDel ); 199 public: 200 SAL_DLLPRIVATE void ImplKillLayoutData() const; 201 SAL_DLLPRIVATE Menu* ImplGetStartedFrom() const; 202 203 Menu(); 204 Menu( sal_Bool bMenuBar ); 205 SAL_DLLPRIVATE Window* ImplGetWindow() const { return pWindow; } 206 207 208 SAL_DLLPRIVATE void ImplSelectWithStart( Menu* pStartMenu = NULL ); 209 public: 210 virtual ~Menu(); 211 212 virtual void Activate(); 213 virtual void Deactivate(); 214 virtual void Highlight(); 215 virtual void Select(); 216 virtual void RequestHelp( const HelpEvent& rHEvt ); 217 218 void InsertItem( sal_uInt16 nItemId, const XubString& rStr, 219 MenuItemBits nItemBits = 0, 220 sal_uInt16 nPos = MENU_APPEND ); 221 void InsertItem( sal_uInt16 nItemId, const Image& rImage, 222 MenuItemBits nItemBits = 0, 223 sal_uInt16 nPos = MENU_APPEND ); 224 void InsertItem( sal_uInt16 nItemId, 225 const XubString& rString, const Image& rImage, 226 MenuItemBits nItemBits = 0, 227 sal_uInt16 nPos = MENU_APPEND ); 228 void InsertItem( const ResId& rResId, sal_uInt16 nPos = MENU_APPEND ); 229 void InsertSeparator( sal_uInt16 nPos = MENU_APPEND ); 230 void RemoveItem( sal_uInt16 nPos ); 231 void CopyItem( const Menu& rMenu, sal_uInt16 nPos, 232 sal_uInt16 nNewPos = MENU_APPEND ); 233 void Clear(); 234 235 void CreateAutoMnemonics(); 236 237 void SetMenuFlags( sal_uInt16 nFlags ) { nMenuFlags = nFlags; } 238 sal_uInt16 GetMenuFlags() const { return nMenuFlags; } 239 240 sal_uInt16 GetItemCount() const; 241 sal_uInt16 GetItemId( sal_uInt16 nPos ) const; 242 sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const; 243 MenuItemType GetItemType( sal_uInt16 nPos ) const; 244 sal_uInt16 GetCurItemId() const; 245 246 void SetDefaultItem( sal_uInt16 nItemId ) { nDefaultItem = nItemId; } 247 sal_uInt16 GetDefaultItem() const { return nDefaultItem; } 248 249 void SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits ); 250 MenuItemBits GetItemBits( sal_uInt16 nItemId ) const; 251 252 void SetUserValue( sal_uInt16 nItemId, sal_uLong nValue ); 253 sal_uLong GetUserValue( sal_uInt16 nItemId ) const; 254 255 void SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu ); 256 PopupMenu* GetPopupMenu( sal_uInt16 nItemId ) const; 257 258 void SetAccelKey( sal_uInt16 nItemId, const KeyCode& rKeyCode ); 259 KeyCode GetAccelKey( sal_uInt16 nItemId ) const; 260 261 void CheckItem( sal_uInt16 nItemId, sal_Bool bCheck = sal_True ); 262 sal_Bool IsItemChecked( sal_uInt16 nItemId ) const; 263 264 void SelectItem( sal_uInt16 nItemId ); 265 void DeSelect() { SelectItem( 0xFFFF ); } // MENUITEMPOS_INVALID 266 267 void EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True ); 268 sal_Bool IsItemEnabled( sal_uInt16 nItemId ) const; 269 270 void ShowItem( sal_uInt16 nItemId, sal_Bool bVisible = sal_True ); 271 void HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, sal_False ); } 272 273 sal_Bool IsItemVisible( sal_uInt16 nItemId ) const; 274 sal_Bool IsItemPosVisible( sal_uInt16 nItemPos ) const; 275 sal_Bool IsMenuVisible() const; 276 sal_Bool IsMenuBar() const { return bIsMenuBar; } 277 278 void RemoveDisabledEntries( sal_Bool bCheckPopups = sal_True, sal_Bool bRemoveEmptyPopups = sal_False ); 279 sal_Bool HasValidEntries( sal_Bool bCheckPopups = sal_True ); 280 281 void SetItemText( sal_uInt16 nItemId, const XubString& rStr ); 282 XubString GetItemText( sal_uInt16 nItemId ) const; 283 284 void SetItemImage( sal_uInt16 nItemId, const Image& rImage ); 285 Image GetItemImage( sal_uInt16 nItemId ) const; 286 void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 ); 287 long GetItemImageAngle( sal_uInt16 nItemId ) const; 288 void SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror ); 289 sal_Bool GetItemImageMirrorMode( sal_uInt16 ) const; 290 291 void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand ); 292 const XubString& GetItemCommand( sal_uInt16 nItemId ) const; 293 294 void SetHelpText( sal_uInt16 nItemId, const XubString& rString ); 295 const XubString& GetHelpText( sal_uInt16 nItemId ) const; 296 297 void SetTipHelpText( sal_uInt16 nItemId, const XubString& rString ); 298 const XubString& GetTipHelpText( sal_uInt16 nItemId ) const; 299 300 void SetHelpCommand( sal_uInt16 nItemId, const XubString& rString ); 301 const XubString& GetHelpCommand( sal_uInt16 nItemId ) const; 302 303 void SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ); 304 rtl::OString GetHelpId( sal_uInt16 nItemId ) const; 305 306 void SetActivateHdl( const Link& rLink ) { aActivateHdl = rLink; } 307 const Link& GetActivateHdl() const { return aActivateHdl; } 308 309 void SetDeactivateHdl( const Link& rLink ) { aDeactivateHdl = rLink; } 310 const Link& GetDeactivateHdl() const { return aDeactivateHdl; } 311 312 void SetHighlightHdl( const Link& rLink ) { aHighlightHdl = rLink; } 313 const Link& GetHighlightHdl() const { return aHighlightHdl; } 314 315 void SetSelectHdl( const Link& rLink ) { aSelectHdl = rLink; } 316 const Link& GetSelectHdl() const { return aSelectHdl; } 317 318 void SetLogo( const MenuLogo& rLogo ); 319 void SetLogo(); 320 sal_Bool HasLogo() const { return pLogo ? sal_True : sal_False; } 321 MenuLogo GetLogo() const; 322 323 void AddEventListener( const Link& rEventListener ); 324 void RemoveEventListener( const Link& rEventListener ); 325 //void AddChildEventListener( const Link& rEventListener ); 326 //void RemoveChildEventListener( const Link& rEventListener ); 327 328 Menu& operator =( const Menu& rMenu ); 329 330 // Fuer Menu-'Funktionen' 331 MenuItemList* GetItemList() const { return pItemList; } 332 333 // returns the system's menu handle if native menues are supported 334 // pData must point to a SystemMenuData structure 335 sal_Bool GetSystemMenuData( SystemMenuData* pData ) const; 336 337 // accessibility helpers 338 339 // gets the displayed text 340 String GetDisplayText() const; 341 // returns the bounding box for the character at index nIndex 342 // where nIndex is relative to the starting index of the item 343 // with id nItemId (in coordinates of the displaying window) 344 Rectangle GetCharacterBounds( sal_uInt16 nItemId, long nIndex ) const; 345 // -1 is returned if no character is at that point 346 // if an index is found the corresponding item id is filled in (else 0) 347 long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const; 348 // returns the number of lines in the result of GetDisplayText() 349 long GetLineCount() const; 350 // returns the interval [start,end] of line nLine 351 // returns [-1,-1] for an invalid line 352 Pair GetLineStartEnd( long nLine ) const; 353 // like GetLineStartEnd but first finds the line number for the item 354 Pair GetItemStartEnd( sal_uInt16 nItemId ) const; 355 // returns the item id for line nLine or 0 if nLine is invalid 356 sal_uInt16 GetDisplayItemId( long nLine ) const; 357 // returns the bounding rectangle for an item at pos nItemPos 358 Rectangle GetBoundingRectangle( sal_uInt16 nItemPos ) const; 359 sal_Bool ConvertPoint( Point& rPoint, Window* pReferenceWindow ) const; 360 361 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible(); 362 void SetAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible ); 363 364 // gets the activation key of the specified item 365 KeyEvent GetActivationKey( sal_uInt16 nItemId ) const; 366 367 Window* GetWindow() const { return pWindow; } 368 369 void SetAccessibleName( sal_uInt16 nItemId, const XubString& rStr ); 370 XubString GetAccessibleName( sal_uInt16 nItemId ) const; 371 372 void SetAccessibleDescription( sal_uInt16 nItemId, const XubString& rStr ); 373 XubString GetAccessibleDescription( sal_uInt16 nItemId ) const; 374 375 // returns whether the item a position nItemPos is highlighted or not. 376 bool IsHighlighted( sal_uInt16 nItemPos ) const; 377 378 void HighlightItem( sal_uInt16 nItemPos ); 379 void DeHighlight() { HighlightItem( 0xFFFF ); } // MENUITEMPOS_INVALID 380 381 382 void doLazyDelete(); 383 }; 384 385 // ----------- 386 // - MenuBar - 387 // ----------- 388 389 class VCL_DLLPUBLIC MenuBar : public Menu 390 { 391 Link maCloserHdl; 392 Link maFloatHdl; 393 Link maHideHdl; 394 sal_Bool mbCloserVisible; 395 sal_Bool mbFloatBtnVisible; 396 sal_Bool mbHideBtnVisible; 397 sal_Bool mbDisplayable; 398 399 //#if 0 // _SOLAR__PRIVATE 400 friend class Application; 401 friend class Menu; 402 friend class MenuBarWindow; 403 friend class MenuFloatingWindow; 404 friend class SystemWindow; 405 406 SAL_DLLPRIVATE static Window* ImplCreate( Window* pParent, Window* pWindow, MenuBar* pMenu ); 407 SAL_DLLPRIVATE static void ImplDestroy( MenuBar* pMenu, sal_Bool bDelete ); 408 SAL_DLLPRIVATE sal_Bool ImplHandleKeyEvent( const KeyEvent& rKEvent, sal_Bool bFromMenu = sal_True ); 409 //#endif 410 411 public: 412 MenuBar(); 413 MenuBar( const ResId& rResId ); 414 MenuBar( const MenuBar& rMenu ); 415 ~MenuBar(); 416 417 MenuBar& operator =( const MenuBar& rMenu ); 418 419 void ShowCloser( sal_Bool bShow = sal_True ); 420 sal_Bool HasCloser() const { return mbCloserVisible; } 421 void ShowFloatButton( sal_Bool bShow = sal_True ); 422 sal_Bool HasFloatButton() const { return mbFloatBtnVisible; } 423 void ShowHideButton( sal_Bool bShow = sal_True ); 424 sal_Bool HasHideButton() const { return mbHideBtnVisible; } 425 void ShowButtons( sal_Bool bClose, sal_Bool bFloat, sal_Bool bHide ); 426 427 void SelectEntry( sal_uInt16 nId ); 428 sal_Bool HandleMenuActivateEvent( Menu *pMenu ) const; 429 sal_Bool HandleMenuDeActivateEvent( Menu *pMenu ) const; 430 sal_Bool HandleMenuHighlightEvent( Menu *pMenu, sal_uInt16 nEventId ) const; 431 sal_Bool HandleMenuCommandEvent( Menu *pMenu, sal_uInt16 nEventId ) const; 432 sal_Bool HandleMenuButtonEvent( Menu *pMenu, sal_uInt16 nEventId ) const; 433 434 void SetCloserHdl( const Link& rLink ) { maCloserHdl = rLink; } 435 const Link& GetCloserHdl() const { return maCloserHdl; } 436 void SetFloatButtonClickHdl( const Link& rLink ) { maFloatHdl = rLink; } 437 const Link& GetFloatButtonClickHdl() const { return maFloatHdl; } 438 void SetHideButtonClickHdl( const Link& rLink ) { maHideHdl = rLink; } 439 const Link& GetHideButtonClickHdl() const { return maHideHdl; } 440 441 // - by default a menubar is displayable 442 // - if a menubar is not displayable, its MenuBarWindow will never be shown 443 // and it will be hidden if it was visible before 444 // - note: if a menubar is diplayable, this does not necessarily mean that it is currently visible 445 void SetDisplayable( sal_Bool bDisplayable ); 446 sal_Bool IsDisplayable() const { return mbDisplayable; } 447 448 struct MenuBarButtonCallbackArg 449 { 450 sal_uInt16 nId; // Id of the button 451 bool bHighlight; // highlight on/off 452 MenuBar* pMenuBar; // menubar the button belongs to 453 }; 454 // add an arbitrary button to the menubar (will appear next to closer) 455 // passed link will be call with a MenuBarButtonCallbackArg on press 456 sal_uInt16 AddMenuBarButton( const Image&, const Link&, sal_uInt16 nPos = 0 ); 457 // add an arbitrary button to the menubar (will appear next to closer) 458 // passed link will be call with a MenuBarButtonCallbackArg on press 459 // passed string will be set as tooltip 460 sal_uInt16 AddMenuBarButton( const Image&, const Link&, const String&, sal_uInt16 nPos = 0 ); 461 // set the highlight link for additional button with ID nId 462 // highlight link will be called with a MenuBarButtonHighlightArg 463 // the bHighlight member of that struct shall contain the new state 464 void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link& ); 465 // returns the rectangle occupied by the additional button named nId 466 // coordinates are relative to the systemwindiow the menubar is attached to 467 // if the menubar is unattached an empty rectangle is returned 468 Rectangle GetMenuBarButtonRectPixel( sal_uInt16 nId ); 469 void RemoveMenuBarButton( sal_uInt16 nId ); 470 }; 471 472 inline MenuBar& MenuBar::operator =( const MenuBar& rMenu ) 473 { 474 Menu::operator =( rMenu ); 475 return *this; 476 } 477 478 479 // ------------- 480 // - PopupMenu - 481 // ------------- 482 483 class VCL_DLLPUBLIC PopupMenu : public Menu 484 { 485 friend class Menu; 486 friend class MenuFloatingWindow; 487 friend class MenuBarWindow; 488 friend struct MenuItemData; 489 490 private: 491 Menu** pRefAutoSubMenu; // keeps track if a pointer to this Menu is stored in the MenuItemData 492 493 SAL_DLLPRIVATE MenuFloatingWindow* ImplGetFloatingWindow() const { return (MenuFloatingWindow*)Menu::ImplGetWindow(); } 494 495 protected: 496 SAL_DLLPRIVATE sal_uInt16 ImplExecute( Window* pWindow, const Rectangle& rRect, sal_uLong nPopupFlags, Menu* pStaredFrom, sal_Bool bPreSelectFirst ); 497 SAL_DLLPRIVATE long ImplCalcHeight( sal_uInt16 nEntries ) const; 498 SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( long nMaxHeight, sal_uInt16 nStartEntry = 0, sal_uInt16* pLastVisible = NULL ) const; 499 500 public: 501 PopupMenu(); 502 PopupMenu( const PopupMenu& rMenu ); 503 PopupMenu( const ResId& rResId ); 504 ~PopupMenu(); 505 506 void SetText( const XubString& rTitle ) { aTitleText = rTitle; } 507 const XubString& GetText() const { return aTitleText; } 508 509 sal_uInt16 Execute( Window* pWindow, const Point& rPopupPos ); 510 sal_uInt16 Execute( Window* pWindow, const Rectangle& rRect, sal_uInt16 nFlags = 0 ); 511 512 // Fuer das TestTool 513 void EndExecute( sal_uInt16 nSelect = 0 ); 514 void SelectEntry( sal_uInt16 nId ); 515 void SetSelectedEntry( sal_uInt16 nId ); // for use by native submenu only 516 517 static sal_Bool IsInExecute(); 518 static PopupMenu* GetActivePopupMenu(); 519 520 PopupMenu& operator =( const PopupMenu& rMenu ); 521 }; 522 523 inline PopupMenu& PopupMenu::operator =( const PopupMenu& rMenu ) 524 { 525 Menu::operator =( rMenu ); 526 return *this; 527 } 528 529 #endif // _SV_MENU_HXX 530 531