diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-03 06:08:24 +0000 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2012-06-15 16:02:57 +0200 |
commit | f453ef14594b7ef432fa39f19464a49e8590b8a2 (patch) | |
tree | e48be4115b5dfe94b8b21efedff103c0ea373510 /sc | |
parent | 534008436ea66ea0b1fe29590a34b6bbf1c50f17 (diff) |
export more conditional formats
Change-Id: I334c8416e74df39bc2a5832b6accf1dba38c245f
Signed-off-by: Jan Holesovsky <kendy@suse.cz>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index e47a6ae70cbb..9fc98b03e29e 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3840,10 +3840,75 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) for(ScConditionalFormatList::const_iterator itr = pCondFormatList->begin(); itr != pCondFormatList->end(); ++itr) { + rtl::OUString sRanges; + const ScRangeList* pRangeList = itr->GetRangeInfo(); + ScRangeStringConverter::GetStringFromRangeList( sRanges, pRangeList, pDoc, formula::FormulaGrammar::CONV_ODF ); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRanges); 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_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList); + sal_Int32 nEntries = itr->Count(); + for(sal_Int32 i = 0; i < nEntries; ++i) + { + const ScCondFormatEntry* pEntry = itr->GetEntry(i); + rtl::OUStringBuffer aCond; + switch(pEntry->GetOperation()) + { + case SC_COND_EQUAL: + aCond.append('='); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case SC_COND_LESS: + aCond.append('<'); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case SC_COND_GREATER: + aCond.append('>'); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case SC_COND_EQLESS: + aCond.append("<="); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case SC_COND_EQGREATER: + aCond.append(">="); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case SC_COND_NOTEQUAL: + aCond.append("!="); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case SC_COND_BETWEEN: + aCond.append(rtl::OUString("between(")); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(','); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 1, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(')'); + break; + case SC_COND_NOTBETWEEN: + aCond.append(rtl::OUString("not-between(")); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(','); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 1, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(')'); + break; + case SC_COND_DUPLICATE: + aCond.append("duplicate"); + break; + case SC_COND_NOTDUPLICATE: + aCond.append("unique"); + break; + case SC_COND_DIRECT: + aCond.append("formula-is("); + aCond.append(pEntry->GetExpression(pEntry->GetSrcPos(), 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(')'); + break; + case SC_COND_NONE: + continue; + } + rtl::OUString sStyle = pEntry->GetStyle(); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_APPLY_STYLE_NAME, sStyle); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, aCond.makeStringAndClear()); + SvXMLElementExport aElementCondEntry(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITION, true, true); + } } } @@ -3854,7 +3919,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) { rtl::OUString sRangeList; const ScRangeList& rRangeList = itr->GetRange(); - ScRangeStringConverter::GetStringFromRangeList( sRangeList, &rRangeList, pDoc, FormulaGrammar::CONV_OOO ); + ScRangeStringConverter::GetStringFromRangeList( sRangeList, &rRangeList, pDoc, formula::FormulaGrammar::CONV_ODF ); AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList); SvXMLElementExport aElementColFormat(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, true, true); |