diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx index e35dc2c391c8..e3d266512311 100644 --- a/sw/inc/swevent.hxx +++ b/sw/inc/swevent.hxx @@ -24,19 +24,21 @@ #include "frmfmt.hxx" #include "hints.hxx" -#define STR_SW_EVENT_PAGE_COUNT 0 -#define STR_SW_EVENT_MAIL_MERGE 1 -#define STR_SW_EVENT_MAIL_MERGE_END 2 -#define STR_SW_EVENT_FIELD_MERGE 3 -#define STR_SW_EVENT_FIELD_MERGE_FINISHED 4 -#define STR_SW_EVENT_LAYOUT_FINISHED 5 -#define STR_SW_EVENT_OBJECT_SELECT 6 -#define STR_SW_EVENT_START_INS_GLOSSARY 7 -#define STR_SW_EVENT_END_INS_GLOSSARY 8 -#define STR_SW_EVENT_FRM_KEYINPUT_ALPHA 9 -#define STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10 -#define STR_SW_EVENT_FRM_RESIZE 11 -#define STR_SW_EVENT_FRM_MOVE 12 +enum class StrSwEvent : sal_Int32 { + PageCount, + MailMerge, + MailMergeEnd, + FieldMerge, + FieldMergeFinished, + LayoutFinished, + ObjectSelect, + StartInsGlossary, + EndInsGlossary, + FrmKeyInputAlpha, + FrmKeyInputNoAlpha, + FrmResize, + FrmMove +}; class SwFormatINetFormat; class IMapObject; diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 9eed3e11225a..54e25efe28ad 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2585,7 +2585,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) : { m_pRoot->ResetIdleFormat(); SfxObjectShell* pDocShell = m_pImp->GetShell().GetDoc()->GetDocShell(); - pDocShell->Broadcast( SfxEventHint( SfxEventHintId::SwEventLayoutFinished, SwDocShell::GetEventName(STR_SW_EVENT_LAYOUT_FINISHED), pDocShell ) ); + pDocShell->Broadcast( SfxEventHint( SfxEventHintId::SwEventLayoutFinished, SwDocShell::GetEventName(static_cast(StrSwEvent::LayoutFinished)), pDocShell ) ); } } diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 827924702aa9..da0e8eff8640 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -838,13 +838,13 @@ IMPL_LINK_NOARG(SwMMResultPrintDialog, PrintHdl_Impl, weld::Button&, void) } SfxObjectShell* pObjSh = pTargetView->GetViewFrame().GetObjectShell(); - SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMerge, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh)); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMerge, SwDocShell::GetEventName(static_cast(StrSwEvent::MailMerge)), pObjSh)); uno::Sequence aProps{ comphelper::makePropertyValue(u"MonitorVisible"_ustr, true), comphelper::makePropertyValue(u"Pages"_ustr, sPages) }; pTargetView->ExecPrint( aProps, false, true ); - SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMergeEnd, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), pObjSh)); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMergeEnd, SwDocShell::GetEventName(static_cast(StrSwEvent::MailMergeEnd)), pObjSh)); m_xDialog->response(RET_OK); } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index cb5c1ef932f8..97da302f9843 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1403,7 +1403,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell& rSourceShell, } } - lcl_emitEvent(SfxEventHintId::SwEventFieldMerge, STR_SW_EVENT_FIELD_MERGE, xWorkDocSh); + lcl_emitEvent(SfxEventHintId::SwEventFieldMerge, static_cast(StrSwEvent::FieldMerge), xWorkDocSh); // tdf#92324: Allow ExpFields update only by explicit instruction to avoid // database cursor movement on any other fields update, for example during @@ -1413,7 +1413,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell& rSourceShell, pWorkShell->SwViewShell::UpdateFields(); pWorkShell->LockExpFields(); - lcl_emitEvent(SfxEventHintId::SwEventFieldMergeFinished, STR_SW_EVENT_FIELD_MERGE_FINISHED, xWorkDocSh); + lcl_emitEvent(SfxEventHintId::SwEventFieldMergeFinished, static_cast(StrSwEvent::FieldMergeFinished), xWorkDocSh); // also emit MailMergeEvent on XInterface if possible const SwXMailMerge *pEvtSrc = GetMailMergeEvtSrc(); @@ -2977,7 +2977,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh, // SfxObjectShellRef is ok, since there should be no control over the document lifetime here SfxObjectShellRef xDocShell = rSh.GetView().GetViewFrame().GetObjectShell(); - lcl_emitEvent(SfxEventHintId::SwMailMerge, STR_SW_EVENT_MAIL_MERGE, xDocShell.get()); + lcl_emitEvent(SfxEventHintId::SwMailMerge, static_cast(StrSwEvent::MailMerge), xDocShell.get()); // prepare mail merge descriptor SwMergeDescriptor aMergeDesc( m_pImpl->pMergeDialog->GetMergeType(), rSh, aDescriptor ); @@ -2997,7 +2997,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh, Merge( aMergeDesc ); - lcl_emitEvent(SfxEventHintId::SwMailMergeEnd, STR_SW_EVENT_MAIL_MERGE_END, xDocShell.get()); + lcl_emitEvent(SfxEventHintId::SwMailMergeEnd, static_cast(StrSwEvent::MailMergeEnd), xDocShell.get()); // reset the cursor inside xResSet = nullptr; diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 9645f44b1fb7..337eec6a0985 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1925,7 +1925,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) if (m_nPageCnt != nCnt) // notify Basic { m_nPageCnt = nCnt; - SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwEventPageCount, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame().GetObjectShell()), false); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwEventPageCount, SwDocShell::GetEventName(static_cast(StrSwEvent::PageCount)), GetViewFrame().GetObjectShell()), false); } } break; diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index 291b13f303c2..fcc54ecafcd1 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -790,9 +790,9 @@ uno::Any SAL_CALL SwXMailMerge::execute( OSL_ENSURE( !pOldSrc || pOldSrc == this, "Ooops... different event source already set." ); pMgr->SetMailMergeEvtSrc( this ); // launch events for listeners - SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMerge, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh.get())); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMerge, SwDocShell::GetEventName(static_cast(StrSwEvent::MailMerge)), xCurDocSh.get())); bool bSucc = pMgr->Merge( aMergeDesc ); - SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMergeEnd, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh.get())); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMergeEnd, SwDocShell::GetEventName(static_cast(StrSwEvent::MailMergeEnd)), xCurDocSh.get())); pMgr->SetMailMergeEvtSrc( pOldSrc );