diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-04-07 16:21:08 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-04-08 07:42:16 +0200 |
commit | e24e780f18830218666514e4e4b83243acf153e8 (patch) | |
tree | 2959d91785595674c6615762df24395b17c65537 /sfx2 | |
parent | eef5cd364f709ea9abe2286eb252ffcf0f344ed6 (diff) |
Fix edit button still appearing in Calc
... even when editing readonly docs was disabled.
Viewshell was not yet available at this point, so
move the code where it belongs, into the object shell.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91832
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit 523922ee9d033fd304d2b50a72b76853ddcfbcdf)
Change-Id: I71cbaf9c912beeeb0b8177538999049f7f8b4e03
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 7 |
3 files changed, 12 insertions, 12 deletions
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 0aad46e02258..f6b1e16c54df 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -84,6 +84,8 @@ #include <comphelper/interaction.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/documentconstants.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <officecfg/Office/Common.hxx> #include <sfx2/signaturestate.hxx> #include <sfx2/app.hxx> @@ -1860,4 +1862,11 @@ bool SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMess return mbContinueImportOnFilterExceptions == yes; } +bool SfxObjectShell::isEditDocLocked() +{ + if (!officecfg::Office::Common::Misc::AllowEditReadonlyDocs::get()) + return true; + return false; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index b1d29d0f09fa..b14a16bfa335 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -278,9 +278,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT )) break; - - SfxViewShell* pViewSh = GetViewShell(); - if (pViewSh && pViewSh->isEditDocLocked()) + if (pSh->isEditDocLocked()) break; // Only change read-only UI and remove info bar when we succeed @@ -868,7 +866,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) const SfxShell *pFSh; if ( !pSh->HasName() || !( pSh->Get_Impl()->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT ) || - (GetViewShell() && GetViewShell()->isEditDocLocked()) || + (pSh->isEditDocLocked()) || ( pSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED && ( !(pVSh = pSh->GetViewShell()) || !(pFSh = pVSh->GetFormShell()) || @@ -1307,7 +1305,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } bool showEditDocumentButton = true; - if (m_xObjSh->GetViewShell() && m_xObjSh->GetViewShell()->isEditDocLocked()) + if (m_xObjSh->isEditDocLocked()) showEditDocumentButton = false; if (showEditDocumentButton) diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 81cc04a222f4..62a79d6555e0 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1755,13 +1755,6 @@ void SfxViewShell::SetController( SfxBaseController* pController ) pImpl->xClipboardListener = new SfxClipboardChangeListener( this, GetClipboardNotifier() ); } -bool SfxViewShell::isEditDocLocked() -{ - if (!officecfg::Office::Common::Misc::AllowEditReadonlyDocs::get()) - return true; - return false; -} - Reference < XController > SfxViewShell::GetController() { return pImpl->m_pController.get(); |