sw: static_cast after dynamic_cast

Change-Id: Ie50fd8bb2bbb26962ead459fe8014828c99fd755
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177789
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2024-12-04 12:49:08 +01:00
parent e3c9a06b70
commit 393565203e

View file

@ -2530,19 +2530,21 @@ Size SwFlyFrame::ChgSize( const Size& aNewSize )
// of the fly frame
Size aAdjustedNewSize( aNewSize );
{
if ( dynamic_cast<SwFlyAtContentFrame*>(this) &&
Lower() && dynamic_cast<SwNoTextFrame*>(Lower()) &&
static_cast<SwNoTextFrame*>(Lower())->GetNode()->GetOLENode() )
if (dynamic_cast<SwFlyAtContentFrame*>(this))
{
SwRect aClipRect;
::CalcClipRect( GetVirtDrawObj(), aClipRect, false );
if ( aAdjustedNewSize.Width() > aClipRect.Width() )
auto pLower = dynamic_cast<SwNoTextFrame*>(Lower());
if ( pLower && pLower->GetNode()->GetOLENode() )
{
aAdjustedNewSize.setWidth( aClipRect.Width() );
}
if ( aAdjustedNewSize.Height() > aClipRect.Height() )
{
aAdjustedNewSize.setWidth( aClipRect.Height() );
SwRect aClipRect;
::CalcClipRect( GetVirtDrawObj(), aClipRect, false );
if ( aAdjustedNewSize.Width() > aClipRect.Width() )
{
aAdjustedNewSize.setWidth( aClipRect.Width() );
}
if ( aAdjustedNewSize.Height() > aClipRect.Height() )
{
aAdjustedNewSize.setWidth( aClipRect.Height() );
}
}
}
}