diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-08 01:27:54 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-09-12 14:18:51 +0200 |
commit | 6c292d3150f414e9e16c84caba7c6b106355bf7e (patch) | |
tree | 1a3fca8eaf78ed6b3a6e7fe1414ad2a61932142c /sc | |
parent | c64dc9ab966bf583183aaab79f91dadf852d0ccb (diff) |
Simplify: use getToken and just store converted integers
Change-Id: I11e640307ba868b02823a7f7fa4475bc71721b23
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx index f45971160958..31a4a0671190 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -249,31 +249,18 @@ void NumberFormatPropertyPanel::NotifyItemUpdate( { const SfxStringItem* pItem = static_cast<const SfxStringItem*>(pState); OUString aCode = pItem->GetValue(); - sal_uInt16 aLen = aCode.getLength(); - OUString* sFormat = new OUString[4]; - OUString sTmpStr = ""; - sal_uInt16 nCount = 0; - sal_uInt16 nStrCount = 0; - while( nCount < aLen ) + sal_Int32 nIndex = 0; + sal_Int32 aFormat[4] = {0}; + for (size_t i=0; i<SAL_N_ELEMENTS(aFormat); ++i) { - sal_Unicode cChar = aCode[nCount]; - if(cChar == ',') - { - sFormat[nStrCount] = sTmpStr; - sTmpStr.clear(); - nStrCount++; - } - else - { - sTmpStr += OUString(cChar); - } - nCount++; + aFormat[i] = aCode.getToken(0, ',', nIndex).toInt32(); + if (nIndex<0) + break; } - bThousand = sFormat[0].toInt32(); - bNegRed = sFormat[1].toInt32(); - nPrecision = (sal_uInt16)sFormat[2].toInt32(); - nLeadZeroes = (sal_uInt16)sFormat[3].toInt32(); - delete[] sFormat; + bThousand = static_cast<bool>(aFormat[0]); + bNegRed = static_cast<bool>(aFormat[1]); + nPrecision = static_cast<sal_uInt16>(aFormat[2]); + nLeadZeroes = static_cast<sal_uInt16>(aFormat[3]); } else { |