summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-27 16:57:21 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-09-06 15:47:44 -0500
commit5bce32904091ffe28884fd5c0f4801ee82bad101 (patch)
treefc2573078a858de456a0dc7b7810176d433241c7 /sd
parent10143717834d8401d85fdf9564e782a58b9983ec (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 'sd')
-rw-r--r--sd/source/core/stlsheet.cxx5
-rw-r--r--sd/source/ui/accessibility/AccessibleSlideSorterView.cxx10
-rw-r--r--sd/source/ui/app/sdmod.cxx4
-rw-r--r--sd/source/ui/dlg/docprev.cxx3
-rw-r--r--sd/source/ui/inc/ViewShellHint.hxx2
-rw-r--r--sd/source/ui/sidebar/MasterPageObserver.cxx6
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.cxx16
-rw-r--r--sd/source/ui/slidesorter/controller/SlsTransferableData.cxx6
-rw-r--r--sd/source/ui/tools/EventMultiplexer.cxx16
-rw-r--r--sd/source/ui/tools/PreviewRenderer.cxx21
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx6
-rw-r--r--sd/source/ui/unoidl/unopback.cxx2
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx5
-rw-r--r--sd/source/ui/view/ViewShellHint.cxx2
-rw-r--r--sd/source/ui/view/drawview.cxx2
15 files changed, 49 insertions, 57 deletions
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 68075de2f872..aaeed2922be7 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -527,9 +527,8 @@ void SdStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
/* if the dummy gets a notify about a changed attribute, he takes care that
the actual ment style sheet sends broadcasts. */
- SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
- sal_uLong nId = pSimple == NULL ? 0 : pSimple->GetId();
- if (nId == SFX_HINT_DATACHANGED && nFamily == SD_STYLE_FAMILY_PSEUDO)
+ const SfxSimpleHint* pSimple = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimple && pSimple->GetId() == SFX_HINT_DATACHANGED && nFamily == SD_STYLE_FAMILY_PSEUDO)
{
SdStyleSheet* pRealStyle = GetRealStyleSheet();
if (pRealStyle)
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index 8a5b2eeff354..c4f818b63657 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -851,10 +851,10 @@ void AccessibleSlideSorterView::Implementation::Notify (
SfxBroadcaster&,
const SfxHint& rHint)
{
- if (rHint.ISA(SdrHint))
+ const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
+ if (pSdrHint)
{
- SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
- switch (rSdrHint.GetKind())
+ switch (pSdrHint->GetKind())
{
case HINT_PAGEORDERCHG:
RequestUpdateChildren();
@@ -863,9 +863,9 @@ void AccessibleSlideSorterView::Implementation::Notify (
break;
}
}
- else if (rHint.ISA(sd::ViewShellHint))
+ else if (dynamic_cast<const sd::ViewShellHint*>(&rHint))
{
- sd::ViewShellHint& rViewShellHint (*PTR_CAST(sd::ViewShellHint, &rHint));
+ const sd::ViewShellHint& rViewShellHint = static_cast<const sd::ViewShellHint&>(rHint);
switch (rViewShellHint.GetHintId())
{
case sd::ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START:
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index dcdf0eb4a4fd..0d891e566344 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -132,8 +132,8 @@ SdModule::~SdModule()
/// get notifications
void SdModule::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
- if( rHint.ISA( SfxSimpleHint ) &&
- ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_DEINITIALIZING )
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DEINITIALIZING )
{
delete pImpressOptions, pImpressOptions = NULL;
delete pDrawOptions, pDrawOptions = NULL;
diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx
index 2a72f6773cb6..301cc708148b 100644
--- a/sd/source/ui/dlg/docprev.cxx
+++ b/sd/source/ui/dlg/docprev.cxx
@@ -293,7 +293,8 @@ void SdDocPreviewWin::updateViewSettings()
void SdDocPreviewWin::Notify(SfxBroadcaster&, const SfxHint& rHint)
{
- if( rHint.ISA( SfxSimpleHint ) && ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_COLORS_CHANGED )
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_COLORS_CHANGED )
{
updateViewSettings();
}
diff --git a/sd/source/ui/inc/ViewShellHint.hxx b/sd/source/ui/inc/ViewShellHint.hxx
index 049e02790937..03ab7aaaf75b 100644
--- a/sd/source/ui/inc/ViewShellHint.hxx
+++ b/sd/source/ui/inc/ViewShellHint.hxx
@@ -45,8 +45,6 @@ public:
HINT_COMPLEX_MODEL_CHANGE_END
};
- TYPEINFO_OVERRIDE();
-
ViewShellHint (HintId nHintId);
HintId GetHintId (void) const { return meHintId;}
diff --git a/sd/source/ui/sidebar/MasterPageObserver.cxx b/sd/source/ui/sidebar/MasterPageObserver.cxx
index 38df5dd28fda..4751635b10b1 100644
--- a/sd/source/ui/sidebar/MasterPageObserver.cxx
+++ b/sd/source/ui/sidebar/MasterPageObserver.cxx
@@ -221,10 +221,10 @@ void MasterPageObserver::Implementation::Notify(
SfxBroadcaster& rBroadcaster,
const SfxHint& rHint)
{
- if (rHint.ISA(SdrHint))
+ const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
+ if (pSdrHint)
{
- SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
- switch (rSdrHint.GetKind())
+ switch (pSdrHint->GetKind())
{
case HINT_PAGEORDERCHG:
// Process the modified set of pages only when the number of
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index 14ec004a0b2e..58e890340bae 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -281,10 +281,10 @@ void Listener::Notify (
SfxBroadcaster& rBroadcaster,
const SfxHint& rHint)
{
- if (rHint.ISA(SdrHint))
+ const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
+ if (pSdrHint)
{
- SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
- switch (rSdrHint.GetKind())
+ switch (pSdrHint->GetKind())
{
case HINT_MODELCLEARED:
if (&rBroadcaster == mrSlideSorter.GetModel().GetDocument())
@@ -295,16 +295,16 @@ void Listener::Notify (
break;
case HINT_PAGEORDERCHG:
if (&rBroadcaster == mrSlideSorter.GetModel().GetDocument())
- HandleModelChange(rSdrHint.GetPage());
+ HandleModelChange(pSdrHint->GetPage());
break;
default:
break;
}
}
- else if (rHint.ISA(ViewShellHint))
+ else if (dynamic_cast<const ViewShellHint*>(&rHint))
{
- ViewShellHint& rViewShellHint (*PTR_CAST(ViewShellHint,&rHint));
+ const ViewShellHint& rViewShellHint = static_cast<const ViewShellHint&>(rHint);
switch (rViewShellHint.GetHintId())
{
case ViewShellHint::HINT_PAGE_RESIZE_START:
@@ -336,9 +336,9 @@ void Listener::Notify (
break;
}
}
- else if (rHint.ISA(SfxSimpleHint))
+ else if (dynamic_cast<const SfxSimpleHint*>(&rHint))
{
- SfxSimpleHint& rSfxSimpleHint (*PTR_CAST(SfxSimpleHint,&rHint));
+ const SfxSimpleHint& rSfxSimpleHint = static_cast<const SfxSimpleHint&>(rHint);
switch (rSfxSimpleHint.GetId())
{
case SFX_HINT_DOCCHANGED:
diff --git a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx
index a3d7a5fc309b..a8500979b00f 100644
--- a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx
@@ -88,10 +88,10 @@ void TransferableData::DragFinished (sal_Int8 nDropAction)
void TransferableData::Notify (SfxBroadcaster&, const SfxHint& rHint)
{
- if (rHint.ISA(SfxSimpleHint) && mpViewShell!=NULL)
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint && mpViewShell)
{
- SfxSimpleHint& rSimpleHint (*PTR_CAST(SfxSimpleHint, &rHint));
- if (rSimpleHint.GetId() == SFX_HINT_DYING)
+ if (pSimpleHint->GetId() == SFX_HINT_DYING)
{
// This hint may come either from the ViewShell or from the
// document (registered by SdTransferable). We do not know
diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx
index f3fe19d74eca..8549a749834c 100644
--- a/sd/source/ui/tools/EventMultiplexer.cxx
+++ b/sd/source/ui/tools/EventMultiplexer.cxx
@@ -650,10 +650,10 @@ void EventMultiplexer::Implementation::Notify (
SfxBroadcaster&,
const SfxHint& rHint)
{
- if (rHint.ISA(SdrHint))
+ const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
+ if (pSdrHint)
{
- SdrHint& rSdrHint (*PTR_CAST(SdrHint,&rHint));
- switch (rSdrHint.GetKind())
+ switch (pSdrHint->GetKind())
{
case HINT_MODELCLEARED:
case HINT_PAGEORDERCHG:
@@ -666,25 +666,25 @@ void EventMultiplexer::Implementation::Notify (
case HINT_OBJCHG:
CallListeners(EventMultiplexerEvent::EID_SHAPE_CHANGED,
- const_cast<void*>(static_cast<const void*>(rSdrHint.GetPage())));
+ const_cast<void*>(static_cast<const void*>(pSdrHint->GetPage())));
break;
case HINT_OBJINSERTED:
CallListeners(EventMultiplexerEvent::EID_SHAPE_INSERTED,
- const_cast<void*>(static_cast<const void*>(rSdrHint.GetPage())));
+ const_cast<void*>(static_cast<const void*>(pSdrHint->GetPage())));
break;
case HINT_OBJREMOVED:
CallListeners(EventMultiplexerEvent::EID_SHAPE_REMOVED,
- const_cast<void*>(static_cast<const void*>(rSdrHint.GetPage())));
+ const_cast<void*>(static_cast<const void*>(pSdrHint->GetPage())));
break;
default:
break;
}
}
- else if (rHint.ISA(SfxSimpleHint))
+ else if (dynamic_cast<const SfxSimpleHint*>(&rHint))
{
- SfxSimpleHint& rSimpleHint (*PTR_CAST(SfxSimpleHint, &rHint));
+ const SfxSimpleHint& rSimpleHint = static_cast<const SfxSimpleHint&>(rHint);
if (rSimpleHint.GetId() == SFX_HINT_DYING)
mpDocument = NULL;
}
diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx
index 1dda905404ad..ee06476b6ffc 100644
--- a/sd/source/ui/tools/PreviewRenderer.cxx
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -490,20 +490,15 @@ Image PreviewRenderer::ScaleBitmap (
void PreviewRenderer::Notify(SfxBroadcaster&, const SfxHint& rHint)
{
- if (rHint.IsA(TYPE(SfxSimpleHint))
- && mpDocShellOfView != NULL)
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint && mpDocShellOfView && pSimpleHint->GetId() == SFX_HINT_DYING)
{
- const SfxSimpleHint* pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint);
- if (pSimpleHint != NULL
- && pSimpleHint->GetId() == SFX_HINT_DYING)
- {
- // The doc shell is dying. Our view uses its item pool and
- // has to be destroyed as well. The next call to
- // ProvideView will create a new one (for another
- // doc shell, of course.)
- mpView.reset();
- mpDocShellOfView = NULL;
- }
+ // The doc shell is dying. Our view uses its item pool and
+ // has to be destroyed as well. The next call to
+ // ProvideView will create a new one (for another
+ // doc shell, of course.)
+ mpView.reset();
+ mpDocShellOfView = NULL;
}
}
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 83da209c16df..abdda6d62be2 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -149,7 +149,7 @@ SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable()
void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
{
- const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
if( pSdrHint )
{
@@ -389,7 +389,7 @@ void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
if( mpDoc )
{
- const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
if( pSdrHint )
{
@@ -410,7 +410,7 @@ void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
else
{
- const SfxSimpleHint* pSfxHint = PTR_CAST(SfxSimpleHint, &rHint );
+ const SfxSimpleHint* pSfxHint = dynamic_cast<const SfxSimpleHint*>( &rHint );
// did our SdDrawDocument just died?
if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING)
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
index 2c24a0fe3624..8c8f396c82f1 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -80,7 +80,7 @@ SdUnoPageBackground::~SdUnoPageBackground() throw()
void SdUnoPageBackground::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
- const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
if( pSdrHint )
{
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index e6a1cbb96b6e..ae6832b33c6a 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -396,9 +396,10 @@ void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
SfxViewShell::Notify(rBC, rHint);
- if (rHint.IsA(TYPE(SfxEventHint)))
+ const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint);
+ if (pEventHint)
{
- switch (static_cast<const SfxEventHint&>(rHint).GetEventId())
+ switch (pEventHint->GetEventId())
{
case SFX_EVENT_OPENDOC:
if( GetDocument() && GetDocument()->IsStartWithPresentation() )
diff --git a/sd/source/ui/view/ViewShellHint.cxx b/sd/source/ui/view/ViewShellHint.cxx
index 900657b2b361..06f32e614064 100644
--- a/sd/source/ui/view/ViewShellHint.cxx
+++ b/sd/source/ui/view/ViewShellHint.cxx
@@ -21,8 +21,6 @@
namespace sd {
-TYPEINIT1(ViewShellHint, SfxHint);
-
ViewShellHint::ViewShellHint (HintId eHintId)
: SfxHint(),
meHintId(eHintId)
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index 3a0a2b88cf99..780f6eb701d1 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -373,7 +373,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
void DrawView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
- if ( mpDrawViewShell && rHint.ISA(SdrHint) )
+ if ( mpDrawViewShell && dynamic_cast<const SdrHint*>(&rHint) )
{
SdrHintKind eHintKind = ( (SdrHint&) rHint).GetKind();