include/xmloff/numehelp.hxx | 3 ++- sc/source/filter/xml/xmlexprt.cxx | 18 +++++++++--------- xmloff/source/style/numehelp.cxx | 6 +++++- 3 files changed, 16 insertions(+), 11 deletions(-)
New commits: commit be9034ec5c43a3dcbebaa75e9eb47a024d4c6072 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu May 23 16:09:36 2013 +0200 prevent invalid files if file contains currency formats A regression from writing error cell information into the file. Change-Id: Idb55646094fcd76912bdcd2102370681bcc8703d diff --git a/include/xmloff/numehelp.hxx b/include/xmloff/numehelp.hxx index 7aa3922..22bf181 100644 --- a/include/xmloff/numehelp.hxx +++ b/include/xmloff/numehelp.hxx @@ -104,7 +104,8 @@ public : sal_Bool bExportValue = sal_True, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE); void SetNumberFormatAttributes(const sal_Int32 nNumberFormat, const double& rValue, - sal_Bool bExportValue = sal_True, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE); + sal_Bool bExportValue = sal_True, + sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE, bool bExportCurrencySymbol = true); void SetNumberFormatAttributes(const OUString& rValue, const OUString& rCharacters, sal_Bool bExportValue = sal_True, diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 05d8da8..a4cbb40 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2876,7 +2876,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) aCell.nNumberFormat, aCell.fValue); if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( - aCell.nNumberFormat, aCell.fValue, false, XML_NAMESPACE_CALC_EXT); + aCell.nNumberFormat, aCell.fValue, false, XML_NAMESPACE_CALC_EXT, false); } break; case table::CellContentType_TEXT : @@ -2940,7 +2940,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) { GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( pFormulaCell->GetStandardFormat(*pDoc->GetFormatTable(), 0), - pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT); + pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT, false); } } } @@ -2953,7 +2953,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( - aCell.nNumberFormat, pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT ); + aCell.nNumberFormat, pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT, false ); } } diff --git a/xmloff/source/style/numehelp.cxx b/xmloff/source/style/numehelp.cxx index f510bd5..33396f1 100644 --- a/xmloff/source/style/numehelp.cxx +++ b/xmloff/source/style/numehelp.cxx @@ -517,13 +517,17 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( } void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes( - const sal_Int32 nNumberFormat, const double& rValue, sal_Bool bExportValue, sal_uInt16 nNamespace) + const sal_Int32 nNumberFormat, const double& rValue, sal_Bool bExportValue, + sal_uInt16 nNamespace, bool bExportCurrencySymbol) { if (pExport) { bool bIsStandard; OUString sCurrency; sal_Int16 nTypeKey = GetCellType(nNumberFormat, sCurrency, bIsStandard); + if(!bExportCurrencySymbol) + sCurrency = OUString(); + WriteAttributes(nTypeKey, rValue, sCurrency, bExportValue, nNamespace); } else { commit cb92803765275eb2a9b4f92b63dd01350ee81c32 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed May 22 23:11:06 2013 +0200 only export these attributes into ODF1.2 extended Change-Id: I6a7fcb55287e61af3a3cd041d187d5d4c693bc6c diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 28a155a..05d8da8 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2874,7 +2874,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) } GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( aCell.nNumberFormat, aCell.fValue); - if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) + if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( aCell.nNumberFormat, aCell.fValue, false, XML_NAMESPACE_CALC_EXT); } @@ -2885,7 +2885,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) OUString sFormula(lcl_GetRawString(pDoc, aCellPos)); GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( sFormula, aCell.sStringValue, true, true); - if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) + if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( sFormula, aCell.sStringValue, false, true, XML_NAMESPACE_CALC_EXT); } @@ -2918,7 +2918,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) GetCellText(aCell, aCellPos); AddAttribute(sAttrValueType, XML_STRING); AddAttribute(sAttrStringValue, aCell.sStringValue); - if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) + if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { //export calcext:value-type="error" AddAttribute(XML_NAMESPACE_CALC_EXT,XML_VALUE_TYPE, OUString("error")); @@ -2936,7 +2936,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( pFormulaCell->GetStandardFormat(*pDoc->GetFormatTable(), 0), pDoc->GetValue( aCellPos )); - if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) + if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( pFormulaCell->GetStandardFormat(*pDoc->GetFormatTable(), 0), @@ -2950,7 +2950,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) { GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( aCell.nNumberFormat, pDoc->GetValue( aCellPos )); - if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) + if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( aCell.nNumberFormat, pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT ); @@ -2966,7 +2966,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) { AddAttribute(sAttrValueType, XML_STRING); AddAttribute(sAttrStringValue, aCell.sStringValue); - if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) + if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { AddAttribute(XML_NAMESPACE_CALC_EXT,XML_VALUE_TYPE, XML_STRING); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits