diff options
author | Eike Rathke <erack@redhat.com> | 2016-09-22 22:20:48 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-09-23 15:14:03 +0000 |
commit | 7d8196ea2f4ec3634dbad7367345e62c4ea9893d (patch) | |
tree | 4550d4ccc4205ae5ca9f134d29927b202e10fb70 /sw | |
parent | 751689283c9f3010f7978b6576b25ffc579202ef (diff) |
perf: eliminate SfxSimpleHint and move to SfxHint, tdf#87101 related
There were over 150 places in *::Notify() functions that did some
dynamic_cast<SfxSimpleHint*> of which ~98% were unnecessary because the
base class SfxHint passed was an SfxSimpleHint anyway. dynamic_cast
operations come with quite some cost, so avoid if possible. Specifically
for ScFormulaCell::Notify() that created a bottleneck in scenarios where
cells were notified that already handled a previous notification. In
mass operations doing the dynamic_cast before it could be decided
whether having to act on it or not this made 2/3 of all time spent in
the Notify() call.
To get rid of that rename/move SfxSimpleHint to SfxHint and let classes
derive from SfxHint instead of SfxSimpleHint. This comes only with a
slight cost that an additional sal_uInt32 is transported in such hints,
initialized to 0, but this is neglectable compared to the huge gain.
For the rare cases where a Notify() actually expects both, an SfxHint
(formerly SfxSimpleHint) and a derived hint, this changed order of the
dynamic_cast involved so the simple SfxHint::GetId() is handled last.
Modules using such combinations can further optimize by treating the
simple SfxHint::GetId() first once verified that none of the other
derived hints use an ID not equal to zero respectively none of the ID
values the simple hint uses.
Change-Id: I9fcf723e3a4487ceb92336189d23a62c344cf0ce
Reviewed-on: https://gerrit.libreoffice.org/29205
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sw')
28 files changed, 102 insertions, 126 deletions
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 341f7d3445da..f6e00bf05905 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -25,7 +25,6 @@ #include <cppuhelper/weakref.hxx> #include <svl/poolitem.hxx> #include <svl/SfxBroadcaster.hxx> -#include <svl/smplhint.hxx> #include "swdllapi.h" #include <calbck.hxx> diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx index 9e6a8a8f66e8..f595cb805e5a 100644 --- a/sw/inc/pch/precompiled_msword.hxx +++ b/sw/inc/pch/precompiled_msword.hxx @@ -521,7 +521,6 @@ #include <svl/macitem.hxx> #include <svl/metitem.hxx> #include <svl/poolitem.hxx> -#include <svl/smplhint.hxx> #include <svl/stritem.hxx> #include <svl/svldllapi.h> #include <svl/undo.hxx> diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 374228bfcad8..86738867aff1 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -437,7 +437,6 @@ #include <svl/poolitem.hxx> #include <svl/ptitem.hxx> #include <svl/slstitm.hxx> -#include <svl/smplhint.hxx> #include <svl/srchitem.hxx> #include <svl/stritem.hxx> #include <svl/svldllapi.h> diff --git a/sw/inc/pch/precompiled_swui.hxx b/sw/inc/pch/precompiled_swui.hxx index 0d13d925c1f4..974fcb88910f 100644 --- a/sw/inc/pch/precompiled_swui.hxx +++ b/sw/inc/pch/precompiled_swui.hxx @@ -516,7 +516,6 @@ #include <svl/ondemand.hxx> #include <svl/poolitem.hxx> #include <svl/slstitm.hxx> -#include <svl/smplhint.hxx> #include <svl/stritem.hxx> #include <svl/style.hxx> #include <svl/svldllapi.h> diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index ad25d87fa1c7..fe55dd657452 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -27,7 +27,6 @@ #include <IDocumentRedlineAccess.hxx> -#include <svl/smplhint.hxx> #include <vector> class SfxItemSet; diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index a84df08797dd..83f2b938c134 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -23,7 +23,7 @@ #include <com/sun/star/uno/Sequence.h> #include <tools/ref.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <sfx2/lnkbase.hxx> #include <sfx2/Metadatable.hxx> @@ -248,11 +248,11 @@ public: }; // #i117863# -class SwSectionFrameMoveAndDeleteHint : public SfxSimpleHint +class SwSectionFrameMoveAndDeleteHint : public SfxHint { public: SwSectionFrameMoveAndDeleteHint( const bool bSaveContent ) - : SfxSimpleHint( SFX_HINT_DYING ) + : SfxHint( SFX_HINT_DYING ) , mbSaveContent( bSaveContent ) {} diff --git a/sw/inc/swhints.hxx b/sw/inc/swhints.hxx index ea4a57700505..04361fbe1af4 100644 --- a/sw/inc/swhints.hxx +++ b/sw/inc/swhints.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SW_INC_SWHINTS_HXX #define INCLUDED_SW_INC_SWHINTS_HXX -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #define SW_BROADCASTID_START SFX_HINT_USER00 #define SW_BROADCAST_DRAWVIEWS_CREATED SW_BROADCASTID_START diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx index ae8facee14b3..bde43a81c846 100644 --- a/sw/source/core/doc/DocumentDrawModelManager.cxx +++ b/sw/source/core/doc/DocumentDrawModelManager.cxx @@ -43,7 +43,7 @@ #include <svx/svdpage.hxx> #include <svx/svdpagv.hxx> #include <svx/svdotext.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <svl/srchitem.hxx> #include <tools/link.hxx> #include <unotools/configmgr.hxx> @@ -226,7 +226,7 @@ SwDrawModel* DocumentDrawModelManager::MakeDrawModel_() // Broadcast, so that the FormShell can be connected to the DrawView if( m_rDoc.GetDocShell() ) { - SfxSimpleHint aHint( SW_BROADCAST_DRAWVIEWS_CREATED ); + SfxHint aHint( SW_BROADCAST_DRAWVIEWS_CREATED ); m_rDoc.GetDocShell()->Broadcast( aHint ); } } diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 774f783057a3..a7eff368be4e 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <svl/smplhint.hxx> #include <hintids.hxx> #include <sfx2/linkmgr.hxx> #include <svl/itemiter.hxx> diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 058d10247767..2186a0add942 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -45,7 +45,6 @@ #include <fmtftn.hxx> #include <docsh.hxx> -#include <svl/smplhint.hxx> typedef std::vector<SwStartNode*> SwSttNdPtrs; diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 0e1065d479ed..cae15e316a47 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -62,7 +62,6 @@ #include <swerror.h> #include <unosection.hxx> #include <calbck.hxx> -#include <svl/smplhint.hxx> #include <algorithm> #include <ndsect.hxx> diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index d42ba3348a3a..986f7bb239e8 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3263,8 +3263,7 @@ void SwFrameHolder::Reset() void SwFrameHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING && &rBC == pFrame ) + if ( rHint.GetId() == SFX_HINT_DYING && &rBC == pFrame ) { pFrame = nullptr; } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 8113d539300a..50d910bae579 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -2246,7 +2246,7 @@ void SwRootFrame::CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* p if (bOldCallbackActionEnabled) { pSh->InvalidateWindows( SwRect( 0, 0, SAL_MAX_INT32, SAL_MAX_INT32 ) ); - pSh->GetDoc()->GetDocShell()->Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED)); + pSh->GetDoc()->GetDocShell()->Broadcast(SfxHint(SFX_HINT_DOCCHANGED)); } } } diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 5d4f18f43bbe..cd434dc7a910 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -39,7 +39,6 @@ #include "hints.hxx" #include <IDocumentFieldsAccess.hxx> #include <fieldhint.hxx> -#include <svl/smplhint.hxx> // constructor for default item in attribute-pool diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 19aec8d817aa..3a601cf458c4 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2139,7 +2139,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart, // do not delete note and later add it -> sidebar flickering if (GetDoc()->GetDocShell()) { - GetDoc()->GetDocShell()->Broadcast( SfxSimpleHint(SFX_HINT_USER04)); + GetDoc()->GetDocShell()->Broadcast( SfxHint(SFX_HINT_USER04)); } // Attribut verschieben m_pSwpHints->Delete( pHt ); @@ -2162,7 +2162,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart, | SetAttrMode::DONTREPLACE ); if (GetDoc()->GetDocShell()) { - GetDoc()->GetDocShell()->Broadcast( SfxSimpleHint(SFX_HINT_USER04)); + GetDoc()->GetDocShell()->Broadcast( SfxHint(SFX_HINT_USER04)); } continue; // while-Schleife weiter, ohne ++ ! } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index d51b84d75cfb..b091b6fe920c 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -72,7 +72,6 @@ #include <istyleaccess.hxx> #include <dcontact.hxx> #include <docsh.hxx> -#include <svl/smplhint.hxx> #include <algorithm> #include <map> #include <memory> diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index f631625bb76e..5070ffacf149 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -21,7 +21,7 @@ #include <hintids.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <svtools/ctrltool.hxx> #include <svl/style.hxx> #include <svl/itemiter.hxx> @@ -245,8 +245,7 @@ namespace sw //SfxListener virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override { - const SfxSimpleHint *pHint = dynamic_cast<const SfxSimpleHint*>( &rHint ); - if(pHint && (pHint->GetId() & SFX_HINT_DYING)) + if(rHint.GetId() & SFX_HINT_DYING) { m_pBasePool = nullptr; m_pDocShell = nullptr; @@ -2776,15 +2775,12 @@ uno::Any SwXStyle::getPropertyDefault(const OUString& rPropertyName) void SwXStyle::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { - const SfxSimpleHint* pHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if(!pHint) - return; - if((pHint->GetId() & SFX_HINT_DYING) || (pHint->GetId() & SfxStyleSheetHintId::ERASED)) + if((rHint.GetId() & SFX_HINT_DYING) || (rHint.GetId() & SfxStyleSheetHintId::ERASED)) { m_pBasePool = nullptr; EndListening(rBC); } - else if(pHint->GetId() & (SfxStyleSheetHintId::CHANGED)) + else if(rHint.GetId() & (SfxStyleSheetHintId::CHANGED)) { static_cast<SfxStyleSheetBasePool&>(rBC).SetSearchMask(m_rEntry.m_eFamily); SfxStyleSheetBase* pOwnBase = static_cast<SfxStyleSheetBasePool&>(rBC).Find(m_sStyleName); diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 5b5e8e06637b..0b8196c16eb9 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -879,9 +879,9 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) pList->Update(); } } - else if(dynamic_cast<const SfxSimpleHint*>(&rHint)) + else { - if (static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DEINITIALIZING) + if (rHint.GetId() == SFX_HINT_DEINITIALIZING) { DELETEZ(m_pWebUsrPref); DELETEZ(m_pUsrPref); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 23d88a0baadb..92c6b1b83715 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -248,10 +248,16 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) lcl_processCompatibleSfxHint( xVbaEvents, rHint ); sal_uInt16 nAction = 0; - if( dynamic_cast<const SfxSimpleHint*>(&rHint) ) + if( dynamic_cast<const SfxEventHint*>(&rHint) && + static_cast<const SfxEventHint&>( rHint).GetEventId() == SFX_EVENT_LOADFINISHED ) + { + // #i38126# - own action id + nAction = 3; + } + else { // switch for more actions - switch( static_cast<const SfxSimpleHint&>( rHint).GetId() ) + switch( rHint.GetId() ) { case SFX_HINT_TITLECHANGED: if( GetMedium() ) @@ -259,12 +265,6 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; } } - else if( dynamic_cast<const SfxEventHint*>(&rHint) && - static_cast<const SfxEventHint&>( rHint).GetEventId() == SFX_EVENT_LOADFINISHED ) - { - // #i38126# - own action id - nAction = 3; - } if( nAction ) { @@ -1262,7 +1262,7 @@ void SwDocShell::SetModified( bool bSet ) } UpdateChildWindows(); - Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED)); + Broadcast(SfxHint(SFX_HINT_DOCCHANGED)); } } diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 0203ee42c9d9..52f1737b7fe9 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -21,7 +21,6 @@ #include <cstdlib> -#include <svl/smplhint.hxx> #include <hintids.hxx> #include <svl/itemiter.hxx> #include <svl/eitem.hxx> diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 6be0a87fd6f2..c417b9185fa3 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -64,7 +64,7 @@ #include <svl/languageoptions.hxx> #include <svtools/langtab.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <svx/svdview.hxx> #include <editeng/eeitem.hxx> @@ -267,51 +267,6 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } - else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) - { - sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId(); - switch ( nId ) - { - case SFX_HINT_MODECHANGED: - { - if ( mbReadOnly != !!(mpView->GetDocShell()->IsReadOnly()) ) - { - mbReadOnly = !mbReadOnly; - SetReadOnlyState(); - mbLayout = true; - } - break; - } - case SFX_HINT_DOCCHANGED: - { - if ( mpView->GetDocShell() == &rBC ) - { - if ( !mbWaitingForCalcRects && !mvPostItFields.empty()) - { - mbWaitingForCalcRects = true; - mnEventId = Application::PostUserEvent( LINK( this, SwPostItMgr, CalcHdl) ); - } - } - break; - } - case SFX_HINT_USER04: - { - // if we are in a SplitNode/Cut operation, do not delete note and then add again, as this will flicker - mbDeleteNote = !mbDeleteNote; - break; - } - case SFX_HINT_DYING: - { - if ( mpView->GetDocShell() != &rBC ) - { - // field to be removed is the broadcaster - OSL_FAIL("Notification for removed SwFormatField was not sent!"); - RemoveItem(&rBC); - } - break; - } - } - } else if ( dynamic_cast<const SwFormatFieldHint*>(&rHint) ) { const SwFormatFieldHint& rFormatHint = static_cast<const SwFormatFieldHint&>(rHint); @@ -406,6 +361,51 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } + else + { + sal_uInt32 nId = rHint.GetId(); + switch ( nId ) + { + case SFX_HINT_MODECHANGED: + { + if ( mbReadOnly != !!(mpView->GetDocShell()->IsReadOnly()) ) + { + mbReadOnly = !mbReadOnly; + SetReadOnlyState(); + mbLayout = true; + } + break; + } + case SFX_HINT_DOCCHANGED: + { + if ( mpView->GetDocShell() == &rBC ) + { + if ( !mbWaitingForCalcRects && !mvPostItFields.empty()) + { + mbWaitingForCalcRects = true; + mnEventId = Application::PostUserEvent( LINK( this, SwPostItMgr, CalcHdl) ); + } + } + break; + } + case SFX_HINT_USER04: + { + // if we are in a SplitNode/Cut operation, do not delete note and then add again, as this will flicker + mbDeleteNote = !mbDeleteNote; + break; + } + case SFX_HINT_DYING: + { + if ( mpView->GetDocShell() != &rBC ) + { + // field to be removed is the broadcaster + OSL_FAIL("Notification for removed SwFormatField was not sent!"); + RemoveItem(&rBC); + } + break; + } + } + } } void SwPostItMgr::Focus(SfxBroadcaster& rBC) diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 670e3b31de8f..8afcea8794e9 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1254,8 +1254,7 @@ void SwRedlineAcceptPanel::dispose() void SwRedlineAcceptPanel::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { - const SfxSimpleHint *pHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (mpImplDlg && pHint && pHint->GetId() == SFX_HINT_DOCCHANGED) + if (mpImplDlg && rHint.GetId() == SFX_HINT_DOCCHANGED) mpImplDlg->Activate(); } diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 0735970b5bd8..b900589433f2 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -752,14 +752,10 @@ sal_Int32 SwSrcView::PrintSource( void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if ( pSimpleHint && + if ( rHint.GetId() == SFX_HINT_MODECHANGED || ( - pSimpleHint->GetId() == SFX_HINT_MODECHANGED || - ( - pSimpleHint->GetId() == SFX_HINT_TITLECHANGED && - !GetDocShell()->IsReadOnly() && aEditWin->IsReadonly() - ) + rHint.GetId() == SFX_HINT_TITLECHANGED && + !GetDocShell()->IsReadOnly() && aEditWin->IsReadonly() ) ) { diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 2674f3e5ac39..8052a712534d 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1566,9 +1566,20 @@ SwGlossaryHdl* SwView::GetGlosHdl() void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { bool bCallBase = true; - if (const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint)) + if(dynamic_cast<const FmDesignModeChangedHint*>(&rHint)) { - sal_uInt32 nId = pSimpleHint->GetId(); + bool bDesignMode = static_cast<const FmDesignModeChangedHint&>(rHint).GetDesignMode(); + if (!bDesignMode && GetDrawFuncPtr()) + { + GetDrawFuncPtr()->Deactivate(); + SetDrawFuncPtr(nullptr); + LeaveDrawCreate(); + AttrChangedNotify(m_pWrtShell); + } + } + else + { + sal_uInt32 nId = rHint.GetId(); switch ( nId ) { // sub shells will be destroyed by the @@ -1637,17 +1648,6 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) break; } } - else if(dynamic_cast<const FmDesignModeChangedHint*>(&rHint)) - { - bool bDesignMode = static_cast<const FmDesignModeChangedHint&>(rHint).GetDesignMode(); - if (!bDesignMode && GetDrawFuncPtr()) - { - GetDrawFuncPtr()->Deactivate(); - SetDrawFuncPtr(nullptr); - LeaveDrawCreate(); - AttrChangedNotify(m_pWrtShell); - } - } if ( bCallBase ) SfxViewShell::Notify(rBC, rHint); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 7de2f70f6d38..e61116d03218 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -48,7 +48,7 @@ #include <docsh.hxx> #include <swmodule.hxx> #include <swdll.hxx> -#include <svl/smplhint.hxx> +#include <svl/hint.hxx> #include <svl/macitem.hxx> #include <editeng/acorrcfg.hxx> #include <comphelper/servicehelper.hxx> @@ -763,25 +763,25 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint ) { if ( &_rBC == &xDocSh ) { // it's our document - if (const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&_rHint)) + if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&_rHint)) { - if ( SFX_HINT_DEINITIALIZING == pSimpleHint->GetId() ) + if (SFX_EVENT_PREPARECLOSEDOC == pEventHint->GetEventId()) { - // our document is dying (possibly because we're shuting down, and the document was notified - // earlier than we are?) - // stop listening at the docu + implFlushDocument(); + xBodyText = nullptr; EndListening( *&xDocSh ); - // and release our reference xDocSh.Clear(); } } - else if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&_rHint)) + else { - if (SFX_EVENT_PREPARECLOSEDOC == pEventHint->GetEventId()) + if ( SFX_HINT_DEINITIALIZING == _rHint.GetId() ) { - implFlushDocument(); - xBodyText = nullptr; + // our document is dying (possibly because we're shuting down, and the document was notified + // earlier than we are?) + // stop listening at the docu EndListening( *&xDocSh ); + // and release our reference xDocSh.Clear(); } } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index b49503448d18..f6a4cc1a30b2 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -2198,8 +2198,7 @@ void SwContentTree::SetConstantShell(SwWrtShell* pSh) void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint) { - SfxSimpleHint const*const pHint(dynamic_cast<SfxSimpleHint const*>(&rHint)); - if (pHint && SFX_HINT_DOCCHANGED == pHint->GetId()) + if (SFX_HINT_DOCCHANGED == rHint.GetId()) { m_bActiveDocModified = true; return; diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 1a0a5a2810a4..46902cc28a3d 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -140,8 +140,7 @@ public: void SwGlobalFrameListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &rHint ); - if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING) + if( rHint.GetId() == SFX_HINT_DYING) bValid = false; } diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 9212c076ae47..cb68eb601121 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -962,8 +962,7 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint ) { if(&rBrdc == m_pCreateView) { - const SfxSimpleHint* pHint = dynamic_cast<const SfxSimpleHint*>(&rHint); - if (pHint && pHint->GetId() == SFX_HINT_DYING) + if (rHint.GetId() == SFX_HINT_DYING) { m_pCreateView = nullptr; } |