diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-07-11 22:24:41 +1000 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-07-11 15:25:57 +0200 |
commit | df9adfc95429bdaf085e9927ec5b326cee6b7a2a (patch) | |
tree | c6f91c94a236538a72a268fd3007e8a77075951f /sfx2 | |
parent | 2e26ef34bf1a2e5d1293e45cf3b1415d9514b056 (diff) |
Restore original value of SID_DOC_READONLY item on cancel or SID_EDITDOC
Otherwise, SfxObjectShell::DoSaveCompleted later calls
SfxMedium::LockOrigFileOnDemand, which sets error state for the medium
reopened in read-only mode, as if it were opened in read-write mode.
Change-Id: Ib2df62470878ea609552ccc76df84a3fdde30646
Reviewed-on: https://gerrit.libreoffice.org/75413
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index e26587be9cb4..495b640c7856 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -460,6 +460,13 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) bool bOK = false; bool bRetryIgnoringLock = false; bool bOpenTemplate = false; + boost::optional<bool> aOrigROVal; + if (!pVersionItem) + { + auto pRO = pMed->GetItemSet()->GetItem<SfxBoolItem>(SID_DOC_READONLY, false); + if (pRO) + aOrigROVal = pRO->GetValue(); + } do { LockFileEntry aLockData; if ( !pVersionItem ) @@ -524,6 +531,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { pMed->ResetError(); pMed->SetOpenMode( SFX_STREAM_READONLY ); + if (aOrigROVal) + pMed->GetItemSet()->Put(SfxBoolItem(SID_DOC_READONLY, *aOrigROVal)); + else + pMed->GetItemSet()->ClearItem(SID_DOC_READONLY); pMed->ReOpen(); pSh->DoSaveCompleted( pMed ); } |