summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-08-05 21:01:49 +0200
committerEike Rathke <erack@redhat.com>2016-08-05 21:18:41 +0200
commitf2e3de4dfcf10f9a59f8fc3f051c620fd50ef3c2 (patch)
tree55fa76d08f7472f7ebc6193e5d3b5df55173cd59 /sc
parenta141cba76606c7dcc4965f0a25cc9a4ff2d8879e (diff)
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
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr4.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index ed433e31839d..055d6d988824 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;
+ }
}
}