diff options
author | Eike Rathke <erack@redhat.com> | 2019-08-16 15:36:15 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-06-23 16:08:15 +0200 |
commit | 78bfcf7727119b1e039f9a61e08026a506f2390b (patch) | |
tree | 2349e434b2d765ca725e971d1dc77b254ee3c25a /sc/source/ui/docshell/docsh4.cxx | |
parent | d8d541523a80a207176b512c4153e50ebbc899f0 (diff) |
Resolves: tdf#126928 allow link updates in an intermediate linked document
... if link updates are allowed in the current document and that
intermediate document resides in a trusted location.
This works with both, the "Always (from trusted locations)" and
the "On request" settings under Tools -> Options -> Calc ->
General. It can't work with documents residing in a non-trusted
location as there is no way to allow updates on demand for a such
loaded document (hidden via formulas).
Reviewed-on: https://gerrit.libreoffice.org/77588
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 54bf84746a2a9a2e2aaf0df9e429b0cfd538f640)
Reviewed-on: https://gerrit.libreoffice.org/77604
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit 14825a8b7f00ee4c148f2583856e5102312cabbd)
(cherry picked from commit f136b30fa3e991b780e4b1ed704d04256d0cfca0)
Change-Id: Ie483f7743db7c6d5cf947dc16a9c3660855f3423
Diffstat (limited to 'sc/source/ui/docshell/docsh4.cxx')
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index c157374b21d8..23ce5db529f7 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -112,6 +112,41 @@ using namespace ::com::sun::star; #include <memory> #include <sfx2/notebookbar/SfxNotebookBar.hxx> +ScLkUpdMode ScDocShell::GetLinkUpdateModeState() const +{ + const ScDocument& rDoc = GetDocument(); + + ScLkUpdMode nSet = rDoc.GetLinkMode(); + + if (nSet == LM_UNKNOWN) + { + ScAppOptions aAppOptions = SC_MOD()->GetAppOptions(); + nSet = aAppOptions.GetLinkMode(); + } + + if (m_nCanUpdate == css::document::UpdateDocMode::NO_UPDATE) + nSet = LM_NEVER; + else if (m_nCanUpdate == css::document::UpdateDocMode::FULL_UPDATE) + nSet = LM_ALWAYS; + + if (nSet == LM_ALWAYS + && !(SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( + GetMedium() == nullptr ? OUString() : GetMedium()->GetName()) + || (IsDocShared() + && SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( + GetSharedFileURL())))) + { + nSet = LM_ON_DEMAND; + } + if (m_nCanUpdate == css::document::UpdateDocMode::QUIET_UPDATE + && nSet == LM_ON_DEMAND) + { + nSet = LM_NEVER; + } + + return nSet; +} + void ScDocShell::Execute( SfxRequest& rReq ) { const SfxItemSet* pReqArgs = rReq.GetArgs(); @@ -413,33 +448,9 @@ void ScDocShell::Execute( SfxRequest& rReq ) ScDocument& rDoc = GetDocument(); - ScLkUpdMode nSet = rDoc.GetLinkMode(); - sal_uInt16 nDlgRet=RET_NO; - if(nSet==LM_UNKNOWN) - { - ScAppOptions aAppOptions=SC_MOD()->GetAppOptions(); - nSet=aAppOptions.GetLinkMode(); - } - if (m_nCanUpdate == css::document::UpdateDocMode::NO_UPDATE) - nSet = LM_NEVER; - else if (m_nCanUpdate == css::document::UpdateDocMode::FULL_UPDATE) - nSet = LM_ALWAYS; - - if (nSet == LM_ALWAYS - && !(SvtSecurityOptions() - .isTrustedLocationUriForUpdatingLinks( - GetMedium() == nullptr - ? OUString() : GetMedium()->GetName()))) - { - nSet = LM_ON_DEMAND; - } - if (m_nCanUpdate == css::document::UpdateDocMode::QUIET_UPDATE - && nSet == LM_ON_DEMAND) - { - nSet = LM_NEVER; - } + ScLkUpdMode nSet = GetLinkUpdateModeState(); if(nSet==LM_ON_DEMAND) { |