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 _SV_SALMENU_HXX 29 #define _SV_SALMENU_HXX 30 31 #include <vcl/sv.h> 32 #include "vcl/dllapi.h" 33 #include <vcl/menu.hxx> 34 #include <vcl/keycod.hxx> 35 #include <vcl/image.hxx> 36 37 struct SystemMenuData; 38 class FloatingWindow; 39 class SalFrame; 40 41 struct SalItemParams 42 { 43 sal_uInt16 nId; // item Id 44 MenuItemType eType; // MenuItem-Type 45 MenuItemBits nBits; // MenuItem-Bits 46 Menu* pMenu; // Pointer to Menu 47 XubString aText; // Menu-Text 48 Image aImage; // Image 49 }; 50 51 52 struct SalMenuButtonItem 53 { 54 sal_uInt16 mnId; 55 Image maImage; 56 rtl::OUString maToolTipText; 57 58 SalMenuButtonItem() : mnId( 0 ) {} 59 SalMenuButtonItem( sal_uInt16 i_nId, const Image& rImg, const rtl::OUString& i_rTTText = rtl::OUString() ) 60 : mnId( i_nId ), maImage( rImg ), maToolTipText( i_rTTText ) {} 61 }; 62 63 class VCL_PLUGIN_PUBLIC SalMenuItem 64 { 65 public: 66 SalMenuItem() {} 67 virtual ~SalMenuItem(); 68 }; 69 70 class VCL_PLUGIN_PUBLIC SalMenu 71 { 72 public: 73 SalMenu() {} 74 virtual ~SalMenu(); 75 76 virtual sal_Bool VisibleMenuBar() = 0; // must return sal_True to actually DISPLAY native menu bars 77 // otherwise only menu messages are processed (eg, OLE on Windows) 78 79 virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) = 0; 80 virtual void RemoveItem( unsigned nPos ) = 0; 81 virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) = 0; 82 virtual void SetFrame( const SalFrame* pFrame ) = 0; 83 virtual void CheckItem( unsigned nPos, sal_Bool bCheck ) = 0; 84 virtual void EnableItem( unsigned nPos, sal_Bool bEnable ) = 0; 85 virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText )= 0; 86 virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0; 87 virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ) = 0; 88 virtual void GetSystemMenuData( SystemMenuData* pData ) = 0; 89 virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags); 90 virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure 91 virtual void RemoveMenuBarButton( sal_uInt16 nId ); 92 93 // return an empty rectangle if not implemented 94 // return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) if menu bar buttons implemented 95 // but rectangle cannot be determined 96 virtual Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame ); 97 }; 98 99 100 #endif // _SV_SALMENU_HXX 101 102