From f1fdd5adb63f84fe7c65374b1a7cf9bd96e7d6b6 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Fri, 2 Nov 2012 00:30:25 +0100 Subject: implement ooxml import for new conditional formats Change-Id: Ia854ef42c23ac8dd4f6d4afa180ecc57b741a3b8 --- sc/source/filter/oox/condformatbuffer.cxx | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index c1452100e799..a8800a6b8540 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -739,10 +739,20 @@ void CondFormatRule::finalizeImport() aReplaceFormula = "NOT(ISERROR(#B))"; break; case XML_top10: - if( maModel.mbPercent ) - aReplaceFormula = "RANK(#B,#R,#M)/COUNT(#R)<=#K%"; + if(maModel.mbPercent) + { + if(maModel.mbBottom) + eOperator = SC_COND_BOTTOM_PERCENT; + else + eOperator = SC_COND_TOP_PERCENT; + } else - aReplaceFormula = "RANK(#B,#R,#M)<=#K"; + { + if(maModel.mbBottom) + eOperator = SC_COND_BOTTOM10; + else + eOperator = SC_COND_TOP10; + } break; case XML_aboveAverage: if( maModel.mnStdDev == 0 ) @@ -827,6 +837,16 @@ void CondFormatRule::finalizeImport() &aTokenArray, pTokenArray2.get(), &rDoc, aPos, aStyleName); mpFormat->AddEntry(pNewEntry); } + else if ( eOperator == SC_COND_TOP10 || SC_COND_BOTTOM10 || + SC_COND_TOP_PERCENT || SC_COND_BOTTOM_PERCENT ) + { + ScDocument& rDoc = getScDocument(); + ScTokenArray aTokenArray; + aTokenArray.AddDouble( maModel.mnRank ); + OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); + ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, NULL, &rDoc, aPos, aStyleName ); + mpFormat->AddEntry(pNewEntry); + } else if( mpColor ) { ScDocument& rDoc = getScDocument(); -- cgit