diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-21 12:31:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-21 14:58:51 +0200 |
commit | 29489b33b435683021b72cb2bce27aba8cb7a430 (patch) | |
tree | 8e4e1c59d56d5ed0d0ca4d088419067041e4553a /svx | |
parent | a4244c0f05b95ded277a3a7ed217bf0451daa996 (diff) |
loplugin:flatten
Change-Id: I3b4226a9d089ec9aedab95d96e50a068f57a76c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123991
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sdr/properties/defaultproperties.cxx | 48 | ||||
-rw-r--r-- | svx/source/unodraw/SvxXTextColumns.cxx | 38 |
2 files changed, 45 insertions, 41 deletions
diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index fd27a9744d80..fadebf4c6dfd 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -110,20 +110,20 @@ namespace sdr::properties { const sal_uInt16 nWhichID(rItem.Which()); - if(AllowItemChange(nWhichID, &rItem)) - { - ItemChange(nWhichID, &rItem); - PostItemChange(nWhichID); + if(!AllowItemChange(nWhichID, &rItem)) + return; - if (WantItemSetInItemSetChanged()) - { - SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhichID, nWhichID); - aSet.Put(rItem); - ItemSetChanged(&aSet); - } - else - ItemSetChanged(nullptr); + ItemChange(nWhichID, &rItem); + PostItemChange(nWhichID); + + if (WantItemSetInItemSetChanged()) + { + SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhichID, nWhichID); + aSet.Put(rItem); + ItemSetChanged(&aSet); } + else + ItemSetChanged(nullptr); } void DefaultProperties::SetObjectItemDirect(const SfxPoolItem& rItem) @@ -138,21 +138,21 @@ namespace sdr::properties void DefaultProperties::ClearObjectItem(const sal_uInt16 nWhich) { - if(AllowItemChange(nWhich)) - { - ItemChange(nWhich); - PostItemChange(nWhich); + if(!AllowItemChange(nWhich)) + return; + + ItemChange(nWhich); + PostItemChange(nWhich); - if(nWhich) + if(nWhich) + { + if (WantItemSetInItemSetChanged()) { - if (WantItemSetInItemSetChanged()) - { - SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhich, nWhich); - ItemSetChanged(&aSet); - } - else - ItemSetChanged(nullptr); + SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhich, nWhich); + ItemSetChanged(&aSet); } + else + ItemSetChanged(nullptr); } } diff --git a/svx/source/unodraw/SvxXTextColumns.cxx b/svx/source/unodraw/SvxXTextColumns.cxx index ee0fa10fa1d4..00971bc7bc87 100644 --- a/svx/source/unodraw/SvxXTextColumns.cxx +++ b/svx/source/unodraw/SvxXTextColumns.cxx @@ -206,11 +206,13 @@ void SvxXTextColumns::setPropertyValue(const OUString& rPropertyName, const css: switch (pEntry->nWID) { case WID_TXTCOL_LINE_WIDTH: - if (sal_Int32 nTmp; !(aValue >>= nTmp) || nTmp < 0) + { + sal_Int32 nTmp; + if (!(aValue >>= nTmp) || nTmp < 0) throw css::lang::IllegalArgumentException(); - else - m_nSepLineWidth = o3tl::toTwips(nTmp, o3tl::Length::mm100); + m_nSepLineWidth = o3tl::toTwips(nTmp, o3tl::Length::mm100); break; + } case WID_TXTCOL_LINE_COLOR: if (!(aValue >>= m_nSepLineColor)) throw css::lang::IllegalArgumentException(); @@ -220,11 +222,13 @@ void SvxXTextColumns::setPropertyValue(const OUString& rPropertyName, const css: throw css::lang::IllegalArgumentException(); break; case WID_TXTCOL_LINE_REL_HGT: - if (sal_Int32 nTmp; !(aValue >>= nTmp) || nTmp < 0) + { + sal_Int32 nTmp; + if (!(aValue >>= nTmp) || nTmp < 0) throw css::lang::IllegalArgumentException(); - else - m_nSepLineHeightRelative = nTmp; + m_nSepLineHeightRelative = nTmp; break; + } case WID_TXTCOL_LINE_ALIGN: if (css::style::VerticalAlignment eAlign; aValue >>= eAlign) m_nSepLineVertAlign = eAlign; @@ -238,21 +242,21 @@ void SvxXTextColumns::setPropertyValue(const OUString& rPropertyName, const css: throw css::lang::IllegalArgumentException(); break; case WID_TXTCOL_AUTO_DISTANCE: - if (sal_Int32 nTmp; !(aValue >>= nTmp) || nTmp < 0 || nTmp >= m_nReference) + { + sal_Int32 nTmp; + if (!(aValue >>= nTmp) || nTmp < 0 || nTmp >= m_nReference) throw css::lang::IllegalArgumentException(); - else + m_nAutoDistance = nTmp; + sal_Int32 nColumns = m_aTextColumns.getLength(); + css::text::TextColumn* pCols = m_aTextColumns.getArray(); + sal_Int32 nDist = m_nAutoDistance / 2; + for (sal_Int32 i = 0; i < nColumns; i++) { - m_nAutoDistance = nTmp; - sal_Int32 nColumns = m_aTextColumns.getLength(); - css::text::TextColumn* pCols = m_aTextColumns.getArray(); - sal_Int32 nDist = m_nAutoDistance / 2; - for (sal_Int32 i = 0; i < nColumns; i++) - { - pCols[i].LeftMargin = i == 0 ? 0 : nDist; - pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist; - } + pCols[i].LeftMargin = i == 0 ? 0 : nDist; + pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist; } break; + } } } |