Related tdf#97694 Fix macro preservation on Windows
Change-Id: Ief183c75e0c3ce6c42868b7c60c5f66f9684d743
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91795
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index fd93feb..415d4a5 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1084,17 +1084,20 @@
// store to current storage
Reference< XStorage > xCurrentStorage( m_pImpl->getOrCreateRootStorage(), UNO_SET_THROW );
OUString aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(xCurrentStorage));
Sequence< PropertyValue > aMediaDescriptor( lcl_appendFileNameToDescriptor( _rArguments, _rURL ) );
impl_storeToStorage_throw( xCurrentStorage, aMediaDescriptor, _rGuard );
// Preserve script signature if the script has not changed
if (bTryToPreserveScriptSignature)
{
// Need to close this storage, otherwise we can't open it for signing below
// (Windows needs exclusive file access)
uno::Reference < lang::XComponent > xComp = xCurrentStorage;
xComp->dispose();
uno::Reference<security::XDocumentDigitalSignatures> xDDSigns;
try
{
OUString aODFVersion(
comphelper::OStorageHelper::GetODFVersionFromStorage(xCurrentStorage));
xDDSigns = security::DocumentDigitalSignatures::createWithVersion(
comphelper::getProcessComponentContext(), aODFVersion);
@@ -1152,7 +1155,7 @@
}
catch (uno::Exception&)
{
SAL_WARN("dbaccess", "Preserving macro signature failed!");
TOOLS_WARN_EXCEPTION("dbaccess", "");
}
}