diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-05-24 12:37:39 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-05-24 12:38:11 +0200 |
commit | f18a242966d3fd25ec0832c09ce7164bdae7ba2d (patch) | |
tree | b115c7868a6eb6a07f3331847bb7da780a19b4a9 | |
parent | 655d61042f5b6130643d2dde3cd46e4e4d3bbb2b (diff) |
use correct namespace for calc odf extensions
Change-Id: I6e0feab7e1d649fbf4dafb9f06d57f68e9a4b934
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 67 | ||||
-rw-r--r-- | xmloff/inc/xmloff/xmlnmspe.hxx | 3 | ||||
-rw-r--r-- | xmloff/inc/xmloff/xmltoken.hxx | 5 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 5 |
5 files changed, 59 insertions, 24 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index a572a082c403..9c1b3bd76c53 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3820,17 +3820,17 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) ScColorFormatList* pColorFormatList = pDoc->GetColorScaleList(nTab); if(pCondFormatList || pColorFormatList) { - SvXMLElementExport aElementCondFormats(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMATS, true, true); + SvXMLElementExport aElementCondFormats(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMATS, true, true); if(pCondFormatList) { for(ScConditionalFormatList::const_iterator itr = pCondFormatList->begin(); itr != pCondFormatList->end(); ++itr) { - SvXMLElementExport aElementCondFormat(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMAT, true, true); + SvXMLElementExport aElementCondFormat(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, true, true); rtl::OUString sRangeList; //ScRangeStringConverter::GetStringFromRangeList( sRanges, rRangeList, pDoc, FormulaGrammar::CONV_OOO ); - AddAttribute(XML_NP_TABLE_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList); } } @@ -3842,43 +3842,64 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) rtl::OUString sRangeList; const ScRangeList& rRangeList = itr->GetRange(); ScRangeStringConverter::GetStringFromRangeList( sRangeList, &rRangeList, pDoc, FormulaGrammar::CONV_OOO ); - AddAttribute(XML_NP_TABLE_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList); - SvXMLElementExport aElementColFormat(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMAT, true, true); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList); + SvXMLElementExport aElementColFormat(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, true, true); if(itr->GetType() == COLORSCALE) { - SvXMLElementExport aElementColorScale(*this, XML_NP_TABLE_EXT, XML_COLOR_SCALE, true, true); + SvXMLElementExport aElementColorScale(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE, true, true); + const ScColorScaleFormat& mrColorScale = static_cast<const ScColorScaleFormat&>(*itr); + for(ScColorScaleFormat::const_iterator it = mrColorScale.begin(); + it != mrColorScale.end(); ++it) + { + if(it->GetFormula()) + { + rtl::OUString sFormula; + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); + } + else + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(it->GetValue())); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*it)); + rtl::OUStringBuffer aBuffer; + ::sax::Converter::convertColor(aBuffer, it->GetColor().GetColor()); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_COLOR, aBuffer.makeStringAndClear()); + SvXMLElementExport aElementColorScaleEntry(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE_ENTRY, true, true); + } } else if(itr->GetType() == DATABAR) { const ScDataBarFormatData* pFormatData = static_cast<const ScDataBarFormat&>(*itr).GetDataBarData(); if(!pFormatData->mbGradient) - AddAttribute(XML_NP_TABLE_EXT, XML_GRADIENT, XML_FALSE); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_GRADIENT, XML_FALSE); rtl::OUStringBuffer aBuffer; ::sax::Converter::convertColor(aBuffer, pFormatData->maPositiveColor.GetColor()); - AddAttribute(XML_NP_TABLE_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear()); - SvXMLElementExport aElementDataBar(*this, XML_NP_TABLE_EXT, XML_DATA_BAR, true, true); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear()); + SvXMLElementExport aElementDataBar(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, true, true); - if(pFormatData->mpLowerLimit->GetFormula()) { - rtl::OUString sFormula; - AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, sFormula); + if(pFormatData->mpLowerLimit->GetFormula()) + { + rtl::OUString sFormula; + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); + } + else + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpLowerLimit->GetValue())); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit)); + SvXMLElementExport aElementDataBarEntryLower(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, true, true); } - else - AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpLowerLimit->GetValue())); - AddAttribute(XML_NP_TABLE_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit)); - SvXMLElementExport aElementDataBarEntryLower(*this, XML_NP_TABLE_EXT, XML_DATA_BAR_ENTRY, true, true); - if(pFormatData->mpUpperLimit->GetFormula()) { - rtl::OUString sFormula; - AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, sFormula); + if(pFormatData->mpUpperLimit->GetFormula()) + { + rtl::OUString sFormula; + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); + } + else + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpUpperLimit->GetValue())); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit)); + SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, true, true); } - else - AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpUpperLimit->GetValue())); - AddAttribute(XML_NP_TABLE_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit)); - SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NP_TABLE_EXT, XML_DATA_BAR_ENTRY, true, true); } } } diff --git a/xmloff/inc/xmloff/xmlnmspe.hxx b/xmloff/inc/xmloff/xmlnmspe.hxx index 2f4615da2a2c..0d222dac725f 100644 --- a/xmloff/inc/xmloff/xmlnmspe.hxx +++ b/xmloff/inc/xmloff/xmlnmspe.hxx @@ -90,8 +90,9 @@ XML_NAMESPACE_EXT( OFFICE, 37U ) XML_NAMESPACE_EXT( TABLE, 38U ) XML_NAMESPACE_EXT( CHART, 39U ) XML_NAMESPACE_EXT( DRAW, 40U ) +XML_NAMESPACE_EXT( CALC, 41U ) -#define _XML_OLD_NAMESPACE_BASE 41U +#define _XML_OLD_NAMESPACE_BASE 42U // namespaces used in the technical preview (SO 5.2) XML_OLD_NAMESPACE( FO, 0U ) diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index dd0529b6fcbb..d47a93b57e22 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -160,6 +160,10 @@ namespace xmloff { namespace token { XML_NP_CSS3TEXT, XML_N_CSS3TEXT, + // calc extensions + XML_NP_CALC_EXT, + XML_N_CALC_EXT, + // units XML_UNIT_MM, XML_UNIT_M, @@ -426,6 +430,7 @@ namespace xmloff { namespace token { XML_COLOR_INVERSION, XML_COLOR_MODE, XML_COLOR_SCALE, + XML_COLOR_SCALE_ENTRY, XML_COLUMN, XML_COLUMN_COUNT, XML_COLUMN_GAP, diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index e70a24ce4b0b..e9f80bba367d 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -374,6 +374,9 @@ void SvXMLExport::_InitCtor() { mpNamespaceMap->Add( GetXMLToken(XML_NP_TABLE_EXT), GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT); + mpNamespaceMap->Add( + GetXMLToken(XML_NP_CALC_EXT), GetXMLToken(XML_N_CALC_EXT), XML_NAMESPACE_CALC_EXT); + } } if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 ) diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index d4e21b2d2bd5..759926aae048 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -164,6 +164,10 @@ namespace xmloff { namespace token { TOKEN( "css3t", XML_NP_CSS3TEXT ), TOKEN( "http://www.w3.org/TR/css3-text/", XML_N_CSS3TEXT ), + // extension namespace for calc extensions + TOKEN( "calcext", XML_NP_CALC_EXT ), + TOKEN( "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0", XML_N_CALC_EXT ), + // units TOKEN( "mm", XML_UNIT_MM ), TOKEN( "m", XML_UNIT_M ), @@ -430,6 +434,7 @@ namespace xmloff { namespace token { TOKEN( "color-inversion", XML_COLOR_INVERSION ), TOKEN( "color-mode", XML_COLOR_MODE ), TOKEN( "color-scale", XML_COLOR_SCALE ), + TOKEN( "color-scale-entry", XML_COLOR_SCALE_ENTRY ), TOKEN( "column", XML_COLUMN ), TOKEN( "column-count", XML_COLUMN_COUNT ), TOKEN( "column-gap", XML_COLUMN_GAP ), |