mso-test: invalid attribute values in srcRect

found by converting tdf97212-1.odp to pptx and running officeotron on the output

we end up with markup like:
    <a:srcRect l="INF" t="NaN" r="NaN" b="INF"/>

Change-Id: I1780cd7b668351b6ced3cd52d557b4a57f959b60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194153
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit bf8db30c20f4c599a53879c0564042b6c4dcb4b6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194200
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2025-11-19 17:44:51 +01:00
committed by Michael Stahl
parent cbf102d4c1
commit 0fa14f38a6
+9 -8
View File
@@ -2014,14 +2014,15 @@ void DrawingML::WriteGraphicCropProperties(uno::Reference<beans::XPropertySet> c
if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
aOriginalSize = Application::GetDefaultDevice()->PixelToLogic(aOriginalSize, MapMode(MapUnit::Map100thMM));
if ( (0 != aGraphicCropStruct.Left) || (0 != aGraphicCropStruct.Top) || (0 != aGraphicCropStruct.Right) || (0 != aGraphicCropStruct.Bottom) )
{
mpFS->singleElementNS( XML_a, XML_srcRect,
XML_l, OString::number(rtl::math::round(aGraphicCropStruct.Left * 100000.0 / aOriginalSize.Width())),
XML_t, OString::number(rtl::math::round(aGraphicCropStruct.Top * 100000.0 / aOriginalSize.Height())),
XML_r, OString::number(rtl::math::round(aGraphicCropStruct.Right * 100000.0 / aOriginalSize.Width())),
XML_b, OString::number(rtl::math::round(aGraphicCropStruct.Bottom * 100000.0 / aOriginalSize.Height())) );
}
if (aOriginalSize.Width() != 0 && aOriginalSize.Height() != 0)
if ( (0 != aGraphicCropStruct.Left) || (0 != aGraphicCropStruct.Top) || (0 != aGraphicCropStruct.Right) || (0 != aGraphicCropStruct.Bottom) )
{
mpFS->singleElementNS( XML_a, XML_srcRect,
XML_l, OString::number(rtl::math::round(aGraphicCropStruct.Left * 100000.0 / aOriginalSize.Width())),
XML_t, OString::number(rtl::math::round(aGraphicCropStruct.Top * 100000.0 / aOriginalSize.Height())),
XML_r, OString::number(rtl::math::round(aGraphicCropStruct.Right * 100000.0 / aOriginalSize.Width())),
XML_b, OString::number(rtl::math::round(aGraphicCropStruct.Bottom * 100000.0 / aOriginalSize.Height())) );
}
}
}