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 /sw/source | |
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 'sw/source')
25 files changed, 191 insertions, 201 deletions
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 ); |