diff options
author | Kohei Yoshida <kohei@openoffice.org> | 2009-11-18 19:35:08 +0000 |
---|---|---|
committer | Kohei Yoshida <kohei@openoffice.org> | 2009-11-18 19:35:08 +0000 |
commit | e90a5b82b8454c8c77a0bf50285e99cf25c631bd (patch) | |
tree | 44df18592b078c7a600abf5e6dba6b623da18ed4 /sc/source | |
parent | d803f1b8cfb2b15920fa03b3a64371b4664f4a31 (diff) |
#i106975# When custom grand total name is not used, write the xml data the old way.
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/xml/XMLExportDataPilot.cxx | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index d6c800853c6f..88c710ae9f11 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -737,10 +737,6 @@ void ScXMLExportDataPilot::WriteDimensions(ScDPSaveData* pDPSave) void ScXMLExportDataPilot::WriteGrandTotal(::xmloff::token::XMLTokenEnum eOrient, bool bVisible, const OUString* pGrandTotal) { - if (rExport.getDefaultVersion() != SvtSaveOptions::ODFVER_LATEST) - // Export grand total only for ODF 1.2 extended or later. - return; - rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DISPLAY, bVisible ? XML_TRUE : XML_FALSE); rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ORIENTATION, eOrient); if (pGrandTotal) @@ -821,14 +817,33 @@ void ScXMLExportDataPilot::WriteDataPilots(const uno::Reference <sheet::XSpreads // grand total elements. const OUString* pGrandTotalName = pDPSave->GetGrandTotalName(); - if (bRowGrand && bColumnGrand) + if (pGrandTotalName && rExport.getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST) { - WriteGrandTotal(XML_BOTH, true, pGrandTotalName); + // Use the new data-pilot-grand-total element. + if (bRowGrand && bColumnGrand) + { + WriteGrandTotal(XML_BOTH, true, pGrandTotalName); + } + else + { + WriteGrandTotal(XML_ROW, bRowGrand, pGrandTotalName); + WriteGrandTotal(XML_COLUMN, bColumnGrand, pGrandTotalName); + } } else { - WriteGrandTotal(XML_ROW, bRowGrand, pGrandTotalName); - WriteGrandTotal(XML_COLUMN, bColumnGrand, pGrandTotalName); + // custom grand total not present, or it's not ODF 1.2 extended. + // Write it the old way. + if (bRowGrand && bColumnGrand) + { + // Don't write anything. Grand totals are displayed for both row and column fields by default. + } + else if (bRowGrand) + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_GRAND_TOTAL, XML_ROW); + else if (bColumnGrand) + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_GRAND_TOTAL, XML_COLUMN); + else + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_GRAND_TOTAL, XML_NONE); } rExport.CheckAttrList(); |