diff options
-rw-r--r-- | include/comphelper/SetFlagContextHelper.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/prevwsh.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 7 |
3 files changed, 19 insertions, 1 deletions
diff --git a/include/comphelper/SetFlagContextHelper.hxx b/include/comphelper/SetFlagContextHelper.hxx index d209e398aeab..1f1e2743cea9 100644 --- a/include/comphelper/SetFlagContextHelper.hxx +++ b/include/comphelper/SetFlagContextHelper.hxx @@ -56,6 +56,14 @@ inline css::uno::Reference<css::uno::XCurrentContext> NoEnableJavaInteractionCon return NewFlagContext("DontEnableJava"); } +inline bool IsContextFlagActive(const OUString& sName) +{ + bool bFlag = false; + if (const auto xContext = css::uno::getCurrentContext()) + xContext->getValueByName(sName) >>= bFlag; + return bFlag; +} + } // namespace comphelper #endif // INCLUDED_COMPHELPER_SETFLAGCONTEXTHELPER_HXX diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index dbb23ca68e42..86986ee99fb6 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -21,6 +21,7 @@ #include <scitems.hxx> +#include <comphelper/SetFlagContextHelper.hxx> #include <sfx2/app.hxx> #include <editeng/sizeitem.hxx> #include <svx/zoomslideritem.hxx> @@ -916,6 +917,10 @@ void ScPreviewShell::ReadUserData(const OUString& rData, bool /* bBrowse */) void ScPreviewShell::WriteUserDataSequence(uno::Sequence < beans::PropertyValue >& rSeq) { + // tdf#130559: don't export preview view data if active + if (comphelper::IsContextFlagActive("NoPreviewData")) + return; + rSeq.realloc(3); beans::PropertyValue* pSeq = rSeq.getArray(); sal_uInt16 nViewID(GetViewFrame()->GetCurViewId()); 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() ) |