From 592a02b2869aa04cb6d95cb3d491cd7c5455bd0a Mon Sep 17 00:00:00 2001 From: Mike Kaganski <mike.kaganski@collabora.com> Date: Sat, 25 Jul 2020 14:21:33 +0300 Subject: tdf#130559: don't export preview view data to ODS ... because trying to activate this view on load will throw and crash Unlike in Writer (SwPagePreview), Calc's ScPreviewShell overrides WriteUserDataSequence to export the view data. This was implemented in commit 1f51730f3c5b05c3afaa35431c925482e8152783. That does not give any clue why is this necessary, so I don't want to revert it. So to pass the flag to XViewDataSupplier::getViewData, this patch sets the flag in current context using comphelper::NewFlagContext. This allows to only skip providing the data conditionally. Change-Id: I95d70b30b0b8762d2b5c703c3e572064d0b2ef75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99441 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> --- xmloff/source/core/xmlexp.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xmloff') diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 59a3c9a00a35..235aa867c221 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -81,6 +81,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/extract.hxx> +#include <comphelper/SetFlagContextHelper.hxx> #include <PropertySetMerger.hxx> #include <unotools/docinfohelper.hxx> @@ -1735,7 +1736,11 @@ void SvXMLExport::GetViewSettingsAndViews(uno::Sequence<beans::PropertyValue>& r { uno::Reference<container::XIndexAccess> xIndexAccess; xViewDataSupplier->setViewData( xIndexAccess ); // make sure we get a newly created sequence - xIndexAccess = xViewDataSupplier->getViewData(); + { + // tdf#130559: don't export preview view data if active + css::uno::ContextLayer layer(comphelper::NewFlagContext("NoPreviewData")); + xIndexAccess = xViewDataSupplier->getViewData(); + } bool bAdd = false; uno::Any aAny; if(xIndexAccess.is() && xIndexAccess->hasElements() ) -- cgit