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 .
21 #include <vcl/vclenum.hxx>
22 #include <vcl/glyphitem.hxx>
23 #include <vcl/image.hxx>
24 #include <vcl/keycod.hxx>
25 #include <vcl/menu.hxx>
26 #include <salmenu.hxx>
35 sal_uInt16 nId
; // SV Id
36 MenuItemType eType
; // MenuItem-Type
37 MenuItemBits nBits
; // MenuItem-Bits
38 VclPtr
<Menu
> pSubMenu
; // Pointer to SubMenu
39 OUString aText
; // Menu-Text
40 SalLayoutGlyphs aTextGlyphs
; ///< Text layout of aText.
41 OUString aHelpText
; // Help-String
42 OUString aTipHelpText
; // TipHelp-String (eg, expanded filenames)
43 OUString aCommandStr
; // CommandString
44 OUString aHelpCommandStr
; // Help command string (to reference external help)
46 OUString aHelpId
; // Help-Id
47 void* nUserValue
; // User value
48 MenuUserDataReleaseFunction aUserValueReleaseFunc
; // called when MenuItemData is destroyed
49 Image aImage
; // Image
50 vcl::KeyCode aAccelKey
; // Accelerator-Key
51 bool bChecked
; // Checked
52 bool bEnabled
; // Enabled
53 bool bVisible
; // Visible (note: this flag will not override MenuFlags::HideDisabledEntries when true)
54 bool bIsTemporary
; // Temporary inserted ('No selection possible')
56 Size aSz
; // only temporarily valid
57 OUString aAccessibleName
; // accessible name
58 OUString aAccessibleDescription
; // accessible description
60 std::unique_ptr
<SalMenuItem
> pSalMenuItem
; // access to native menu
64 , eType(MenuItemType::DONTKNOW
)
65 , nBits(MenuItemBits::NONE
)
68 , aUserValueReleaseFunc(nullptr)
76 MenuItemData( OUString aStr
)
78 , eType(MenuItemType::DONTKNOW
)
79 , nBits(MenuItemBits::NONE
)
81 , aText(std::move(aStr
))
83 , aUserValueReleaseFunc(nullptr)
94 /// Computes aText's text layout (glyphs), cached in aTextGlyphs.
95 SalLayoutGlyphs
* GetTextGlyphs(const OutputDevice
* pOutputDevice
);
99 return bChecked
|| ( nBits
& ( MenuItemBits::RADIOCHECK
| MenuItemBits::CHECKABLE
| MenuItemBits::AUTOCHECK
) );
106 ::std::vector
< std::unique_ptr
<MenuItemData
> > maItemList
;
112 MenuItemData
* Insert(
116 const OUString
& rStr
,
119 const OUString
&rIdent
121 void InsertSeparator(const OUString
&rIdent
, size_t nPos
);
122 void Remove( size_t nPos
);
125 MenuItemData
* GetData( sal_uInt16 nSVId
, size_t& rPos
) const;
126 MenuItemData
* GetData( sal_uInt16 nSVId
) const
129 return GetData( nSVId
, nTemp
);
131 MenuItemData
* GetDataFromPos( size_t nPos
) const
133 return ( nPos
< maItemList
.size() ) ? maItemList
[ nPos
].get() : nullptr;
136 MenuItemData
* SearchItem(
137 sal_Unicode cSelectChar
,
138 vcl::KeyCode aKeyCode
,
143 size_t GetItemCount( sal_Unicode cSelectChar
) const;
144 size_t GetItemCount( vcl::KeyCode aKeyCode
) const;
147 return maItemList
.size();
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */