From 7efea44937b783ef1663006410e9d8c7f549f3be Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 30 Aug 2010 18:45:51 +0200 Subject: calc59: #i114202# save table:show-empty attribute only if valid in ScDPSaveDimension --- sc/inc/dpsave.hxx | 1 + sc/source/core/data/dpsave.cxx | 5 +++++ sc/source/filter/xml/XMLExportDataPilot.cxx | 10 +++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'sc') diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx index bfff0b97a168..8272b850b27e 100644 --- a/sc/inc/dpsave.hxx +++ b/sc/inc/dpsave.hxx @@ -140,6 +140,7 @@ public: void SetSubTotals(long nCount, const USHORT* pFuncs); long GetSubTotalsCount() const { return nSubTotalCount; } USHORT GetSubTotalFunc(long nIndex) const { return pSubTotalFuncs[nIndex]; } + bool HasShowEmpty() const; void SetShowEmpty(BOOL bSet); BOOL GetShowEmpty() const { return BOOL(nShowEmptyMode); } void SetFunction(USHORT nNew); // enum GeneralFunction diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index dd493bb0df6c..bad05968bf72 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -410,6 +410,11 @@ void ScDPSaveDimension::SetSubTotals(long nCount, const USHORT* pFuncs) bSubTotalDefault = FALSE; } +bool ScDPSaveDimension::HasShowEmpty() const +{ + return nShowEmptyMode != SC_DPSAVEMODE_DONTKNOW; +} + void ScDPSaveDimension::SetShowEmpty(BOOL bSet) { nShowEmptyMode = bSet; diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index e43ff21a114d..f8cba5ecf6c3 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -503,9 +503,13 @@ void ScXMLExportDataPilot::WriteMembers(ScDPSaveDimension* pDim) void ScXMLExportDataPilot::WriteLevels(ScDPSaveDimension* pDim) { - rtl::OUStringBuffer sBuffer; - SvXMLUnitConverter::convertBool(sBuffer, pDim->GetShowEmpty()); - rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, sBuffer.makeStringAndClear()); + // #i114202# GetShowEmpty is only valid if HasShowEmpty is true. + if (pDim->HasShowEmpty()) + { + rtl::OUStringBuffer sBuffer; + SvXMLUnitConverter::convertBool(sBuffer, pDim->GetShowEmpty()); + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, sBuffer.makeStringAndClear()); + } SvXMLElementExport aElemDPL(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_LEVEL, sal_True, sal_True); WriteSubTotals(pDim); -- cgit