diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-04 12:47:16 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-04 13:50:06 +0100 |
commit | 46f74ab5f97415b8777b1043bbd7bf9839163075 (patch) | |
tree | a0d53e8bb5d3886ffbe05e1123c00ecf2cd7b193 /sfx2 | |
parent | Include headers using OpenBSD too (diff) | |
download | core-46f74ab5f97415b8777b1043bbd7bf9839163075.tar.gz core-46f74ab5f97415b8777b1043bbd7bf9839163075.zip |
sfx2: fix locking after signing OOXML documents
File -> digital signatures looks like a way to view and modify digital
signatures, internally it's a sign action, that at the end may not modify
signatures after all. For this to work, SfxObjectShell::ImplSign() calls
GetMedium()->CloseAndRelease() to release the document's lock file, invokes the
signing dialog, then DoSaveCompleted() creates the lockfile again.
When signing OOXML documents, the lock file is not re-created, as
DoSaveCompleted() only creates the lockfile in case
IsPackageStorageFormat_Impl() (== own format) is true. Fix this by adding a
mode that creates the lock file, even in case of a foreign format.
With this, closing the digital signatures dialog for OOXML documents no longer
results in a confusing "Document in Use" dialog after closing the signatures
dialog.
Change-Id: Ie9e56b88768825e61765669b27a89082cdc1981f
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/inc/objshimp.hxx | 2 |
4 files changed, 11 insertions, 0 deletions
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 57946d0231a5..ef2795f52a8c 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1486,7 +1486,9 @@ void SfxObjectShell::ImplSign( bool bScriptingContent ) || pImp->nDocumentSignatureState == SignatureState::NOTVALIDATED || pImp->nDocumentSignatureState == SignatureState::PARTIAL_OK); + pImp->m_bSavingForSigning = true; DoSaveCompleted( GetMedium() ); + pImp->m_bSavingForSigning = false; if ( bSigned ) { diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 01d7435bf2ef..87518733a044 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2009,6 +2009,12 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed ) } else { + if (pImp->m_bSavingForSigning && pFilter && pFilter->GetSupportsSigning()) + // So that pMedium->pImp->xStream becomes a non-empty + // reference, and at the end we attempt locking again in + // SfxMedium::LockOrigFileOnDemand(). + pMedium->GetMedium_Impl(); + if( pMedium->GetOpenMode() & StreamMode::WRITE ) pMedium->GetInStream(); xStorage = GetStorage(); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index de21929497bd..94ed0f2893fe 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -264,6 +264,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bIncomplEncrWarnShown( false ) ,m_nModifyPasswordHash( 0 ) ,m_bModifyPasswordEntered( false ) + ,m_bSavingForSigning( false ) { SfxObjectShell* pDoc = &_rDocShell; SfxObjectShellArr_Impl &rArr = SfxGetpApp()->GetObjectShells_Impl(); diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index fb94a8e02978..1a338bebcd18 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -146,6 +146,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_uInt32 m_nModifyPasswordHash; css::uno::Sequence< css::beans::PropertyValue > m_aModifyPasswordInfo; bool m_bModifyPasswordEntered; + /// If true, then this is not a real save, just the signatures change. + bool m_bSavingForSigning; SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); virtual ~SfxObjectShell_Impl(); |