summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-08-05 21:01:49 +0200
committerAndras Timar <andras.timar@collabora.com>2016-08-23 10:48:15 +0200
commitcfed2619b3a394fd6badadb2851cff898a1670bd (patch)
tree404c4a636d5899b4cf631c77bf7cc9028bfaf647
parentf3033dbbdf68c89dcc31d6cdee82a57a4bb79cdb (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 (cherry picked from commit f2e3de4dfcf10f9a59f8fc3f051c620fd50ef3c2) Reviewed-on: https://gerrit.libreoffice.org/27917 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 6b63d44fee68a8db94b045c60767ee11a7265446)
-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 0642fcd29595..6bd15b7bbd13 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4074,9 +4074,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;
+ }
}
}