sd/source/core/drawdoc.cxx | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
New commits: commit fb8b4a7014eb09c9f0f1d4194c37c5a64913009d Author: Caolán McNamara <[email protected]> AuthorDate: Sun Oct 12 13:33:07 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Oct 12 21:46:15 2025 +0200 ofz: Use-of-uninitialized-value an artifact of using 0 as FieldUnit Change-Id: Ia956a027a01c6489881b275662500ea3e195fe0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192250 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 6a05c2e287a2..7cbf50613202 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -158,24 +158,28 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) SetSwapGraphics(); } - // Set measuring unit (of the application) and scale (of SdMod) - sal_Int32 nX, nY; SdOptions* pOptions = SdModule::get()->GetSdOptions(meDocType); - nX = officecfg::Office::Draw::Zoom::ScaleX::get(); - nY = officecfg::Office::Draw::Zoom::ScaleY::get(); SvtSysLocale aSysLocale; - - // Allow UI scale only for draw documents. - if( eType == DocumentType::Draw ) - if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == MeasurementSystem::Metric) - SetUIUnit( static_cast<FieldUnit>(officecfg::Office::Draw::Layout::Other::MeasureUnit::Metric::get()), Fraction( nX, nY ) ); // user-defined - else - SetUIUnit( static_cast<FieldUnit>(officecfg::Office::Draw::Layout::Other::MeasureUnit::NonMetric::get()), Fraction( nX, nY ) ); // user-defined + // Set measuring unit (of the application) and scale (of SdMod) + if (comphelper::IsFuzzing()) + SetUIUnit(FieldUnit::CM, Fraction(1, 1)); else - if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == MeasurementSystem::Metric) - SetUIUnit( static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::get()), Fraction( 1, 1 ) ); // default + { + sal_Int32 nX = officecfg::Office::Draw::Zoom::ScaleX::get(); + sal_Int32 nY = officecfg::Office::Draw::Zoom::ScaleY::get(); + + // Allow UI scale only for draw documents. + if( eType == DocumentType::Draw ) + if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == MeasurementSystem::Metric) + SetUIUnit( static_cast<FieldUnit>(officecfg::Office::Draw::Layout::Other::MeasureUnit::Metric::get()), Fraction( nX, nY ) ); // user-defined + else + SetUIUnit( static_cast<FieldUnit>(officecfg::Office::Draw::Layout::Other::MeasureUnit::NonMetric::get()), Fraction( nX, nY ) ); // user-defined else - SetUIUnit( static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::get()), Fraction( 1, 1 ) ); // default + if (aSysLocale.GetLocaleData().getMeasurementSystemEnum() == MeasurementSystem::Metric) + SetUIUnit( static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::get()), Fraction( 1, 1 ) ); // default + else + SetUIUnit( static_cast<FieldUnit>(officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::get()), Fraction( 1, 1 ) ); // default + } SetScaleUnit(MapUnit::Map100thMM); SetDefaultFontHeight(o3tl::convert(24, o3tl::Length::pt, o3tl::Length::mm100));
