diff options
author | Dr. David Alan Gilbert <dave@treblig.org> | 2023-05-25 02:44:21 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-05-30 15:37:47 +0200 |
commit | 4998370216bbea3bcaff7fac2d62cbb4ac978c5d (patch) | |
tree | 55fa6645e154244550ab26de3a5cffe370206d3f /sw/source/uibase | |
parent | 8c1892cd80a5095b38e88d558f653b27d93b074c (diff) |
tdf#145538,tdf#147021: sw/source: range based loops
A bunch of range based loop changes in sw/source
that also take out SAL_N_ELEMENTS usages
Change-Id: I28b929d2ecbe40c1b257454f21b5d2ff51d617e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152251
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/dbui/mmconfigitem.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/PageFormatPanel.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/utlui/initui.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/utlui/unotools.cxx | 17 |
4 files changed, 14 insertions, 23 deletions
diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index 17623c0a6068..40c9aac78da1 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -212,9 +212,9 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() : m_bIsGreetingLineInMail_LastUserSetting(false), m_bIsGreetingLine_LastUserSetting(false) { - for (size_t i = 0; i < SAL_N_ELEMENTS(SA_ADDRESS_HEADER); ++i) + for (auto const& [aName, aID] : SA_ADDRESS_HEADER) { - m_AddressHeaderSA.emplace_back(SwResId(SA_ADDRESS_HEADER[i].first), SA_ADDRESS_HEADER[i].second); + m_AddressHeaderSA.emplace_back(SwResId(aName), aID); } const Sequence<OUString>& rNames = GetPropertyNames(); diff --git a/sw/source/uibase/sidebar/PageFormatPanel.cxx b/sw/source/uibase/sidebar/PageFormatPanel.cxx index 189b43bfbe57..fdfa9ce6616d 100644 --- a/sw/source/uibase/sidebar/PageFormatPanel.cxx +++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx @@ -62,19 +62,19 @@ void PageFormatPanel::SetMarginFieldUnit() if (IsInch(meFUnit)) { OUString sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH); - for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_INCH); ++i) + for (auto const& [aName, nSize] : RID_PAGEFORMATPANEL_MARGINS_INCH) { - OUString sStr = rLocaleData.getNum(RID_PAGEFORMATPANEL_MARGINS_INCH[i].second, 2, true, false) + sSuffix; - mxMarginSelectBox->append_text(SwResId(RID_PAGEFORMATPANEL_MARGINS_INCH[i].first).replaceFirst("%1", sStr)); + OUString sStr = rLocaleData.getNum(nSize, 2, true, false) + sSuffix; + mxMarginSelectBox->append_text(SwResId(aName).replaceFirst("%1", sStr)); } } else { OUString sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::CM); - for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_CM); ++i) + for (auto const& [aName, nSize] : RID_PAGEFORMATPANEL_MARGINS_CM) { - OUString sStr = rLocaleData.getNum(RID_PAGEFORMATPANEL_MARGINS_CM[i].second, 2, true, false) + " " + sSuffix; - mxMarginSelectBox->append_text(SwResId(RID_PAGEFORMATPANEL_MARGINS_CM[i].first).replaceFirst("%1", sStr)); + OUString sStr = rLocaleData.getNum(nSize, 2, true, false) + " " + sSuffix; + mxMarginSelectBox->append_text(SwResId(aName).replaceFirst("%1", sStr)); } } mxMarginSelectBox->set_active(nSelected); diff --git a/sw/source/uibase/utlui/initui.cxx b/sw/source/uibase/utlui/initui.cxx index 2444d652ea73..f24cded867f5 100644 --- a/sw/source/uibase/utlui/initui.cxx +++ b/sw/source/uibase/utlui/initui.cxx @@ -135,8 +135,8 @@ ShellResource::ShellResource() sPageDescFollowName( SwResId(STR_PAGEDESC_FOLLOWNAME)), sPageDescName( SwResId(STR_PAGEDESC_NAME)) { - for (size_t i = 0; i < SAL_N_ELEMENTS(FLD_DOCINFO_ARY); ++i) - aDocInfoLst.push_back(SwResId(FLD_DOCINFO_ARY[i])); + for (auto const& aID : FLD_DOCINFO_ARY) + aDocInfoLst.push_back(SwResId(aID)); } OUString ShellResource::GetPageDescName(sal_uInt16 nNo, PageNameMode eMode) diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index b2d08f058567..7e72566685e2 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -87,15 +87,6 @@ static void disableScrollBars(uno::Reference< beans::XPropertySet > const & xVie } } -const sal_Int16 nZoomValues[] = -{ - 20, - 40, - 50, - 75, - 100 -}; - SwOneExampleFrame::SwOneExampleFrame(sal_uInt32 nFlags, const Link<SwOneExampleFrame&,void>* pInitializedLink, const OUString* pURL) @@ -479,13 +470,13 @@ bool SwOneExampleFrame::CreatePopup(const Point& rPt) sal_Int16 nZoom = 0; aZoom >>= nZoom; - for (size_t i = 0; i < SAL_N_ELEMENTS(nZoomValues); ++i) + for (auto const nZoomPreset : { 20, 40, 50, 75, 100 }) { - OUString sTemp = unicode::formatPercent(nZoomValues[i], + OUString sTemp = unicode::formatPercent(nZoomPreset, Application::GetSettings().GetUILanguageTag()); - OUString sIdent = "zoom" + OUString::number(nZoomValues[i]); + OUString sIdent = "zoom" + OUString::number(nZoomPreset); xPop->set_label(sIdent, sTemp); - if (nZoom == nZoomValues[i]) + if (nZoom == nZoomPreset) xPop->set_active(sIdent, true); } |