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

Eike Rathke (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 14 00:50:05 UTC 2019


 sc/source/core/tool/compiler.cxx |    9 ++++++---
 sc/source/ui/app/inputhdl.cxx    |   23 ++++++++++++-----------
 2 files changed, 18 insertions(+), 14 deletions(-)

New commits:
commit eb7729d7740b2b16a7111d8fec15b268a03a1f44
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Jun 13 21:41:14 2019 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Fri Jun 14 02:49:35 2019 +0200

    Related: tdf#113541 use reference syntax of the document being edited
    
    When creating a formula referencing an external document by
    travelling (clicking in) to that document, the reference was
    created using the reference syntax of the referenced document,
    which may be different if the syntax was changed for only one of
    the documents after being opened. Use the reference syntax of the
    document being edited instead so the created reference is correct
    and can be compiled.
    
    Change-Id: I07d0ce9cd911ac8e62576b4cdabdfd2569336fbf
    Reviewed-on: https://gerrit.libreoffice.org/73983
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 2d36e43d3d3ac69f4cacd532308cfc8c81982864)
    Reviewed-on: https://gerrit.libreoffice.org/73995

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index cadf157bdc0d..eb8142a913cf 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3046,15 +3046,16 @@ void ScInputHandler::SetReference( const ScRange& rRef, const ScDocument* pDoc )
 {
     HideTip();
 
-    bool bOtherDoc = ( pRefViewSh &&
-                        pRefViewSh->GetViewData().GetDocument() != pDoc );
-    if (bOtherDoc)
-        if (!pDoc->GetDocumentShell()->HasName())
-        {
-            // References to unnamed document; that doesn't work
-            // SetReference should not be called, then
-            return;
-        }
+    const ScDocument* pThisDoc = nullptr;
+    bool bOtherDoc = (pRefViewSh && ((pThisDoc = pRefViewSh->GetViewData().GetDocument()) != pDoc));
+    if (bOtherDoc && !pDoc->GetDocumentShell()->HasName())
+    {
+        // References to unnamed document; that doesn't work
+        // SetReference should not be called, then
+        return;
+    }
+    if (!pThisDoc)
+        pThisDoc = pDoc;
 
     UpdateActiveView();
     if (!pTableView && !pTopView)
@@ -3089,9 +3090,9 @@ void ScInputHandler::SetReference( const ScRange& rRef, const ScDocument* pDoc )
         }
     }
 
-    // Create string from reference
+    // Create string from reference, in the syntax of the document being edited.
     OUString aRefStr;
-    const ScAddress::Details aAddrDetails( pDoc, aCursorPos );
+    const ScAddress::Details aAddrDetails( pThisDoc, aCursorPos );
     if (bOtherDoc)
     {
         // Reference to other document
commit 6e68110a916500a92a15357b6bf90e62dc631a01
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Jun 13 20:25:49 2019 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Fri Jun 14 02:49:21 2019 +0200

    Resolves: tdf#113541 handle external reference in Excel syntax
    
    ... not only OOXML. This wasn't only a problem when creating a
    reference by clicking or travelling to a cell in the external
    document, but also when editing an external reference in Excel_A1
    or Excel_R1C1 reference syntax.
    
    Change-Id: Iee3d529ff9834e5013a61c2056238277f33356fe
    Reviewed-on: https://gerrit.libreoffice.org/73979
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 69903b5c5f9b9015c88931c0eb8a47b52ea3de12)
    Reviewed-on: https://gerrit.libreoffice.org/73987

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 320198151ef3..23788b707d3a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2134,11 +2134,14 @@ Label_MaskStateMachine:
                 }
                 else if( nMask & ScCharFlags::Char )
                 {
-                    // '[' is a special case in OOXML, it can start an external
-                    // reference ID like [1]Sheet1!A1 that needs to be scanned
+                    // '[' is a special case in Excel syntax, it can start an
+                    // external reference, ID in OOXML like [1]Sheet1!A1 or
+                    // Excel_A1 [filename]Sheet!A1 or Excel_R1C1
+                    // [filename]Sheet!R1C1 that needs to be scanned
                     // entirely, or can be ocTableRefOpen, of which the first
                     // transforms an ocDBArea into an ocTableRef.
-                    if (c == '[' && FormulaGrammar::isOOXML( meGrammar) && eLastOp != ocDBArea && maTableRefs.empty())
+                    if (c == '[' && FormulaGrammar::isExcelSyntax( meGrammar)
+                            && eLastOp != ocDBArea && maTableRefs.empty())
                     {
                         nMask &= ~ScCharFlags::Char;
                         goto Label_MaskStateMachine;


More information about the Libreoffice-commits mailing list