[Libreoffice-commits] core.git: sc/source

Eike Rathke (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 13 21:25:18 UTC 2019


 sc/source/ui/app/inputhdl.cxx |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 2d36e43d3d3ac69f4cacd532308cfc8c81982864
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Jun 13 21:41:14 2019 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Thu Jun 13 23:24:21 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

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


More information about the Libreoffice-commits mailing list