[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

Eike Rathke erack at redhat.com
Tue Aug 16 20:05:25 UTC 2016


 sc/source/core/tool/interpr4.cxx |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 6b63d44fee68a8db94b045c60767ee11a7265446
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
    (cherry picked from commit f2e3de4dfcf10f9a59f8fc3f051c620fd50ef3c2)
    Reviewed-on: https://gerrit.libreoffice.org/27917
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2e31123..bf155a8 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;
+                }
             }
         }
 


More information about the Libreoffice-commits mailing list