summaryrefslogtreecommitdiff
path: root/svx/source/form
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-07-18 21:25:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-07-18 21:27:20 +0100
commit1918546e92ce7a60ecc4fac55f17a0b9dd0a03a0 (patch)
tree8853088b717b2efa99426c0c1fa5778de00022b2 /svx/source/form
parent5e455d5d0c55f63ba39c3337b24460398f195d3c (diff)
dynamic_cast followed by static_cast and elide some casts when possible
Change-Id: Ib7d303bc18aebaa562bb380a8f3ab7d9fddcbca9
Diffstat (limited to 'svx/source/form')
-rw-r--r--svx/source/form/fmundo.cxx19
-rw-r--r--svx/source/form/navigatortreemodel.cxx21
2 files changed, 17 insertions, 23 deletions
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index e49af1dc8abe..db6162f7d1ac 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -184,7 +184,6 @@ FmXUndoEnvironment::FmXUndoEnvironment(FmFormModel& _rModel)
}
}
-
FmXUndoEnvironment::~FmXUndoEnvironment()
{
if ( !m_bDisposed ) // i120746, call FormScriptingEnvironment::dispose to avoid memory leak
@@ -194,7 +193,6 @@ FmXUndoEnvironment::~FmXUndoEnvironment()
delete static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
}
-
void FmXUndoEnvironment::dispose()
{
OSL_ENSURE( !m_bDisposed, "FmXUndoEnvironment::dispose: disposed twice?" );
@@ -288,10 +286,9 @@ void FmXUndoEnvironment::ModeChanged()
void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
{
- const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
- if (pSdrHint)
+ if (const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint))
{
- switch( pSdrHint->GetKind() )
+ switch (pSdrHint->GetKind())
{
case HINT_OBJINSERTED:
{
@@ -308,9 +305,9 @@ void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
break;
}
}
- else if (dynamic_cast<const SfxSimpleHint*>(&rHint))
+ else if (const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint))
{
- switch ( static_cast<const SfxSimpleHint*>(&rHint)->GetId() )
+ switch (pSimpleHint->GetId())
{
case SFX_HINT_DYING:
dispose();
@@ -321,20 +318,18 @@ void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
break;
}
}
- else if (dynamic_cast<const SfxEventHint*>(&rHint))
+ else if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint))
{
- switch ( static_cast<const SfxEventHint*>(&rHint)->GetEventId() )
+ switch (pEventHint->GetEventId())
{
- case SFX_EVENT_CREATEDOC:
+ case SFX_EVENT_CREATEDOC:
case SFX_EVENT_OPENDOC:
ModeChanged();
break;
}
}
-
}
-
void FmXUndoEnvironment::Inserted(SdrObject* pObj)
{
if (pObj->GetObjInventor() == FmFormInventor)
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index fbfbeb6bd8f4..88bb2ac5194c 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -672,9 +672,9 @@ namespace svxform
if (rText == aEntryText)
return pEntryData;
- if( bRecurs && dynamic_cast<const FmFormData*>( pEntryData) != nullptr )
+ if (FmFormData* pFormData = bRecurs ? dynamic_cast<FmFormData*>(pEntryData) : nullptr)
{
- pChildData = FindData( rText, static_cast<FmFormData*>(pEntryData) );
+ pChildData = FindData(rText, pFormData);
if( pChildData )
return pChildData;
}
@@ -683,11 +683,10 @@ namespace svxform
return nullptr;
}
-
void NavigatorTreeModel::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
{
const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
- if( pSdrHint )
+ if (pSdrHint)
{
switch( pSdrHint->GetKind() )
{
@@ -702,18 +701,18 @@ namespace svxform
}
}
// is shell gone?
- else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && static_cast<const SfxSimpleHint*>(&rHint)->GetId() == SFX_HINT_DYING)
- UpdateContent(nullptr);
-
+ else if (const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint))
+ {
+ if (pSimpleHint->GetId() == SFX_HINT_DYING)
+ UpdateContent(nullptr);
+ }
// changed mark of controls?
- else if (dynamic_cast<const FmNavViewMarksChanged*>(&rHint))
+ else if (const FmNavViewMarksChanged* pvmcHint = dynamic_cast<const FmNavViewMarksChanged*>(&rHint))
{
- const FmNavViewMarksChanged* pvmcHint = static_cast<const FmNavViewMarksChanged*>(&rHint);
- BroadcastMarkedObjects( pvmcHint->GetAffectedView()->GetMarkedObjectList() );
+ BroadcastMarkedObjects(pvmcHint->GetAffectedView()->GetMarkedObjectList());
}
}
-
void NavigatorTreeModel::InsertSdrObj( const SdrObject* pObj )
{
const FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );