sc/source/ui/docshell/docsh4.cxx |    7 ++++++-
 sc/source/ui/inc/docsh.hxx       |    1 +
 sc/source/ui/view/tabvwsh4.cxx   |    9 +++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 486034a22860e8db1ef5ea4ee258d3fe0395886d
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Sun Nov 1 18:09:45 2020 +0100
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Tue Nov 3 10:39:17 2020 +0100

    Resolves: tdf#135108 Allow link updates if loaded document so far had none
    
    It is the current user who'll add external references, not the
    creator of the loaded document.
    
    Change-Id: I59a6d0b8600a9b299aa54a1efeedfccc16ad69d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105152
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 14f9dac4fbaeb0e13ad4875f77960c4019d8f229)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105055
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 3aa1426eb9e7..59caa054701b 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -110,10 +110,15 @@ using namespace ::com::sun::star;
 
 #include <svx/xdef.hxx>
 
-void ScDocShell::ReloadAllLinks()
+void ScDocShell::AllowLinkUpdate()
 {
     m_aDocument.SetLinkFormulaNeedingCheck(false);
     getEmbeddedObjectContainer().setUserAllowsLinkUpdate(true);
+}
+
+void ScDocShell::ReloadAllLinks()
+{
+    AllowLinkUpdate();
 
     ReloadTabLinks();
     weld::Window *pDialogParent = GetActiveDialogParent();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index e23067503bae..dc77bdcbb25b 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -294,6 +294,7 @@ public:
 
     virtual void    ReconnectDdeLink(SfxObjectShell& rServer) override;
     void            UpdateLinks() override;
+    void            AllowLinkUpdate();
     void            ReloadAllLinks();
     void            ReloadTabLinks();
     ScLkUpdMode     GetLinkUpdateModeState() const;
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index e57caf3c2c33..c3fa4e1fe39f 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1579,6 +1579,15 @@ void ScTabViewShell::Construct( TriState 
nForceDesignMode )
                                             SfxCallMode::ASYNCHRON | 
SfxCallMode::RECORD );
                 }
             }
+            else
+            {
+                // No links yet, but loading an existing document may have
+                // disabled link update but there's no "Allow updating" infobar
+                // that could enable it again. So in order to enable the user
+                // to add formulas with external references allow link updates
+                // again.
+                pDocSh->AllowLinkUpdate();
+            }
 
             bool bReImport = false;                             // update 
imported data
             ScDBCollection* pDBColl = rDoc.GetDBCollection();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to