diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-08-24 15:14:38 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-08-24 15:14:38 +0200 |
commit | 191c0a9e7719b777146430486d703641aaff43bf (patch) | |
tree | ca2afff9832f58fcbab4fc6d0582d776bd54602e /sfx2 | |
parent | 057ae1cfcac518e5693e75aca87d307ce90ba6fb (diff) |
tdf#93630: Remember whether a doc was originally requested to be opened r/o
...so it'll be opened r/o again on SID_RELOAD. Needs addition of yet another
m_bOriginallyLoadedReadOnly state, after
a199cad8376a5470c50125def2738b44b55ec018 "tdf#65498, tdf#87545: Don't confuse
logically r/o doc with physically r/o" already added m_bOriginallyReadOnly.
Change-Id: I9c7129a6f1b0e7618be616d5897ee6ef29e0abb7
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 3 |
3 files changed, 16 insertions, 4 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 366a2f377310..301a0263206a 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -188,6 +188,7 @@ public: bool m_bGotDateTime:1; bool m_bRemoveBackup:1; bool m_bOriginallyReadOnly:1; + bool m_bOriginallyLoadedReadOnly:1; bool m_bTriedStorage:1; bool m_bRemote:1; bool m_bInputStreamIsReadOnly:1; @@ -266,6 +267,7 @@ SfxMedium_Impl::SfxMedium_Impl() : m_bGotDateTime( false ), m_bRemoveBackup( false ), m_bOriginallyReadOnly(false), + m_bOriginallyLoadedReadOnly(false), m_bTriedStorage(false), m_bRemote(false), m_bInputStreamIsReadOnly(false), @@ -3019,15 +3021,15 @@ SfxMedium::SfxMedium( const uno::Sequence<beans::PropertyValue>& aArgs ) : } } - bool readOnly = false; const SfxBoolItem* pReadOnlyItem = SfxItemSet::GetItem<SfxBoolItem>(pImpl->m_pSet, SID_DOC_READONLY, false); if ( pReadOnlyItem && pReadOnlyItem->GetValue() ) - readOnly = true; + pImpl->m_bOriginallyLoadedReadOnly = true; const SfxStringItem* pFileNameItem = SfxItemSet::GetItem<SfxStringItem>(pImpl->m_pSet, SID_FILE_NAME, false); if (!pFileNameItem) throw uno::RuntimeException(); pImpl->m_aLogicName = pFileNameItem->GetValue(); - pImpl->m_nStorOpenMode = readOnly ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE; + pImpl->m_nStorOpenMode = pImpl->m_bOriginallyLoadedReadOnly + ? SFX_STREAM_READONLY : SFX_STREAM_READWRITE; Init_Impl(); } @@ -3334,6 +3336,10 @@ bool SfxMedium::IsOriginallyReadOnly() const return pImpl->m_bOriginallyReadOnly; } +bool SfxMedium::IsOriginallyLoadedReadOnly() const +{ + return pImpl->m_bOriginallyLoadedReadOnly; +} bool SfxMedium::SetWritableForUserOnly( const OUString& aURL ) { diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 57551b7524d5..201664b1c705 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -382,6 +382,11 @@ bool SfxObjectShell::IsOriginallyReadOnlyMedium() const return pMedium == nullptr || pMedium->IsOriginallyReadOnly(); } +bool SfxObjectShell::IsOriginallyLoadedReadOnlyMedium() const +{ + return pMedium != nullptr && pMedium->IsOriginallyLoadedReadOnly(); +} + void SfxObjectShell::SetReadOnlyUI( bool bReadOnly ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index a98f8912616f..f1c93d81243e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -615,7 +615,8 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // let the current security settings be checked again pNewSet->Put( SfxUInt16Item( SID_MACROEXECMODE, document::MacroExecMode::USE_CONFIG ) ); - if ( pSh->IsOriginallyReadOnlyMedium() ) + if ( pSh->IsOriginallyReadOnlyMedium() + || pSh->IsOriginallyLoadedReadOnlyMedium() ) // edit mode is switched or reload of readonly document pNewSet->Put( SfxBoolItem( SID_DOC_READONLY, true ) ); else |