diff options
48 files changed, 337 insertions, 329 deletions
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<sal_uLong>(pE->GetUserData()) ); + const SvxMacro* pM = aTbl.Get( (SvMacroItemId)reinterpret_cast<sal_uLong>(pE->GetUserData()) ); mpImpl->pDeletePB->Enable( nullptr != pM ); OUString sEventMacro = static_cast<const SvLBoxString&>(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<sal_uLong>(pE->GetUserData()); + SvMacroItemId nEvent = (SvMacroItemId)reinterpret_cast<sal_uLong>(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<sal_uLong>( pE->GetUserData() ); + SvMacroItemId nEventId = (SvMacroItemId) reinterpret_cast<sal_uLong>( pE->GetUserData() ); if( aTbl.IsKeyValid( nEventId ) ) sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ) ); diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx index 7dbb9c08cf32..3e86bcd9989b 100644 --- a/include/sfx2/event.hxx +++ b/include/sfx2/event.hxx @@ -30,16 +30,45 @@ #include <com/sun/star/frame/XController2.hpp> #include <com/sun/star/view/PrintableState.hpp> -#define EVENT_SFX_START 5000 -// EVENT_SFX_END 9999 - -#define EVENT_APP_START 20000 -// EVENT_APP_END 29999 +/** + these values get stored in streams in a 16-bit value +*/ +enum class SvMacroItemId : sal_uInt16 { + NONE = 0, + + // used by SwHTMLForm_Impl + HtmlOnSubmitForm, + HtmlOnResetForm, + HtmlOnGetFocus, + HtmlOnLoseFocus, + HtmlOnClick, + HtmlOnClickItem, + HtmlOnChange, + HtmlOnSelect, + + // used by SwHTMLParser + OpenDoc, + PrepareCloseDoc, + ActivateDoc, + DeactivateDoc, -// Events for Controls etc. -#define SFX_EVENT_MOUSEOVER_OBJECT ( EVENT_SFX_START + 100 ) -#define SFX_EVENT_MOUSECLICK_OBJECT ( EVENT_SFX_START + 101 ) -#define SFX_EVENT_MOUSEOUT_OBJECT ( EVENT_SFX_START + 102 ) + // Events for Controls etc. + OnMouseOver = 5100, + OnClick = 5101, + OnMouseOut = 5102, + + OnImageLoadDone = 10000, + OnImageLoadCancel = 10001, + OnImageLoadError = 10002, + + SwObjectSelect = 20000, + SwStartInsGlossary = 20001, + SwEndInsGlossary = 20002, + SwFrmKeyInputAlpha = 20004, + SwFrmKeyInputNoAlpha = 20005, + SwFrmResize = 20006, + SwFrmMove = 20007, +}; class SfxObjectShell; diff --git a/include/sfx2/evntconf.hxx b/include/sfx2/evntconf.hxx index 2a7078ff3661..7df7c6ae6f88 100644 --- a/include/sfx2/evntconf.hxx +++ b/include/sfx2/evntconf.hxx @@ -34,11 +34,11 @@ class SvxMacroTableDtor; struct SFX2_DLLPUBLIC SfxEventName { - sal_uInt16 mnId; - OUString maEventName; - OUString maUIName; + SvMacroItemId mnId; + OUString maEventName; + OUString maUIName; - SfxEventName( sal_uInt16 nId, + SfxEventName( SvMacroItemId nId, const OUString& rEventName, const OUString& rUIName ) : mnId( nId ) @@ -86,7 +86,7 @@ public: virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; const SfxEventNamesList& GetEvents() const { return aEventsList;} - void AddEvent( const OUString&, const OUString&, sal_uInt16 ); + void AddEvent( const OUString&, const OUString&, SvMacroItemId ); }; diff --git a/include/sfx2/sfxhtml.hxx b/include/sfx2/sfxhtml.hxx index 2796c950cad4..19ee5cfb3864 100644 --- a/include/sfx2/sfxhtml.hxx +++ b/include/sfx2/sfxhtml.hxx @@ -59,11 +59,11 @@ public: { return ParseMapOptions(pImageMap, GetOptions()); } static bool ParseAreaOptions(ImageMap * pImageMap, const OUString& rBaseURL, const HTMLOptions& rOptions, - sal_uInt16 nEventMouseOver, - sal_uInt16 nEventMouseOut ); + SvMacroItemId nEventMouseOver, + SvMacroItemId nEventMouseOut ); inline bool ParseAreaOptions(ImageMap * pImageMap, const OUString& rBaseURL, - sal_uInt16 nEventMouseOver, - sal_uInt16 nEventMouseOut); + SvMacroItemId nEventMouseOver, + SvMacroItemId nEventMouseOut); // <TD SDVAL="..." SDNUM="..."> static double GetTableDataOptionsValNum( sal_uInt32& nNumForm, @@ -100,8 +100,8 @@ protected: }; inline bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const OUString& rBaseURL, - sal_uInt16 nEventMouseOver, - sal_uInt16 nEventMouseOut) + SvMacroItemId nEventMouseOver, + SvMacroItemId nEventMouseOut) { return ParseAreaOptions( pImageMap, rBaseURL, GetOptions(), nEventMouseOver, nEventMouseOut ); diff --git a/include/svl/macitem.hxx b/include/svl/macitem.hxx index e3b7d589ece7..b7e6f292bbd8 100644 --- a/include/svl/macitem.hxx +++ b/include/svl/macitem.hxx @@ -27,6 +27,7 @@ #include <map> class SvStream; +enum class SvMacroItemId : sal_uInt16; #define SVX_MACRO_LANGUAGE_JAVASCRIPT "JavaScript" #define SVX_MACRO_LANGUAGE_STARBASIC "StarBasic" @@ -69,7 +70,7 @@ inline SvxMacro::SvxMacro( const OUString &rMacName, const OUString &rLibName, {} // Macro Table, destroys the pointers in the DTor! -typedef std::map<sal_uInt16, SvxMacro> SvxMacroTable; +typedef std::map<SvMacroItemId, SvxMacro> SvxMacroTable; #define SVX_MACROTBL_VERSION31 0 #define SVX_MACROTBL_VERSION40 1 @@ -100,15 +101,15 @@ public: bool empty() const { return aSvxMacroTable.empty(); } // returns NULL if no entry exists, or a pointer to the internal value - const SvxMacro* Get(sal_uInt16 nEvent) const; + const SvxMacro* Get(SvMacroItemId nEvent) const; // returns NULL if no entry exists, or a pointer to the internal value - SvxMacro* Get(sal_uInt16 nEvent); + SvxMacro* Get(SvMacroItemId nEvent); // return true if the key exists - bool IsKeyValid(sal_uInt16 nEvent) const; + bool IsKeyValid(SvMacroItemId nEvent) const; // This stores a copy of the rMacro parameter - SvxMacro& Insert(sal_uInt16 nEvent, const SvxMacro& rMacro); + SvxMacro& Insert(SvMacroItemId nEvent, const SvxMacro& rMacro); // If the entry exists, remove it from the map and release it's storage - void Erase(sal_uInt16 nEvent); + void Erase(SvMacroItemId nEvent); }; @@ -136,9 +137,9 @@ public: const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;} void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; } - inline const SvxMacro& GetMacro( sal_uInt16 nEvent ) const; - inline bool HasMacro( sal_uInt16 nEvent ) const; - void SetMacro( sal_uInt16 nEvent, const SvxMacro& ); + inline const SvxMacro& GetMacro( SvMacroItemId nEvent ) const; + inline bool HasMacro( SvMacroItemId nEvent ) const; + void SetMacro( SvMacroItemId nEvent, const SvxMacro& ); private: SvxMacroTableDtor aMacroTable; @@ -155,11 +156,11 @@ inline SvxMacroItem::SvxMacroItem( const SvxMacroItem &rCpy ) aMacroTable( rCpy.GetMacroTable() ) {} -inline bool SvxMacroItem::HasMacro( sal_uInt16 nEvent ) const +inline bool SvxMacroItem::HasMacro( SvMacroItemId nEvent ) const { return aMacroTable.IsKeyValid( nEvent ); } -inline const SvxMacro& SvxMacroItem::GetMacro( sal_uInt16 nEvent ) const +inline const SvxMacro& SvxMacroItem::GetMacro( SvMacroItemId nEvent ) const { return *(aMacroTable.Get(nEvent)); } 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 }; diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 09dc209d3e02..2c37e45b9c21 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -48,12 +48,6 @@ #define MID_ZOOMSLIDER_MINZOOM 0x7b #define MID_ZOOMSLIDER_MAXZOOM 0x7c -// event IDs block 2 - -#define SVX_EVENT_IMAGE_LOAD (SID_LIB_START) -#define SVX_EVENT_IMAGE_ABORT (SID_LIB_START + 1) -#define SVX_EVENT_IMAGE_ERROR (SID_LIB_START + 2) - // function IDs #define FID_SVX_START (SID_LIB_START + 500) diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 05c8288a8fa2..7d0b8ea9385e 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -330,7 +330,7 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, vcl::Window* pWin ) { SvxMacroTableDtor aTab; OUString sMacro = pInfo->GetMacro(); - aTab.Insert(SFX_EVENT_MOUSECLICK_OBJECT, SvxMacro(sMacro, OUString())); + aTab.Insert(SvMacroItemId::OnClick, SvxMacro(sMacro, OUString())); aItem.SetMacroTable( aTab ); } @@ -339,7 +339,7 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, vcl::Window* pWin ) pItemSet->Put ( aItem ); SfxEventNamesItem aNamesItem(SID_EVENTCONFIG); - aNamesItem.AddEvent( ScResId(RID_SCSTR_ONCLICK), OUString(), SFX_EVENT_MOUSECLICK_OBJECT ); + aNamesItem.AddEvent( ScResId(RID_SCSTR_ONCLICK), OUString(), SvMacroItemId::OnClick ); pItemSet->Put( aNamesItem ); css::uno::Reference < css::frame::XFrame > xFrame; @@ -355,7 +355,7 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, vcl::Window* pWin ) if( SfxItemState::SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, false, &pItem )) { OUString sMacro; - const SvxMacro* pMacro = static_cast<const SvxMacroItem*>(pItem)->GetMacroTable().Get( SFX_EVENT_MOUSECLICK_OBJECT ); + const SvxMacro* pMacro = static_cast<const SvxMacroItem*>(pItem)->GetMacroTable().Get( SvMacroItemId::OnClick ); if ( pMacro ) sMacro = pMacro->GetMacName(); diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index 0e59d3f5229c..4946b0099817 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -24,6 +24,7 @@ #include <svtools/unoimap.hxx> #include <svx/svdobj.hxx> #include <vcl/svapp.hxx> +#include <sfx2/event.hxx> #include <svx/unoshape.hxx> #include <editeng/unofield.hxx> #include <svx/shapepropertynotifier.hxx> @@ -68,7 +69,7 @@ const SvEventDescription* ScShapeObj::GetSupportedMacroItems() { static const SvEventDescription aMacroDescriptionsImpl[] = { - { 0, nullptr } + { SvMacroItemId::NONE, nullptr } }; return aMacroDescriptionsImpl; } diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 69f5484cd805..384cd5b96342 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -254,9 +254,9 @@ const SvEventDescription* ImplGetSupportedMacroItems() { static const SvEventDescription aMacroDescriptionsImpl[] = { - { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, - { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, - { 0, nullptr } + { SvMacroItemId::OnMouseOver, "OnMouseOver" }, + { SvMacroItemId::OnMouseOut, "OnMouseOut" }, + { SvMacroItemId::NONE, nullptr } }; return aMacroDescriptionsImpl; diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index a066fd8c615c..ee2137a3ed56 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -22,6 +22,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/docfile.hxx> +#include <sfx2/event.hxx> #include "openflag.hxx" #include <svtools/htmlkywd.hxx> @@ -102,8 +103,8 @@ bool SfxHTMLParser::ParseMapOptions( bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const OUString& rBaseURL, const HTMLOptions& rOptions, - sal_uInt16 nEventMouseOver, - sal_uInt16 nEventMouseOut ) + SvMacroItemId nEventMouseOver, + SvMacroItemId nEventMouseOut ) { DBG_ASSERT( pImageMap, "ParseAreaOptions: no Image-Map" ); @@ -115,7 +116,7 @@ bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const OUString& rBase for (size_t i = rOptions.size(); i; ) { - sal_uInt16 nEvent = 0; + SvMacroItemId nEvent = SvMacroItemId::NONE; ScriptType eScrpType = STARBASIC; const HTMLOption& rOption = rOptions[--i]; switch( rOption.GetToken() ) @@ -156,7 +157,7 @@ bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const OUString& rBase nEvent = nEventMouseOut; goto IMAPOBJ_SETEVENT; IMAPOBJ_SETEVENT: - if( nEvent ) + if( nEvent != SvMacroItemId::NONE) { OUString sTmp( rOption.GetString() ); if( !sTmp.isEmpty() ) diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 21369698b772..eed3e1cbd47a 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -126,7 +126,7 @@ sal_uInt16 SfxEventNamesItem::GetVersion( sal_uInt16 ) const return 0; } -void SfxEventNamesItem::AddEvent( const OUString& rName, const OUString& rUIName, sal_uInt16 nID ) +void SfxEventNamesItem::AddEvent( const OUString& rName, const OUString& rUIName, SvMacroItemId nID ) { aEventsList.push_back( new SfxEventName( nID, rName, !rUIName.isEmpty() ? rUIName : rName ) ); } diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx index 627daa9330dd..9bf75713b6d9 100644 --- a/svl/source/items/macitem.cxx +++ b/svl/source/items/macitem.cxx @@ -131,7 +131,7 @@ void SvxMacroTableDtor::Read( SvStream& rStrm, sal_uInt16 nVersion ) if( SVX_MACROTBL_VERSION40 <= nVersion ) rStrm.ReadUInt16( eType ); - aSvxMacroTable.insert( SvxMacroTable::value_type(nCurKey, SvxMacro( aMacName, aLibName, (ScriptType)eType ) )); + aSvxMacroTable.insert( SvxMacroTable::value_type(SvMacroItemId(nCurKey), SvxMacro( aMacName, aLibName, (ScriptType)eType ) )); } } @@ -151,7 +151,7 @@ SvStream& SvxMacroTableDtor::Write( SvStream& rStream ) const while( it != aSvxMacroTable.end() && rStream.GetError() == ERRCODE_NONE ) { const SvxMacro& rMac = it->second; - rStream.WriteUInt16( it->first ); + rStream.WriteUInt16( (sal_uInt16)it->first ); writeByteString(rStream, rMac.GetLibName()); writeByteString(rStream, rMac.GetMacName()); @@ -163,34 +163,34 @@ SvStream& SvxMacroTableDtor::Write( SvStream& rStream ) const } // returns NULL if no entry exists, or a pointer to the internal value -const SvxMacro* SvxMacroTableDtor::Get(sal_uInt16 nEvent) const +const SvxMacro* SvxMacroTableDtor::Get(SvMacroItemId nEvent) const { SvxMacroTable::const_iterator it = aSvxMacroTable.find(nEvent); return it == aSvxMacroTable.end() ? nullptr : &(it->second); } // returns NULL if no entry exists, or a pointer to the internal value -SvxMacro* SvxMacroTableDtor::Get(sal_uInt16 nEvent) +SvxMacro* SvxMacroTableDtor::Get(SvMacroItemId nEvent) { SvxMacroTable::iterator it = aSvxMacroTable.find(nEvent); return it == aSvxMacroTable.end() ? nullptr : &(it->second); } // return true if the key exists -bool SvxMacroTableDtor::IsKeyValid(sal_uInt16 nEvent) const +bool SvxMacroTableDtor::IsKeyValid(SvMacroItemId nEvent) const { SvxMacroTable::const_iterator it = aSvxMacroTable.find(nEvent); return it != aSvxMacroTable.end(); } // This stores a copy of the rMacro parameter -SvxMacro& SvxMacroTableDtor::Insert(sal_uInt16 nEvent, const SvxMacro& rMacro) +SvxMacro& SvxMacroTableDtor::Insert(SvMacroItemId nEvent, const SvxMacro& rMacro) { return aSvxMacroTable.insert( SvxMacroTable::value_type( nEvent, rMacro ) ).first->second; } // If the entry exists, remove it from the map and release it's storage -void SvxMacroTableDtor::Erase(sal_uInt16 nEvent) +void SvxMacroTableDtor::Erase(SvMacroItemId nEvent) { SvxMacroTable::iterator it = aSvxMacroTable.find(nEvent); if ( it != aSvxMacroTable.end()) @@ -259,7 +259,7 @@ SfxPoolItem* SvxMacroItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const } -void SvxMacroItem::SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro ) +void SvxMacroItem::SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro ) { aMacroTable.Insert( nEvent, rMacro); } diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 04e335a146a1..351f6a76b999 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -21,6 +21,7 @@ #include <cppuhelper/supportsservice.hxx> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> +#include <sfx2/event.hxx> #include <svtools/unoevent.hxx> #include <svl/macitem.hxx> @@ -238,7 +239,7 @@ SvBaseEventDescriptor::SvBaseEventDescriptor( const SvEventDescription* pSupport { assert(pSupportedMacroItems != nullptr && "Need a list of supported events!"); - for( ; mpSupportedMacroItems[mnMacroItems].mnEvent != 0; mnMacroItems++) ; + for( ; mpSupportedMacroItems[mnMacroItems].mnEvent != SvMacroItemId::NONE; mnMacroItems++) ; } @@ -250,10 +251,10 @@ void SvBaseEventDescriptor::replaceByName( const OUString& rName, const Any& rElement ) { - sal_uInt16 nMacroID = getMacroID(rName); + SvMacroItemId nMacroID = getMacroID(rName); // error checking - if (0 == nMacroID) + if (SvMacroItemId::NONE == nMacroID) throw NoSuchElementException(); if (rElement.getValueType() != getElementType()) throw IllegalArgumentException(); @@ -271,10 +272,10 @@ void SvBaseEventDescriptor::replaceByName( Any SvBaseEventDescriptor::getByName( const OUString& rName ) { - sal_uInt16 nMacroID = getMacroID(rName); + SvMacroItemId nMacroID = getMacroID(rName); // error checking - if (0 == nMacroID) + if (SvMacroItemId::NONE == nMacroID) throw NoSuchElementException(); // perform get (in subclass) @@ -300,8 +301,8 @@ Sequence<OUString> SvBaseEventDescriptor::getElementNames() sal_Bool SvBaseEventDescriptor::hasByName( const OUString& rName ) { - sal_uInt16 nMacroID = getMacroID(rName); - return (nMacroID != 0); + SvMacroItemId nMacroID = getMacroID(rName); + return (nMacroID != SvMacroItemId::NONE); } Type SvBaseEventDescriptor::getElementType() @@ -326,7 +327,7 @@ Sequence<OUString> SvBaseEventDescriptor::getSupportedServiceNames() return aSequence; } -sal_uInt16 SvBaseEventDescriptor::mapNameToEventID(const OUString& rName) const +SvMacroItemId SvBaseEventDescriptor::mapNameToEventID(const OUString& rName) const { // iterate over known event names for(sal_Int16 i = 0; i < mnMacroItems; i++) @@ -338,10 +339,10 @@ sal_uInt16 SvBaseEventDescriptor::mapNameToEventID(const OUString& rName) const } // not found -> return zero - return 0; + return SvMacroItemId::NONE; } -sal_uInt16 SvBaseEventDescriptor::getMacroID(const OUString& rName) const +SvMacroItemId SvBaseEventDescriptor::getMacroID(const OUString& rName) const { return mapNameToEventID(rName); } @@ -361,7 +362,7 @@ SvEventDescriptor::~SvEventDescriptor() } void SvEventDescriptor::replaceByName( - const sal_uInt16 nEvent, + const SvMacroItemId nEvent, const SvxMacro& rMacro) { SvxMacroItem aItem(getMacroItemWhich()); @@ -372,7 +373,7 @@ void SvEventDescriptor::replaceByName( void SvEventDescriptor::getByName( SvxMacro& rMacro, - const sal_uInt16 nEvent ) + const SvMacroItemId nEvent ) { const SvxMacroItem& rItem = getMacroItem(); if( rItem.HasMacro( nEvent ) ) @@ -397,12 +398,12 @@ SvDetachedEventDescriptor::~SvDetachedEventDescriptor() { } -sal_Int16 SvDetachedEventDescriptor::getIndex(const sal_uInt16 nID) const +sal_Int16 SvDetachedEventDescriptor::getIndex(const SvMacroItemId nID) const { // iterate over supported events sal_Int16 nIndex = 0; while ( (mpSupportedMacroItems[nIndex].mnEvent != nID) && - (mpSupportedMacroItems[nIndex].mnEvent != 0) ) + (mpSupportedMacroItems[nIndex].mnEvent != SvMacroItemId::NONE) ) { nIndex++; } @@ -416,7 +417,7 @@ OUString SvDetachedEventDescriptor::getImplementationName() void SvDetachedEventDescriptor::replaceByName( - const sal_uInt16 nEvent, + const SvMacroItemId nEvent, const SvxMacro& rMacro) { sal_Int16 nIndex = getIndex(nEvent); @@ -430,7 +431,7 @@ void SvDetachedEventDescriptor::replaceByName( void SvDetachedEventDescriptor::getByName( SvxMacro& rMacro, - const sal_uInt16 nEvent ) + const SvMacroItemId nEvent ) { sal_Int16 nIndex = getIndex(nEvent); if (-1 == nIndex ) @@ -441,7 +442,7 @@ void SvDetachedEventDescriptor::getByName( } bool SvDetachedEventDescriptor::hasById( - const sal_uInt16 nEvent ) const /// item ID of event + const SvMacroItemId nEvent ) const /// item ID of event { sal_Int16 nIndex = getIndex(nEvent); if (-1 == nIndex) @@ -461,9 +462,9 @@ SvMacroTableEventDescriptor::SvMacroTableEventDescriptor( const SvEventDescription* pSupportedMacroItems) : SvDetachedEventDescriptor(pSupportedMacroItems) { - for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++) + for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != SvMacroItemId::NONE; i++) { - const sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent; + const SvMacroItemId nEvent = mpSupportedMacroItems[i].mnEvent; const SvxMacro* pMacro = rMacroTable.Get(nEvent); if (nullptr != pMacro) replaceByName(nEvent, *pMacro); @@ -477,9 +478,9 @@ SvMacroTableEventDescriptor::~SvMacroTableEventDescriptor() void SvMacroTableEventDescriptor::copyMacrosIntoTable( SvxMacroTableDtor& rMacroTable) { - for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++) + for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != SvMacroItemId::NONE; i++) { - const sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent; + const SvMacroItemId nEvent = mpSupportedMacroItems[i].mnEvent; if (hasById(nEvent)) { SvxMacro& rMacro = rMacroTable.Insert(nEvent, SvxMacro("", "")); diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index faa784d4b506..ce44fc65a89e 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -637,8 +637,8 @@ void IMapWindow::DoMacroAssign() SfxItemSet aSet( *pIMapPool, svl::Items<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG>{} ); SfxEventNamesItem aNamesItem(SID_EVENTCONFIG); - aNamesItem.AddEvent( "MouseOver", "", SFX_EVENT_MOUSEOVER_OBJECT ); - aNamesItem.AddEvent( "MouseOut", "", SFX_EVENT_MOUSEOUT_OBJECT ); + aNamesItem.AddEvent( "MouseOver", "", SvMacroItemId::OnMouseOver ); + aNamesItem.AddEvent( "MouseOut", "", SvMacroItemId::OnMouseOut ); aSet.Put( aNamesItem ); SvxMacroItem aMacroItem(SID_ATTR_MACROITEM); diff --git a/svx/source/items/hlnkitem.cxx b/svx/source/items/hlnkitem.cxx index 01f6c024fcf0..2627e738b05d 100644 --- a/svx/source/items/hlnkitem.cxx +++ b/svx/source/items/hlnkitem.cxx @@ -75,7 +75,7 @@ SvStream& SvxHyperlinkItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ const SvxMacro& rMac = it->second; if( STARBASIC == rMac.GetScriptType() ) { - rStrm.WriteUInt16( it->first ); + rStrm.WriteUInt16( sal_uInt16(it->first) ); // UNICODE: rStrm << pMac->GetLibName(); rStrm.WriteUniOrByteString(rMac.GetLibName(), rStrm.GetStreamCharSet()); @@ -97,7 +97,7 @@ SvStream& SvxHyperlinkItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ const SvxMacro& rMac = it->second; if( STARBASIC != rMac.GetScriptType() ) { - rStrm.WriteUInt16( it->first ); + rStrm.WriteUInt16( sal_uInt16(it->first) ); // UNICODE: rStrm << pMac->GetLibName(); rStrm.WriteUniOrByteString(rMac.GetLibName(), rStrm.GetStreamCharSet()); @@ -253,17 +253,17 @@ bool SvxHyperlinkItem::operator==( const SfxPoolItem& rAttr ) const void SvxHyperlinkItem::SetMacro( HyperDialogEvent nEvent, const SvxMacro& rMacro ) { - sal_uInt16 nSfxEvent = 0; + SvMacroItemId nSfxEvent = SvMacroItemId::NONE; switch( nEvent ) { case HyperDialogEvent::MouseOverObject: - nSfxEvent = SFX_EVENT_MOUSEOVER_OBJECT; + nSfxEvent = SvMacroItemId::OnMouseOver; break; case HyperDialogEvent::MouseClickObject: - nSfxEvent = SFX_EVENT_MOUSECLICK_OBJECT; + nSfxEvent = SvMacroItemId::OnClick; break; case HyperDialogEvent::MouseOutObject: - nSfxEvent = SFX_EVENT_MOUSEOUT_OBJECT; + nSfxEvent = SvMacroItemId::OnMouseOut; break; default: break; } diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 4aac08018752..3de01ff87b20 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -99,9 +99,9 @@ static const SvEventDescription* ImplGetSupportedMacroItems() { static const SvEventDescription aMacroDescriptionsImpl[] = { - { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, - { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, - { 0, nullptr } + { SvMacroItemId::OnMouseOver, "OnMouseOver" }, + { SvMacroItemId::OnMouseOut, "OnMouseOut" }, + { SvMacroItemId::NONE, nullptr } }; return aMacroDescriptionsImpl; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index b0042896602f..651078c3500c 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1388,7 +1388,7 @@ public: bool ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); // Call into intransparent Basic / JavaScript. - sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent, + sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent, bool bChkPtr = false ); /** Adjust left margin via object bar (similar to adjustment of numerations). diff --git a/sw/inc/fmtinfmt.hxx b/sw/inc/fmtinfmt.hxx index db8606322bc2..48f0e2aaefad 100644 --- a/sw/inc/fmtinfmt.hxx +++ b/sw/inc/fmtinfmt.hxx @@ -27,6 +27,7 @@ class SvxMacro; class SvxMacroTableDtor; class SwTextINetFormat; class IntlWrapper; +enum class SvMacroItemId : sal_uInt16; // ATT_INETFMT @@ -131,10 +132,8 @@ public: } /// Macro getter and setter. - void SetMacro( - sal_uInt16 nEvent, - const SvxMacro& rMacro ); - const SvxMacro* GetMacro( sal_uInt16 nEvent ) const; + void SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro ); + const SvxMacro* GetMacro( SvMacroItemId nEvent ) const; }; #endif diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx index 8ef0e908fd19..5b58745ddd04 100644 --- a/sw/inc/swevent.hxx +++ b/sw/inc/swevent.hxx @@ -25,14 +25,6 @@ #include <calbck.hxx> #include <frmfmt.hxx> -#define SW_EVENT_OBJECT_SELECT ( EVENT_APP_START + 0 ) -#define SW_EVENT_START_INS_GLOSSARY ( EVENT_APP_START + 1 ) -#define SW_EVENT_END_INS_GLOSSARY ( EVENT_APP_START + 2 ) -#define SW_EVENT_FRM_KEYINPUT_ALPHA ( EVENT_APP_START + 4 ) -#define SW_EVENT_FRM_KEYINPUT_NOALPHA ( EVENT_APP_START + 5 ) -#define SW_EVENT_FRM_RESIZE ( EVENT_APP_START + 6 ) -#define SW_EVENT_FRM_MOVE ( EVENT_APP_START + 7 ) - #define STR_SW_EVENT_PAGE_COUNT 0 #define STR_SW_EVENT_MAIL_MERGE 1 #define STR_SW_EVENT_MAIL_MERGE_END 2 diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx index 8b197546f10d..4d3335e31c72 100644 --- a/sw/source/core/doc/docbasic.cxx +++ b/sw/source/core/doc/docbasic.cxx @@ -129,7 +129,7 @@ bool SwDoc::ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ) return ERRCODE_NONE == eErr; } -sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent, +sal_uInt16 SwDoc::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent, bool bCheckPtr ) { if( !mpDocShell ) // we can't do that without a DocShell! diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index cc86094b1808..de742ac81d94 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -105,16 +105,16 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem ) if( rValue.hasValue() && ( rValue >>= sState )) { - sal_uInt16 nEvent = 0; + SvMacroItemId nEvent = SvMacroItemId::NONE; switch( sState.toInt32() ) { - case sfx2::LinkManager::STATE_LOAD_OK: nEvent = SVX_EVENT_IMAGE_LOAD; break; - case sfx2::LinkManager::STATE_LOAD_ERROR: nEvent = SVX_EVENT_IMAGE_ERROR; break; - case sfx2::LinkManager::STATE_LOAD_ABORT: nEvent = SVX_EVENT_IMAGE_ABORT; break; + case sfx2::LinkManager::STATE_LOAD_OK: nEvent = SvMacroItemId::OnImageLoadDone; break; + case sfx2::LinkManager::STATE_LOAD_ERROR: nEvent = SvMacroItemId::OnImageLoadError; break; + case sfx2::LinkManager::STATE_LOAD_ABORT: nEvent = SvMacroItemId::OnImageLoadCancel; break; } SwFrameFormat* pFormat; - if( nEvent && nullptr != ( pFormat = pContentNode->GetFlyFormat() )) + if( nEvent != SvMacroItemId::NONE && nullptr != ( pFormat = pContentNode->GetFlyFormat() )) { SwCallMouseEvent aCallEvent; aCallEvent.Set( EVENT_OBJECT_IMAGE, pFormat ); diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index d1df0a5252ca..c0315483159d 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -152,9 +152,9 @@ ErrCode SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) // taken from unocore/unoevents.cxx or ui/unotxt.cxx const struct SvEventDescription aAutotextEvents[] = { - { SW_EVENT_START_INS_GLOSSARY, "OnInsertStart" }, - { SW_EVENT_END_INS_GLOSSARY, "OnInsertDone" }, - { 0, nullptr } + { SvMacroItemId::SwStartInsGlossary, "OnInsertStart" }, + { SvMacroItemId::SwEndInsGlossary, "OnInsertDone" }, + { SvMacroItemId::NONE, nullptr } }; ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index d26594caf222..d2099dff14b2 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -253,7 +253,7 @@ void SwFormatINetFormat::SetMacroTable( const SvxMacroTableDtor* pNewTable ) } } -void SwFormatINetFormat::SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro ) +void SwFormatINetFormat::SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro ) { if( !mpMacroTable ) mpMacroTable.reset( new SvxMacroTableDtor ); @@ -261,7 +261,7 @@ void SwFormatINetFormat::SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro ) mpMacroTable->Insert( nEvent, rMacro ); } -const SvxMacro* SwFormatINetFormat::GetMacro( sal_uInt16 nEvent ) const +const SvxMacro* SwFormatINetFormat::GetMacro( SvMacroItemId nEvent ) const { const SvxMacro* pRet = nullptr; if( mpMacroTable && mpMacroTable->IsKeyValid( nEvent ) ) diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 1557c9abffdb..fa647bcf9f18 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -462,9 +462,9 @@ const SvEventDescription* sw_GetSupportedMacroItems() { static const SvEventDescription aMacroDescriptionsImpl[] = { - { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, - { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, - { 0, nullptr } + { SvMacroItemId::OnMouseOver, "OnMouseOver" }, + { SvMacroItemId::OnMouseOut, "OnMouseOut" }, + { SvMacroItemId::NONE, nullptr } }; return aMacroDescriptionsImpl; diff --git a/sw/source/core/unocore/unoevent.cxx b/sw/source/core/unocore/unoevent.cxx index 8f0b69d68f8b..3d2f30d53d73 100644 --- a/sw/source/core/unocore/unoevent.cxx +++ b/sw/source/core/unocore/unoevent.cxx @@ -38,60 +38,60 @@ using ::com::sun::star::container::XNameReplace; const struct SvEventDescription aGraphicEvents[] = { - { SW_EVENT_OBJECT_SELECT, "OnSelect" }, - { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, - { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" }, - { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, - { SVX_EVENT_IMAGE_LOAD, "OnLoadDone" }, - { SVX_EVENT_IMAGE_ABORT, "OnLoadCancel" }, - { SVX_EVENT_IMAGE_ERROR, "OnLoadError" }, - { 0, nullptr } + { SvMacroItemId::SwObjectSelect, "OnSelect" }, + { SvMacroItemId::OnMouseOver, "OnMouseOver" }, + { SvMacroItemId::OnClick, "OnClick" }, + { SvMacroItemId::OnMouseOut, "OnMouseOut" }, + { SvMacroItemId::OnImageLoadDone, "OnLoadDone" }, + { SvMacroItemId::OnImageLoadCancel, "OnLoadCancel" }, + { SvMacroItemId::OnImageLoadError, "OnLoadError" }, + { SvMacroItemId::NONE, nullptr } }; const struct SvEventDescription aFrameEvents[] = { - { SW_EVENT_OBJECT_SELECT, "OnSelect" }, - { SW_EVENT_FRM_KEYINPUT_ALPHA, "OnAlphaCharInput" }, - { SW_EVENT_FRM_KEYINPUT_NOALPHA, "OnNonAlphaCharInput" }, - { SW_EVENT_FRM_RESIZE, "OnResize" }, - { SW_EVENT_FRM_MOVE, "OnMove" }, - { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, - { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" }, - { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, - { 0, nullptr } + { SvMacroItemId::SwObjectSelect, "OnSelect" }, + { SvMacroItemId::SwFrmKeyInputAlpha, "OnAlphaCharInput" }, + { SvMacroItemId::SwFrmKeyInputNoAlpha, "OnNonAlphaCharInput" }, + { SvMacroItemId::SwFrmResize, "OnResize" }, + { SvMacroItemId::SwFrmMove, "OnMove" }, + { SvMacroItemId::OnMouseOver, "OnMouseOver" }, + { SvMacroItemId::OnClick, "OnClick" }, + { SvMacroItemId::OnMouseOut, "OnMouseOut" }, + { SvMacroItemId::NONE, nullptr } }; const struct SvEventDescription aOLEEvents[] = { - { SW_EVENT_OBJECT_SELECT, "OnSelect" }, - { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, - { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" }, - { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, - { 0, nullptr } + { SvMacroItemId::SwObjectSelect, "OnSelect" }, + { SvMacroItemId::OnMouseOver, "OnMouseOver" }, + { SvMacroItemId::OnClick, "OnClick" }, + { SvMacroItemId::OnMouseOut, "OnMouseOut" }, + { SvMacroItemId::NONE, nullptr } }; const struct SvEventDescription aHyperlinkEvents[] = { - { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, - { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" }, - { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, - { 0, nullptr } + { SvMacroItemId::OnMouseOver, "OnMouseOver" }, + { SvMacroItemId::OnClick, "OnClick" }, + { SvMacroItemId::OnMouseOut, "OnMouseOut" }, + { SvMacroItemId::NONE, nullptr } }; const struct SvEventDescription aFrameStyleEvents[] = { - { SW_EVENT_OBJECT_SELECT, "OnSelect" }, - { SW_EVENT_FRM_KEYINPUT_ALPHA, "OnAlphaCharInput" }, - { SW_EVENT_FRM_KEYINPUT_NOALPHA, "OnNonAlphaCharInput" }, - { SW_EVENT_FRM_RESIZE, "OnResize" }, - { SW_EVENT_FRM_MOVE, "OnMove" }, - { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, - { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" }, - { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, - { SVX_EVENT_IMAGE_LOAD, "OnLoadDone" }, - { SVX_EVENT_IMAGE_ABORT, "OnLoadCancel" }, - { SVX_EVENT_IMAGE_ERROR, "OnLoadError" }, - { 0, nullptr } + { SvMacroItemId::SwObjectSelect, "OnSelect" }, + { SvMacroItemId::SwFrmKeyInputAlpha, "OnAlphaCharInput" }, + { SvMacroItemId::SwFrmKeyInputNoAlpha, "OnNonAlphaCharInput" }, + { SvMacroItemId::SwFrmResize, "OnResize" }, + { SvMacroItemId::SwFrmMove, "OnMove" }, + { SvMacroItemId::OnMouseOver, "OnMouseOver" }, + { SvMacroItemId::OnClick, "OnClick" }, + { SvMacroItemId::OnMouseOut, "OnMouseOut" }, + { SvMacroItemId::OnImageLoadDone, "OnLoadDone" }, + { SvMacroItemId::OnImageLoadCancel, "OnLoadCancel" }, + { SvMacroItemId::OnImageLoadError, "OnLoadError" }, + { SvMacroItemId::NONE, nullptr } }; SwHyperlinkEventDescriptor::SwHyperlinkEventDescriptor() : @@ -111,9 +111,9 @@ OUString SwHyperlinkEventDescriptor::getImplementationName() void SwHyperlinkEventDescriptor::copyMacrosFromINetFormat( const SwFormatINetFormat& aFormat) { - for(sal_uInt16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; ++i) + for(sal_uInt16 i = 0; mpSupportedMacroItems[i].mnEvent != SvMacroItemId::NONE; ++i) { - const sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent; + const SvMacroItemId nEvent = mpSupportedMacroItems[i].mnEvent; const SvxMacro* aMacro = aFormat.GetMacro(nEvent); if (nullptr != aMacro) replaceByName(nEvent, *aMacro); @@ -123,9 +123,9 @@ void SwHyperlinkEventDescriptor::copyMacrosFromINetFormat( void SwHyperlinkEventDescriptor::copyMacrosIntoINetFormat( SwFormatINetFormat& aFormat) { - for(sal_uInt16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; ++i) + for(sal_uInt16 i = 0; mpSupportedMacroItems[i].mnEvent != SvMacroItemId::NONE; ++i) { - const sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent; + const SvMacroItemId nEvent = mpSupportedMacroItems[i].mnEvent; if (hasById(nEvent)) { SvxMacro aMacro("", ""); diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 0763ba4212a4..2d99f4dabcd3 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -85,10 +85,10 @@ using namespace css; HTMLOutEvent const aAnchorEventTable[] = { - { OOO_STRING_SVTOOLS_HTML_O_SDonclick, OOO_STRING_SVTOOLS_HTML_O_onclick, SFX_EVENT_MOUSECLICK_OBJECT }, - { OOO_STRING_SVTOOLS_HTML_O_SDonmouseover, OOO_STRING_SVTOOLS_HTML_O_onmouseover, SFX_EVENT_MOUSEOVER_OBJECT }, - { OOO_STRING_SVTOOLS_HTML_O_SDonmouseout, OOO_STRING_SVTOOLS_HTML_O_onmouseout, SFX_EVENT_MOUSEOUT_OBJECT }, - { nullptr, nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_O_SDonclick, OOO_STRING_SVTOOLS_HTML_O_onclick, SvMacroItemId::OnClick }, + { OOO_STRING_SVTOOLS_HTML_O_SDonmouseover, OOO_STRING_SVTOOLS_HTML_O_onmouseover, SvMacroItemId::OnMouseOver }, + { OOO_STRING_SVTOOLS_HTML_O_SDonmouseout, OOO_STRING_SVTOOLS_HTML_O_onmouseout, SvMacroItemId::OnMouseOut }, + { nullptr, nullptr, SvMacroItemId::NONE } }; static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt ); diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 948dede6aaa8..535f6fb0f71e 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -50,11 +50,11 @@ using namespace ::com::sun::star::container; static HTMLOutEvent aBodyEventTable[] = { - { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, (sal_uInt16)SfxEventHintId::OpenDoc }, - { OOO_STRING_SVTOOLS_HTML_O_SDonunload, OOO_STRING_SVTOOLS_HTML_O_onunload, (sal_uInt16)SfxEventHintId::PrepareCloseDoc }, - { OOO_STRING_SVTOOLS_HTML_O_SDonfocus, OOO_STRING_SVTOOLS_HTML_O_onfocus, (sal_uInt16)SfxEventHintId::ActivateDoc }, - { OOO_STRING_SVTOOLS_HTML_O_SDonblur, OOO_STRING_SVTOOLS_HTML_O_onblur, (sal_uInt16)SfxEventHintId::DeactivateDoc }, - { nullptr, nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, SvMacroItemId::OpenDoc }, + { OOO_STRING_SVTOOLS_HTML_O_SDonunload, OOO_STRING_SVTOOLS_HTML_O_onunload, SvMacroItemId::PrepareCloseDoc }, + { OOO_STRING_SVTOOLS_HTML_O_SDonfocus, OOO_STRING_SVTOOLS_HTML_O_onfocus, SvMacroItemId::ActivateDoc }, + { OOO_STRING_SVTOOLS_HTML_O_SDonblur, OOO_STRING_SVTOOLS_HTML_O_onblur, SvMacroItemId::DeactivateDoc }, + { nullptr, nullptr, SvMacroItemId::NONE } }; void SwHTMLParser::NewScript() diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 4b19eec0f16c..725d4db2c2fd 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -145,17 +145,17 @@ static Writer& OutHTML_FrameFormatAsMarquee( Writer& rWrt, const SwFrameFormat& static HTMLOutEvent aImageEventTable[] = { - { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, SVX_EVENT_IMAGE_LOAD }, - { OOO_STRING_SVTOOLS_HTML_O_SDonabort, OOO_STRING_SVTOOLS_HTML_O_onabort, SVX_EVENT_IMAGE_ABORT }, - { OOO_STRING_SVTOOLS_HTML_O_SDonerror, OOO_STRING_SVTOOLS_HTML_O_onerror, SVX_EVENT_IMAGE_ERROR }, - { nullptr, nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, SvMacroItemId::OnImageLoadDone }, + { OOO_STRING_SVTOOLS_HTML_O_SDonabort, OOO_STRING_SVTOOLS_HTML_O_onabort, SvMacroItemId::OnImageLoadCancel }, + { OOO_STRING_SVTOOLS_HTML_O_SDonerror, OOO_STRING_SVTOOLS_HTML_O_onerror, SvMacroItemId::OnImageLoadError }, + { nullptr, nullptr, SvMacroItemId::NONE } }; static HTMLOutEvent aIMapEventTable[] = { - { OOO_STRING_SVTOOLS_HTML_O_SDonmouseover, OOO_STRING_SVTOOLS_HTML_O_onmouseover, SFX_EVENT_MOUSEOVER_OBJECT }, - { OOO_STRING_SVTOOLS_HTML_O_SDonmouseout, OOO_STRING_SVTOOLS_HTML_O_onmouseout, SFX_EVENT_MOUSEOUT_OBJECT }, - { nullptr, nullptr, 0 } + { OOO_STRING_SVTOOLS_HTML_O_SDonmouseover, OOO_STRING_SVTOOLS_HTML_O_onmouseover, SvMacroItemId::OnMouseOver }, + { OOO_STRING_SVTOOLS_HTML_O_SDonmouseout, OOO_STRING_SVTOOLS_HTML_O_onmouseout, SvMacroItemId::OnMouseOut }, + { nullptr, nullptr, SvMacroItemId::NONE } }; sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat, diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index de9bb703509c..bca98350cb87 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -28,6 +28,7 @@ #include <svl/urihelper.hxx> #include <sfx2/request.hxx> #include <sfx2/docfile.hxx> +#include <sfx2/event.hxx> #include <sfx2/viewfrm.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> @@ -112,17 +113,17 @@ static HTMLOptionEnum<HTMLWordWrapMode> aHTMLTextAreaWrapTable[] = { nullptr, (HTMLWordWrapMode)0 } }; -HTMLEventType aEventTypeTable[] = +static SvMacroItemId aEventTypeTable[] = { - HTML_ET_ONSUBMITFORM, - HTML_ET_ONRESETFORM, - HTML_ET_ONGETFOCUS, - HTML_ET_ONLOSEFOCUS, - HTML_ET_ONCLICK, - HTML_ET_ONCLICK_ITEM, - HTML_ET_ONCHANGE, - HTML_ET_ONSELECT, - HTML_ET_END + SvMacroItemId::HtmlOnSubmitForm, + SvMacroItemId::HtmlOnResetForm, + SvMacroItemId::HtmlOnGetFocus, + SvMacroItemId::HtmlOnLoseFocus, + SvMacroItemId::HtmlOnClick, + SvMacroItemId::HtmlOnClickItem, + SvMacroItemId::HtmlOnChange, + SvMacroItemId::HtmlOnSelect, + SvMacroItemId::NONE }; const sal_Char * aEventListenerTable[] = @@ -743,7 +744,7 @@ static void lcl_html_setEvents( // First the number of events has to be determined sal_Int32 nEvents = 0; - for( int i = 0; HTML_ET_END != aEventTypeTable[i]; ++i ) + for( int i = 0; SvMacroItemId::NONE != aEventTypeTable[i]; ++i ) { const SvxMacro *pMacro = rMacroTable.Get( aEventTypeTable[i] ); // As long as not all events are implemented the table also holds empty strings @@ -768,7 +769,7 @@ static void lcl_html_setEvents( script::ScriptEventDescriptor* pDescs = aDescs.getArray(); sal_Int32 nEvent = 0; - for( int i=0; HTML_ET_END != aEventTypeTable[i]; ++i ) + for( int i=0; SvMacroItemId::NONE != aEventTypeTable[i]; ++i ) { const SvxMacro *pMacro = rMacroTable.Get( aEventTypeTable[i] ); if( pMacro && aEventListenerTable[i] ) @@ -1235,7 +1236,7 @@ void SwHTMLParser::NewForm( bool bAppend ) { const HTMLOption& rOption = rHTMLOptions[--i]; ScriptType eScriptType2 = eDfltScriptType; - sal_uInt16 nEvent = 0; + SvMacroItemId nEvent = SvMacroItemId::NONE; bool bSetEvent = false; switch( rOption.GetToken() ) @@ -1260,7 +1261,7 @@ void SwHTMLParser::NewForm( bool bAppend ) eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONSUBMIT: - nEvent = HTML_ET_ONSUBMITFORM; + nEvent = SvMacroItemId::HtmlOnSubmitForm; bSetEvent = true; break; @@ -1268,7 +1269,7 @@ void SwHTMLParser::NewForm( bool bAppend ) eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONRESET: - nEvent = HTML_ET_ONRESETFORM; + nEvent = SvMacroItemId::HtmlOnResetForm; bSetEvent = true; break; @@ -1402,7 +1403,7 @@ void SwHTMLParser::InsertInput() { const HTMLOption& rOption = rHTMLOptions[--i]; ScriptType eScriptType2 = eDfltScriptType; - sal_uInt16 nEvent = 0; + SvMacroItemId nEvent = SvMacroItemId::NONE; bool bSetEvent = false; switch( rOption.GetToken() ) @@ -1464,7 +1465,7 @@ void SwHTMLParser::InsertInput() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONFOCUS: - nEvent = HTML_ET_ONGETFOCUS; + nEvent = SvMacroItemId::HtmlOnGetFocus; bSetEvent = true; break; @@ -1472,7 +1473,7 @@ void SwHTMLParser::InsertInput() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONBLUR: - nEvent = HTML_ET_ONLOSEFOCUS; + nEvent = SvMacroItemId::HtmlOnLoseFocus; bSetEvent = true; break; @@ -1480,7 +1481,7 @@ void SwHTMLParser::InsertInput() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONCLICK: - nEvent = HTML_ET_ONCLICK; + nEvent = SvMacroItemId::HtmlOnClick; bSetEvent = true; break; @@ -1488,7 +1489,7 @@ void SwHTMLParser::InsertInput() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONCHANGE: - nEvent = HTML_ET_ONCHANGE; + nEvent = SvMacroItemId::HtmlOnChange; bSetEvent = true; break; @@ -1496,7 +1497,7 @@ void SwHTMLParser::InsertInput() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONSELECT: - nEvent = HTML_ET_ONSELECT; + nEvent = SvMacroItemId::HtmlOnSelect; bSetEvent = true; break; @@ -1647,11 +1648,11 @@ void SwHTMLParser::InsertInput() xPropSet->setPropertyValue("DefaultState", aTmp ); } - const SvxMacro* pMacro = aMacroTable.Get( HTML_ET_ONCLICK ); + const SvxMacro* pMacro = aMacroTable.Get( SvMacroItemId::HtmlOnClick ); if( pMacro ) { - aMacroTable.Insert( HTML_ET_ONCLICK_ITEM, *pMacro ); - aMacroTable.Erase( HTML_ET_ONCLICK ); + aMacroTable.Insert( SvMacroItemId::HtmlOnClickItem, *pMacro ); + aMacroTable.Erase( SvMacroItemId::HtmlOnClick ); } // evaluating SIZE shouldn't be necessary here? bMinWidth = bMinHeight = true; @@ -1874,7 +1875,7 @@ void SwHTMLParser::NewTextArea() { const HTMLOption& rOption = rHTMLOptions[--i]; ScriptType eScriptType2 = eDfltScriptType; - sal_uInt16 nEvent = 0; + SvMacroItemId nEvent = SvMacroItemId::NONE; bool bSetEvent = false; switch( rOption.GetToken() ) @@ -1912,7 +1913,7 @@ void SwHTMLParser::NewTextArea() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONFOCUS: - nEvent = HTML_ET_ONGETFOCUS; + nEvent = SvMacroItemId::HtmlOnGetFocus; bSetEvent = true; break; @@ -1920,7 +1921,7 @@ void SwHTMLParser::NewTextArea() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONBLUR: - nEvent = HTML_ET_ONLOSEFOCUS; + nEvent = SvMacroItemId::HtmlOnLoseFocus; bSetEvent = true; break; @@ -1928,7 +1929,7 @@ void SwHTMLParser::NewTextArea() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONCLICK: - nEvent = HTML_ET_ONCLICK; + nEvent = SvMacroItemId::HtmlOnClick; bSetEvent = true; break; @@ -1936,7 +1937,7 @@ void SwHTMLParser::NewTextArea() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONCHANGE: - nEvent = HTML_ET_ONCHANGE; + nEvent = SvMacroItemId::HtmlOnChange; bSetEvent = true; break; @@ -1944,7 +1945,7 @@ void SwHTMLParser::NewTextArea() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONSELECT: - nEvent = HTML_ET_ONSELECT; + nEvent = SvMacroItemId::HtmlOnSelect; bSetEvent = true; break; @@ -2153,7 +2154,7 @@ void SwHTMLParser::NewSelect() { const HTMLOption& rOption = rHTMLOptions[--i]; ScriptType eScriptType2 = eDfltScriptType; - sal_uInt16 nEvent = 0; + SvMacroItemId nEvent = SvMacroItemId::NONE; bool bSetEvent = false; switch( rOption.GetToken() ) @@ -2188,7 +2189,7 @@ void SwHTMLParser::NewSelect() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONFOCUS: - nEvent = HTML_ET_ONGETFOCUS; + nEvent = SvMacroItemId::HtmlOnGetFocus; bSetEvent = true; break; @@ -2196,7 +2197,7 @@ void SwHTMLParser::NewSelect() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONBLUR: - nEvent = HTML_ET_ONLOSEFOCUS; + nEvent = SvMacroItemId::HtmlOnLoseFocus; bSetEvent = true; break; @@ -2204,7 +2205,7 @@ void SwHTMLParser::NewSelect() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONCLICK: - nEvent = HTML_ET_ONCLICK; + nEvent = SvMacroItemId::HtmlOnClick; bSetEvent = true; break; @@ -2212,7 +2213,7 @@ void SwHTMLParser::NewSelect() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONCHANGE: - nEvent = HTML_ET_ONCHANGE; + nEvent = SvMacroItemId::HtmlOnChange; bSetEvent = true; break; diff --git a/sw/source/filter/html/htmlform.hxx b/sw/source/filter/html/htmlform.hxx index c3a7388c4bbf..b097e86a9202 100644 --- a/sw/source/filter/html/htmlform.hxx +++ b/sw/source/filter/html/htmlform.hxx @@ -20,16 +20,6 @@ #ifndef INCLUDED_SW_SOURCE_FILTER_HTML_HTMLFORM_HXX #define INCLUDED_SW_SOURCE_FILTER_HTML_HTMLFORM_HXX -enum HTMLEventType -{ - HTML_ET_ONSUBMITFORM, HTML_ET_ONRESETFORM, - HTML_ET_ONGETFOCUS, HTML_ET_ONLOSEFOCUS, - HTML_ET_ONCLICK, HTML_ET_ONCLICK_ITEM, - HTML_ET_ONCHANGE, HTML_ET_ONSELECT, - HTML_ET_END -}; - -extern HTMLEventType aEventTypeTable[]; extern const sal_Char * aEventListenerTable[]; extern const sal_Char * aEventMethodTable[]; extern const sal_Char * aEventSDOptionTable[]; diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 363c2b8a6c11..cd3e85d6e372 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -317,7 +317,7 @@ void SwHTMLParser::InsertImage() const HTMLOptions& rHTMLOptions = GetOptions(); for (size_t i = rHTMLOptions.size(); i; ) { - sal_uInt16 nEvent = 0; + SvMacroItemId nEvent = SvMacroItemId::NONE; ScriptType eScriptType2 = eDfltScriptType; const HTMLOption& rOption = rHTMLOptions[--i]; switch( rOption.GetToken() ) @@ -385,21 +385,21 @@ void SwHTMLParser::InsertImage() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONLOAD: - nEvent = SVX_EVENT_IMAGE_LOAD; + nEvent = SvMacroItemId::OnImageLoadDone; goto IMAGE_SETEVENT; case HtmlOptionId::SDONABORT: eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONABORT: - nEvent = SVX_EVENT_IMAGE_ABORT; + nEvent = SvMacroItemId::OnImageLoadCancel; goto IMAGE_SETEVENT; case HtmlOptionId::SDONERROR: eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONERROR: - nEvent = SVX_EVENT_IMAGE_ERROR; + nEvent = SvMacroItemId::OnImageLoadError; goto IMAGE_SETEVENT; IMAGE_SETEVENT: { @@ -755,17 +755,16 @@ IMAGE_SETEVENT: pFlyFormat->SetFormatAttr( aURL ); { - static const sal_uInt16 aEvents[] = { - SFX_EVENT_MOUSEOVER_OBJECT, - SFX_EVENT_MOUSECLICK_OBJECT, - SFX_EVENT_MOUSEOUT_OBJECT, - 0 }; + static const SvMacroItemId aEvents[] = { + SvMacroItemId::OnMouseOver, + SvMacroItemId::OnClick, + SvMacroItemId::OnMouseOut }; - for( int n = 0; aEvents[ n ]; ++n ) + for( SvMacroItemId id : aEvents ) { - const SvxMacro *pMacro = rINetFormat.GetMacro( aEvents[ n ] ); + const SvxMacro *pMacro = rINetFormat.GetMacro( id ); if( nullptr != pMacro ) - aMacroItem.SetMacro( aEvents[ n ], *pMacro ); + aMacroItem.SetMacro( id, *pMacro ); } } @@ -1068,7 +1067,7 @@ void SwHTMLParser::NewAnchor() const HTMLOptions& rHTMLOptions = GetOptions(); for (size_t i = rHTMLOptions.size(); i; ) { - sal_uInt16 nEvent = 0; + SvMacroItemId nEvent = SvMacroItemId::NONE; ScriptType eScriptType2 = eDfltScriptType; const HTMLOption& rOption = rHTMLOptions[--i]; switch( rOption.GetToken() ) @@ -1108,21 +1107,21 @@ void SwHTMLParser::NewAnchor() eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONCLICK: - nEvent = SFX_EVENT_MOUSECLICK_OBJECT; + nEvent = SvMacroItemId::OnClick; goto ANCHOR_SETEVENT; case HtmlOptionId::SDONMOUSEOVER: eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONMOUSEOVER: - nEvent = SFX_EVENT_MOUSEOVER_OBJECT; + nEvent = SvMacroItemId::OnMouseOver; goto ANCHOR_SETEVENT; case HtmlOptionId::SDONMOUSEOUT: eScriptType2 = STARBASIC; SAL_FALLTHROUGH; case HtmlOptionId::ONMOUSEOUT: - nEvent = SFX_EVENT_MOUSEOUT_OBJECT; + nEvent = SvMacroItemId::OnMouseOut; goto ANCHOR_SETEVENT; ANCHOR_SETEVENT: { diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 48b99fb9b359..48e895a7edfa 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -1979,8 +1979,8 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken ) case HtmlTokenId::AREA: if( m_pImageMap ) - ParseAreaOptions( m_pImageMap, m_sBaseURL, SFX_EVENT_MOUSEOVER_OBJECT, - SFX_EVENT_MOUSEOUT_OBJECT ); + ParseAreaOptions( m_pImageMap, m_sBaseURL, SvMacroItemId::OnMouseOver, + SvMacroItemId::OnMouseOut ); break; case HtmlTokenId::FRAMESET_ON: diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx index ebfcae266a42..f9bcdfc648fa 100644 --- a/sw/source/ui/dialog/macassgn.cxx +++ b/sw/source/ui/dialog/macassgn.cxx @@ -51,20 +51,20 @@ SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) { case MACASSGN_AUTOTEXT: aItem.AddEvent( SwResId(STR_EVENT_START_INS_GLOSSARY), OUString(), - SW_EVENT_START_INS_GLOSSARY ); + SvMacroItemId::SwStartInsGlossary ); aItem.AddEvent( SwResId(STR_EVENT_END_INS_GLOSSARY), OUString(), - SW_EVENT_END_INS_GLOSSARY); + SvMacroItemId::SwEndInsGlossary); // in order for the new handler to become active! break; case MACASSGN_ALLFRM: case MACASSGN_GRAPHIC: // graphics { aItem.AddEvent( SwResId(STR_EVENT_IMAGE_ERROR), OUString(), - SVX_EVENT_IMAGE_ERROR); + SvMacroItemId::OnImageLoadError); aItem.AddEvent( SwResId(STR_EVENT_IMAGE_ABORT), OUString(), - SVX_EVENT_IMAGE_ABORT); + SvMacroItemId::OnImageLoadCancel); aItem.AddEvent( SwResId(STR_EVENT_IMAGE_LOAD), OUString(), - SVX_EVENT_IMAGE_LOAD); + SvMacroItemId::OnImageLoadDone); } SAL_FALLTHROUGH; case MACASSGN_FRMURL: // Frame - URL-Attributes @@ -73,13 +73,13 @@ SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) (MACASSGN_FRMURL == eType || MACASSGN_ALLFRM == eType)) { aItem.AddEvent( SwResId( STR_EVENT_FRM_KEYINPUT_A ), OUString(), - SW_EVENT_FRM_KEYINPUT_ALPHA ); + SvMacroItemId::SwFrmKeyInputAlpha ); aItem.AddEvent( SwResId( STR_EVENT_FRM_KEYINPUT_NOA ), OUString(), - SW_EVENT_FRM_KEYINPUT_NOALPHA ); + SvMacroItemId::SwFrmKeyInputNoAlpha ); aItem.AddEvent( SwResId( STR_EVENT_FRM_RESIZE ), OUString(), - SW_EVENT_FRM_RESIZE ); + SvMacroItemId::SwFrmResize ); aItem.AddEvent( SwResId( STR_EVENT_FRM_MOVE ), OUString(), - SW_EVENT_FRM_MOVE ); + SvMacroItemId::SwFrmMove ); } } SAL_FALLTHROUGH; @@ -87,17 +87,17 @@ SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) { if( !bHtmlMode ) aItem.AddEvent( SwResId(STR_EVENT_OBJECT_SELECT), OUString(), - SW_EVENT_OBJECT_SELECT ); + SvMacroItemId::SwObjectSelect ); } SAL_FALLTHROUGH; case MACASSGN_INETFMT: // INetFormat-Attributes { aItem.AddEvent( SwResId(STR_EVENT_MOUSEOVER_OBJECT), OUString(), - SFX_EVENT_MOUSEOVER_OBJECT ); + SvMacroItemId::OnMouseOver ); aItem.AddEvent( SwResId(STR_EVENT_MOUSECLICK_OBJECT), OUString(), - SFX_EVENT_MOUSECLICK_OBJECT); + SvMacroItemId::OnClick); aItem.AddEvent( SwResId(STR_EVENT_MOUSEOUT_OBJECT), OUString(), - SFX_EVENT_MOUSEOUT_OBJECT); + SvMacroItemId::OnMouseOut); } break; } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 3756fdb894ed..7c48cf135374 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -532,9 +532,9 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool ) SvxMacroItem aItem(RES_FRMMACRO); if( aStart.HasMacro() ) - aItem.SetMacro( SW_EVENT_START_INS_GLOSSARY, aStart ); + aItem.SetMacro( SvMacroItemId::SwStartInsGlossary, aStart ); if( aEnd.HasMacro() ) - aItem.SetMacro( SW_EVENT_END_INS_GLOSSARY, aEnd ); + aItem.SetMacro( SvMacroItemId::SwEndInsGlossary, aEnd ); aSet.Put( aItem ); aSet.Put( SwMacroAssignDlg::AddEvents( MACASSGN_AUTOTEXT ) ); @@ -548,8 +548,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool ) { const SvxMacroTableDtor& rTable = static_cast<const SvxMacroItem*>(pItem)->GetMacroTable(); pGlossaryHdl->SetMacros( m_pShortNameEdit->GetText(), - rTable.Get( SW_EVENT_START_INS_GLOSSARY ), - rTable.Get( SW_EVENT_END_INS_GLOSSARY ) ); + rTable.Get( SvMacroItemId::SwStartInsGlossary ), + rTable.Get( SvMacroItemId::SwEndInsGlossary ) ); } } else if (sItemIdent == "import") diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 484cdb31b5f4..d6f5c7f7a369 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -571,9 +571,9 @@ void SwGlossaryHdl::SetMacros(const OUString& rShortName, : rStatGlossaries.GetGroupDoc( aCurGrp ); SvxMacroTableDtor aMacroTable; if( pStart ) - aMacroTable.Insert( SW_EVENT_START_INS_GLOSSARY, *pStart); + aMacroTable.Insert( SvMacroItemId::SwStartInsGlossary, *pStart); if( pEnd ) - aMacroTable.Insert( SW_EVENT_END_INS_GLOSSARY, *pEnd); + aMacroTable.Insert( SvMacroItemId::SwEndInsGlossary, *pEnd); sal_uInt16 nIdx = pGlos->GetIndex( rShortName ); if( !pGlos->SetMacroTable( nIdx, aMacroTable ) && pGlos->GetError() ) ErrorHandler::HandleError( pGlos->GetError() ); @@ -596,11 +596,11 @@ void SwGlossaryHdl::GetMacros( const OUString &rShortName, SvxMacroTableDtor aMacroTable; if( pGlos->GetMacroTable( nIndex, aMacroTable ) ) { - SvxMacro *pMacro = aMacroTable.Get( SW_EVENT_START_INS_GLOSSARY ); + SvxMacro *pMacro = aMacroTable.Get( SvMacroItemId::SwStartInsGlossary ); if( pMacro ) rStart = *pMacro; - pMacro = aMacroTable.Get( SW_EVENT_END_INS_GLOSSARY ); + pMacro = aMacroTable.Get( SvMacroItemId::SwEndInsGlossary ); if( pMacro ) rEnd = *pMacro; } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index d33cb06d4918..707f525eab6f 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -1487,13 +1487,13 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) const SwFrameFormat* pFlyFormat = rSh.GetFlyFrameFormat(); if( pFlyFormat ) { - sal_uInt16 nEvent; + SvMacroItemId nEvent; if( 32 <= aCh && 0 == (( KEY_MOD1 | KEY_MOD2 ) & rKeyCode.GetModifier() )) - nEvent = SW_EVENT_FRM_KEYINPUT_ALPHA; + nEvent = SvMacroItemId::SwFrmKeyInputAlpha; else - nEvent = SW_EVENT_FRM_KEYINPUT_NOALPHA; + nEvent = SvMacroItemId::SwFrmKeyInputNoAlpha; const SvxMacro* pMacro = pFlyFormat->GetMacro().GetMacroTable().Get( nEvent ); if( pMacro ) @@ -1504,7 +1504,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) xArgs->Put( xVar.get(), 1 ); xVar = new SbxVariable; - if( SW_EVENT_FRM_KEYINPUT_ALPHA == nEvent ) + if( SvMacroItemId::SwFrmKeyInputAlpha == nEvent ) xVar->PutChar( aCh ); else xVar->PutUShort( rKeyCode.GetModifier() | rKeyCode.GetCode() ); @@ -4020,9 +4020,9 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) const SwFrameFormat *const pFlyFormat(rSh.GetFlyFrameFormat()); const SvxMacro* pMacro = nullptr; - sal_uInt16 nEvent = SdrHdlKind::Move == g_eSdrMoveHdl - ? SW_EVENT_FRM_MOVE - : SW_EVENT_FRM_RESIZE; + SvMacroItemId nEvent = SdrHdlKind::Move == g_eSdrMoveHdl + ? SvMacroItemId::SwFrmMove + : SvMacroItemId::SwFrmResize; if (nullptr != pFlyFormat) pMacro = pFlyFormat->GetMacro().GetMacroTable().Get(nEvent); @@ -4037,7 +4037,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) xVar->PutString( pFlyFormat->GetName() ); xArgs->Put( xVar.get(), ++nPos ); - if( SW_EVENT_FRM_RESIZE == nEvent ) + if( SvMacroItemId::SwFrmResize == nEvent ) { xVar = new SbxVariable; xVar->PutUShort( static_cast< sal_uInt16 >(g_eSdrMoveHdl) ); @@ -4211,10 +4211,10 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) if( m_aSaveCallEvent != aLastCallEvent ) { if( aLastCallEvent.HasEvent() ) - rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT, + rSh.CallEvent( SvMacroItemId::OnMouseOut, aLastCallEvent, true ); // 0 says that the object doesn't have any table - if( !rSh.CallEvent( SFX_EVENT_MOUSEOVER_OBJECT, + if( !rSh.CallEvent( SvMacroItemId::OnMouseOver, m_aSaveCallEvent )) m_aSaveCallEvent.Clear(); } @@ -4222,7 +4222,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) else if( aLastCallEvent.HasEvent() ) { // cursor was on an object - rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT, + rSh.CallEvent( SvMacroItemId::OnMouseOut, aLastCallEvent, true ); } @@ -4483,9 +4483,9 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) const SwFrameFormat *const pFlyFormat(rSh.GetFlyFrameFormat()); const SvxMacro* pMacro = nullptr; - sal_uInt16 nEvent = SdrHdlKind::Move == eOldSdrMoveHdl - ? SW_EVENT_FRM_MOVE - : SW_EVENT_FRM_RESIZE; + SvMacroItemId nEvent = SdrHdlKind::Move == eOldSdrMoveHdl + ? SvMacroItemId::SwFrmMove + : SvMacroItemId::SwFrmResize; if (nullptr != pFlyFormat) pMacro = pFlyFormat->GetMacro().GetMacroTable().Get(nEvent); @@ -4499,7 +4499,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) xVar->PutString( pFlyFormat->GetName() ); xArgs->Put( xVar.get(), ++nPos ); - if( SW_EVENT_FRM_RESIZE == nEvent ) + if( SvMacroItemId::SwFrmResize == nEvent ) { xVar = new SbxVariable; xVar->PutUShort( static_cast< sal_uInt16 >(eOldSdrMoveHdl) ); diff --git a/sw/source/uibase/inc/unoatxt.hxx b/sw/source/uibase/inc/unoatxt.hxx index 8011c612885f..1b6f1a7fc14b 100644 --- a/sw/source/uibase/inc/unoatxt.hxx +++ b/sw/source/uibase/inc/unoatxt.hxx @@ -261,13 +261,13 @@ public: protected: 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; 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; }; diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index dd12bc01e27f..bed54a04205f 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -419,7 +419,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); // Because nobody else is doing it, here is a ExecMacro() void ExecMacro( const SvxMacro& rMacro, OUString* pRet = nullptr, SbxArray* pArgs = nullptr ); // call into the dark Basic/JavaScript - sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent, + sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent, bool bCheckPtr = false ); // a click at the given field. the cursor is on it. diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 41fead859ada..811db69c5d1c 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -918,15 +918,15 @@ void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem) aINetFormat.SetName(rHlnkItem.GetIntName()); if(pMacroTable) { - const SvxMacro *pMacro = pMacroTable->Get( SFX_EVENT_MOUSEOVER_OBJECT ); + const SvxMacro *pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOver ); if( pMacro ) - aINetFormat.SetMacro(SFX_EVENT_MOUSEOVER_OBJECT, *pMacro); - pMacro = pMacroTable->Get( SFX_EVENT_MOUSECLICK_OBJECT ); + aINetFormat.SetMacro(SvMacroItemId::OnMouseOver, *pMacro); + pMacro = pMacroTable->Get( SvMacroItemId::OnClick ); if( pMacro ) - aINetFormat.SetMacro(SFX_EVENT_MOUSECLICK_OBJECT, *pMacro); - pMacro = pMacroTable->Get( SFX_EVENT_MOUSEOUT_OBJECT ); + aINetFormat.SetMacro(SvMacroItemId::OnClick, *pMacro); + pMacro = pMacroTable->Get( SvMacroItemId::OnMouseOut ); if( pMacro ) - aINetFormat.SetMacro(SFX_EVENT_MOUSEOUT_OBJECT, *pMacro); + aINetFormat.SetMacro(SvMacroItemId::OnMouseOut, *pMacro); } rSh.SttSelect(); rSh.InsertURL( aINetFormat, rName, true ); diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 06c4b6c48b76..c52ab289189a 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -642,15 +642,15 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) aHLinkItem.SetURL(pINetFormat->GetValue()); aHLinkItem.SetTargetFrame(pINetFormat->GetTargetFrame()); aHLinkItem.SetIntName(pINetFormat->GetName()); - const SvxMacro *pMacro = pINetFormat->GetMacro( SFX_EVENT_MOUSEOVER_OBJECT ); + const SvxMacro *pMacro = pINetFormat->GetMacro( SvMacroItemId::OnMouseOver ); if( pMacro ) aHLinkItem.SetMacro(HyperDialogEvent::MouseOverObject, *pMacro); - pMacro = pINetFormat->GetMacro( SFX_EVENT_MOUSECLICK_OBJECT ); + pMacro = pINetFormat->GetMacro( SvMacroItemId::OnClick ); if( pMacro ) aHLinkItem.SetMacro(HyperDialogEvent::MouseClickObject, *pMacro); - pMacro = pINetFormat->GetMacro( SFX_EVENT_MOUSEOUT_OBJECT ); + pMacro = pINetFormat->GetMacro( SvMacroItemId::OnMouseOut ); if( pMacro ) aHLinkItem.SetMacro(HyperDialogEvent::MouseOutObject, *pMacro); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 4ea2e22fc16d..5d57bb4cdc22 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -957,9 +957,9 @@ uno::Reference< container::XNameReplace > SwXAutoTextEntry::getEvents() const struct SvEventDescription aAutotextEvents[] = { - { SW_EVENT_START_INS_GLOSSARY, "OnInsertStart" }, - { SW_EVENT_END_INS_GLOSSARY, "OnInsertDone" }, - { 0, nullptr } + { SvMacroItemId::SwStartInsGlossary, "OnInsertStart" }, + { SvMacroItemId::SwEndInsGlossary, "OnInsertDone" }, + { SvMacroItemId::NONE, nullptr } }; SwAutoTextEventDescriptor::SwAutoTextEventDescriptor( @@ -981,13 +981,13 @@ OUString SwAutoTextEventDescriptor::getImplementationName() } void SwAutoTextEventDescriptor::replaceByName( - const sal_uInt16 nEvent, + const SvMacroItemId nEvent, const SvxMacro& rMacro) { OSL_ENSURE( nullptr != rAutoTextEntry.GetGlossaries(), "Strangely enough, the AutoText vanished!" ); - OSL_ENSURE( (nEvent == SW_EVENT_END_INS_GLOSSARY) || - (nEvent == SW_EVENT_START_INS_GLOSSARY) , + OSL_ENSURE( (nEvent == SvMacroItemId::SwEndInsGlossary) || + (nEvent == SvMacroItemId::SwStartInsGlossary) , "Unknown event ID" ); SwGlossaries *const pGlossaries = @@ -1015,11 +1015,11 @@ void SwAutoTextEventDescriptor::replaceByName( void SwAutoTextEventDescriptor::getByName( SvxMacro& rMacro, - const sal_uInt16 nEvent ) + const SvMacroItemId nEvent ) { OSL_ENSURE( nullptr != rAutoTextEntry.GetGlossaries(), "no AutoText" ); - OSL_ENSURE( (nEvent == SW_EVENT_END_INS_GLOSSARY) || - (nEvent == SW_EVENT_START_INS_GLOSSARY) , + OSL_ENSURE( (nEvent == SvMacroItemId::SwEndInsGlossary) || + (nEvent == SvMacroItemId::SwStartInsGlossary) , "Unknown event ID" ); SwGlossaries *const pGlossaries = diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 29bca71acd2b..231902eeb2b2 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -708,9 +708,9 @@ IMPL_LINK( SwWrtShell, ExecFlyMac, const SwFlyFrameFormat*, pFlyFormat, void ) OSL_ENSURE(pFormat, "no frame format"); const SvxMacroItem &rFormatMac = pFormat->GetMacro(); - if(rFormatMac.HasMacro(SW_EVENT_OBJECT_SELECT)) + if(rFormatMac.HasMacro(SvMacroItemId::SwObjectSelect)) { - const SvxMacro &rMac = rFormatMac.GetMacro(SW_EVENT_OBJECT_SELECT); + const SvxMacro &rMac = rFormatMac.GetMacro(SvMacroItemId::SwObjectSelect); if( IsFrameSelected() ) m_bLayoutMode = true; CallChgLnk(); diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index f4ed6cc0afa0..ca25cce2f77b 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -414,12 +414,12 @@ void SwWrtShell::ClickToINetAttr( const SwFormatINetFormat& rItem, LoadUrlFlags m_bIsInClickToEdit = true; // At first run the possibly set ObjectSelect Macro - const SvxMacro* pMac = rItem.GetMacro( SFX_EVENT_MOUSECLICK_OBJECT ); + const SvxMacro* pMac = rItem.GetMacro( SvMacroItemId::OnClick ); if( pMac ) { SwCallMouseEvent aCallEvent; aCallEvent.Set( &rItem ); - GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent ); + GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent ); } // So that the implementation of templates is displayed immediately @@ -444,12 +444,12 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter ) { bRet = true; // At first run the possibly set ObjectSelect Macro - const SvxMacro* pMac = &pFnd->GetMacro().GetMacro( SFX_EVENT_MOUSECLICK_OBJECT ); + const SvxMacro* pMac = &pFnd->GetMacro().GetMacro( SvMacroItemId::OnClick ); if( pMac ) { SwCallMouseEvent aCallEvent; aCallEvent.Set( EVENT_OBJECT_URLITEM, pFnd ); - GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent ); + GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent ); } ::LoadURL(*this, sURL, nFilter, sTargetFrameName); diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx index db7de18d251b..63e15214e217 100644 --- a/sw/source/uibase/wrtsh/wrtsh3.cxx +++ b/sw/source/uibase/wrtsh/wrtsh3.cxx @@ -157,7 +157,7 @@ void SwWrtShell::ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pA } } -sal_uInt16 SwWrtShell::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent, +sal_uInt16 SwWrtShell::CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent, bool bChkPtr) { return GetDoc()->CallEvent( nEvent, rCallEvent, bChkPtr ); |