summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-23 16:09:36 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-05-23 16:15:53 +0200
commitbe9034ec5c43a3dcbebaa75e9eb47a024d4c6072 (patch)
tree3dc65ce8b49e0237d30d2da80964d7163a241a1c
parentcb92803765275eb2a9b4f92b63dd01350ee81c32 (diff)
prevent invalid files if file contains currency formats
A regression from writing error cell information into the file. Change-Id: Idb55646094fcd76912bdcd2102370681bcc8703d
-rw-r--r--include/xmloff/numehelp.hxx3
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx6
-rw-r--r--xmloff/source/style/numehelp.cxx6
3 files changed, 10 insertions, 5 deletions
diff --git a/include/xmloff/numehelp.hxx b/include/xmloff/numehelp.hxx
index 7aa3922ebc72..22bf1819a347 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 05d8da8f8ed0..a4cbb407b68f 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 f510bd5eddf9..33396f1ce78b 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 {