diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-04-13 08:01:29 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2022-04-14 16:15:25 +0200 |
commit | bfc43aad0e8eb90e9d3495b940bc2283081f04c6 (patch) | |
tree | 6b8cd4a50f8d5b022969ec3ce96d138be05a899a /sfx2/source | |
parent | 3f793465819f63aa001f5842f232be24d13153fd (diff) |
Prevent save interception when sharing Calc doc
Using the dispatch mechanism means that this can be caught by the dispatch interceptor
which we don't want in this place.
Change-Id: Ie7e5f92e6043e2aff98d4887829a3573c12c6d08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132941
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 9acfe6d1651b..a09a7ac9feef 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -97,6 +97,7 @@ #include <workwin.hxx> #include <sfx2/sfxdlg.hxx> #include <sfx2/infobar.hxx> +#include <sfx2/sfxbasemodel.hxx> #include <openflag.hxx> #include "objstor.hxx" #include <appopen.hxx> @@ -507,9 +508,16 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool bSave ) { // TODO/LATER: currently the application guards against the reentrance problem SetModified(); // the modified flag has to be set to let the document be stored with the shared flag - const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC ); - const SfxBoolItem* pResult = dynamic_cast<const SfxBoolItem*>( pItem ); - bResult = ( pResult && pResult->GetValue() ); + try + { + // Do *not* use dispatch mechanism in this place - we don't want others (extensions etc.) to intercept this. + pImpl->pBaseModel->store(); + bResult = true; + } + catch (...) + { + bResult = false; + } } } |