1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <vcl/vclenum.hxx>
21 #include <vcl/glyphitem.hxx>
22 #include <vcl/image.hxx>
23 #include <vcl/keycod.hxx>
24 #include <vcl/menu.hxx>
25 #include <salmenu.hxx>
34 sal_uInt16 nId
; // SV Id
35 MenuItemType eType
; // MenuItem-Type
36 MenuItemBits nBits
; // MenuItem-Bits
37 VclPtr
<Menu
> pSubMenu
; // Pointer to SubMenu
38 OUString aText
; // Menu-Text
39 SalLayoutGlyphs aTextGlyphs
; ///< Text layout of aText.
40 OUString aHelpText
; // Help-String
41 OUString aTipHelpText
; // TipHelp-String (eg, expanded filenames)
42 OUString aCommandStr
; // CommandString
43 OUString aHelpCommandStr
; // Help command string (to reference external help)
45 OString aHelpId
; // Help-Id
46 void* nUserValue
; // User value
47 MenuUserDataReleaseFunction aUserValueReleaseFunc
; // called when MenuItemData is destroyed
48 Image aImage
; // Image
49 vcl::KeyCode aAccelKey
; // Accelerator-Key
50 bool bChecked
; // Checked
51 bool bEnabled
; // Enabled
52 bool bVisible
; // Visible (note: this flag will not override MenuFlags::HideDisabledEntries when true)
53 bool bIsTemporary
; // Temporary inserted ('No selection possible')
55 Size aSz
; // only temporarily valid
56 OUString aAccessibleName
; // accessible name
57 OUString aAccessibleDescription
; // accessible description
59 std::unique_ptr
<SalMenuItem
> pSalMenuItem
; // access to native menu
63 , eType(MenuItemType::DONTKNOW
)
64 , nBits(MenuItemBits::NONE
)
67 , aUserValueReleaseFunc(nullptr)
75 MenuItemData( const OUString
& rStr
)
77 , eType(MenuItemType::DONTKNOW
)
78 , nBits(MenuItemBits::NONE
)
82 , aUserValueReleaseFunc(nullptr)
93 /// Computes aText's text layout (glyphs), cached in aTextGlyphs.
94 SalLayoutGlyphs
* GetTextGlyphs(const OutputDevice
* pOutputDevice
);
98 return bChecked
|| ( nBits
& ( MenuItemBits::RADIOCHECK
| MenuItemBits::CHECKABLE
| MenuItemBits::AUTOCHECK
) );
105 ::std::vector
< std::unique_ptr
<MenuItemData
> > maItemList
;
111 MenuItemData
* Insert(
115 const OUString
& rStr
,
118 const OString
&rIdent
120 void InsertSeparator(const OString
&rIdent
, size_t nPos
);
121 void Remove( size_t nPos
);
124 MenuItemData
* GetData( sal_uInt16 nSVId
, size_t& rPos
) const;
125 MenuItemData
* GetData( sal_uInt16 nSVId
) const
128 return GetData( nSVId
, nTemp
);
130 MenuItemData
* GetDataFromPos( size_t nPos
) const
132 return ( nPos
< maItemList
.size() ) ? maItemList
[ nPos
].get() : nullptr;
135 MenuItemData
* SearchItem(
136 sal_Unicode cSelectChar
,
137 vcl::KeyCode aKeyCode
,
142 size_t GetItemCount( sal_Unicode cSelectChar
) const;
143 size_t GetItemCount( vcl::KeyCode aKeyCode
) const;
146 return maItemList
.size();
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */