crashtesting: avoid eventual assert when double inf is cast to sal_Int32

seen on loading forum-mso-en4-604220.xlsx and asserting on export to ods

lets assume that an infinite Y position equates to ALIGN_BOTTOM which is
the case seen in this example, and assume the same for infinite X and
ALIGN_RIGHT if it arises

Change-Id: I009a9cd94b7bd9ed66e18f8dbbb9eb91d37eaa65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168892
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-06-14 15:52:08 +01:00
parent 4890e08519
commit 64da52a947

View file

@ -1119,6 +1119,20 @@ std::shared_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
aNewPosition = RelativePositionHelper::getCenterOfAnchoredObject(
awt::Point(static_cast<sal_Int32>(fX),static_cast<sal_Int32>(fY))
, aTitleUnrotatedSize, aRelativePosition.Anchor, fAnglePi );
const bool bInfiniteY = std::isinf(aRelativePosition.Secondary);
if (bInfiniteY)
{
SAL_WARN("chart2", "infinite aRelativePosition.Secondary position, using ALIGN_BOTTOM");
aNewPosition.Y = rRemainingSpace.Y + rRemainingSpace.Height - aTitleSize.Height/2 - nYDistance;
}
const bool bInfiniteX = std::isinf(aRelativePosition.Primary);
if (bInfiniteX)
{
SAL_WARN("chart2", "infinite aRelativePosition.Primary position, using ALIGN_RIGHT");
aNewPosition.X = rRemainingSpace.X + rRemainingSpace.Width - aTitleSize.Width/2 - nXDistance;
}
}
else //auto position
{