summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-07 15:53:33 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-10-07 17:46:04 +0200
commitd576baca31d2a2d9d96c203dfafb59dfda8f064b (patch)
tree2a35be6fc32064f1ffd7bfc0af4176bb1e467c98
parentaff70ac6ce3362fb76a74aa0d732a979bd047537 (diff)
dynamic_cast followed by static_cast
Change-Id: I0e5b7a2531f10d7a9cafa45f33f128f82603f30f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104062 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/frmedt/fecopy.cxx12
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx7
2 files changed, 7 insertions, 12 deletions
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index ffb74b457180..16a42d8a168b 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -397,10 +397,8 @@ bool SwFEShell::CopyDrawSel( SwFEShell& rDestShell, const Point& rSttPt,
pFormat->SetFormatAttr( SwFormatVertOrient( aPos.getY(), text::VertOrientation::NONE, text::RelOrientation::FRAME ) );
// #i47455# - notify draw frame format
// that position attributes are already set.
- if ( dynamic_cast<const SwDrawFrameFormat*>( pFormat) != nullptr )
- {
- static_cast<SwDrawFrameFormat*>(pFormat)->PosAttrSet();
- }
+ if (SwDrawFrameFormat *pDrawFormat = dynamic_cast<SwDrawFrameFormat*>(pFormat))
+ pDrawFormat->PosAttrSet();
}
if( bSelectInsert )
pDestDrwView->MarkObj( pNew, pDestPgView );
@@ -997,10 +995,8 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable)
pDV->MarkObj( pObj, pDV->GetSdrPageView() );
// #i47455# - notify draw frame format
// that position attributes are already set.
- if ( dynamic_cast<const SwDrawFrameFormat*>( pNew) != nullptr )
- {
- static_cast<SwDrawFrameFormat*>(pNew)->PosAttrSet();
- }
+ if (SwDrawFrameFormat *pDrawFormat = dynamic_cast<SwDrawFrameFormat*>(pNew))
+ pDrawFormat->PosAttrSet();
}
}
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 53f9739502eb..3b24423abce6 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2817,11 +2817,10 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
}
}
+ SwDrawFrameFormat* pDrawFrameFormat = dynamic_cast<SwDrawFrameFormat*>(pRetFrameFormat);
// #i44344#, #i44681# - positioning attributes already set
- if ( pRetFrameFormat /*#i52825# */ && dynamic_cast< const SwDrawFrameFormat *>( pRetFrameFormat ) != nullptr )
- {
- static_cast<SwDrawFrameFormat*>(pRetFrameFormat)->PosAttrSet();
- }
+ if (pDrawFrameFormat)
+ pDrawFrameFormat->PosAttrSet();
if (!IsInlineEscherHack())
MapWrapIntoFlyFormat(pRecord, pRetFrameFormat);