From aea66f8a3d5757e073b9bdcf1ff240371777314e Mon Sep 17 00:00:00 2001 From: David Tardon Date: Mon, 30 Apr 2018 15:30:22 +0200 Subject: convert a sequence of if to a switch Change-Id: Ibca33b2170348ce56e9fa376009ee1cdea2dd67e --- .../source/calc/MSWorksCalcImportFilter.cxx | 50 ++++++++++++---------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'writerperfect') diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx index 969f0e0b4417..2b560e795a55 100644 --- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx +++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx @@ -195,31 +195,35 @@ bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream& rInp if (needEncoding) { OUString title, encoding; - if (creator == libwps::WPS_MSWORKS) - { - title = WpResId(STR_ENCODING_DIALOG_TITLE_MSWORKS); - encoding = "CP850"; - } - else if (creator == libwps::WPS_LOTUS) - { - title = WpResId(STR_ENCODING_DIALOG_TITLE_LOTUS); - encoding = "CP437"; - } - else if (creator == libwps::WPS_SYMPHONY) - { - title = WpResId(STR_ENCODING_DIALOG_TITLE_SYMPHONY); - encoding = "CP437"; - } - else if (creator == libwps::WPS_QUATTRO_PRO) - { - title = WpResId(STR_ENCODING_DIALOG_TITLE_QUATTROPRO); - encoding = "CP437"; - } - else + switch (creator) { - title = WpResId(STR_ENCODING_DIALOG_TITLE_MSMULTIPLAN); - encoding = "CP437"; + case libwps::WPS_MSWORKS: + title = WpResId(STR_ENCODING_DIALOG_TITLE_MSWORKS); + encoding = "CP850"; + break; + case libwps::WPS_LOTUS: + title = WpResId(STR_ENCODING_DIALOG_TITLE_LOTUS); + encoding = "CP437"; + break; + case libwps::WPS_SYMPHONY: + title = WpResId(STR_ENCODING_DIALOG_TITLE_SYMPHONY); + encoding = "CP437"; + break; + case libwps::WPS_QUATTRO_PRO: + title = WpResId(STR_ENCODING_DIALOG_TITLE_QUATTROPRO); + encoding = "CP437"; + break; + case libwps::WPS_RESERVED_2: + title = WpResId(STR_ENCODING_DIALOG_TITLE_MSMULTIPLAN); + encoding = "CP437"; + break; + default: + SAL_INFO("writerperfect", "unexpected creator: " << creator); + title = WpResId(STR_ENCODING_DIALOG_TITLE); + encoding = "CP437"; + break; } + try { const ScopedVclPtrInstance pDlg(title, encoding); -- cgit