diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-04 17:06:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-04 16:57:59 +0100 |
commit | 628e96ce1fce194b30a5c2912feb8b7ec0328db0 (patch) | |
tree | 7a901d6da7d0dea1da3ac55ebe96fc33fc904150 /cui/source/tabpages/measure.cxx | |
parent | 9d5365f7cacecf92f1f056dce7bb6bbaf9f0cc40 (diff) |
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I3432afca1ee9bf9e8adce1d55d58d57bf1a09cb4
Reviewed-on: https://gerrit.libreoffice.org/62847
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'cui/source/tabpages/measure.cxx')
-rw-r--r-- | cui/source/tabpages/measure.cxx | 65 |
1 files changed, 11 insertions, 54 deletions
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx index 977c9c253fc5..e27e1c8d9970 100644 --- a/cui/source/tabpages/measure.cxx +++ b/cui/source/tabpages/measure.cxx @@ -166,75 +166,39 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) // SdrMeasureLineDistItem if( pItem == nullptr ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASURELINEDIST ); - if( pItem ) - { - long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); - SetMetricValue( *m_xMtrFldLineDist, nValue, eUnit ); - } - else - { - m_xMtrFldLineDist->set_text(OUString()); - } + SetMetricValue(*m_xMtrFldLineDist, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit); m_xMtrFldLineDist->save_value(); // SdrMeasureHelplineOverhangItem pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINEOVERHANG ); if( pItem == nullptr ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEOVERHANG ); - if( pItem ) - { - long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); - SetMetricValue( *m_xMtrFldHelplineOverhang, nValue, eUnit ); - } - else - { - m_xMtrFldHelplineOverhang->set_text(OUString()); - } + SetMetricValue(*m_xMtrFldHelplineOverhang, static_cast<const SdrMetricItem*>(pItem)->GetValue(), + eUnit); m_xMtrFldHelplineOverhang->save_value(); // SdrMeasureHelplineDistItem pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINEDIST ); if( pItem == nullptr ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEDIST ); - if( pItem ) - { - long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); - SetMetricValue( *m_xMtrFldHelplineDist, nValue, eUnit ); - } - else - { - m_xMtrFldHelplineDist->set_text(OUString()); - } + SetMetricValue(*m_xMtrFldHelplineDist, static_cast<const SdrMetricItem*>(pItem)->GetValue(), + eUnit); m_xMtrFldHelplineDist->save_value(); // SdrMeasureHelpline1LenItem pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINE1LEN ); if( pItem == nullptr ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE1LEN ); - if( pItem ) - { - long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); - SetMetricValue( *m_xMtrFldHelpline1Len, nValue, eUnit ); - } - else - { - m_xMtrFldHelpline1Len->set_text(OUString()); - } + SetMetricValue(*m_xMtrFldHelpline1Len, static_cast<const SdrMetricItem*>(pItem)->GetValue(), + eUnit); m_xMtrFldHelpline1Len->save_value(); // SdrMeasureHelpline2LenItem pItem = GetItem( *rAttrs, SDRATTR_MEASUREHELPLINE2LEN ); if( pItem == nullptr ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE2LEN ); - if( pItem ) - { - long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); - SetMetricValue( *m_xMtrFldHelpline2Len, nValue, eUnit ); - } - else - { - m_xMtrFldHelpline2Len->set_text(OUString()); - } + SetMetricValue(*m_xMtrFldHelpline2Len, static_cast<const SdrMetricItem*>(pItem)->GetValue(), + eUnit); m_xMtrFldHelpline2Len->save_value(); // SdrMeasureBelowRefEdgeItem @@ -253,15 +217,8 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) pItem = GetItem( *rAttrs, SDRATTR_MEASUREDECIMALPLACES ); if( pItem == nullptr ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREDECIMALPLACES ); - if( pItem ) - { - sal_Int16 nValue = static_cast<const SdrMeasureDecimalPlacesItem*>( pItem )->GetValue(); - m_xMtrFldDecimalPlaces->set_value(nValue); - } - else - { - m_xMtrFldDecimalPlaces->set_text(OUString()); - } + m_xMtrFldDecimalPlaces->set_value( + static_cast<const SdrMeasureDecimalPlacesItem*>(pItem)->GetValue()); m_xMtrFldDecimalPlaces->save_value(); // SdrMeasureTextRota90Item |