diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-25 10:03:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-25 12:21:22 +0200 |
commit | 31a85a9a13595a9aeae1932ee08c9b09ead384cd (patch) | |
tree | d3cf4136e21a3acee1ddbf77aca62f3d73c3ed55 /include/svtools | |
parent | 2fffaf6f05d829e345ad8b391646a6e8df9a9a26 (diff) |
convert UNO event ids to scoped enum
I'm fairly sure there are more simplifications that could be make here.
It seems like we have both an ID and a string name for all of these
events, and we could probably get by with just one of those, or
alternately, centralise the name<->id mapping somewhere
Change-Id: I978073822ddbebce94ac5b560fea675bea905a35
Reviewed-on: https://gerrit.libreoffice.org/40392
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/svtools')
-rw-r--r-- | include/svtools/htmlout.hxx | 2 | ||||
-rw-r--r-- | include/svtools/unoevent.hxx | 34 |
2 files changed, 18 insertions, 18 deletions
diff --git a/include/svtools/htmlout.hxx b/include/svtools/htmlout.hxx index 979741af0f85..5d14ef72b845 100644 --- a/include/svtools/htmlout.hxx +++ b/include/svtools/htmlout.hxx @@ -38,7 +38,7 @@ struct HTMLOutEvent { const sal_Char *pBasicName; const sal_Char *pJavaName; - sal_uInt16 nEvent; + SvMacroItemId nEvent; }; struct SVT_DLLPUBLIC HTMLOutContext diff --git a/include/svtools/unoevent.hxx b/include/svtools/unoevent.hxx index 3d8b0936dfde..74470085ff52 100644 --- a/include/svtools/unoevent.hxx +++ b/include/svtools/unoevent.hxx @@ -30,6 +30,7 @@ class SvxMacroTableDtor; class SvxMacroItem; class SvxMacro; +enum class SvMacroItemId : sal_uInt16; /** SvEventDescription: Description of a single event. mnEvent is the id used by SvxMacroItem @@ -39,7 +40,7 @@ class SvxMacro; */ struct SvEventDescription { - sal_uInt16 mnEvent; + SvMacroItemId mnEvent; const sal_Char* mpEventName; }; @@ -121,8 +122,8 @@ protected: /// @throws css::lang::WrappedTargetException /// @throws css::uno::RuntimeException virtual void replaceByName( - const sal_uInt16 nEvent, /// item ID of event - const SvxMacro& rMacro) /// event (will be copied) + const SvMacroItemId nEvent, /// item ID of event + const SvxMacro& rMacro) /// event (will be copied) = 0; /// Must be implemented in subclass. @@ -132,13 +133,13 @@ protected: /// @throws css::uno::RuntimeException virtual void getByName( SvxMacro& rMacro, - const sal_uInt16 nEvent ) = 0; + const SvMacroItemId nEvent ) = 0; /// convert an API event name to the event ID as used by SvxMacroItem - sal_uInt16 mapNameToEventID(const OUString& rName) const; + SvMacroItemId mapNameToEventID(const OUString& rName) const; /// get the event ID for the name; return 0 if not supported - sal_uInt16 getMacroID(const OUString& rName) const; + SvMacroItemId getMacroID(const OUString& rName) const; }; @@ -173,14 +174,14 @@ protected: using SvBaseEventDescriptor::replaceByName; virtual void replaceByName( - const sal_uInt16 nEvent, /// item ID of event - const SvxMacro& rMacro) /// event (will be copied) + const SvMacroItemId nEvent, /// item ID of event + const SvxMacro& rMacro) /// event (will be copied) override; using SvBaseEventDescriptor::getByName; virtual void getByName( - SvxMacro& rMacros, /// macro to be filled with values - const sal_uInt16 nEvent ) /// item ID of event + SvxMacro& rMacros, /// macro to be filled with values + const SvMacroItemId nEvent ) /// item ID of event override; @@ -221,18 +222,18 @@ public: protected: - sal_Int16 getIndex(const sal_uInt16 nID) const; + sal_Int16 getIndex(const SvMacroItemId nID) const; using SvBaseEventDescriptor::replaceByName; virtual void replaceByName( - const sal_uInt16 nEvent, /// item ID of event - const SvxMacro& rMacro) /// event (will be copied) + const SvMacroItemId nEvent, /// item ID of event + const SvxMacro& rMacro) /// event (will be copied) override; using SvBaseEventDescriptor::getByName; virtual void getByName( - SvxMacro& rMacro, /// macro to be filled - const sal_uInt16 nEvent ) /// item ID of event + SvxMacro& rMacro, /// macro to be filled + const SvMacroItemId nEvent ) /// item ID of event override; /// do we have an event? @@ -240,8 +241,7 @@ protected: /// return false: no macro; getByName() will return an empty macro /// @throws css::lang::IllegalArgumentException if the event is not supported bool hasById( - const sal_uInt16 nEvent ) const /// item ID of event - ; + const SvMacroItemId nEvent ) const; /// item ID of event }; |