diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-26 10:52:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-26 11:42:49 +0200 |
commit | f2964b9cdb04595e842de329222ffa2b63e5d7f7 (patch) | |
tree | 20470a5ecb639d74fa260711583139bb4a6ad41e /include | |
parent | 6f691e9c763e4c5f13a745a56fe4d889188187ed (diff) |
convert SfxGroupId to scoped enum
in the process I had to teach the idl compiler to cope with identifiers
like SfxGroupID::Math, which has the side effect of requiring a space
before a ':' in some of the .sdi files.
Change-Id: If256599cb8aa1dfc0a33642c5070c5560702f3ba
Reviewed-on: https://gerrit.libreoffice.org/40441
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/groupid.hxx | 83 |
1 files changed, 34 insertions, 49 deletions
diff --git a/include/sfx2/groupid.hxx b/include/sfx2/groupid.hxx index 288c33e224f5..7df33ccec28a 100644 --- a/include/sfx2/groupid.hxx +++ b/include/sfx2/groupid.hxx @@ -19,16 +19,43 @@ #ifndef INCLUDED_SFX2_GROUPID_HXX #define INCLUDED_SFX2_GROUPID_HXX -#include <o3tl/strong_int.hxx> -#include <sal/types.h> -#include <functional> +// !! If you add a new group, please change sfxbasecontroller.cxx and +// !! com.sun.star.frame.CommandGroup accordingly! -struct SfxGroupIdTag {}; -typedef o3tl::strong_int<sal_uInt16, SfxGroupIdTag> SfxGroupId; +enum class SfxGroupId { + NONE = 0, + Intern = 32700, + Application, + Document, + View, + Edit, + Macro, + Options, + Math, + Navigator, + Insert, + Format, + Template, + Text, + Frame, + Graphic, + Table, + Enumeration, + Data, + Special, + Image, + Chart, + Explorer, + Connector, + Modify, + Drawing, + Controls, + Navigation +}; // make it hashable for storing in maps -namespace std { - +namespace std +{ template <> struct hash<SfxGroupId> { @@ -37,50 +64,8 @@ namespace std { return std::hash<sal_uInt16>()((sal_uInt16)k); } }; - } -// Make it easier to declare the constants in the .hrc files. -// This way, we only have to mark the START constant as being SfxGroupId. -inline SfxGroupId operator+(SfxGroupId lhs, sal_uInt16 rhs) -{ - return SfxGroupId((sal_uInt16)lhs + rhs); -} - -// group ids - -// !! If you add a new group, please change sfxbasecontroller.cxx and -// !! com.sun.star.frame.CommandGroup accordingly! - -#define RID_GROUPS_SFXOFFSET SfxGroupId(32700) -#define GID_INTERN (RID_GROUPS_SFXOFFSET+ 0) -#define GID_APPLICATION (RID_GROUPS_SFXOFFSET+ 1) -#define GID_DOCUMENT (RID_GROUPS_SFXOFFSET+ 2) -#define GID_VIEW (RID_GROUPS_SFXOFFSET+ 3) -#define GID_EDIT (RID_GROUPS_SFXOFFSET+ 4) -#define GID_MACRO (RID_GROUPS_SFXOFFSET+ 5) -#define GID_OPTIONS (RID_GROUPS_SFXOFFSET+ 6) -#define GID_MATH (RID_GROUPS_SFXOFFSET+ 7) -#define GID_NAVIGATOR (RID_GROUPS_SFXOFFSET+ 8) -#define GID_INSERT (RID_GROUPS_SFXOFFSET+ 9) -#define GID_FORMAT (RID_GROUPS_SFXOFFSET+10) -#define GID_TEMPLATE (RID_GROUPS_SFXOFFSET+11) -#define GID_TEXT (RID_GROUPS_SFXOFFSET+12) -#define GID_FRAME (RID_GROUPS_SFXOFFSET+13) -#define GID_GRAPHIC (RID_GROUPS_SFXOFFSET+14) -#define GID_TABLE (RID_GROUPS_SFXOFFSET+15) -#define GID_ENUMERATION (RID_GROUPS_SFXOFFSET+16) -#define GID_DATA (RID_GROUPS_SFXOFFSET+17) -#define GID_SPECIAL (RID_GROUPS_SFXOFFSET+18) -#define GID_IMAGE (RID_GROUPS_SFXOFFSET+19) -#define GID_CHART (RID_GROUPS_SFXOFFSET+20) -#define GID_EXPLORER (RID_GROUPS_SFXOFFSET+21) -#define GID_CONNECTOR (RID_GROUPS_SFXOFFSET+22) -#define GID_MODIFY (RID_GROUPS_SFXOFFSET+23) -#define GID_DRAWING (RID_GROUPS_SFXOFFSET+24) -#define GID_CONTROLS (RID_GROUPS_SFXOFFSET+25) -#define GID_NAVIGATION (RID_GROUPS_SFXOFFSET+26) - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |