summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-07-10 14:30:34 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-05-17 10:22:59 +0200
commit9d5b6de63d80d528c292913c582376e0d9ad7f97 (patch)
tree5b3a4fdf889551e3d8b1da64cd12ee26344e8341
parent6ccb5f0cd44293730c6604184683ac6165f8b055 (diff)
tdf#134582 sfx2: when storing, set Version on embedded object storagefeature/cib_contract57d
This previously wasn't needed because there was only one version for which it was checked (1.2) but since commit a541cd91951eca15e40764244b34c72b347f9f26 there's a second version so when loading an existing embedded object in one version and storing it in another, the Version must be updated so the attribute in META-INF/manifest.xml matches the one in content.xml. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98521 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 519d96fd8b83ef4c61576d87b58f97b7e6e6e3c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98459 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit a24a4cc1838e3a2d55261a8edf6cb63186f4c38f) (cherry picked from commit 2976392800739d38d5f84f1f8242701c526b29e1) Change-Id: Ic2fc303c6f6bc254050d531d578029377976ecb5
-rw-r--r--sfx2/source/doc/objstor.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index b865ce456b7d..36f58416a9e9 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -986,6 +986,39 @@ bool SfxObjectShell::DoSave()
pImpl->bIsSaving = true;
+ if (IsOwnStorageFormat(*GetMedium()))
+ {
+ SvtSaveOptions::ODFSaneDefaultVersion nDefVersion = SvtSaveOptions::ODFSVER_012;
+ if (!utl::ConfigManager::IsFuzzing())
+ {
+ SvtSaveOptions aSaveOpt;
+ nDefVersion = aSaveOpt.GetODFSaneDefaultVersion();
+ }
+ uno::Reference<beans::XPropertySet> const xProps(GetMedium()->GetStorage(), uno::UNO_QUERY);
+ assert(xProps.is());
+ if (nDefVersion >= SvtSaveOptions::ODFSVER_012) // property exists only since ODF 1.2
+ {
+ try // tdf#134582 set Version on embedded objects as they
+ { // could have been loaded with a different/old version
+#if 0
+// not on old branch
+ if (SvtSaveOptions::ODFSVER_013 <= nDefVersion)
+ {
+ xProps->setPropertyValue("Version", uno::makeAny<OUString>(ODFVER_013_TEXT));
+ }
+ else
+#endif
+ {
+ xProps->setPropertyValue("Version", uno::makeAny<OUString>(ODFVER_012_TEXT));
+ }
+ }
+ catch (uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("sfx.doc" /*, "SfxObjectShell::DoSave"*/);
+ }
+ }
+ }
+
uno::Sequence< beans::NamedValue > aEncryptionData;
if ( IsPackageStorageFormat_Impl( *GetMedium() ) )
{