diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-05-10 16:41:54 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2021-05-18 15:25:17 +0200 |
commit | ad5ebd2bcf6d80d46b59849fb85aa3ee226b52a3 (patch) | |
tree | 38269794a4f112df338d58fbe4b845ce2ae7a0f3 /sfx2 | |
parent | f18b902062c8753a19847f866cd7f51432106e60 (diff) |
tdf#138209 ODF export: work around forms problem in LO < 7.0
LO without commit 519d96fd8b83ef4c61576d87b58f97b7e6e6e3c6 makes a mess
when storing form documents it has loaded from ODF 1.3 documents: the
XML parts are stored as ODF 1.2, but the storage (and therefore manifest
entry) keeps version 1.3.
To avoid this, store form documents as ODF 1.2 extended by default.
Unfortunately a bunch of ODF export code accesses the global
SvtSaveOptions variable; with this version override, only
SvXMLExport::getSaneDefaultVersion() must be used.
Change-Id: I5fa8e286f5103c578ed0d93da07a8a6cbe2f0ddd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115357
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 16de54a5c47fbc4691ee099c1f7bb559a8fe11ac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115390
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 4188ec2a7ef2..29ca6d9a0fed 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -29,6 +29,7 @@ #include <svl/intitem.hxx> #include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModule.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/document/XExporter.hpp> @@ -335,7 +336,11 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto try { // older versions can not have this property set, it exists only starting from ODF1.2 - if (SvtSaveOptions::ODFSVER_013 <= nDefVersion) + uno::Reference<frame::XModule> const xModule(GetModel(), uno::UNO_QUERY); + bool const isBaseForm(xModule.is() && + xModule->getIdentifier() == "com.sun.star.sdb.FormDesign"); + SAL_INFO_IF(isBaseForm, "sfx.doc", "tdf#138209 force form export to ODF 1.2"); + if (!isBaseForm && SvtSaveOptions::ODFSVER_013 <= nDefVersion) { xProps->setPropertyValue("Version", uno::makeAny<OUString>(ODFVER_013_TEXT)); } @@ -981,7 +986,11 @@ bool SfxObjectShell::DoSave() { try // tdf#134582 set Version on embedded objects as they { // could have been loaded with a different/old version - if (SvtSaveOptions::ODFSVER_013 <= nDefVersion) + uno::Reference<frame::XModule> const xModule(GetModel(), uno::UNO_QUERY); + bool const isBaseForm(xModule.is() && + xModule->getIdentifier() == "com.sun.star.sdb.FormDesign"); + SAL_INFO_IF(isBaseForm, "sfx.doc", "tdf#138209 force form export to ODF 1.2"); + if (!isBaseForm && SvtSaveOptions::ODFSVER_013 <= nDefVersion) { xProps->setPropertyValue("Version", uno::makeAny<OUString>(ODFVER_013_TEXT)); } |