LCOV - code coverage report
Current view: top level - include/vcl - menu.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 23 37 62.2 %
Date: 2014-11-03 Functions: 21 31 67.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_MENU_HXX
      21             : #define INCLUDED_VCL_MENU_HXX
      22             : 
      23             : #include <rsc/rsc-vcl-shared-types.hxx>
      24             : #include <tools/color.hxx>
      25             : #include <tools/rc.hxx>
      26             : #include <tools/resid.hxx>
      27             : #include <tools/solar.h>
      28             : #include <vcl/dllapi.h>
      29             : #include <vcl/bitmapex.hxx>
      30             : #include <vcl/keycod.hxx>
      31             : #include <vcl/vclevent.hxx>
      32             : #include <com/sun/star/frame/XFrame.hpp>
      33             : #include <com/sun/star/uno/Reference.hxx>
      34             : 
      35             : struct ImplSVEvent;
      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 KeyEvent;
      46             : class MenuFloatingWindow;
      47             : namespace vcl { class Window; }
      48             : class SalMenu;
      49             : class IMenuBarWindow;
      50             : struct SystemMenuData;
      51             : 
      52             : namespace com {
      53             : namespace sun {
      54             : namespace star {
      55             : namespace accessibility {
      56             :     class XAccessible;
      57             : }}}}
      58             : 
      59             : namespace vcl { struct MenuLayoutData; }
      60             : 
      61             : 
      62             : // - Menu-Types -
      63             : 
      64             : 
      65             : #define MENU_APPEND             ((sal_uInt16)0xFFFF)
      66             : #define MENU_ITEM_NOTFOUND      ((sal_uInt16)0xFFFF)
      67             : 
      68             : #define POPUPMENU_EXECUTE_DOWN     ((sal_uInt16)0x0001)
      69             : #define POPUPMENU_EXECUTE_UP       ((sal_uInt16)0x0002)
      70             : #define POPUPMENU_EXECUTE_LEFT     ((sal_uInt16)0x0004)
      71             : #define POPUPMENU_EXECUTE_RIGHT    ((sal_uInt16)0x0008)
      72             : #define POPUPMENU_NOMOUSEUPCLOSE   ((sal_uInt16)0x0010)
      73             : //If there isn't enough space to put the menu where it wants
      74             : //to go, then they will be autoplaced. Toggle this bit
      75             : //on to force menus to be placed either above or below
      76             : //the starting rectangle and shrunk to fit and then scroll rather than place
      77             : //the menu beside that rectangle
      78             : #define POPUPMENU_NOHORZ_PLACEMENT ((sal_uInt16)0x0020)
      79             : 
      80             : #define MENU_FLAG_NOAUTOMNEMONICS       0x0001
      81             : #define MENU_FLAG_HIDEDISABLEDENTRIES   0x0002
      82             : 
      83             : // overrides default hiding of disabled entries in popup menus
      84             : #define MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES 0x0004
      85             : 
      86             : /// Invalid menu item id
      87             : #define ITEMPOS_INVALID     0xFFFF
      88             : 
      89             : struct ImplMenuDelData
      90             : {
      91             :     ImplMenuDelData* mpNext;
      92             :     const Menu* mpMenu;
      93             : 
      94             :     explicit ImplMenuDelData( const Menu* );
      95             :     ~ImplMenuDelData();
      96             : 
      97     2508451 :     bool isDeleted() const { return mpMenu == 0; }
      98             : };
      99             : 
     100             : 
     101             : // - Menu -
     102             : 
     103             : 
     104           0 : struct MenuLogo
     105             : {
     106             :     BitmapEx    aBitmap;
     107             :     Color       aStartColor;
     108             :     Color       aEndColor;
     109             : };
     110             : 
     111             : class VCL_DLLPUBLIC Menu : public Resource
     112             : {
     113             :     friend class MenuBar;
     114             :     friend class MenuBarWindow;
     115             :     friend class MenuButton;
     116             :     friend class MenuFloatingWindow;
     117             :     friend class PopupMenu;
     118             :     friend class SystemWindow;
     119             :     friend struct ImplMenuDelData;
     120             : private:
     121             :     ImplMenuDelData*    mpFirstDel;
     122             :     MenuItemList*       pItemList;          // Liste mit den MenuItems
     123             :     MenuLogo*           pLogo;
     124             :     Menu*               pStartedFrom;
     125             :     vcl::Window*             pWindow;
     126             : 
     127             :     Link                aActivateHdl;       // Active-Handler
     128             :     Link                aDeactivateHdl;     // Deactivate-Handler
     129             :     Link                aHighlightHdl;      // Highlight-Handler
     130             :     Link                aSelectHdl;         // Highlight-Handler
     131             : 
     132             :     VclEventListeners   maEventListeners;
     133             :     VclEventListeners   maChildEventListeners;
     134             : 
     135             :     OUString            aTitleText;         // PopupMenu text
     136             : 
     137             :     ImplSVEvent *       nEventId;
     138             :     sal_uInt16          mnHighlightedItemPos; // for native menus: keeps track of the highlighted item
     139             :     sal_uInt16          nMenuFlags;
     140             :     sal_uInt16          nDefaultItem;       // Id of default item
     141             :     sal_uInt16          nSelectedId;
     142             : 
     143             :     // for output:
     144             :     sal_uInt16          nImgOrChkPos;
     145             :     sal_uInt16          nTextPos;
     146             : 
     147             :     bool                bCanceled   : 1,        ///< Terminated during a callback
     148             :                         bInCallback : 1,        ///< In Activate/Deactivate
     149             :                         bKilled     : 1;        ///< Killed
     150             : 
     151             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
     152             :     mutable vcl::MenuLayoutData* mpLayoutData;
     153             :     SalMenu*            mpSalMenu;
     154             : 
     155             : protected:
     156             :     SAL_DLLPRIVATE Menu*            ImplGetStartMenu();
     157             :     SAL_DLLPRIVATE Menu*            ImplFindSelectMenu();
     158             :     SAL_DLLPRIVATE Menu*            ImplFindMenu( sal_uInt16 nId );
     159             :     SAL_DLLPRIVATE Size             ImplCalcSize( const vcl::Window* pWin );
     160             :     SAL_DLLPRIVATE bool             ImplIsVisible( sal_uInt16 nPos ) const;
     161             :     SAL_DLLPRIVATE bool             ImplIsSelectable( sal_uInt16 nPos ) const;
     162             :     SAL_DLLPRIVATE sal_uInt16           ImplGetVisibleItemCount() const;
     163             :     SAL_DLLPRIVATE sal_uInt16           ImplGetFirstVisible() const;
     164             :     SAL_DLLPRIVATE sal_uInt16           ImplGetPrevVisible( sal_uInt16 nPos ) const;
     165             :     SAL_DLLPRIVATE sal_uInt16           ImplGetNextVisible( sal_uInt16 nPos ) const;
     166             :     SAL_DLLPRIVATE void             ImplPaint( vcl::Window* pWin, sal_uInt16 nBorder, long nOffY = 0, MenuItemData* pThisDataOnly = 0, bool bHighlighted = false, bool bLayout = false, bool bRollover = false ) const;
     167             :     SAL_DLLPRIVATE void             ImplSelect();
     168             :     SAL_DLLPRIVATE void             ImplCallHighlight( sal_uInt16 nHighlightItem );
     169             :     SAL_DLLPRIVATE void             ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos );
     170             :     DECL_DLLPRIVATE_LINK(           ImplCallSelect, void* );
     171             : 
     172             :     SAL_DLLPRIVATE void             ImplFillLayoutData() const;
     173      755248 :     SAL_DLLPRIVATE SalMenu*         ImplGetSalMenu() { return mpSalMenu; }
     174             :     SAL_DLLPRIVATE void             ImplSetSalMenu( SalMenu *pMenu );
     175             :     SAL_DLLPRIVATE OUString         ImplGetHelpText( sal_uInt16 nItemId ) const;
     176             : 
     177             :     // returns native check and option menu symbol height in rCheckHeight and rRadioHeight
     178             :     // return value is maximum width and height of checkboxes and radiobuttons
     179             :     SAL_DLLPRIVATE Size             ImplGetNativeCheckAndRadioSize( const vcl::Window*, long& rCheckHeight, long& rRadioHeight ) const;
     180             : 
     181             :     // returns native submenu arrow size and spacing from right border
     182             :     // return value is whether it's supported natively
     183             :     SAL_DLLPRIVATE bool         ImplGetNativeSubmenuArrowSize( vcl::Window* pWin, Size& rArrowSize, long& rArrowSpacing ) const;
     184             : 
     185             :     SAL_DLLPRIVATE void                ImplAddDel( ImplMenuDelData &rDel );
     186             :     SAL_DLLPRIVATE void                ImplRemoveDel( ImplMenuDelData &rDel );
     187             : 
     188             :     /// Close the 'pStartedFrom' menu window.
     189             :     virtual void ClosePopup(Menu* pMenu) = 0;
     190             : 
     191             :     /// Deactivate the MenuBarWindow.
     192             :     virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId);
     193             : 
     194             :     /// Forward the KeyInput call to the MenuBar.
     195             :     virtual void MenuBarKeyInput(const KeyEvent& rEvent);
     196             : 
     197             : public:
     198             :     SAL_DLLPRIVATE void             ImplKillLayoutData() const;
     199             :     SAL_DLLPRIVATE Menu*            ImplGetStartedFrom() const { return pStartedFrom; }
     200             : 
     201      534470 :     SAL_DLLPRIVATE vcl::Window*  ImplGetWindow() const { return pWindow; }
     202             :     void ImplSelectWithStart( Menu* pStartMenu = NULL );
     203             : 
     204             : protected:
     205             : 
     206             :     /** The Menu constructor is protected.
     207             : 
     208             :     The callers are supposed to instantiate either PopupMenu or MenuBar, but
     209             :     not a Menu directly.
     210             :     */
     211             :     Menu();
     212             : 
     213             : public:
     214             :     virtual             ~Menu();
     215             : 
     216             :     virtual void        Activate();
     217             :     virtual void        Deactivate();
     218             :     virtual void        Highlight();
     219             :     virtual void        Select();
     220             :     virtual void        RequestHelp( const HelpEvent& rHEvt );
     221             : 
     222             :     void                InsertItem( sal_uInt16 nItemId, const OUString& rStr,
     223             :                                     MenuItemBits nItemBits = MenuItemBits::NONE,
     224             :                                     const OString &rIdent = OString(),
     225             :                                     sal_uInt16 nPos = MENU_APPEND );
     226             :     void                InsertItem( sal_uInt16 nItemId, const Image& rImage,
     227             :                                     MenuItemBits nItemBits = MenuItemBits::NONE,
     228             :                                     const OString &rIdent = OString(),
     229             :                                     sal_uInt16 nPos = MENU_APPEND );
     230             :     void                InsertItem( sal_uInt16 nItemId,
     231             :                                     const OUString& rString, const Image& rImage,
     232             :                                     MenuItemBits nItemBits = MenuItemBits::NONE,
     233             :                                     const OString &rIdent = OString(),
     234             :                                     sal_uInt16 nPos = MENU_APPEND );
     235             :     void                InsertItem( const ResId& rResId, sal_uInt16 nPos = MENU_APPEND );
     236             :     void                InsertSeparator( const OString &rIdent = OString(),
     237             :                             sal_uInt16 nPos = MENU_APPEND );
     238             :     void                RemoveItem( sal_uInt16 nPos );
     239             :     void                CopyItem( const Menu& rMenu, sal_uInt16 nPos,
     240             :                                   sal_uInt16 nNewPos = MENU_APPEND );
     241             :     void                Clear();
     242             : 
     243             :     void                CreateAutoMnemonics();
     244             : 
     245          44 :     void                SetMenuFlags( sal_uInt16 nFlags ) { nMenuFlags = nFlags; }
     246         198 :     sal_uInt16              GetMenuFlags() const { return nMenuFlags; }
     247             : 
     248             :     sal_uInt16              GetItemCount() const;
     249             :     sal_uInt16          GetItemId(sal_uInt16 nPos) const;
     250             :     sal_uInt16          GetItemId(const OString &rIdent) const;
     251             :     sal_uInt16          GetItemPos( sal_uInt16 nItemId ) const;
     252             :     OString             GetItemIdent(sal_uInt16 nItemId) const;
     253             :     MenuItemType        GetItemType( sal_uInt16 nPos ) const;
     254          52 :     sal_uInt16          GetCurItemId() const { return nSelectedId;}
     255             :     OString             GetCurItemIdent() const;
     256             : 
     257           0 :     void                SetDefaultItem( sal_uInt16 nItemId )    { nDefaultItem = nItemId; }
     258           0 :     sal_uInt16          GetDefaultItem() const              { return nDefaultItem; }
     259             : 
     260             :     void                SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits );
     261             :     MenuItemBits        GetItemBits( sal_uInt16 nItemId ) const;
     262             : 
     263             :     void                SetUserValue( sal_uInt16 nItemId, sal_uLong nValue );
     264             :     sal_uLong           GetUserValue( sal_uInt16 nItemId ) const;
     265             : 
     266             :     void                SetPopupMenu( sal_uInt16 nItemId, PopupMenu* pMenu );
     267             :     PopupMenu*          GetPopupMenu( sal_uInt16 nItemId ) const;
     268             : 
     269             :     void                SetAccelKey( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode );
     270             :     vcl::KeyCode        GetAccelKey( sal_uInt16 nItemId ) const;
     271             : 
     272             :     void                CheckItem( sal_uInt16 nItemId, bool bCheck = true );
     273             :     bool                IsItemChecked( sal_uInt16 nItemId ) const;
     274             : 
     275             :     virtual void        SelectItem(sal_uInt16 nItemId) = 0;
     276             :     void                DeSelect() { SelectItem( 0xFFFF ); } // MENUITEMPOS_INVALID
     277             : 
     278             :     void                EnableItem( sal_uInt16 nItemId, bool bEnable = true );
     279           0 :     void                EnableItem(const OString &rIdent, bool bEnable = true)
     280             :     {
     281           0 :         EnableItem(GetItemId(rIdent), bEnable);
     282           0 :     }
     283             :     bool            IsItemEnabled( sal_uInt16 nItemId ) const;
     284             : 
     285             :     void                ShowItem( sal_uInt16 nItemId, bool bVisible = true );
     286           0 :     void                HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, false ); }
     287             : 
     288             :     bool            IsItemPosVisible( sal_uInt16 nItemPos ) const;
     289             :     bool            IsMenuVisible() const;
     290             :     virtual bool        IsMenuBar() const = 0;
     291             : 
     292             :     void                RemoveDisabledEntries( bool bCheckPopups = true, bool bRemoveEmptyPopups = false );
     293             :     bool            HasValidEntries( bool bCheckPopups = true );
     294             : 
     295             :     void                SetItemText( sal_uInt16 nItemId, const OUString& rStr );
     296             :     OUString            GetItemText( sal_uInt16 nItemId ) const;
     297             : 
     298             :     void                SetItemImage( sal_uInt16 nItemId, const Image& rImage );
     299             :     Image               GetItemImage( sal_uInt16 nItemId ) const;
     300             :     void                SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
     301             :     void                SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror );
     302             : 
     303             :     void                SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
     304             :     OUString            GetItemCommand( sal_uInt16 nItemId ) const;
     305             : 
     306             :     void                SetHelpText( sal_uInt16 nItemId, const OUString& rString );
     307             :     OUString            GetHelpText( sal_uInt16 nItemId ) const;
     308             : 
     309             :     void                SetTipHelpText( sal_uInt16 nItemId, const OUString& rString );
     310             :     OUString            GetTipHelpText( sal_uInt16 nItemId ) const;
     311             : 
     312             :     void                SetHelpCommand( sal_uInt16 nItemId, const OUString& rString );
     313             :     OUString            GetHelpCommand( sal_uInt16 nItemId ) const;
     314             : 
     315             :     void                SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
     316             :     OString             GetHelpId( sal_uInt16 nItemId ) const;
     317             : 
     318       60512 :     void                SetActivateHdl( const Link& rLink )     { aActivateHdl = rLink; }
     319             :     const Link&         GetActivateHdl() const                  { return aActivateHdl; }
     320             : 
     321       60940 :     void                SetDeactivateHdl( const Link& rLink )   { aDeactivateHdl = rLink; }
     322             :     const Link&         GetDeactivateHdl() const                { return aDeactivateHdl; }
     323             : 
     324       60512 :     void                SetHighlightHdl( const Link& rLink )    { aHighlightHdl = rLink; }
     325             :     const Link&         GetHighlightHdl() const                 { return aHighlightHdl; }
     326             : 
     327       61728 :     void                SetSelectHdl( const Link& rLink )       { aSelectHdl = rLink; }
     328             :     const Link&         GetSelectHdl() const                    { return aSelectHdl; }
     329             : 
     330             :     bool                HasLogo() const { return pLogo ? true : false; }
     331             : 
     332             :     void                AddEventListener( const Link& rEventListener );
     333             :     void                RemoveEventListener( const Link& rEventListener );
     334             :     void                AddChildEventListener( const Link& rEventListener );
     335             :     void                RemoveChildEventListener( const Link& rEventListener );
     336             : 
     337             :     Menu&               operator =( const Menu& rMenu );
     338             : 
     339             :     // Fuer Menu-'Funktionen'
     340       18006 :     MenuItemList*       GetItemList() const                     { return pItemList; }
     341             : 
     342             :     // returns the system's menu handle if native menus are supported
     343             :     // pData must point to a SystemMenuData structure
     344             :     bool                GetSystemMenuData( SystemMenuData* pData ) const;
     345             : 
     346             :     // accessibility helpers
     347             : 
     348             :     // returns the bounding box for the character at index nIndex
     349             :     // where nIndex is relative to the starting index of the item
     350             :     // with id nItemId (in coordinates of the displaying window)
     351             :     Rectangle GetCharacterBounds( sal_uInt16 nItemId, long nIndex ) const;
     352             :     // -1 is returned if no character is at that point
     353             :     // if an index is found the corresponding item id is filled in (else 0)
     354             :     long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const;
     355             :     // returns the bounding rectangle for an item at pos nItemPos
     356             :     Rectangle GetBoundingRectangle( sal_uInt16 nItemPos ) const;
     357             : 
     358             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible();
     359             :     void SetAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible );
     360             : 
     361             :     // gets the activation key of the specified item
     362             :     KeyEvent GetActivationKey( sal_uInt16 nItemId ) const;
     363             : 
     364        7838 :     vcl::Window*             GetWindow() const { return pWindow; }
     365             : 
     366             :     void                SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr );
     367             :     OUString            GetAccessibleName( sal_uInt16 nItemId ) const;
     368             : 
     369             :     // returns whether the item a position nItemPos is highlighted or not.
     370             :     bool  IsHighlighted( sal_uInt16 nItemPos ) const;
     371             : 
     372             :     void                HighlightItem( sal_uInt16 nItemPos );
     373           0 :     void                DeHighlight() { HighlightItem( 0xFFFF ); } // MENUITEMPOS_INVALID
     374             : };
     375             : 
     376             : 
     377             : namespace vcl
     378             : {
     379             :     class VCL_DLLPUBLIC MenuInvalidator
     380             :     {
     381             :         public:
     382             :             MenuInvalidator();
     383             :             VclEventListeners2* GetMenuInvalidateListeners();
     384             :             void Invalidated();
     385             :     };
     386             : }
     387             : 
     388             : // - MenuBar -
     389             : 
     390             : 
     391             : class VCL_DLLPUBLIC MenuBar : public Menu
     392             : {
     393             :     Link                maCloseHdl;
     394             :     Link                maFloatHdl;
     395             :     Link                maHideHdl;
     396             :     bool                mbCloseBtnVisible;
     397             :     bool                mbFloatBtnVisible;
     398             :     bool                mbHideBtnVisible;
     399             :     bool                mbDisplayable;
     400             : 
     401             :     friend class Application;
     402             :     friend class Menu;
     403             :     friend class MenuBarWindow;
     404             :     friend class MenuFloatingWindow;
     405             :     friend class SystemWindow;
     406             : 
     407             :     SAL_DLLPRIVATE static vcl::Window* ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu, const css::uno::Reference<css::frame::XFrame> &rFrame);
     408             :     SAL_DLLPRIVATE static void         ImplDestroy( MenuBar* pMenu, bool bDelete );
     409             :     SAL_DLLPRIVATE bool                ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu = true );
     410             : 
     411             : protected:
     412             : 
     413             :     /// Return the IMenuBarWindow interface.
     414             :     IMenuBarWindow* getMenuBarWindow();
     415             : 
     416             : public:
     417             :                         MenuBar();
     418             :                         MenuBar( const MenuBar& rMenu );
     419             :                         virtual ~MenuBar();
     420             : 
     421             :     MenuBar&            operator =( const MenuBar& rMenu );
     422             : 
     423      338770 :     virtual bool        IsMenuBar() const SAL_OVERRIDE { return true; }
     424             : 
     425             :     /// Close the 'pStartedFrom' menu window.
     426             :     virtual void ClosePopup(Menu* pMenu) SAL_OVERRIDE;
     427             : 
     428             :     /// Deactivate the MenuBarWindow.
     429             :     virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId) SAL_OVERRIDE;
     430             : 
     431             :     /// Forward the KeyInput call to the MenuBar.
     432             :     virtual void MenuBarKeyInput(const KeyEvent& rEvent) SAL_OVERRIDE;
     433             : 
     434             :     void                ShowCloseButton( bool bShow = true );
     435       10960 :     bool                HasCloseButton() const { return mbCloseBtnVisible; }
     436        5480 :     bool            HasFloatButton() const { return mbFloatBtnVisible; }
     437        5480 :     bool            HasHideButton() const { return mbHideBtnVisible; }
     438             :     void                ShowButtons( bool bClose, bool bFloat, bool bHide );
     439             : 
     440             :     virtual void        SelectItem(sal_uInt16 nId) SAL_OVERRIDE;
     441             :     bool                HandleMenuActivateEvent(Menu *pMenu) const;
     442             :     bool                HandleMenuDeActivateEvent(Menu *pMenu) const;
     443             :     bool                HandleMenuHighlightEvent(Menu *pMenu, sal_uInt16 nEventId) const;
     444             :     bool                HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const;
     445             :     bool                HandleMenuButtonEvent(Menu *pMenu, sal_uInt16 nEventId);
     446             : 
     447        7210 :     void                SetCloseButtonClickHdl( const Link& rLink ) { maCloseHdl = rLink; }
     448           0 :     const Link&         GetCloseButtonClickHdl() const              { return maCloseHdl; }
     449             :     void                SetFloatButtonClickHdl( const Link& rLink ) { maFloatHdl = rLink; }
     450           0 :     const Link&         GetFloatButtonClickHdl() const              { return maFloatHdl; }
     451             :     void                SetHideButtonClickHdl( const Link& rLink )  { maHideHdl = rLink; }
     452           0 :     const Link&         GetHideButtonClickHdl() const               { return maHideHdl; }
     453             : 
     454             :     //  - by default a menubar is displayable
     455             :     //  - if a menubar is not displayable, its MenuBarWindow will never be shown
     456             :     //    and it will be hidden if it was visible before
     457             :     //  - note: if a menubar is diplayable, this does not necessarily mean that it is currently visible
     458             :     void                SetDisplayable( bool bDisplayable );
     459       11941 :     bool            IsDisplayable() const                       { return mbDisplayable; }
     460             : 
     461             :     struct MenuBarButtonCallbackArg
     462             :     {
     463             :         sal_uInt16      nId;             // Id of the button
     464             :         bool            bHighlight;      // highlight on/off
     465             :         MenuBar*        pMenuBar;        // menubar the button belongs to
     466             :     };
     467             :     // add an arbitrary button to the menubar (will appear next to closer)
     468             :     // passed link will be call with a MenuBarButtonCallbackArg on press
     469             :     // passed string will be set as tooltip
     470             :     sal_uInt16          AddMenuBarButton( const Image&, const Link&, const OUString&, sal_uInt16 nPos = 0 );
     471             :     // set the highlight link for additional button with ID nId
     472             :     // highlight link will be called with a MenuBarButtonHighlightArg
     473             :     // the bHighlight member of that struct shall contain the new state
     474             :     void                SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const Link& );
     475             :     // returns the rectangle occupied by the additional button named nId
     476             :     // coordinates are relative to the systemwindiow the menubar is attached to
     477             :     // if the menubar is unattached an empty rectangle is returned
     478             :     Rectangle           GetMenuBarButtonRectPixel( sal_uInt16 nId );
     479             :     void                RemoveMenuBarButton( sal_uInt16 nId );
     480             : };
     481             : 
     482           0 : inline MenuBar& MenuBar::operator =( const MenuBar& rMenu )
     483             : {
     484           0 :     Menu::operator =( rMenu );
     485           0 :     return *this;
     486             : }
     487             : 
     488             : 
     489             : 
     490             : // - PopupMenu -
     491             : 
     492             : 
     493             : class VCL_DLLPUBLIC PopupMenu : public Menu
     494             : {
     495             :     friend class Menu;
     496             :     friend class MenuFloatingWindow;
     497             :     friend class MenuBarWindow;
     498             :     friend struct MenuItemData;
     499             : 
     500             : private:
     501             :     Menu**              pRefAutoSubMenu;    // keeps track if a pointer to this Menu is stored in the MenuItemData
     502             : 
     503          64 :     SAL_DLLPRIVATE MenuFloatingWindow*   ImplGetFloatingWindow() const { return (MenuFloatingWindow*)Menu::ImplGetWindow(); }
     504             : 
     505             : protected:
     506             :     SAL_DLLPRIVATE sal_uInt16                ImplExecute( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nPopupFlags, Menu* pStaredFrom, bool bPreSelectFirst );
     507             :     SAL_DLLPRIVATE long                  ImplCalcHeight( sal_uInt16 nEntries ) const;
     508             :     SAL_DLLPRIVATE sal_uInt16                ImplCalcVisEntries( long nMaxHeight, sal_uInt16 nStartEntry = 0, sal_uInt16* pLastVisible = NULL ) const;
     509             : 
     510             : public:
     511             :                         PopupMenu();
     512             :                         PopupMenu( const PopupMenu& rMenu );
     513             :     explicit            PopupMenu( const ResId& );
     514             :     virtual             ~PopupMenu();
     515             : 
     516      677844 :     virtual bool        IsMenuBar() const SAL_OVERRIDE { return false; }
     517             : 
     518             :     /// Close the 'pStartedFrom' menu window.
     519             :     virtual void ClosePopup(Menu* pMenu) SAL_OVERRIDE;
     520             : 
     521             :     void                SetText( const OUString& rTitle )  { aTitleText = rTitle; }
     522             :     const OUString&     GetText() const                     { return aTitleText; }
     523             : 
     524             :     sal_uInt16              Execute( vcl::Window* pWindow, const Point& rPopupPos );
     525             :     sal_uInt16              Execute( vcl::Window* pWindow, const Rectangle& rRect, sal_uInt16 nFlags = 0 );
     526             : 
     527             :     // Fuer das TestTool
     528             :     void                EndExecute( sal_uInt16 nSelect = 0 );
     529             :     virtual void        SelectItem(sal_uInt16 nId) SAL_OVERRIDE;
     530             :     void                SetSelectedEntry( sal_uInt16 nId ); // for use by native submenu only
     531             : 
     532             :     static bool         IsInExecute();
     533             :     static PopupMenu*   GetActivePopupMenu();
     534             : 
     535             :     PopupMenu&          operator =( const PopupMenu& rMenu );
     536             : };
     537             : 
     538        1494 : inline PopupMenu& PopupMenu::operator =( const PopupMenu& rMenu )
     539             : {
     540        1494 :     Menu::operator =( rMenu );
     541        1494 :     return *this;
     542             : }
     543             : 
     544             : #endif // INCLUDED_VCL_MENU_HXX
     545             : 
     546             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10