diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-11-03 19:00:34 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-11-03 19:07:02 +0100 |
commit | 338c7073e45df2463dfe1e85babe34bc10017a1c (patch) | |
tree | 3f8019dbc346f9df3713bcc67af2b53370fa74ce /sc/source | |
parent | 167ba3fee2f3f52420197d7791a3125787a93247 (diff) |
improve cond format export to ooxml
Change-Id: Ie89d5595c528b546b5de870421bf7d27a928c739
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index e278a09bd9e1..9672dc449cbf 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -853,16 +853,50 @@ const char* GetTypeString(ScConditionMode eMode) } } +bool IsTopBottomRule(ScConditionMode eMode) +{ + switch(eMode) + { + case SC_COND_TOP10: + case SC_COND_BOTTOM10: + case SC_COND_TOP_PERCENT: + case SC_COND_BOTTOM_PERCENT: + return true; + default: + break; + } + + return false; +} + } void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm ) { bool bFmla2 = false; + ScConditionMode eOperation = mrFormatEntry.GetOperation(); + sal_Int32 nAboveAverage = eOperation == SC_COND_ABOVE_AVERAGE; + sal_Int32 nBottom = eOperation == SC_COND_BOTTOM10 + || eOperation == SC_COND_BOTTOM_PERCENT; + sal_Int32 nPercent = eOperation == SC_COND_TOP_PERCENT || + eOperation == SC_COND_BOTTOM_PERCENT; + rtl::OString aRank; + if(IsTopBottomRule(eOperation)) + { + // position and formula grammar are not important + // we only store a number there + aRank = XclXmlUtils::ToOString(mrFormatEntry.GetExpression(ScAddress(0,0,0), 0)); + } + sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->startElement( XML_cfRule, XML_type, GetTypeString( mrFormatEntry.GetOperation() ), XML_priority, OString::valueOf( mnPriority + 1 ).getStr(), XML_operator, GetOperatorString( mrFormatEntry.GetOperation(), bFmla2 ), + XML_aboveAverage, OString::valueOf( nAboveAverage ).getStr(), + XML_bottom, OString::valueOf( nBottom ).getStr(), + XML_percent, OString::valueOf( nPercent ).getStr(), + XML_rank, aRank.getStr(), XML_dxfId, OString::valueOf( GetDxfs().GetDxfId( mrFormatEntry.GetStyle() ) ).getStr(), FSEND ); rWorksheet->startElement( XML_formula, FSEND ); |