diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-27 16:57:21 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-09-06 15:47:44 -0500 |
commit | 5bce32904091ffe28884fd5c0f4801ee82bad101 (patch) | |
tree | fc2573078a858de456a0dc7b7810176d433241c7 /sfx2/source/dialog | |
parent | 10143717834d8401d85fdf9564e782a58b9983ec (diff) |
SfxHint: convert home-grown RTTI to normal C++ RTTI
Also note that I fixed a bug in SvxFontMenuControl::Notify
where the if statement had the check the wrong way around.
Change-Id: I611e8929c65818191e36bd80f2b985820ada4411
Reviewed-on: https://gerrit.libreoffice.org/11147
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'sfx2/source/dialog')
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 13 |
2 files changed, 13 insertions, 10 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 59ea7c2ceab6..9bb8497cb81d 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -58,9 +58,10 @@ public: void SfxModelessDialog_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); + if ( pSimpleHint ) { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) + switch( pSimpleHint->GetId() ) { case SFX_HINT_DYING: pMgr->Destroy(); @@ -82,9 +83,10 @@ public: void SfxFloatingWindow_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); + if ( pSimpleHint ) { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) + switch( pSimpleHint->GetId() ) { case SFX_HINT_DYING: pMgr->Destroy(); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 6c428468373d..5cf9fa7e3065 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1572,9 +1572,10 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, TimeOut, Timer *, pTim ) void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { // tap update - if(rHint.Type() == TYPE(SfxSimpleHint)) + const SfxSimpleHint* pSfxSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); + if(pSfxSimpleHint) { - switch(((SfxSimpleHint&) rHint ).GetId()) + switch(pSfxSimpleHint->GetId()) { case SFX_HINT_UPDATEDONE: { @@ -1644,12 +1645,12 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint // possible that a new one is registered after the timer is up - // works bad in UpdateStyles_Impl ()! - sal_uIntPtr nId = rHint.ISA(SfxSimpleHint) ? ( (SfxSimpleHint&)rHint ).GetId() : 0; + sal_uIntPtr nId = pSfxSimpleHint ? pSfxSimpleHint->GetId() : 0; if(!bDontUpdate && nId != SFX_HINT_DYING && - (rHint.Type() == TYPE(SfxStyleSheetPoolHint)|| - rHint.Type() == TYPE(SfxStyleSheetHint) || - rHint.Type() == TYPE( SfxStyleSheetHintExtended ))) + (dynamic_cast<const SfxStyleSheetPoolHint*>(&rHint) || + dynamic_cast<const SfxStyleSheetHint*>(&rHint) || + dynamic_cast<const SfxStyleSheetHintExtended*>(&rHint))) { if(!pTimer) { |