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

Eike Rathke erack at redhat.com
Mon Aug 31 03:53:50 PDT 2015


 sc/source/core/tool/address.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit f139baa08cb65eba659890802d08ec0486b04260
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Aug 26 13:06:05 2015 +0200

    do not parse range fragments as valid ranges
    
    For example, "B2:" or ":B2" were accepted as valid range, with the
    missing part set to A1, which resulted in a A1:B2 range.
    
    An omitted sheet specifier always results in a valid relative sheet,
    hence that flag is set, so testing flags for non-null before the final
    result is available isn't sufficient.
    
    Additionally this revealed a flaw in handling of external references
    when loading documents if the original file name differs from the
    resulting real file name due to relative paths.
    
    Actually now the displayed file name matches the real file name when
    such a document was loaded, where before the original file name was
    displayed.
    
    Probably such references didn't even work before if the reference
    spanned more than one sheet, which is a rather rare case for external
    references.
    
    Change-Id: I38035f2e4b3a11c0280457498cf62b02f882d2a1
    (cherry picked from commit 56238d58a7da705e4e91604964e6564d819a9196)
    Reviewed-on: https://gerrit.libreoffice.org/18035
    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/address.cxx b/sc/source/core/tool/address.cxx
index fa34c64..051b062 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1198,7 +1198,14 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo
             // Need document name if inherited.
             if (bExtDocInherited)
             {
-                const OUString* pFileName = pRefMgr->getExternalFileName( pExtInfo->mnFileId);
+                // The FileId was created using the original file name, so
+                // obtain that. Otherwise lcl_ScRange_External_TabSpan() would
+                // retrieve a FileId for the real name and bail out if that
+                // differed from pExtInfo->mnFileId, as is the case when
+                // loading documents that refer external files relative to the
+                // current own document but were saved from a different path
+                // than loaded.
+                const OUString* pFileName = pRefMgr->getExternalFileName( pExtInfo->mnFileId, true);
                 if (pFileName)
                     aDocName = *pFileName;
                 else
@@ -1521,7 +1528,7 @@ static sal_uInt16 lcl_ScRange_Parse_OOo( ScRange& rRange,
                     nRes2 |= SCA_COL_ABSOLUTE;
                 }
             }
-            if (nRes1 && nRes2)
+            if ((nRes1 & SCA_VALID) && (nRes2 & SCA_VALID))
             {
                 // PutInOrder / Justify
                 sal_uInt16 nMask, nBits1, nBits2;


More information about the Libreoffice-commits mailing list