LibreOffice Module vcl (master) 1
menuitemlist.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
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>
26
27#include <memory>
28#include <vector>
29
30class SalMenuItem;
31
33{
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
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)
44 OString sIdent;
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
58
59 std::unique_ptr<SalMenuItem> pSalMenuItem; // access to native menu
60
62 : nId(0)
65 , pSubMenu(nullptr)
66 , nUserValue(nullptr)
67 , aUserValueReleaseFunc(nullptr)
68 , bChecked(false)
69 , bEnabled(false)
70 , bVisible(false)
71 , bIsTemporary(false)
72 , bHiddenOnGUI(false)
73 {
74 }
75 MenuItemData( const OUString& rStr )
76 : nId(0)
79 , pSubMenu(nullptr)
80 , aText(rStr)
81 , nUserValue(nullptr)
82 , aUserValueReleaseFunc(nullptr)
83 , aImage()
84 , bChecked(false)
85 , bEnabled(false)
86 , bVisible(false)
87 , bIsTemporary(false)
88 , bHiddenOnGUI(false)
89 {
90 }
92
94 SalLayoutGlyphs* GetTextGlyphs(const OutputDevice* pOutputDevice);
95
96 bool HasCheck() const
97 {
99 }
100};
101
103{
104private:
105 ::std::vector< std::unique_ptr<MenuItemData> > maItemList;
106
107public:
110
112 sal_uInt16 nId,
113 MenuItemType eType,
114 MenuItemBits nBits,
115 const OUString& rStr,
116 Menu* pMenu,
117 size_t nPos,
118 const OString &rIdent
119 );
120 void InsertSeparator(const OString &rIdent, size_t nPos);
121 void Remove( size_t nPos );
122 void Clear();
123
124 MenuItemData* GetData( sal_uInt16 nSVId, size_t& rPos ) const;
125 MenuItemData* GetData( sal_uInt16 nSVId ) const
126 {
127 size_t nTemp;
128 return GetData( nSVId, nTemp );
129 }
130 MenuItemData* GetDataFromPos( size_t nPos ) const
131 {
132 return ( nPos < maItemList.size() ) ? maItemList[ nPos ].get() : nullptr;
133 }
134
136 sal_Unicode cSelectChar,
137 vcl::KeyCode aKeyCode,
138 size_t& rPos,
139 size_t& nDuplicates,
140 size_t nCurrentPos
141 ) const;
142 size_t GetItemCount( sal_Unicode cSelectChar ) const;
143 size_t GetItemCount( vcl::KeyCode aKeyCode ) const;
144 size_t size() const
145 {
146 return maItemList.size();
147 }
148};
149
150/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: image.hxx:40
size_t GetItemCount(sal_Unicode cSelectChar) const
size_t size() const
void Remove(size_t nPos)
MenuItemData * GetData(sal_uInt16 nSVId, size_t &rPos) const
MenuItemData * Insert(sal_uInt16 nId, MenuItemType eType, MenuItemBits nBits, const OUString &rStr, Menu *pMenu, size_t nPos, const OString &rIdent)
MenuItemData * GetDataFromPos(size_t nPos) const
::std::vector< std::unique_ptr< MenuItemData > > maItemList
MenuItemData * GetData(sal_uInt16 nSVId) const
void InsertSeparator(const OString &rIdent, size_t nPos)
MenuItemData * SearchItem(sal_Unicode cSelectChar, vcl::KeyCode aKeyCode, size_t &rPos, size_t &nDuplicates, size_t nCurrentPos) const
Definition: menu.hxx:116
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:176
sal_uInt16 nPos
void(* MenuUserDataReleaseFunction)(void *)
Definition: menu.hxx:113
NONE
vcl::KeyCode aAccelKey
SalLayoutGlyphs aTextGlyphs
Text layout of aText.
VclPtr< Menu > pSubMenu
OString sIdent
sal_uInt16 nId
void * nUserValue
MenuUserDataReleaseFunction aUserValueReleaseFunc
MenuItemBits nBits
SalLayoutGlyphs * GetTextGlyphs(const OutputDevice *pOutputDevice)
Computes aText's text layout (glyphs), cached in aTextGlyphs.
MenuItemData(const OUString &rStr)
OUString aAccessibleDescription
std::unique_ptr< SalMenuItem > pSalMenuItem
MenuItemType eType
OUString aAccessibleName
OUString aHelpText
OUString aCommandStr
OUString aHelpCommandStr
OUString aText
bool HasCheck() const
OUString aTipHelpText
OString aHelpId
sal_uInt16 sal_Unicode
MenuItemType
Definition: vclenum.hxx:30
MenuItemBits
Definition: vclenum.hxx:33