Kaydet (Commit) be9034ec authored tarafından Markus Mohrhard's avatar Markus Mohrhard

prevent invalid files if file contains currency formats

A regression from writing error cell information into the file.

Change-Id: Idb55646094fcd76912bdcd2102370681bcc8703d
üst cb928037
...@@ -104,7 +104,8 @@ public : ...@@ -104,7 +104,8 @@ public :
sal_Bool bExportValue = sal_True, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE); sal_Bool bExportValue = sal_True, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
void SetNumberFormatAttributes(const sal_Int32 nNumberFormat, void SetNumberFormatAttributes(const sal_Int32 nNumberFormat,
const double& rValue, 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, void SetNumberFormatAttributes(const OUString& rValue,
const OUString& rCharacters, const OUString& rCharacters,
sal_Bool bExportValue = sal_True, sal_Bool bExportValue = sal_True,
......
...@@ -2876,7 +2876,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) ...@@ -2876,7 +2876,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
aCell.nNumberFormat, aCell.fValue); aCell.nNumberFormat, aCell.fValue);
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, aCell.fValue, false, XML_NAMESPACE_CALC_EXT); aCell.nNumberFormat, aCell.fValue, false, XML_NAMESPACE_CALC_EXT, false);
} }
break; break;
case table::CellContentType_TEXT : case table::CellContentType_TEXT :
...@@ -2940,7 +2940,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount) ...@@ -2940,7 +2940,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{ {
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
pFormulaCell->GetStandardFormat(*pDoc->GetFormatTable(), 0), 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) ...@@ -2953,7 +2953,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
{ {
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes( GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
aCell.nNumberFormat, pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT ); aCell.nNumberFormat, pDoc->GetValue( aCellPos ), false, XML_NAMESPACE_CALC_EXT, false );
} }
} }
......
...@@ -517,13 +517,17 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( ...@@ -517,13 +517,17 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes(
} }
void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes( 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) if (pExport)
{ {
bool bIsStandard; bool bIsStandard;
OUString sCurrency; OUString sCurrency;
sal_Int16 nTypeKey = GetCellType(nNumberFormat, sCurrency, bIsStandard); sal_Int16 nTypeKey = GetCellType(nNumberFormat, sCurrency, bIsStandard);
if(!bExportCurrencySymbol)
sCurrency = OUString();
WriteAttributes(nTypeKey, rValue, sCurrency, bExportValue, nNamespace); WriteAttributes(nTypeKey, rValue, sCurrency, bExportValue, nNamespace);
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment