summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-03 10:49:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-03 13:11:41 +0200
commit3c1026bd793ebd81a94a9bf8514553aea23ce375 (patch)
tree59fd71215935f9051a8e43879fd5bcf1c7060684 /i18npool
parent9eaaf3b7e1d55d064c0518cbbb7bb724e219e10a (diff)
only loop over props once
Change-Id: If41314c90397199c14c91fe65ed41243ac385dae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97827 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx31
1 files changed, 11 insertions, 20 deletions
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index ae1e77055e88..648e55be3b07 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -621,30 +621,21 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal
OUString prefix;
sal_Int16 numType = -1; // type of formatting from style::NumberingType (roman, arabic, etc)
OUString suffix;
- sal_Int32 number = -12345; // the number that needs to be formatted.
+ sal_Int32 number = -1; // the number that needs to be formatted.
// int nProperties = aProperties.getLength();
// int last = nProperties-1;
- try {
- getPropertyByName(aProperties, "Prefix", false) >>=prefix;
- } catch (Exception&) {
- //prefix _must_ be empty here!
- }
- try {
- getPropertyByName(aProperties, "Suffix", false) >>=suffix;
- } catch (Exception&) {
- //suffix _must_ be empty here!
- }
- try {
- getPropertyByName(aProperties, "NumberingType", true) >>=numType;
- } catch (Exception& ) {
- numType = -1;
- }
- try {
- getPropertyByName(aProperties, "Value", true) >>=number;
- } catch (Exception& ) {
- number = -1;
+ for (auto const & prop : aProperties)
+ {
+ if (prop.Name == "Prefix")
+ prop.Value >>= prefix;
+ else if (prop.Name == "Suffix")
+ prop.Value >>= suffix;
+ else if (prop.Name == "NumberingType")
+ prop.Value >>= numType;
+ else if (prop.Name == "Value")
+ prop.Value >>= number;
}
if( number <= 0 )