diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-03-30 09:51:34 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-03-30 09:51:34 +0200 |
commit | ac4acb66485c54746721201d0b107ccca63ab049 (patch) | |
tree | 9657dc58b0def0f58790acd6870600771f1b20d3 | |
parent | 22a9d3837f3552806e0a8d149962134928f00e74 (diff) |
Evaluate the AllowEditReadonlyDocs config option
Partial backport of a474e2267cdcb1707333acdea1353d883d58c801
Change-Id: I33fb8c526839a74d0e959c75ad6cb9e4d0614f5d
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index f15e0fc670be..b1d29d0f09fa 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -278,6 +278,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT )) break; + + SfxViewShell* pViewSh = GetViewShell(); + if (pViewSh && pViewSh->isEditDocLocked()) + break; + // Only change read-only UI and remove info bar when we succeed struct ReadOnlyUIGuard { @@ -863,6 +868,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) const SfxShell *pFSh; if ( !pSh->HasName() || !( pSh->Get_Impl()->nLoadedFlags & SfxLoadedFlags::MAINDOCUMENT ) || + (GetViewShell() && GetViewShell()->isEditDocLocked()) || ( pSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED && ( !(pVSh = pSh->GetViewShell()) || !(pFSh = pVSh->GetFormShell()) || @@ -1300,11 +1306,18 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) pInfoBar->addButton(xSignButton); } - VclPtrInstance<PushButton> xBtn(&GetWindow()); - xBtn->SetText(SfxResId(STR_READONLY_EDIT)); - xBtn->SetSizePixel(xBtn->GetOptimalSize()); - xBtn->SetClickHdl(LINK(this, SfxViewFrame, SwitchReadOnlyHandler)); - pInfoBar->addButton(xBtn); + bool showEditDocumentButton = true; + if (m_xObjSh->GetViewShell() && m_xObjSh->GetViewShell()->isEditDocLocked()) + showEditDocumentButton = false; + + if (showEditDocumentButton) + { + VclPtrInstance<PushButton> xBtn(&GetWindow()); + xBtn->SetText(SfxResId(STR_READONLY_EDIT)); + xBtn->SetSizePixel(xBtn->GetOptimalSize()); + xBtn->SetClickHdl(LINK(this, SfxViewFrame, SwitchReadOnlyHandler)); + pInfoBar->addButton(xBtn); + } } } |