[Libreoffice-commits] core.git: sfx2/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 11 13:26:57 UTC 2019


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

New commits:
commit df9adfc95429bdaf085e9927ec5b326cee6b7a2a
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Jul 11 22:24:41 2019 +1000
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Jul 11 15:25:57 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.kaganski at collabora.com>

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 );
                     }


More information about the Libreoffice-commits mailing list