Skip to content

Commit 22c9f9b

Browse files
caolanmXisco Fauli
authored andcommitted
cid#1660069 Division or modulo by float zero
and cid#1660394 Division or modulo by float zero Change-Id: I10b0b100ff3fe99682bf4e0da6bc9ef3e356a996 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189257 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins (cherry picked from commit 56c55dc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189294 Reviewed-by: Xisco Fauli <[email protected]>
1 parent 0326f81 commit 22c9f9b

File tree

1 file changed

+35
-25
lines changed

1 file changed

+35
-25
lines changed

cui/source/tabpages/transfrm.cxx

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,18 +1020,23 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* )
10201020

10211021
if ( !mbPageDisabled )
10221022
{
1023-
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_X );
1024-
if ( pItem )
1023+
m_xMtrPosX->set_sensitive(fUIScale != 0.0);
1024+
m_xMtrPosY->set_sensitive(fUIScale != 0.0);
1025+
if (fUIScale != 0.0)
10251026
{
1026-
const double fTmp((static_cast<const SfxInt32Item*>(pItem)->GetValue() - maAnchor.getX()) / fUIScale);
1027-
SetMetricValue(*m_xMtrPosX, basegfx::fround(fTmp), mePoolUnit);
1028-
}
1027+
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_X );
1028+
if ( pItem )
1029+
{
1030+
const double fTmp((static_cast<const SfxInt32Item*>(pItem)->GetValue() - maAnchor.getX()) / fUIScale);
1031+
SetMetricValue(*m_xMtrPosX, basegfx::fround(fTmp), mePoolUnit);
1032+
}
10291033

1030-
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_Y );
1031-
if ( pItem )
1032-
{
1033-
const double fTmp((static_cast<const SfxInt32Item*>(pItem)->GetValue() - maAnchor.getY()) / fUIScale);
1034-
SetMetricValue(*m_xMtrPosY, basegfx::fround(fTmp), mePoolUnit);
1034+
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_Y );
1035+
if ( pItem )
1036+
{
1037+
const double fTmp((static_cast<const SfxInt32Item*>(pItem)->GetValue() - maAnchor.getY()) / fUIScale);
1038+
SetMetricValue(*m_xMtrPosY, basegfx::fround(fTmp), mePoolUnit);
1039+
}
10351040
}
10361041

10371042
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_POS );
@@ -1052,22 +1057,27 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet* )
10521057
ChangePosProtectHdl(*m_xTsbPosProtect);
10531058
}
10541059

1055-
{ // #i75273# set width
1056-
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_WIDTH );
1057-
mfOldWidth = std::max( pItem ? static_cast<double>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0.0, 1.0 );
1058-
double fTmpWidth((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldWidth), mePoolUnit, MapUnit::Map100thMM)) / fUIScale);
1059-
if (m_xMtrWidth->get_digits())
1060-
fTmpWidth *= pow(10.0, m_xMtrWidth->get_digits());
1061-
m_xMtrWidth->set_value(fTmpWidth, FieldUnit::MM_100TH);
1062-
}
1060+
m_xMtrWidth->set_sensitive(fUIScale != 0.0);
1061+
m_xMtrHeight->set_sensitive(fUIScale != 0.0);
1062+
if (fUIScale != 0.0)
1063+
{
1064+
{ // #i75273# set width
1065+
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_WIDTH );
1066+
mfOldWidth = std::max( pItem ? static_cast<double>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0.0, 1.0 );
1067+
double fTmpWidth((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldWidth), mePoolUnit, MapUnit::Map100thMM)) / fUIScale);
1068+
if (m_xMtrWidth->get_digits())
1069+
fTmpWidth *= pow(10.0, m_xMtrWidth->get_digits());
1070+
m_xMtrWidth->set_value(fTmpWidth, FieldUnit::MM_100TH);
1071+
}
10631072

1064-
{ // #i75273# set height
1065-
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_HEIGHT );
1066-
mfOldHeight = std::max( pItem ? static_cast<double>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0.0, 1.0 );
1067-
double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldHeight), mePoolUnit, MapUnit::Map100thMM)) / fUIScale);
1068-
if (m_xMtrHeight->get_digits())
1069-
fTmpHeight *= pow(10.0, m_xMtrHeight->get_digits());
1070-
m_xMtrHeight->set_value(fTmpHeight, FieldUnit::MM_100TH);
1073+
{ // #i75273# set height
1074+
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_HEIGHT );
1075+
mfOldHeight = std::max( pItem ? static_cast<double>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()) : 0.0, 1.0 );
1076+
double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldHeight), mePoolUnit, MapUnit::Map100thMM)) / fUIScale);
1077+
if (m_xMtrHeight->get_digits())
1078+
fTmpHeight *= pow(10.0, m_xMtrHeight->get_digits());
1079+
m_xMtrHeight->set_value(fTmpHeight, FieldUnit::MM_100TH);
1080+
}
10711081
}
10721082

10731083
pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE );

0 commit comments

Comments
 (0)