diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-12-19 11:01:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-12-20 06:08:30 +0000 |
commit | ed2b8ca92ae00ab96b0ea2b1c3fc9be4622b61ff (patch) | |
tree | 5fe7754d4aa1e93c6aa186ff74e6f96aaecdcd74 /sw | |
parent | 9eb4b14ffa57cd7bbdf0fc43096f5f1e65c8e388 (diff) |
convert SFX_EVENT constants to scoped enum
SFX_EVENT_CLOSEAPP and SFX_EVENT_TOGGLEFULLSCREENMODE are never
generated,
so remove them and delete the code that receives them
Change-Id: I2d003ba73fff0b02120ba29ff58e1d2399dedf00
Reviewed-on: https://gerrit.libreoffice.org/32168
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/swevent.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/layact.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmlbas.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmresultdialogs.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/apphdl.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unoatxt.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomailmerge.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navipi.cxx | 7 |
12 files changed, 38 insertions, 51 deletions
diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx index 567928739b1d..ed63b5f80b39 100644 --- a/sw/inc/swevent.hxx +++ b/sw/inc/swevent.hxx @@ -26,16 +26,10 @@ #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_MAIL_MERGE ( EVENT_APP_START + 3 ) #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 SW_EVENT_PAGE_COUNT ( EVENT_APP_START + 8 ) -#define SW_EVENT_MAIL_MERGE_END ( EVENT_APP_START + 9 ) -#define SW_EVENT_FIELD_MERGE ( EVENT_APP_START + 10 ) -#define SW_EVENT_FIELD_MERGE_FINISHED ( EVENT_APP_START + 11 ) -#define SW_EVENT_LAYOUT_FINISHED ( EVENT_APP_START + 12 ) #define STR_SW_EVENT_PAGE_COUNT 0 #define STR_SW_EVENT_MAIL_MERGE 1 diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index a4ef2ab39904..93a574a748ec 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2266,7 +2266,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) : { pRoot->ResetIdleFormat(); SfxObjectShell* pDocShell = pImp->GetShell()->GetDoc()->GetDocShell(); - pDocShell->Broadcast( SfxEventHint( SW_EVENT_LAYOUT_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_LAYOUT_FINISHED), pDocShell ) ); + pDocShell->Broadcast( SfxEventHint( SfxEventHintId::SwEventLayoutFinished, SwDocShell::GetEventName(STR_SW_EVENT_LAYOUT_FINISHED), pDocShell ) ); } } diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 54ff3e252f2c..424f0d38f31f 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -51,11 +51,11 @@ using namespace ::com::sun::star::container; static HTMLOutEvent aBodyEventTable[] = { - { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, SFX_EVENT_OPENDOC }, - { OOO_STRING_SVTOOLS_HTML_O_SDonunload, OOO_STRING_SVTOOLS_HTML_O_onunload, SFX_EVENT_PREPARECLOSEDOC }, - { OOO_STRING_SVTOOLS_HTML_O_SDonfocus, OOO_STRING_SVTOOLS_HTML_O_onfocus, SFX_EVENT_ACTIVATEDOC }, - { OOO_STRING_SVTOOLS_HTML_O_SDonblur, OOO_STRING_SVTOOLS_HTML_O_onblur, SFX_EVENT_DEACTIVATEDOC }, - { nullptr, nullptr, 0 } + { 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 } }; void SwHTMLParser::NewScript() diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index a8527de8147a..2fa7ba337612 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -840,7 +840,7 @@ IMPL_LINK(SwMMResultPrintDialog, PrintHdl_Impl, Button*, pButton, void) } SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell(); - SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh)); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMerge, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh)); SfxBoolItem aMergeSilent(SID_SILENT, false); uno::Sequence < beans::PropertyValue > aProps( 2 ); @@ -850,7 +850,7 @@ IMPL_LINK(SwMMResultPrintDialog, PrintHdl_Impl, Button*, pButton, void) aProps[1]. Value <<= sPages; pTargetView->ExecPrint( aProps, false, true ); - SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), pObjSh)); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMergeEnd, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), pObjSh)); endDialog(pButton); } diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 3948cf591b0b..816f0f276a53 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -813,16 +813,15 @@ void SwModule::ExecOther(SfxRequest& rReq) // Catch hint for DocInfo void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if( dynamic_cast<const SfxEventHint*>(&rHint) ) + if( const SfxEventHint* pEvHint = dynamic_cast<const SfxEventHint*>( &rHint) ) { - const SfxEventHint& rEvHint = static_cast<const SfxEventHint&>( rHint); - SwDocShell* pDocSh = dynamic_cast<SwDocShell*>( rEvHint.GetObjShell() ); + SwDocShell* pDocSh = dynamic_cast<SwDocShell*>( pEvHint->GetObjShell() ); if( pDocSh ) { SwWrtShell* pWrtSh = pDocSh->GetWrtShell(); - switch( rEvHint.GetEventId() ) + switch( pEvHint->GetEventId() ) { - case SFX_EVENT_LOADFINISHED: + case SfxEventHintId::LoadFinished: OSL_ASSERT(!pWrtSh); // if it is a new document created from a template, // update fixed fields @@ -835,7 +834,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } } break; - case SFX_EVENT_CREATEDOC: + case SfxEventHintId::CreateDoc: // Update all FIX-Date/Time fields if( pWrtSh ) { @@ -859,12 +858,13 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } } break; + default: break; } } } - else if(dynamic_cast<const SfxItemSetHint*>(&rHint)) + else if(const SfxItemSetHint* pSfxItemSetHint = dynamic_cast<const SfxItemSetHint*>(&rHint)) { - if( SfxItemState::SET == static_cast<const SfxItemSetHint&>(rHint).GetItemSet().GetItemState(SID_ATTR_PATHNAME)) + if( SfxItemState::SET == pSfxItemSetHint->GetItemSet().GetItemState(SID_ATTR_PATHNAME)) { ::GetGlossaries()->UpdateGlosPath( false ); SwGlossaryList* pList = ::GetGlossaryList(); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 65080d282cdc..83c2001e4057 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -217,18 +217,18 @@ void SwDocShell::DoFlushDocInfo() static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVBAEventProcessor >& xVbaEvents, const SfxHint& rHint ) { using namespace com::sun::star::script::vba::VBAEventId; - if ( dynamic_cast<const SfxEventHint*>(&rHint) ) + if ( const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint) ) { uno::Sequence< uno::Any > aArgs; - sal_uLong nEventId = static_cast<const SfxEventHint&>(rHint).GetEventId(); - switch( nEventId ) + switch( pSfxEventHint->GetEventId() ) { - case SFX_EVENT_CREATEDOC: + case SfxEventHintId::CreateDoc: xVbaEvents->processVbaEvent( DOCUMENT_NEW, aArgs ); break; - case SFX_EVENT_OPENDOC: + case SfxEventHintId::OpenDoc: xVbaEvents->processVbaEvent( DOCUMENT_OPEN, aArgs ); break; + default: break; } } } @@ -248,7 +248,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) sal_uInt16 nAction = 0; auto pEventHint = dynamic_cast<const SfxEventHint*>(&rHint); - if( pEventHint && pEventHint->GetEventId() == SFX_EVENT_LOADFINISHED ) + if( pEventHint && pEventHint->GetEventId() == SfxEventHintId::LoadFinished ) { // #i38126# - own action id nAction = 3; diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 805b81f3d6c0..b0f95bc44e74 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -151,7 +151,7 @@ void rescheduleGui() { Application::Reschedule(); } -void lcl_emitEvent(sal_uInt16 nEventId, sal_Int32 nStrId, SfxObjectShell* pDocShell) +void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 nStrId, SfxObjectShell* pDocShell) { SfxGetpApp()->NotifyEvent(SfxEventHint(nEventId, SwDocShell::GetEventName(nStrId), @@ -1388,7 +1388,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, pWorkShell->CalcLayout(); } - lcl_emitEvent(SW_EVENT_FIELD_MERGE, STR_SW_EVENT_FIELD_MERGE, xWorkDocSh); + lcl_emitEvent(SfxEventHintId::SwEventFieldMerge, STR_SW_EVENT_FIELD_MERGE, xWorkDocSh); // tdf#92324: Allow ExpFields update only by explicit instruction to avoid // database cursor movement on any other fields update, for example during @@ -1398,7 +1398,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, pWorkShell->SwViewShell::UpdateFields(); pWorkShell->LockExpFields(); - lcl_emitEvent(SW_EVENT_FIELD_MERGE_FINISHED, STR_SW_EVENT_FIELD_MERGE_FINISHED, xWorkDocSh); + lcl_emitEvent(SfxEventHintId::SwEventFieldMergeFinished, STR_SW_EVENT_FIELD_MERGE_FINISHED, xWorkDocSh); // also emit MailMergeEvent on XInterface if possible const SwXMailMerge *pEvtSrc = GetMailMergeEvtSrc(); @@ -2858,7 +2858,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(SW_EVENT_MAIL_MERGE, STR_SW_EVENT_MAIL_MERGE, xDocShell.get()); + lcl_emitEvent(SfxEventHintId::SwMailMerge, STR_SW_EVENT_MAIL_MERGE, xDocShell.get()); // prepare mail merge descriptor SwMergeDescriptor aMergeDesc( pImpl->pMergeDialog->GetMergeType(), rSh, aDescriptor ); @@ -2873,7 +2873,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh, Merge( aMergeDesc ); - lcl_emitEvent(SW_EVENT_MAIL_MERGE_END, STR_SW_EVENT_MAIL_MERGE_END, xDocShell.get()); + lcl_emitEvent(SfxEventHintId::SwMailMergeEnd, STR_SW_EVENT_MAIL_MERGE_END, xDocShell.get()); // reset the cursor inside xResSet = nullptr; diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 3e4aff029336..d169a89a99b8 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -255,10 +255,9 @@ void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast ) void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - if ( dynamic_cast<const SfxEventHint*>(&rHint) ) + if ( const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint) ) { - sal_uInt32 nId = static_cast<const SfxEventHint&>(rHint).GetEventId(); - if ( nId == SW_EVENT_LAYOUT_FINISHED ) + if ( pSfxEventHint->GetEventId() == SfxEventHintId::SwEventLayoutFinished ) { if ( !mbWaitingForCalcRects && !mvPostItFields.empty()) { @@ -267,11 +266,10 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } - else if ( dynamic_cast<const SwFormatFieldHint*>(&rHint) ) + else if ( const SwFormatFieldHint * pFormatHint = dynamic_cast<const SwFormatFieldHint*>(&rHint) ) { - const SwFormatFieldHint& rFormatHint = static_cast<const SwFormatFieldHint&>(rHint); - SwFormatField* pField = const_cast <SwFormatField*>( rFormatHint.GetField() ); - switch ( rFormatHint.Which() ) + SwFormatField* pField = const_cast <SwFormatField*>( pFormatHint->GetField() ); + switch ( pFormatHint->Which() ) { case SwFormatFieldHintWhich::INSERTED : { @@ -309,7 +307,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } case SwFormatFieldHintWhich::FOCUS: { - if (rFormatHint.GetView()== mpView) + if (pFormatHint->GetView()== mpView) Focus(rBC); break; } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 28ec6d45194f..9b8392490a67 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1341,7 +1341,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) if (m_nPageCnt != nCnt) // notify Basic { m_nPageCnt = nCnt; - SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), false); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwEventPageCount, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), false); } } break; diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 44f96d8e1854..f984a3e65428 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -764,7 +764,7 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint ) { // it's our document if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&_rHint)) { - if (SFX_EVENT_PREPARECLOSEDOC == pEventHint->GetEventId()) + if (SfxEventHintId::PrepareCloseDoc == pEventHint->GetEventId()) { implFlushDocument(); xBodyText = nullptr; diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index 357aca692551..3d055c45a005 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -801,9 +801,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(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh.get())); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMerge, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh.get())); bool bSucc = pMgr->Merge( aMergeDesc ); - SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh.get())); + SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwMailMergeEnd, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh.get())); pMgr->SetMailMergeEvtSrc( pOldSrc ); diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 2adcb91b7c76..5dcd827cb51e 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -879,13 +879,8 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint ) { if (const SfxEventHint* pHint = dynamic_cast<const SfxEventHint*>(&rHint)) { - if (m_pxObjectShell && pHint->GetEventId() == SFX_EVENT_CLOSEAPP) + if (pHint->GetEventId() == SfxEventHintId::OpenDoc) { - DELETEZ(m_pxObjectShell); - } - else if (pHint->GetEventId() == SFX_EVENT_OPENDOC) - { - SwView *pActView = GetCreateView(); if(pActView) { |