From 31a85a9a13595a9aeae1932ee08c9b09ead384cd Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 25 Jul 2017 10:03:44 +0200 Subject: 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 Reviewed-by: Noel Grandin --- cui/source/dialogs/hltpbase.cxx | 6 +++--- cui/source/inc/macroass.hxx | 2 +- cui/source/tabpages/macroass.cxx | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx index 68afa3cb9433..bae6b299bd78 100644 --- a/cui/source/dialogs/hltpbase.cxx +++ b/cui/source/dialogs/hltpbase.cxx @@ -342,13 +342,13 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, Button*, void) if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOverObject ) pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT1), - SFX_EVENT_MOUSEOVER_OBJECT ); + SvMacroItemId::OnMouseOver ); if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseClickObject ) pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT2), - SFX_EVENT_MOUSECLICK_OBJECT); + SvMacroItemId::OnClick); if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOutObject ) pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT3), - SFX_EVENT_MOUSEOUT_OBJECT); + SvMacroItemId::OnMouseOut); if ( bIsInputEnabled ) GetParent()->EnableInput(); diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx index 3f37b3a260a2..e7fcd756e29f 100644 --- a/cui/source/inc/macroass.hxx +++ b/cui/source/inc/macroass.hxx @@ -62,7 +62,7 @@ public: virtual ~SfxMacroTabPage() override; virtual void dispose() override; - void AddEvent( const OUString & rEventName, sal_uInt16 nEventId ); + void AddEvent( const OUString & rEventName, SvMacroItemId nEventId ); void ScriptChanged(); virtual void PageCreated (const SfxAllItemSet& aSet) override; diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index 79c0fcd6f64c..a2b61d49e812 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -117,7 +117,7 @@ void SfxMacroTabPage::EnableButtons() if ( pE ) { // get bound macro - const SvxMacro* pM = aTbl.Get( (sal_uInt16)reinterpret_cast(pE->GetUserData()) ); + const SvxMacro* pM = aTbl.Get( (SvMacroItemId)reinterpret_cast(pE->GetUserData()) ); mpImpl->pDeletePB->Enable( nullptr != pM ); OUString sEventMacro = static_cast(pE->GetItem( LB_MACROS_ITEMPOS )).GetText(); @@ -167,7 +167,7 @@ void SfxMacroTabPage::dispose() SfxTabPage::dispose(); } -void SfxMacroTabPage::AddEvent( const OUString & rEventName, sal_uInt16 nEventId ) +void SfxMacroTabPage::AddEvent( const OUString & rEventName, SvMacroItemId nEventId ) { OUString sTmp = rEventName + "\t"; @@ -325,7 +325,7 @@ bool SfxMacroTabPage::AssignDeleteHdl(Control* pBtn) const bool bAssEnabled = pBtn != mpImpl->pDeletePB && mpImpl->pAssignPB->IsEnabled(); // remove from the table - sal_uInt16 nEvent = (sal_uInt16)reinterpret_cast(pE->GetUserData()); + SvMacroItemId nEvent = (SvMacroItemId)reinterpret_cast(pE->GetUserData()); aTbl.Erase( nEvent ); OUString sScriptURI; @@ -428,7 +428,7 @@ void SfxMacroTabPage::FillEvents() OUString sOld( rLItem.GetText() ); OUString sNew; - sal_uInt16 nEventId = ( sal_uInt16 ) reinterpret_cast( pE->GetUserData() ); + SvMacroItemId nEventId = (SvMacroItemId) reinterpret_cast( pE->GetUserData() ); if( aTbl.IsKeyValid( nEventId ) ) sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ) ); -- cgit