Kaydet (Commit) 46f74ab5 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst d9835c81
......@@ -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 )
{
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment