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 <rsc/rsc-vcl-shared-types.hxx>
21 #include <vcl/image.hxx>
22 #include <vcl/keycod.hxx>
23 #include <vcl/menu.hxx>
25 #include <com/sun/star/i18n/XCharacterClassification.hpp>
33 sal_uInt16 nId
; // SV Id
34 MenuItemType eType
; // MenuItem-Type
35 MenuItemBits nBits
; // MenuItem-Bits
36 VclPtr
<Menu
> pSubMenu
; // Pointer to SubMenu
37 VclPtr
<Menu
> pAutoSubMenu
; // Pointer to SubMenu from Resource
38 OUString aText
; // Menu-Text
39 OUString aHelpText
; // Help-String
40 OUString aTipHelpText
; // TipHelp-String (eg, expanded filenames)
41 OUString aCommandStr
; // CommandString
42 OUString aHelpCommandStr
; // Help command string (to reference external help)
44 OString aHelpId
; // Help-Id
45 sal_uLong nUserValue
; // User value
46 MenuUserDataReleaseFunction aUserValueReleaseFunc
; // called when MenuItemData is destroyed
47 Image aImage
; // Image
48 vcl::KeyCode aAccelKey
; // Accelerator-Key
49 bool bChecked
; // Checked
50 bool bEnabled
; // Enabled
51 bool bVisible
; // Visible (note: this flag will not override MenuFlags::HideDisabledEntries when true)
52 bool bIsTemporary
; // Temporary inserted ('No selection possible')
53 Size aSz
; // only temporarily valid
54 OUString aAccessibleName
; // accessible name
56 SalMenuItem
* pSalMenuItem
; // access to native menu
60 , eType(MenuItemType::DONTKNOW
)
61 , nBits(MenuItemBits::NONE
)
63 , pAutoSubMenu(nullptr)
65 , aUserValueReleaseFunc(nullptr)
70 , pSalMenuItem(nullptr)
73 MenuItemData( const OUString
& rStr
, const Image
& rImage
)
75 , eType(MenuItemType::DONTKNOW
)
76 , nBits(MenuItemBits::NONE
)
78 , pAutoSubMenu(nullptr)
81 , aUserValueReleaseFunc(nullptr)
87 , pSalMenuItem(nullptr)
93 return bChecked
|| ( nBits
& ( MenuItemBits::RADIOCHECK
| MenuItemBits::CHECKABLE
| MenuItemBits::AUTOCHECK
) );
100 typedef ::std::vector
< MenuItemData
* > MenuItemDataList_impl
;
101 MenuItemDataList_impl maItemList
;
107 MenuItemData
* Insert(
111 const OUString
& rStr
,
115 const OString
&rIdent
117 void InsertSeparator(const OString
&rIdent
, size_t nPos
);
118 void Remove( size_t nPos
);
121 MenuItemData
* GetData( sal_uInt16 nSVId
, size_t& rPos
) const;
122 MenuItemData
* GetData( sal_uInt16 nSVId
) const
125 return GetData( nSVId
, nTemp
);
127 MenuItemData
* GetDataFromPos( size_t nPos
) const
129 return ( nPos
< maItemList
.size() ) ? maItemList
[ nPos
] : nullptr;
132 MenuItemData
* SearchItem(
133 sal_Unicode cSelectChar
,
134 vcl::KeyCode aKeyCode
,
136 sal_uInt16
& nDuplicates
,
137 sal_uInt16 nCurrentPos
139 size_t GetItemCount( sal_Unicode cSelectChar
) const;
140 size_t GetItemCount( vcl::KeyCode aKeyCode
) const;
143 return maItemList
.size();
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */