diff options
36 files changed, 175 insertions, 198 deletions
diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx index 6137496183b6..f0fc85500c72 100644 --- a/include/sfx2/event.hxx +++ b/include/sfx2/event.hxx @@ -34,20 +34,55 @@ class SfxObjectShell; +enum class SfxEventHintId { + NONE = 0, + ActivateDoc, + CloseDoc, + CloseView, + CreateDoc, + DeactivateDoc, + DocCreated, + LoadFinished, + ModifyChanged, + OpenDoc, + PrepareCloseDoc, + PrepareCloseView, + PrintDoc, + SaveAsDoc, + SaveAsDocDone, + SaveAsDocFailed, + SaveDoc, + SaveDocDone, + SaveDocFailed, + SaveToDoc, + SaveToDocDone, + SaveToDocFailed, + StorageChanged, + ViewCreated, + VisAreaChanged, + // SW events + SwMailMerge, + SwMailMergeEnd, + SwEventPageCount, + SwEventFieldMerge, + SwEventFieldMergeFinished, + SwEventLayoutFinished, +}; + class SFX2_DLLPUBLIC SfxEventHint : public SfxHint { SfxObjectShell* pObjShell; - OUString aEventName; - sal_uInt16 nEventId; + OUString aEventName; + SfxEventHintId nEventId; public: - SfxEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj ) + SfxEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj ) : pObjShell(pObj), aEventName(aName), nEventId(nId) {} - sal_uInt16 GetEventId() const + SfxEventHintId GetEventId() const { return nEventId; } const OUString& GetEventName() const @@ -63,12 +98,12 @@ class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint css::uno::Reference< css::frame::XController2 > xViewController; public: - SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController >& xController ) + SfxViewEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController >& xController ) : SfxEventHint( nId, aName, pObj ) , xViewController( xController, css::uno::UNO_QUERY ) {} - SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 >& xController ) + SfxViewEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 >& xController ) : SfxEventHint( nId, aName, pObj ) , xViewController( xController ) {} @@ -85,22 +120,22 @@ class SfxPrintingHint : public SfxViewEventHint css::uno::Sequence < css::beans::PropertyValue > aOpts; public: SfxPrintingHint( - sal_Int32 nEvent, + sal_Int32 nState, const css::uno::Sequence < css::beans::PropertyValue >& rOpts, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 >& xController ) : SfxViewEventHint( - SFX_EVENT_PRINTDOC, + SfxEventHintId::PrintDoc, GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ), pObj, xController ) - , mnPrintableState( nEvent ) + , mnPrintableState( nState ) , aOpts( rOpts ) {} - SfxPrintingHint( sal_Int32 nEvent ) - : SfxViewEventHint( SFX_EVENT_PRINTDOC, rtl::OUString(), nullptr, css::uno::Reference< css::frame::XController >() ) - , mnPrintableState( nEvent ) + SfxPrintingHint( sal_Int32 nState ) + : SfxViewEventHint( SfxEventHintId::PrintDoc, rtl::OUString(), nullptr, css::uno::Reference< css::frame::XController >() ) + , mnPrintableState( nState ) {} sal_Int32 GetWhich() const { return mnPrintableState; } diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 84ff20818883..39ed879d9a69 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -82,6 +82,7 @@ class JobSetup; class Size; class Point; enum class SfxModelFlags; +enum class SfxEventHintId; // These values presumably must match exactly the corresponding // css::embed::Aspects ones (in offapi/com/sun/star/embed/Aspects.idl) @@ -691,7 +692,7 @@ public: SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl(); SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress ); SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* ); - SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 ); + SAL_DLLPRIVATE void SetActivateEvent_Impl(SfxEventHintId ); SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); // configuration items diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc index df385999e1a7..44bf0759a41b 100644 --- a/include/sfx2/sfx.hrc +++ b/include/sfx2/sfx.hrc @@ -35,39 +35,7 @@ // EVENT_APP_END 29999 // Warning: the following are simultaneously SID_ON_ ... -#define SFX_EVENT_CLOSEAPP (EVENT_SFX_START + 1) -#define SFX_EVENT_CREATEDOC (EVENT_SFX_START + 2) -#define SFX_EVENT_OPENDOC (EVENT_SFX_START + 3) -#define SFX_EVENT_CLOSEDOC (EVENT_SFX_START + 4) -#define SFX_EVENT_SAVEDOC (EVENT_SFX_START + 5) -#define SFX_EVENT_SAVEASDOC (EVENT_SFX_START + 6) -#define SFX_EVENT_ACTIVATEDOC (EVENT_SFX_START + 7) -#define SFX_EVENT_DEACTIVATEDOC (EVENT_SFX_START + 8) -#define SFX_EVENT_PRINTDOC (EVENT_SFX_START + 9) - -#define SFX_EVENT_LOADFINISHED (EVENT_SFX_START + 11) - -#define SFX_EVENT_MODIFYCHANGED (EVENT_SFX_START + 13) -#define SFX_EVENT_PREPARECLOSEDOC (EVENT_SFX_START + 14) -#define SFX_EVENT_TOGGLEFULLSCREENMODE (EVENT_SFX_START + 16) -#define SFX_EVENT_SAVEDOCDONE (EVENT_SFX_START + 17) -#define SFX_EVENT_SAVEASDOCDONE (EVENT_SFX_START + 18) - -#define SFX_EVENT_SAVETODOC (EVENT_SFX_START + 19) -#define SFX_EVENT_SAVETODOCDONE (EVENT_SFX_START + 20) - -#define SFX_EVENT_VIEWCREATED (EVENT_SFX_START + 21) -#define SFX_EVENT_PREPARECLOSEVIEW (EVENT_SFX_START + 22) -#define SFX_EVENT_CLOSEVIEW (EVENT_SFX_START + 23) - -#define SFX_EVENT_STORAGECHANGED (EVENT_SFX_START + 24) -#define SFX_EVENT_VISAREACHANGED (EVENT_SFX_START + 25) - -#define SFX_EVENT_DOCCREATED (EVENT_SFX_START + 26) - -#define SFX_EVENT_SAVEASDOCFAILED (EVENT_SFX_START + 27) -#define SFX_EVENT_SAVEDOCFAILED (EVENT_SFX_START + 28) -#define SFX_EVENT_SAVETODOCFAILED (EVENT_SFX_START + 29) + // Events for Controls etc. #define SFX_EVENT_MOUSEOVER_OBJECT ( EVENT_SFX_START + 100 ) diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 1ed5a0f608e0..0b88697d62ee 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1948,8 +1948,8 @@ void ScPosWnd::Notify( SfxBroadcaster&, const SfxHint& rHint ) // Does the list of range names need updating? if ( dynamic_cast<const SfxEventHint*>(&rHint) ) { - sal_uLong nEventId = static_cast<const SfxEventHint*>(&rHint)->GetEventId(); - if ( nEventId == SFX_EVENT_ACTIVATEDOC ) + SfxEventHintId nEventId = static_cast<const SfxEventHint*>(&rHint)->GetEventId(); + if ( nEventId == SfxEventHintId::ActivateDoc ) FillRangeNames(); } else diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 075c446b8b9e..f34f675fd1f8 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -673,10 +673,10 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } else if ( dynamic_cast<const SfxEventHint*>(&rHint) ) { - sal_uLong nEventId = static_cast<const SfxEventHint*>(&rHint)->GetEventId(); + SfxEventHintId nEventId = static_cast<const SfxEventHint*>(&rHint)->GetEventId(); switch ( nEventId ) { - case SFX_EVENT_LOADFINISHED: + case SfxEventHintId::LoadFinished: { #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT // the readonly documents should not be opened in shared mode @@ -701,7 +701,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) #endif } break; - case SFX_EVENT_VIEWCREATED: + case SfxEventHintId::ViewCreated: { #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT if ( IsDocShared() && !SC_MOD()->IsInSharedDocLoading() ) @@ -759,7 +759,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } break; - case SFX_EVENT_SAVEDOC: + case SfxEventHintId::SaveDoc: { #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() ) @@ -925,7 +925,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } catch ( uno::Exception& ) { - OSL_FAIL( "SFX_EVENT_SAVEDOC: caught exception\n" ); + OSL_FAIL( "SfxEventHintId::SaveDoc: caught exception\n" ); SC_MOD()->SetInSharedDocSaving( false ); try @@ -948,7 +948,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) pSheetSaveData->SetInSupportedSave(true); } break; - case SFX_EVENT_SAVEASDOC: + case SfxEventHintId::SaveAsDoc: { if ( GetDocument().GetExternalRefManager()->containsUnsavedReferences() ) { @@ -962,21 +962,21 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } SAL_FALLTHROUGH; } - case SFX_EVENT_SAVETODOC: + case SfxEventHintId::SaveToDoc: // #i108978# If no event is sent before saving, there will also be no "...DONE" event, // and SAVE/SAVEAS can't be distinguished from SAVETO. So stream copying is only enabled // if there is a SAVE/SAVEAS/SAVETO event first. if (pSheetSaveData) pSheetSaveData->SetInSupportedSave(true); break; - case SFX_EVENT_SAVEDOCDONE: - case SFX_EVENT_SAVEASDOCDONE: + case SfxEventHintId::SaveDocDone: + case SfxEventHintId::SaveAsDocDone: { // new positions are used after "save" and "save as", but not "save to" UseSheetSaveEntries(); // use positions from saved file for next saving SAL_FALLTHROUGH; } - case SFX_EVENT_SAVETODOCDONE: + case SfxEventHintId::SaveToDocDone: // only reset the flag, don't use the new positions if (pSheetSaveData) pSheetSaveData->SetInSupportedSave(false); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 44436a0a8504..d5b694518541 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -3192,18 +3192,18 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint ) const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint); if ( pEventHint ) { - sal_uLong nEventId = pEventHint->GetEventId(); + SfxEventHintId nEventId = pEventHint->GetEventId(); switch ( nEventId ) { - case SFX_EVENT_PREPARECLOSEDOC: + case SfxEventHintId::PrepareCloseDoc: { ScopedVclPtrInstance<WarningBox> aBox( ScDocShell::GetActiveDialogParent(), WinBits( WB_OK ), ScGlobal::GetRscString( STR_CLOSE_WITH_UNSAVED_REFS ) ); aBox->Execute(); } break; - case SFX_EVENT_SAVEDOCDONE: - case SFX_EVENT_SAVEASDOCDONE: + case SfxEventHintId::SaveDocDone: + case SfxEventHintId::SaveAsDocDone: { SfxObjectShell* pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell(); transformUnsavedRefToSavedRef(pObjShell); diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 80b3c2431116..e48419208a5f 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -582,8 +582,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) { if (const SfxEventHint* pHint = dynamic_cast<const SfxEventHint*>(&rHint)) { - sal_uLong nEventId = pHint->GetEventId(); - if (nEventId == SFX_EVENT_ACTIVATEDOC) + if (pHint->GetEventId() == SfxEventHintId::ActivateDoc) { aLbEntries->ActiveDocChanged(); UpdateAll(); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 112f3a6d55d6..5bab83fe5b73 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2786,7 +2786,7 @@ void ScModelObj::HandleCalculateEvents() { ScDocument& rDoc = pDocShell->GetDocument(); // don't call events before the document is visible - // (might also set a flag on SFX_EVENT_LOADFINISHED and only disable while loading) + // (might also set a flag on SfxEventHintId::LoadFinished and only disable while loading) if ( rDoc.IsDocVisible() ) { SCTAB nTabCount = rDoc.GetTableCount(); diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 14a5ad2995a4..8a3665bda16a 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -429,7 +429,7 @@ void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { switch (pEventHint->GetEventId()) { - case SFX_EVENT_OPENDOC: + case SfxEventHintId::OpenDoc: if( GetDocument() && GetDocument()->IsStartWithPresentation() ) { if( GetViewFrame() ) diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 5675d3667486..a573fcc084a6 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -320,7 +320,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) if ( pOldFrame ) { if ( bTaskActivate ) - NotifyEvent( SfxViewEventHint( SFX_EVENT_DEACTIVATEDOC, GlobalEventConfig::GetEventName(GlobalEventId::DEACTIVATEDOC), pOldFrame->GetObjectShell(), pOldFrame->GetFrame().GetController() ) ); + NotifyEvent( SfxViewEventHint( SfxEventHintId::DeactivateDoc, GlobalEventConfig::GetEventName(GlobalEventId::DEACTIVATEDOC), pOldFrame->GetObjectShell(), pOldFrame->GetFrame().GetController() ) ); pOldFrame->DoDeactivate( bTaskActivate, pFrame ); if( pOldFrame->GetProgress() ) @@ -335,7 +335,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) if ( bTaskActivate && pFrame->GetObjectShell() ) { pFrame->GetObjectShell()->PostActivateEvent_Impl( pFrame ); - NotifyEvent(SfxViewEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName(GlobalEventId::ACTIVATEDOC), pFrame->GetObjectShell(), pFrame->GetFrame().GetController() ) ); + NotifyEvent(SfxViewEventHint(SfxEventHintId::ActivateDoc, GlobalEventConfig::GetEventName(GlobalEventId::ACTIVATEDOC), pFrame->GetObjectShell(), pFrame->GetFrame().GetController() ) ); } SfxProgress *pProgress = pFrame->GetProgress(); diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 771205a5354c..38754445e180 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -203,7 +203,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) switch ( pEventHint->GetEventId() ) { - case SFX_EVENT_CREATEDOC: + case SfxEventHintId::CreateDoc: { bool bAllowModif = pDocSh->IsEnableSetModified(); if ( bAllowModif ) @@ -223,17 +223,17 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) } break; - case SFX_EVENT_OPENDOC: - case SFX_EVENT_SAVEDOCDONE: - case SFX_EVENT_SAVEASDOCDONE: - case SFX_EVENT_SAVETODOCDONE: - case SFX_EVENT_CLOSEDOC: + case SfxEventHintId::OpenDoc: + case SfxEventHintId::SaveDocDone: + case SfxEventHintId::SaveAsDocDone: + case SfxEventHintId::SaveToDocDone: + case SfxEventHintId::CloseDoc: { AddDocumentToPickList(pDocSh); } break; - case SFX_EVENT_SAVEASDOC: + case SfxEventHintId::SaveAsDoc: { SfxMedium *pMedium = pDocSh->GetMedium(); if (!pMedium) @@ -250,6 +250,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) } } break; + default: break; } } } diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index e190f3a05760..ab90ef7fc015 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -124,7 +124,7 @@ void SfxObjectShell::SetVisArea( const Rectangle & rVisArea ) if ( IsEnableSetModified() ) SetModified(); - SfxGetpApp()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(GlobalEventId::VISAREACHANGED), this)); + SfxGetpApp()->NotifyEvent(SfxEventHint( SfxEventHintId::VisAreaChanged, GlobalEventConfig::GetEventName(GlobalEventId::VISAREACHANGED), this)); } } } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index d546333bcf35..4cc03cc6d228 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -336,7 +336,7 @@ void SfxObjectShell::ModifyChanged() Invalidate( SID_MACRO_SIGNATURE ); Broadcast( SfxHint( SfxHintId::TitleChanged ) ); // xmlsec05, signed state might change in title... - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, GlobalEventConfig::GetEventName(GlobalEventId::MODIFYCHANGED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::ModifyChanged, GlobalEventConfig::GetEventName(GlobalEventId::MODIFYCHANGED), this ) ); } @@ -955,18 +955,18 @@ void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame* pFrame ) const SfxBoolItem* pHiddenItem = SfxItemSet::GetItem<SfxBoolItem>(pMedium->GetItemSet(), SID_HIDDEN, false); if ( !pHiddenItem || !pHiddenItem->GetValue() ) { - sal_uInt16 nId = pImpl->nEventId; - pImpl->nEventId = 0; - if ( nId == SFX_EVENT_OPENDOC ) + SfxEventHintId nId = pImpl->nEventId; + pImpl->nEventId = SfxEventHintId::NONE; + if ( nId == SfxEventHintId::OpenDoc ) pSfxApp->NotifyEvent(SfxViewEventHint( nId, GlobalEventConfig::GetEventName(GlobalEventId::OPENDOC), this, pFrame->GetFrame().GetController() ), false); - else if (nId == SFX_EVENT_CREATEDOC ) + else if (nId == SfxEventHintId::CreateDoc ) pSfxApp->NotifyEvent(SfxViewEventHint( nId, GlobalEventConfig::GetEventName(GlobalEventId::CREATEDOC), this, pFrame->GetFrame().GetController() ), false); } } } -void SfxObjectShell::SetActivateEvent_Impl(sal_uInt16 nId ) +void SfxObjectShell::SetActivateEvent_Impl(SfxEventHintId nId ) { if ( GetFactory().GetFlags() & SfxObjectShellFlags::HASOPENDOC ) pImpl->nEventId = nId; @@ -1206,7 +1206,7 @@ void SfxObjectShell::FinishedLoading( SfxLoadedFlags nFlags ) // Title is not available until loading has finished Broadcast( SfxHint( SfxHintId::TitleChanged ) ); - if ( pImpl->nEventId ) + if ( pImpl->nEventId != SfxEventHintId::NONE ) PostActivateEvent_Impl(SfxViewFrame::GetFirst(this)); } } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 490d85d04b50..6208765c6c4f 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -630,12 +630,12 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) bool bOk = false; std::shared_ptr<const SfxFilter> pFilter = pMed->GetFilter(); SfxItemSet* pSet = pMedium->GetItemSet(); - if( !pImpl->nEventId ) + if( pImpl->nEventId == SfxEventHintId::NONE ) { const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(pSet, SID_TEMPLATE, false); SetActivateEvent_Impl( ( pTemplateItem && pTemplateItem->GetValue() ) - ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); + ? SfxEventHintId::CreateDoc : SfxEventHintId::OpenDoc ); } const SfxStringItem* pBaseItem = SfxItemSet::GetItem<SfxStringItem>(pSet, SID_BASEURL, false); @@ -3065,7 +3065,7 @@ uno::Reference< embed::XStorage > SfxObjectShell::GetStorage() SetupStorage( pImpl->m_xDocStorage, SOFFICE_FILEFORMAT_CURRENT, false ); pImpl->m_bCreateTempStor = false; if (!utl::ConfigManager::IsAvoidConfig()) - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(GlobalEventId::STORAGECHANGED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::StorageChanged, GlobalEventConfig::GetEventName(GlobalEventId::STORAGECHANGED), this ) ); } catch( uno::Exception& ) { @@ -3214,7 +3214,7 @@ bool SfxObjectShell::SaveCompleted( const uno::Reference< embed::XStorage >& xSt if ( bSendNotification ) { - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(GlobalEventId::STORAGECHANGED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::StorageChanged, GlobalEventConfig::GetEventName(GlobalEventId::STORAGECHANGED), this ) ); } return bResult; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index c5bafe78702c..61db73a28999 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -241,7 +241,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bAllowShareControlFileClean( true ) ,m_bConfigOptionsChecked( false ) ,lErr(ERRCODE_NONE) - ,nEventId ( 0) + ,nEventId ( SfxEventHintId::NONE ) ,pReloadTimer ( nullptr) ,nLoadedFlags ( SfxLoadedFlags::ALL ) ,nFlagsInProgress( SfxLoadedFlags::NONE ) @@ -567,7 +567,7 @@ bool SfxObjectShell::PrepareClose } SfxApplication *pSfxApp = SfxGetpApp(); - pSfxApp->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEDOC, GlobalEventConfig::GetEventName(GlobalEventId::PREPARECLOSEDOC), this) ); + pSfxApp->NotifyEvent( SfxEventHint(SfxEventHintId::PrepareCloseDoc, GlobalEventConfig::GetEventName(GlobalEventId::PREPARECLOSEDOC), this) ); if( GetCreateMode() == SfxObjectCreateMode::EMBEDDED ) { @@ -1106,12 +1106,12 @@ void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) return; if ( i_fromInitNew ) { - SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(GlobalEventId::DOCCREATED), this ) ); + SetActivateEvent_Impl( SfxEventHintId::CreateDoc ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::DocCreated, GlobalEventConfig::GetEventName(GlobalEventId::DOCCREATED), this ) ); } else { - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(GlobalEventId::LOADFINISHED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::LoadFinished, GlobalEventConfig::GetEventName(GlobalEventId::LOADFINISHED), this ) ); } } diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 2570e16fb763..fc19db8f9098 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1539,7 +1539,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() ); TransformParameters( nSlotId, aArgs, *pParams ); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOC), m_pData->m_pObjectShell.get() ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDoc, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOC), m_pData->m_pObjectShell.get() ) ); bool bRet = false; @@ -1580,7 +1580,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "successful saving." ); m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCDONE), m_pData->m_pObjectShell.get() ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDocDone, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCDONE), m_pData->m_pObjectShell.get() ) ); } else { @@ -1588,7 +1588,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > m_pData->m_pObjectShell->StoreLog(); // write the contents of the logger to the file - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCFAILED), m_pData->m_pObjectShell.get() ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDocFailed, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCFAILED), m_pData->m_pObjectShell.get() ) ); throw task::ErrorCodeIOException( "SfxBaseModel::storeSelf: 0x" + OUString::number(nErrCode, 16), @@ -2725,7 +2725,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , switch ( pNamedHint->GetEventId() ) { - case SFX_EVENT_STORAGECHANGED: + case SfxEventHintId::StorageChanged: { if ( m_pData->m_xUIConfigurationManager.is() && m_pData->m_pObjectShell->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) @@ -2752,7 +2752,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , } break; - case SFX_EVENT_LOADFINISHED: + case SfxEventHintId::LoadFinished: { impl_getPrintHelper(); ListenForStorage_Impl( m_pData->m_pObjectShell->GetStorage() ); @@ -2760,7 +2760,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , } break; - case SFX_EVENT_SAVEASDOCDONE: + case SfxEventHintId::SaveAsDocDone: { m_pData->m_sURL = m_pData->m_pObjectShell->GetMedium()->GetName(); @@ -2773,21 +2773,21 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , } break; - case SFX_EVENT_DOCCREATED: + case SfxEventHintId::DocCreated: { impl_getPrintHelper(); m_pData->m_bModifiedSinceLastSave = false; } break; - case SFX_EVENT_MODIFYCHANGED: + case SfxEventHintId::ModifyChanged: { m_pData->m_bModifiedSinceLastSave = isModified(); } break; + default: break; } - const SfxViewEventHint* pViewHint = dynamic_cast<const SfxViewEventHint*>(&rHint); postEvent_Impl( pNamedHint->GetEventName(), pViewHint ? pViewHint->GetController() : Reference< frame::XController2 >() ); } @@ -2972,7 +2972,7 @@ void SfxBaseModel::impl_store( const OUString& sURL if ( !bSaved && m_pData->m_pObjectShell.Is() ) { - SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), + SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), m_pData->m_pObjectShell.get() ) ); std::unique_ptr<SfxAllItemSet> pItemSet(new SfxAllItemSet(SfxGetpApp()->GetPool())); @@ -3072,14 +3072,14 @@ void SfxBaseModel::impl_store( const OUString& sURL m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); m_pData->m_pObjectShell->SetModifyPasswordEntered(); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVEASDOCDONE), m_pData->m_pObjectShell.get() ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveAsDocDone, GlobalEventConfig::GetEventName(GlobalEventId::SAVEASDOCDONE), m_pData->m_pObjectShell.get() ) ); } else { m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVETODOCDONE), m_pData->m_pObjectShell.get() ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveToDocDone, GlobalEventConfig::GetEventName(GlobalEventId::SAVETODOCDONE), m_pData->m_pObjectShell.get() ) ); } } else @@ -3092,7 +3092,7 @@ void SfxBaseModel::impl_store( const OUString& sURL m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); - SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOCFAILED : GlobalEventId::SAVEASDOCFAILED), + SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDocFailed : SfxEventHintId::SaveAsDocFailed, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOCFAILED : GlobalEventId::SAVEASDOCFAILED), m_pData->m_pObjectShell.get() ) ); throw task::ErrorCodeIOException( @@ -3696,7 +3696,7 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const Reference< embed::XStorage >& const SfxBoolItem* pTemplateItem = aSet.GetItem<SfxBoolItem>(SID_TEMPLATE, false); bool bTemplate = pTemplateItem && pTemplateItem->GetValue(); - m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); + m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SfxEventHintId::CreateDoc : SfxEventHintId::OpenDoc ); m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = false; // load document diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index bbcf19f572b5..9a3b5c167681 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -100,7 +100,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess IndexBitSet aBitSet; sal_uInt32 lErr; - sal_uInt16 nEventId; // If Open/Create as to be sent + SfxEventHintId nEventId; // If Open/Create as to be sent // before Activate AutoReloadTimer_Impl *pReloadTimer; SfxLoadedFlags nLoadedFlags; diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 75d4a4348915..117cc7ac6dcd 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -200,7 +200,7 @@ bool SfxFrame::PrepareClose_Impl( bool bUI ) bOther = ( &pFrame->GetFrame() != this ); } - SfxGetpApp()->NotifyEvent( SfxViewEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( GlobalEventId::PREPARECLOSEVIEW ), pCur, GetController() ) ); + SfxGetpApp()->NotifyEvent( SfxViewEventHint(SfxEventHintId::PrepareCloseView, GlobalEventConfig::GetEventName( GlobalEventId::PREPARECLOSEVIEW ), pCur, GetController() ) ); if ( bOther ) // if there are other views only the current view of this frame must be asked diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index fc67319dca73..e732d27eccf4 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -572,7 +572,7 @@ void SAL_CALL SfxBaseController::attachFrame( const Reference< frame::XFrame >& ShowInfoBars( ); // attaching the frame to the controller is the last step in the creation of a new view, so notify this - SfxViewEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( GlobalEventId::VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell(), Reference< frame::XController2 >( this ) ); + SfxViewEventHint aHint( SfxEventHintId::ViewCreated, GlobalEventConfig::GetEventName( GlobalEventId::VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell(), Reference< frame::XController2 >( this ) ); SfxGetpApp()->NotifyEvent( aHint ); } } @@ -1001,9 +1001,9 @@ void SAL_CALL SfxBaseController::dispose() throw( RuntimeException, std::excepti pView = SfxViewFrame::GetNext( *pView, pDoc ); } - SfxGetpApp()->NotifyEvent( SfxViewEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEVIEW ), pDoc, Reference< frame::XController2 >( this ) ) ); + SfxGetpApp()->NotifyEvent( SfxViewEventHint(SfxEventHintId::CloseView, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEVIEW ), pDoc, Reference< frame::XController2 >( this ) ) ); if ( !pView ) - SfxGetpApp()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ), pDoc) ); + SfxGetpApp()->NotifyEvent( SfxEventHint(SfxEventHintId::CloseDoc, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ), pDoc) ); Reference< frame::XModel > xModel = pDoc->GetModel(); Reference < util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 6e11dfdf55fc..c0e4c13f94bb 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -786,7 +786,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } // Propagate document closure. - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ), xOldObj ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::CloseDoc, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ), xOldObj ) ); } // Record as done @@ -1160,7 +1160,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) // is not read only, and the loading is finished. switch ( pEventHint->GetEventId() ) { - case SFX_EVENT_MODIFYCHANGED: + case SfxEventHintId::ModifyChanged: { SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_DOC_MODIFIED ); @@ -1169,8 +1169,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) break; } - case SFX_EVENT_OPENDOC: - case SFX_EVENT_CREATEDOC: + case SfxEventHintId::OpenDoc: + case SfxEventHintId::CreateDoc: { if ( !m_xObjSh.Is() ) break; @@ -1232,13 +1232,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) break; } - - case SFX_EVENT_TOGGLEFULLSCREENMODE: - { - if ( GetFrame().OwnsBindings_Impl() ) - GetBindings().GetDispatcher_Impl()->Update_Impl( true ); - break; - } + default: break; } } else diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index e62577b81975..f9d6c9a99044 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -308,7 +308,7 @@ void SfxPrinterController::jobStarted() xDocProps->setPrintDate( now.GetUNODateTime() ); - SfxGetpApp()->NotifyEvent( SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ), mpObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint(SfxEventHintId::PrintDoc, GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ), mpObjectShell ) ); uno::Sequence < beans::PropertyValue > aOpts; aOpts = getJobProperties( aOpts ); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 766e67f81207..91e1c284f3b7 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1405,34 +1405,25 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint); - if ( pEventHint ) + if ( pEventHint && pEventHint->GetEventId() == SfxEventHintId::LoadFinished ) { - switch ( pEventHint->GetEventId() ) + if ( GetController().is() ) { - case SFX_EVENT_LOADFINISHED: + // avoid access to dangling ViewShells + SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl(); + for (SfxViewFrame* frame : rFrames) { - if ( GetController().is() ) + if ( frame == GetViewFrame() && &rBC == GetObjectShell() ) { - // avoid access to dangling ViewShells - SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl(); - for (SfxViewFrame* frame : rFrames) + SfxItemSet* pSet = GetObjectShell()->GetMedium()->GetItemSet(); + const SfxUnoAnyItem* pItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pSet, SID_VIEW_DATA, false); + if ( pItem ) { - if ( frame == GetViewFrame() && &rBC == GetObjectShell() ) - { - SfxItemSet* pSet = GetObjectShell()->GetMedium()->GetItemSet(); - const SfxUnoAnyItem* pItem = SfxItemSet::GetItem<SfxUnoAnyItem>(pSet, SID_VIEW_DATA, false); - if ( pItem ) - { - pImpl->m_pController->restoreViewData( pItem->GetValue() ); - pSet->ClearItem( SID_VIEW_DATA ); - } - - break; - } + pImpl->m_pController->restoreViewData( pItem->GetValue() ); + pSet->ClearItem( SID_VIEW_DATA ); } + break; } - - break; } } } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 87c1961d431a..804e3f77918e 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -164,7 +164,7 @@ void SmDocShell::SetText(const OUString& rBuffer) // have SwOleClient::FormatChanged() to align the modified formula properly // even if the vis area does not change (e.g. when formula text changes from // "{a over b + c} over d" to "d over {a over b + c}" - SfxGetpApp()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(GlobalEventId::VISAREACHANGED), this)); + SfxGetpApp()->NotifyEvent(SfxEventHint( SfxEventHintId::VisAreaChanged, GlobalEventConfig::GetEventName(GlobalEventId::VISAREACHANGED), this)); Repaint(); } diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 6aecd03c1d44..448489b54a31 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -323,10 +323,11 @@ void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { switch (pEventHint->GetEventId()) { - case SFX_EVENT_CREATEDOC: - case SFX_EVENT_OPENDOC: + case SfxEventHintId::CreateDoc: + case SfxEventHintId::OpenDoc: ModeChanged(); break; + default: break; } } } 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) { |