[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 21 13:22:38 UTC 2021
sw/source/core/doc/notxtfrm.cxx | 5 +++--
sw/source/core/layout/fly.cxx | 9 ++++-----
sw/source/core/layout/frmtool.cxx | 10 ++++++----
3 files changed, 13 insertions(+), 11 deletions(-)
New commits:
commit efacb4bc357761f5d849a4905eff981aa14eb366
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jun 21 13:33:16 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jun 21 15:21:59 2021 +0200
replace dynamic_cast<SwFlyFreeFrame> with cheaper check
Change-Id: Ia84984e47c60eb8407bbddaf9e3365d9f7f52311
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117581
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index e4f2e071afba..05bb89d103ee 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -279,9 +279,10 @@ void SwNoTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect cons
// size instead of scaling it
if ( pGrfNd && rNoTNd.getIDocumentSettingAccess()->get( DocumentSettingId::CLIPPED_PICTURES ) )
{
- const SwFlyFreeFrame *pFly = dynamic_cast< const SwFlyFreeFrame* >( FindFlyFrame() );
- if( pFly )
+ auto pFindFly = FindFlyFrame();
+ if (pFindFly && pFindFly->IsFlyFreeFrame())
{
+ const SwFlyFreeFrame *pFly = static_cast< const SwFlyFreeFrame* >( pFindFly );
bool bGetUnclippedFrame=true;
const SfxPoolItem* pItem;
if( pFly->GetFormat() && SfxItemState::SET == pFly->GetFormat()->GetItemState(RES_BOX, false, &pItem) )
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 8181bd623d39..da5bc1c31272 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2730,9 +2730,9 @@ bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour,
bRet = true;
}
}
- else
+ else if (IsFlyFreeFrame())
{
- const SwFlyFreeFrame* pSwFlyFreeFrame(dynamic_cast< const SwFlyFreeFrame* >(this));
+ const SwFlyFreeFrame* pSwFlyFreeFrame(static_cast< const SwFlyFreeFrame* >(this));
if(nullptr != pSwFlyFreeFrame &&
pSwFlyFreeFrame->supportsAutoContour() &&
@@ -2751,9 +2751,8 @@ bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour,
if(bRet && 0 != rContour.Count())
{
- const SwFlyFreeFrame* pSwFlyFreeFrame(dynamic_cast< const SwFlyFreeFrame* >(this));
-
- if(nullptr != pSwFlyFreeFrame && pSwFlyFreeFrame->isTransformableSwFrame())
+ if (IsFlyFreeFrame() &&
+ static_cast< const SwFlyFreeFrame* >(this)->isTransformableSwFrame())
{
// Need to adapt contour to transformation
basegfx::B2DVector aScale, aTranslate;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 13350fef27c3..03c1f1bbfe02 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -704,9 +704,11 @@ SwFlyNotify::~SwFlyNotify()
// further notifications/invalidations, if format is called by grow/shrink
if ( !pFly->ConsiderObjWrapInfluenceOnObjPos() )
return;
- auto pFlyFreeFrame = dynamic_cast<SwFlyFreeFrame*>(pFly);
- if (pFlyFreeFrame && pFlyFreeFrame->IsNoMoveOnCheckClip())
- return;
+ if (pFly->IsFlyFreeFrame())
+ {
+ if (static_cast<SwFlyFreeFrame*>(pFly)->IsNoMoveOnCheckClip())
+ return;
+ }
// #i54138# - suppress restart of the layout process
// on changed frame height.
@@ -2911,7 +2913,7 @@ static void lcl_AddObjsToPage( SwFrame* _pFrame, SwPageFrame* _pPage )
// anchored Writer fly frames from page
if ( auto pFlyFrame = dynamic_cast<SwFlyFrame*>( pObj) )
{
- if ( dynamic_cast<const SwFlyFreeFrame*>( pObj) != nullptr )
+ if (pFlyFrame->IsFlyFreeFrame())
{
_pPage->AppendFlyToPage( pFlyFrame );
}
More information about the Libreoffice-commits
mailing list