From a8b7c72425aabae87bfd2e141aa06f06319ae11c Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 24 Apr 2013 18:45:15 +0200 Subject: add error to office:value-type for calc cells and fdo#51810 For cached value import we need the information which cells are error cells. For ODF 1.2 extended we therefore export now calcext:office-value with the additional value "error". Change-Id: I9bc988ea4924bea767ba5e504b77f6a16e51a82e --- xmloff/source/style/numehelp.cxx | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/style/numehelp.cxx b/xmloff/source/style/numehelp.cxx index fcefcc690784..f510bd5eddf9 100644 --- a/xmloff/source/style/numehelp.cxx +++ b/xmloff/source/style/numehelp.cxx @@ -60,7 +60,6 @@ XMLNumberFormatAttributesExportHelper::XMLNumberFormatAttributesExportHelper( pExport(&rTempExport), sStandardFormat(XML_STANDARDFORMAT), sType(XML_TYPE), - sAttrValueType(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_VALUE_TYPE))), sAttrValue(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_VALUE))), sAttrDateValue(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_DATE_VALUE))), sAttrTimeValue(rTempExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, GetXMLToken(XML_TIME_VALUE))), @@ -384,12 +383,13 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( const sal_Int16 nTypeKey, const double& rValue, const OUString& rCurrency, - sal_Bool bExportValue) + sal_Bool bExportValue, sal_uInt16 nNamespace) { if (!pExport) return; sal_Bool bWasSetTypeAttribute = sal_False; + OUString sAttrValType = pExport->GetNamespaceMap().GetQNameByKey( nNamespace, GetXMLToken(XML_VALUE_TYPE)); switch(nTypeKey & ~util::NumberFormat::DEFINED) { case 0: @@ -399,7 +399,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( { if (!bWasSetTypeAttribute) { - pExport->AddAttribute(sAttrValueType, XML_FLOAT); + pExport->AddAttribute(sAttrValType, XML_FLOAT); bWasSetTypeAttribute = sal_True; } } // No Break @@ -407,7 +407,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( { if (!bWasSetTypeAttribute) { - pExport->AddAttribute(sAttrValueType, XML_PERCENTAGE); + pExport->AddAttribute(sAttrValType, XML_PERCENTAGE); bWasSetTypeAttribute = sal_True; } } // No Break @@ -415,7 +415,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( { if (!bWasSetTypeAttribute) { - pExport->AddAttribute(sAttrValueType, XML_CURRENCY); + pExport->AddAttribute(sAttrValType, XML_CURRENCY); if (!rCurrency.isEmpty()) pExport->AddAttribute(sAttrCurrency, rCurrency); bWasSetTypeAttribute = sal_True; @@ -435,7 +435,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( { if (!bWasSetTypeAttribute) { - pExport->AddAttribute(sAttrValueType, XML_DATE); + pExport->AddAttribute(sAttrValType, XML_DATE); bWasSetTypeAttribute = sal_True; } if (bExportValue) @@ -453,7 +453,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( { if (!bWasSetTypeAttribute) { - pExport->AddAttribute(sAttrValueType, XML_TIME); + pExport->AddAttribute(sAttrValType, XML_TIME); bWasSetTypeAttribute = sal_True; } if (bExportValue) @@ -468,7 +468,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( { if (!bWasSetTypeAttribute) { - pExport->AddAttribute(sAttrValueType, XML_BOOLEAN); + pExport->AddAttribute(sAttrValType, XML_BOOLEAN); bWasSetTypeAttribute = sal_True; } if (bExportValue) @@ -501,7 +501,7 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( { if (!bWasSetTypeAttribute) { - pExport->AddAttribute(sAttrValueType, XML_FLOAT); + pExport->AddAttribute(sAttrValType, XML_FLOAT); bWasSetTypeAttribute = sal_True; if (bExportValue) { @@ -517,14 +517,14 @@ void XMLNumberFormatAttributesExportHelper::WriteAttributes( } void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes( - const sal_Int32 nNumberFormat, const double& rValue, sal_Bool bExportValue) + const sal_Int32 nNumberFormat, const double& rValue, sal_Bool bExportValue, sal_uInt16 nNamespace) { if (pExport) { bool bIsStandard; OUString sCurrency; sal_Int16 nTypeKey = GetCellType(nNumberFormat, sCurrency, bIsStandard); - WriteAttributes(nTypeKey, rValue, sCurrency, bExportValue); + WriteAttributes(nTypeKey, rValue, sCurrency, bExportValue, nNamespace); } else { OSL_FAIL("no SvXMLExport given"); @@ -533,12 +533,13 @@ void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes( void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes( const OUString& rValue, const OUString& rCharacters, - sal_Bool bExportValue, sal_Bool bExportTypeAttribute) + sal_Bool bExportValue, sal_Bool bExportTypeAttribute, + sal_uInt16 nNamespace) { if (pExport) { if (bExportTypeAttribute) - pExport->AddAttribute(sAttrValueType, XML_STRING); + pExport->AddAttribute(nNamespace, XML_VALUE_TYPE, XML_STRING); if (bExportValue && !rValue.isEmpty() && (rValue != rCharacters)) pExport->AddAttribute(sAttrStringValue, rValue); } -- cgit