sc/source/core/data/column3.cxx |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit bb329b0fbcc416b122885511f6120992bb369959
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Jun 27 14:12:32 2019 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Jul 17 21:31:10 2019 +0200

    Resolves: tdf#126116 keep original date format if detected type is identical
    
    Regression from
    
        commit 478e051f4ea13b15120fdf74faf94a6c2cfcb50c
        CommitDate: Tue May 21 15:35:07 2019 +0200
    
            Resolves: tdf#125109 prefer edit format's acceptance patterns and 
YMD order
    
    Change-Id: If1240f75ca7c4d46c156966a72b6a98c83448770
    Reviewed-on: https://gerrit.libreoffice.org/74803
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit e6a1bbe6690474e752416c81e1ca8c82b2843539)
    Reviewed-on: https://gerrit.libreoffice.org/74856
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 903111b20769..013cbd0850cc 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2057,11 +2057,23 @@ bool ScColumn::ParseString(
                 if (!bIsNumberFormat)
                     break;
 
-                // convert back to the original language if a built-in format 
was detected
-                if (!pOldFormat)
-                    pOldFormat = aParam.mpNumFormatter->GetEntry( nOldIndex );
-                if ( pOldFormat )
-                    nIndex = 
aParam.mpNumFormatter->GetFormatForLanguageIfBuiltIn( nIndex, 
pOldFormat->GetLanguage() );
+                // If we have bForceFormatDate, the pOldFormat was/is of
+                // nOldIndex date(+time) type already, if detected type is
+                // compatible keep the original format.
+                if (bForceFormatDate && SvNumberFormatter::IsCompatible(
+                            eNumFormatType, aParam.mpNumFormatter->GetType( 
nIndex)))
+                {
+                    nIndex = nOldIndex;
+                }
+                else
+                {
+                    // convert back to the original language if a built-in 
format was detected
+                    if (!pOldFormat)
+                        pOldFormat = aParam.mpNumFormatter->GetEntry( 
nOldIndex );
+                    if (pOldFormat)
+                        nIndex = 
aParam.mpNumFormatter->GetFormatForLanguageIfBuiltIn(
+                                nIndex, pOldFormat->GetLanguage());
+                }
 
                 rCell.set(nVal);
                 if ( nIndex != nOldIndex)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to