sfx2/source/view/viewfrm.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit a148813cec0c4da58686cac199a2de7d9b543b06
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Jul 11 22:24:41 2019 +1000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Jul 15 09:06:17 2019 +0200

    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.kagan...@collabora.com>
    (cherry picked from commit df9adfc95429bdaf085e9927ec5b326cee6b7a2a)
    Reviewed-on: https://gerrit.libreoffice.org/75493
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 0d9b905e2382..d814ed43e5a0 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -469,6 +469,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 )
@@ -533,6 +540,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 );
                     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to