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 /sw/source/uibase | |
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 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/app/apphdl.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/docvw/srcedtw.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/srcview.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unoatxt.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/utlui/glbltree.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navipi.cxx | 4 |
10 files changed, 29 insertions, 26 deletions
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 44781a6cd877..6bc7f33a1683 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -654,7 +654,7 @@ void SwModule::ExecOther(SfxRequest& rReq) // Catch hint for DocInfo void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if( rHint.ISA( SfxEventHint ) ) + if( dynamic_cast<const SfxEventHint*>(&rHint) ) { SfxEventHint& rEvHint = (SfxEventHint&) rHint; SwDocShell* pDocSh = PTR_CAST( SwDocShell, rEvHint.GetObjShell() ); @@ -705,7 +705,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } } } - else if(rHint.ISA(SfxItemSetHint)) + else if(dynamic_cast<const SfxItemSetHint*>(&rHint)) { if( SFX_ITEM_SET == ((SfxItemSetHint&)rHint).GetItemSet().GetItemState(SID_ATTR_PATHNAME)) { @@ -715,7 +715,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) pList->Update(); } } - else if(rHint.ISA(SfxSimpleHint)) + else if(dynamic_cast<const SfxSimpleHint*>(&rHint)) { sal_uInt16 nHintId = ((SfxSimpleHint&)rHint).GetId(); if(SFX_HINT_DEINITIALIZING == nHintId) diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index f3b7b9c39050..38adecf52f48 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -215,7 +215,7 @@ 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 ( rHint.ISA( SfxEventHint ) ) + if ( dynamic_cast<const SfxEventHint*>(&rHint) ) { uno::Sequence< uno::Any > aArgs; sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId(); @@ -244,7 +244,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) lcl_processCompatibleSfxHint( xVbaEvents, rHint ); sal_uInt16 nAction = 0; - if( rHint.ISA(SfxSimpleHint) ) + if( dynamic_cast<const SfxSimpleHint*>(&rHint) ) { // switch for more actions switch( ((SfxSimpleHint&) rHint).GetId() ) @@ -255,7 +255,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) break; } } - else if( rHint.ISA(SfxEventHint) && + else if( dynamic_cast<const SfxEventHint*>(&rHint) && ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED ) { // #i38126# - own action id diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 0fa8e68f412c..3da6a018c318 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -3039,10 +3039,11 @@ void SwStyleSheetIterator::InvalidateIterator() void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint ) { // search and remove from View-List!! - if( rHint.ISA( SfxStyleSheetHint ) && - SFX_STYLESHEET_ERASED == ((SfxStyleSheetHint&) rHint).GetHint() ) + const SfxStyleSheetHint* pStyleSheetHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint); + if( pStyleSheetHint && + SFX_STYLESHEET_ERASED == pStyleSheetHint->GetHint() ) { - SfxStyleSheetBase* pStyle = ((SfxStyleSheetHint&)rHint).GetStyleSheet(); + SfxStyleSheetBase* pStyle = pStyleSheetHint->GetStyleSheet(); if (pStyle) aLst.RemoveName(pStyle->GetFamily(), pStyle->GetName()); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 6c1b7f350d03..b1ce47bb70b3 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -255,7 +255,7 @@ void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast ) void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - if ( rHint.IsA(TYPE(SfxEventHint) ) ) + if ( dynamic_cast<const SfxEventHint*>(&rHint) ) { sal_uInt32 nId = ((SfxEventHint&)rHint).GetEventId(); if ( nId == SW_EVENT_LAYOUT_FINISHED ) @@ -267,7 +267,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } - else if ( rHint.IsA(TYPE(SfxSimpleHint) ) ) + else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) { sal_uInt32 nId = ((SfxSimpleHint&)rHint).GetId(); switch ( nId ) @@ -312,7 +312,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } - else if ( rHint.IsA(TYPE(SwFmtFldHint) ) ) + else if ( dynamic_cast<const SwFmtFldHint*>(&rHint) ) { const SwFmtFldHint& rFmtHint = static_cast<const SwFmtFldHint&>(rHint); SwFmtFld* pFld = const_cast <SwFmtFld*>( rFmtHint.GetField() ); diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx index c1ff04e01f47..6a97983a234b 100644 --- a/sw/source/uibase/docvw/srcedtw.cxx +++ b/sw/source/uibase/docvw/srcedtw.cxx @@ -727,7 +727,7 @@ void SwSrcEditWindow::ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineO void SwSrcEditWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if ( rHint.ISA( TextHint ) ) + if ( dynamic_cast<const TextHint*>(&rHint) ) { const TextHint& rTextHint = (const TextHint&)rHint; if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED ) diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 696916637a0b..af86372e7e39 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -767,11 +767,12 @@ sal_Int32 SwSrcView::PrintSource( void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - if ( rHint.ISA(SfxSimpleHint) && + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); + if ( pSimpleHint && ( - ((SfxSimpleHint&) rHint).GetId() == SFX_HINT_MODECHANGED || + pSimpleHint->GetId() == SFX_HINT_MODECHANGED || ( - ((SfxSimpleHint&) rHint).GetId() == SFX_HINT_TITLECHANGED && + pSimpleHint->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 5ed48eb213ae..452d8329d4a7 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1591,7 +1591,7 @@ SwGlossaryHdl* SwView::GetGlosHdl() void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { bool bCallBase = true; - if ( rHint.ISA(SfxSimpleHint) ) + if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) { sal_uInt32 nId = ((SfxSimpleHint&)rHint).GetId(); switch ( nId ) @@ -1663,7 +1663,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) break; } } - else if(rHint.ISA(FmDesignModeChangedHint)) + else if(dynamic_cast<const FmDesignModeChangedHint*>(&rHint)) { bool bDesignMode = ((FmDesignModeChangedHint&)rHint).GetDesignMode(); if (!bDesignMode && GetDrawFuncPtr()) diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index deb0019eac84..3095807f4be6 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -786,9 +786,10 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint ) { if ( &_rBC == &xDocSh ) { // it's our document - if ( _rHint.ISA( SfxSimpleHint ) ) + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &_rHint ); + if ( pSimpleHint ) { - if ( SFX_HINT_DEINITIALIZING == static_cast< const SfxSimpleHint& >( _rHint ).GetId() ) + if ( SFX_HINT_DEINITIALIZING == pSimpleHint->GetId() ) { // our document is dying (possibly because we're shuting down, and the document was notified // earlier than we are?) @@ -798,7 +799,7 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint ) xDocSh.Clear(); } } - else if(_rHint.ISA(SfxEventHint)) + else if(dynamic_cast<const SfxEventHint*>(&_rHint)) { if(SFX_EVENT_PREPARECLOSEDOC == static_cast< const SfxEventHint& >( _rHint ).GetEventId()) { diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index db549530b40d..063c304301aa 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -137,10 +137,10 @@ public: bool IsValid() const {return bValid;} }; -void SwGlobalFrameListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) +void SwGlobalFrameListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - if( rHint.ISA(SfxSimpleHint) && - (((SfxSimpleHint&) rHint).GetId() == SFX_HINT_DYING)) + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>( &rHint ); + if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING) bValid = false; } diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 2c35600cc2bd..d6f60cd96530 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -999,14 +999,14 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint ) { if(&rBrdc == pCreateView) { - if(rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING) + if(dynamic_cast<const SfxSimpleHint*>(&rHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING) { pCreateView = 0; } } else { - if(rHint.ISA(SfxEventHint)) + if(dynamic_cast<const SfxEventHint*>(&rHint)) { if( pxObjectShell && ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_CLOSEAPP) |