20#ifndef INCLUDED_VCL_MENU_HXX
21#define INCLUDED_VCL_MENU_HXX
33#include <com/sun/star/uno/Reference.hxx>
163 SAL_DLLPRIVATE
Menu* ImplGetStartMenu();
164 SAL_DLLPRIVATE
Menu* ImplFindSelectMenu();
165 SAL_DLLPRIVATE
Menu* ImplFindMenu( sal_uInt16 nId );
167 SAL_DLLPRIVATE
bool ImplIsVisible( sal_uInt16 nPos )
const;
168 SAL_DLLPRIVATE
bool ImplCurrentlyHiddenOnGUI(sal_uInt16 nPos)
const;
169 SAL_DLLPRIVATE
bool ImplIsSelectable( sal_uInt16 nPos )
const;
170 SAL_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount()
const;
171 SAL_DLLPRIVATE sal_uInt16 ImplGetFirstVisible()
const;
172 SAL_DLLPRIVATE sal_uInt16 ImplGetPrevVisible( sal_uInt16 nPos )
const;
173 SAL_DLLPRIVATE sal_uInt16 ImplGetNextVisible( sal_uInt16 nPos )
const;
176 bool bHighlighted =
false,
bool bLayout =
false,
bool bRollover =
false )
const;
178 SAL_DLLPRIVATE
void ImplSelect();
179 SAL_DLLPRIVATE
void ImplCallHighlight( sal_uInt16 nHighlightItem );
180 SAL_DLLPRIVATE
void ImplCallEventListeners(
VclEventId nEvent, sal_uInt16 nPos );
183 SAL_DLLPRIVATE
void ImplFillLayoutData()
const;
185 SAL_DLLPRIVATE OUString ImplGetHelpText( sal_uInt16 nItemId )
const;
199 const OUString& rStr,
Menu* pMenu,
200 size_t nPos,
const OUString &rIdent);
206 virtual void MenuBarKeyInput(
const KeyEvent& rEvent);
209 SAL_DLLPRIVATE
void ImplKillLayoutData()
const;
213 void ImplSelectWithStart(
Menu* pStartMenu =
nullptr );
226 virtual ~Menu()
override;
227 virtual void dispose()
override;
233 void InsertItem(sal_uInt16 nItemId,
const OUString& rStr,
235 const OUString &rIdent = {},
237 void InsertItem(sal_uInt16 nItemId,
const Image& rImage,
239 const OUString &rIdent = {},
241 void InsertItem(sal_uInt16 nItemId,
242 const OUString& rString,
const Image& rImage,
244 const OUString &rIdent = {},
246 void InsertSeparator(
const OUString &rIdent = {}, sal_uInt16
nPos =
MENU_APPEND);
247 void RemoveItem( sal_uInt16 nPos );
250 void CreateAutoMnemonics();
255 bool HasValidEntries(
bool bCheckPopups)
const;
256 sal_uInt16 GetItemCount()
const;
257 sal_uInt16 GetItemId(sal_uInt16 nPos)
const;
258 sal_uInt16 GetItemId(std::u16string_view rIdent)
const;
259 sal_uInt16 GetItemPos( sal_uInt16 nItemId )
const;
260 OUString GetItemIdent(sal_uInt16 nItemId)
const;
264 void SetItemBits( sal_uInt16 nItemId,
MenuItemBits nBits );
268 void* GetUserValue(sal_uInt16 nItemId)
const;
270 void SetPopupMenu( sal_uInt16 nItemId,
PopupMenu* pMenu );
271 PopupMenu* GetPopupMenu( sal_uInt16 nItemId )
const;
273 void SetAccelKey( sal_uInt16 nItemId,
const vcl::KeyCode& rKeyCode );
276 void CheckItem( sal_uInt16 nItemId,
bool bCheck =
true );
277 void CheckItem( std::u16string_view rIdent,
bool bCheck =
true );
278 bool IsItemChecked( sal_uInt16 nItemId )
const;
282 void EnableItem( sal_uInt16 nItemId,
bool bEnable =
true );
283 void EnableItem(std::u16string_view rIdent,
bool bEnable =
true)
285 EnableItem(GetItemId(rIdent), bEnable);
287 bool IsItemEnabled( sal_uInt16 nItemId )
const;
289 void ShowItem( sal_uInt16 nItemId,
bool bVisible =
true );
290 void HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId,
false ); }
292 bool IsItemPosVisible( sal_uInt16 nItemPos )
const;
293 bool IsMenuVisible()
const;
296 void RemoveDisabledEntries(
bool bRemoveEmptyPopups =
false );
298 void UpdateNativeMenu();
300 void SetItemText( sal_uInt16 nItemId,
const OUString& rStr );
301 OUString GetItemText( sal_uInt16 nItemId )
const;
303 void SetItemImage( sal_uInt16 nItemId,
const Image& rImage );
304 Image GetItemImage( sal_uInt16 nItemId )
const;
306 void SetItemCommand( sal_uInt16 nItemId,
const OUString& rCommand );
307 OUString GetItemCommand( sal_uInt16 nItemId )
const;
309 void SetHelpText( sal_uInt16 nItemId,
const OUString& rString );
310 OUString GetHelpText( sal_uInt16 nItemId )
const;
312 void SetTipHelpText( sal_uInt16 nItemId,
const OUString& rString );
313 OUString GetTipHelpText( sal_uInt16 nItemId )
const;
315 void SetHelpCommand( sal_uInt16 nItemId,
const OUString& rString );
316 OUString GetHelpCommand( sal_uInt16 nItemId )
const;
318 void SetHelpId( sal_uInt16 nItemId,
const OUString& rHelpId );
319 OUString GetHelpId( sal_uInt16 nItemId )
const;
321 void SetHelpId(
const OUString& rHelpId ) { m_sMenuHelpId = rHelpId; }
326 aActivateHdl = rLink;
331 aDeactivateHdl = rLink;
352 return pItemList.get();
367 tools::Long GetIndexForPoint(
const Point& rPoint, sal_uInt16& rItemID )
const;
371 css::uno::Reference<css::accessibility::XAccessible> GetAccessible();
372 void SetAccessible(
const css::uno::Reference<css::accessibility::XAccessible >& rxAccessible);
375 KeyEvent GetActivationKey( sal_uInt16 nItemId )
const;
379 void SetAccessibleName( sal_uInt16 nItemId,
const OUString& rStr );
380 OUString GetAccessibleName( sal_uInt16 nItemId )
const;
382 void SetAccessibleDescription( sal_uInt16 nItemId,
const OUString& rStr );
383 OUString GetAccessibleDescription( sal_uInt16 nItemId )
const;
386 bool IsHighlighted( sal_uInt16 nItemPos )
const;
388 void HighlightItem( sal_uInt16 nItemPos );
391 bool HandleMenuCommandEvent(
Menu *pMenu, sal_uInt16 nEventId)
const;
392 bool HandleMenuActivateEvent(
Menu *pMenu)
const;
393 bool HandleMenuDeActivateEvent(
Menu *pMenu)
const;
398 void set_id(
const OUString& rID) { maID = rID; }
403 const OUString&
get_id()
const {
return maID; }
427 SAL_DLLPRIVATE
static void ImplDestroy(
MenuBar* pMenu,
bool bDelete);
428 SAL_DLLPRIVATE
bool ImplHandleKeyEvent(
const KeyEvent& rKEvent);
437 virtual void dispose()
override;
441 virtual bool IsMenuBar()
const override {
return true; }
444 virtual void ClosePopup(
Menu* pMenu)
override;
447 virtual void MenuBarKeyInput(
const KeyEvent& rEvent)
override;
449 void ShowCloseButton(
bool bShow );
453 void ShowButtons(
bool bClose,
bool bFloat,
bool bHide );
455 virtual void SelectItem(sal_uInt16 nId)
override;
456 bool HandleMenuHighlightEvent(
Menu *pMenu, sal_uInt16 nEventId)
const;
457 bool HandleMenuButtonEvent(sal_uInt16 nEventId);
466 void SetDisplayable(
bool bDisplayable );
481 void RemoveMenuBarButton( sal_uInt16 nId );
482 void LayoutChanged();
507 SAL_DLLPRIVATE
void ImplFlushPendingSelect();
508 SAL_DLLPRIVATE
tools::Long ImplCalcHeight( sal_uInt16 nEntries )
const;
509 SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries(
tools::Long nMaxHeight, sal_uInt16 nStartEntry, sal_uInt16* pLastVisible =
nullptr )
const;
516 virtual bool IsMenuBar()
const override {
return false; }
519 virtual void ClosePopup(
Menu* pMenu)
override;
531 virtual void SelectItem(sal_uInt16
nId)
override;
532 void SetSelectedEntry( sal_uInt16
nId );
534 css::uno::Reference<css::awt::XPopupMenu> CreateMenuInterface();
Base class used mainly for the LibreOffice Desktop class.
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
int GetMenuBarHeight() const
VclReferenceBase & operator=(const VclReferenceBase &)=delete
virtual void SetHelpId(const OUString &) override
void Clear(EHistoryType eHistory)
OutputDevice RenderContext