[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Fri Aug 5 19:19:12 UTC 2016
sc/source/core/tool/interpr4.cxx | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
New commits:
commit f2e3de4dfcf10f9a59f8fc3f051c620fd50ef3c2
Author: Eike Rathke <erack at redhat.com>
Date: Fri Aug 5 21:01:49 2016 +0200
Resolves: rhbz#1364406 inherit the actual format index also for date and time
So summing [HH]:MM cells or calculating with dates uses the same format
in the result, not just the default format of a type.
This also fixes the apparently broken state stored by 4.4 (and earlier,
later?) where no type information was stored with the formula cell,
which may be just due to the old behavior of not applying the actual
format but determining it on the fly instead.
Change-Id: I14d0a7d07185bf5c77e0d7f6989a4a1d1a468d27
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index ed433e3..055d6d9 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4355,9 +4355,18 @@ StackVar ScInterpreter::Interpret()
if ( nFuncFmtType != css::util::NumberFormat::UNDEFINED )
{
nRetTypeExpr = nFuncFmtType;
- // inherit the format index only for currency formats
- nRetIndexExpr = ( nFuncFmtType == css::util::NumberFormat::CURRENCY ?
- nFuncFmtIndex : 0 );
+ // Inherit the format index for currency, date or time formats.
+ switch (nFuncFmtType)
+ {
+ case css::util::NumberFormat::CURRENCY:
+ case css::util::NumberFormat::DATE:
+ case css::util::NumberFormat::TIME:
+ case css::util::NumberFormat::DATETIME:
+ nRetIndexExpr = nFuncFmtIndex;
+ break;
+ default:
+ nRetIndexExpr = 0;
+ }
}
}
More information about the Libreoffice-commits
mailing list