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 14f9dac4fbaeb0e13ad4875f77960c4019d8f229
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Sun Nov 1 18:09:45 2020 +0100
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Sun Nov 1 20:39:28 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

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index c2d1c5047794..737268f9b8e7 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -111,10 +111,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 706d47cc6996..bfdaf85af4b3 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 c173ca5e69bf..68a76c329007 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1583,6 +1583,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