diff options
author | Eike Rathke <erack@redhat.com> | 2019-06-13 21:41:14 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2019-06-13 23:24:21 +0200 |
commit | 2d36e43d3d3ac69f4cacd532308cfc8c81982864 (patch) | |
tree | 6d86167f448d4d4228e3850ba94189c2521f9803 /sc/source/ui/app | |
parent | cc82a2e92ae99a6cf5ae304e2b9b8dcffa3f514d (diff) |
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@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/app')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
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 |