From 343a23058e080c28088a97bf22e444160aa2030e Mon Sep 17 00:00:00 2001 From: Laurent Balland-Poirier Date: Sat, 31 Jan 2015 16:47:28 +0100 Subject: tdf#88960 Scientific format: add/remove digits with buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use buttons "Add Decimal Place" or "Delete Decimal Place" to change the number of significant digits with scientific format (also works for "General" format) Improve format management for "red for negative" to be compatible with tdf#88999 Change-Id: Id681afc4fc73674c9823172c6cd71925e63b867f Reviewed-on: https://gerrit.libreoffice.org/14264 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- svl/source/numbers/zforlist.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'svl') diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 2a3ed223a032..8a9b17a6b423 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -2652,6 +2652,19 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, { sString.append('%'); } + else if (eType == NUMBERFORMAT_SCIENTIFIC) + { + OUStringBuffer sOldFormatString = pFormat->GetFormatstring(); + sal_Int32 nIndexE = sOldFormatString.indexOf('E'); + if (nIndexE > -1) + { + sal_Int32 nIndexSep = sOldFormatString.indexOf(';'); + if (nIndexSep > -1) + sString.append( sOldFormatString.copy(nIndexE, nIndexSep - nIndexE) ); + else + sString.append( sOldFormatString.copy(nIndexE) ); + } + } else if (eType == NUMBERFORMAT_CURRENCY) { OUStringBuffer sNegStr(sString); -- cgit