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

Eike Rathke erack at redhat.com
Tue Aug 9 20:48:56 UTC 2016


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

New commits:
commit 0ace5d2c25042cc03e42d4d7b8cfc47d031fa99c
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/27916
    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 8997c8f..e4b3e5e 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4149,9 +4149,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