From 4a5fe0d1b7a1ffeb8240be94db571bcbcebdd846 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 19 Dec 2019 15:19:49 +0000 Subject: SpacingListBox is now unused MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I051200802c7841dc6feb9e3ab852385887c29b09 Reviewed-on: https://gerrit.libreoffice.org/85533 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- svx/source/dialog/spacinglistbox.cxx | 135 ++++++++++------------------------- 1 file changed, 39 insertions(+), 96 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/spacinglistbox.cxx b/svx/source/dialog/spacinglistbox.cxx index ac31393b3a2f..4412e958c7ac 100644 --- a/svx/source/dialog/spacinglistbox.cxx +++ b/svx/source/dialog/spacinglistbox.cxx @@ -20,114 +20,57 @@ #include #include #include -#include #include #include -#include #include -SpacingListBox::SpacingListBox(vcl::Window* pParent) - : ListBox( pParent, WB_BORDER | WB_DROPDOWN) +namespace SpacingListBox { -} - -void SpacingListBox::Init(SpacingType eType) -{ - auto nSelected = GetSelectedEntryPos(); - if (nSelected == LISTBOX_ENTRY_NOTFOUND) - nSelected = 0; - Clear(); - - const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper(); - OUString sSuffix; - - const measurement* pResources; - switch (eType) + void Fill(SpacingType eType, weld::ComboBox& rComboBox) { - case SpacingType::SPACING_INCH: - pResources = RID_SVXSTRARY_SPACING_INCH; - sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH); - break; - case SpacingType::MARGINS_INCH: - pResources = RID_SVXSTRARY_MARGINS_INCH; - sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH); - break; - case SpacingType::SPACING_CM: - pResources = RID_SVXSTRARY_SPACING_CM; - sSuffix = " " + weld::MetricSpinButton::MetricToString(FieldUnit::CM); - break; - default: - case SpacingType::MARGINS_CM: - sSuffix = " " + weld::MetricSpinButton::MetricToString(FieldUnit::CM); - pResources = RID_SVXSTRARY_MARGINS_CM; - break; - } - - while (pResources->key) - { - OUString sMeasurement = rLocaleData.getNum(pResources->human, 2, true, false) + sSuffix; - OUString aStr = SvxResId(pResources->key).replaceFirst("%1", sMeasurement); - sal_uInt16 nData = pResources->twips; - sal_Int32 nPos = InsertEntry( aStr ); - - SetEntryData( nPos, reinterpret_cast(static_cast(nData)) ); - ++pResources; - } + auto nSelected = rComboBox.get_active(); + if (nSelected == -1) + nSelected = 0; + rComboBox.clear(); - SetDropDownLineCount(8); - SelectEntryPos(nSelected); -} + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper(); + OUString sSuffix; -void SpacingListBox::Fill(SpacingType eType, weld::ComboBox& rComboBox) -{ - auto nSelected = rComboBox.get_active(); - if (nSelected == -1) - nSelected = 0; - rComboBox.clear(); + const measurement* pResources; + switch (eType) + { + case SpacingType::SPACING_INCH: + pResources = RID_SVXSTRARY_SPACING_INCH; + sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH); + break; + case SpacingType::MARGINS_INCH: + pResources = RID_SVXSTRARY_MARGINS_INCH; + sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH); + break; + case SpacingType::SPACING_CM: + pResources = RID_SVXSTRARY_SPACING_CM; + sSuffix = " " + weld::MetricSpinButton::MetricToString(FieldUnit::CM); + break; + default: + case SpacingType::MARGINS_CM: + sSuffix = " " + weld::MetricSpinButton::MetricToString(FieldUnit::CM); + pResources = RID_SVXSTRARY_MARGINS_CM; + break; + } - const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper(); - OUString sSuffix; + while (pResources->key) + { + OUString sMeasurement = rLocaleData.getNum(pResources->human, 2, true, false) + sSuffix; + OUString aStr = SvxResId(pResources->key).replaceFirst("%1", sMeasurement); + sal_uInt32 nData = pResources->twips; + rComboBox.append(OUString::number(nData), aStr); + ++pResources; + } - const measurement* pResources; - switch (eType) - { - case SpacingType::SPACING_INCH: - pResources = RID_SVXSTRARY_SPACING_INCH; - sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH); - break; - case SpacingType::MARGINS_INCH: - pResources = RID_SVXSTRARY_MARGINS_INCH; - sSuffix = weld::MetricSpinButton::MetricToString(FieldUnit::INCH); - break; - case SpacingType::SPACING_CM: - pResources = RID_SVXSTRARY_SPACING_CM; - sSuffix = " " + weld::MetricSpinButton::MetricToString(FieldUnit::CM); - break; - default: - case SpacingType::MARGINS_CM: - sSuffix = " " + weld::MetricSpinButton::MetricToString(FieldUnit::CM); - pResources = RID_SVXSTRARY_MARGINS_CM; - break; - } + rComboBox.set_active(nSelected); - while (pResources->key) - { - OUString sMeasurement = rLocaleData.getNum(pResources->human, 2, true, false) + sSuffix; - OUString aStr = SvxResId(pResources->key).replaceFirst("%1", sMeasurement); - sal_uInt32 nData = pResources->twips; - rComboBox.append(OUString::number(nData), aStr); - ++pResources; + rComboBox.set_size_request(150, -1); } - - rComboBox.set_active(nSelected); - - rComboBox.set_size_request(150, -1); } -VCL_BUILDER_FACTORY(SpacingListBox); - -Size SpacingListBox::GetOptimalSize() const -{ - return Size(150, ListBox::GetOptimalSize().Height()); -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit