diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-27 02:15:01 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-30 01:03:55 +0100 |
commit | 2b2c67c557d427d37a18a66f8acad6fdca726c6f (patch) | |
tree | 72a42e571dae6f1220b3c59187247d1525382bb8 /sc | |
parent | 22b055914f5f1726d45a9802143cff7ada9ededb (diff) |
extract same code into shared method
Change-Id: Ib8c141309227aa711944bed202258d131ed1367d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 75 |
1 files changed, 28 insertions, 47 deletions
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 75fc18aa62fc..f469390c975c 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -141,50 +141,58 @@ void lclAppendProperty( ::std::vector< PropertyValue >& orProps, const OUString& orProps.back().Value <<= rValue; } -} // namespace +//------------------------------------------------------------------------------ -ColorScaleRule::ColorScaleRule( const CondFormat& rFormat ): - WorksheetHelper( rFormat ), - mnCfvo(0), - mnCol(0) -{ -} - -void ColorScaleRule::importCfvo( const AttributeList& rAttribs ) +void SetCfvoData( ColorScaleRuleModelEntry* pEntry, const AttributeList& rAttribs ) { - if(mnCfvo >= maColorScaleRuleEntries.size()) - maColorScaleRuleEntries.push_back(ColorScaleRuleModelEntry()); - rtl::OUString aType = rAttribs.getString( XML_type, rtl::OUString() ); double nVal = rAttribs.getDouble( XML_val, 0.0 ); - maColorScaleRuleEntries[mnCfvo].mnVal = nVal; + pEntry->mnVal = nVal; if (aType == "num") { // nothing to do } else if( aType == "min" ) { - maColorScaleRuleEntries[mnCfvo].mbMin = true; + pEntry->mbMin = true; } else if( aType == "max" ) { - maColorScaleRuleEntries[mnCfvo].mbMax = true; + pEntry->mbMax = true; } else if( aType == "percent" ) { - maColorScaleRuleEntries[mnCfvo].mbPercent = true; + pEntry->mbPercent = true; } else if( aType == "percentile" ) { - maColorScaleRuleEntries[mnCfvo].mbPercentile = true; + pEntry->mbPercentile = true; } else if( aType == "formula" ) { rtl::OUString aFormula = rAttribs.getString( XML_val, rtl::OUString() ); - maColorScaleRuleEntries[mnCfvo].maFormula = aFormula; + pEntry->maFormula = aFormula; } +} + +} + +ColorScaleRule::ColorScaleRule( const CondFormat& rFormat ): + WorksheetHelper( rFormat ), + mnCfvo(0), + mnCol(0) +{ +} + +void ColorScaleRule::importCfvo( const AttributeList& rAttribs ) +{ + if(mnCfvo >= maColorScaleRuleEntries.size()) + maColorScaleRuleEntries.push_back(ColorScaleRuleModelEntry()); + + SetCfvoData( &maColorScaleRuleEntries[mnCfvo], rAttribs ); + ++mnCfvo; } @@ -260,7 +268,7 @@ void ColorScaleRule::AddEntries( ScColorScaleFormat* pFormat, ScDocument* pDoc, } // ============================================================================ -// + DataBarRule::DataBarRule( const CondFormat& rFormat ): WorksheetHelper( rFormat ), mpFormat(new ScDataBarFormatData) @@ -297,35 +305,8 @@ void DataBarRule::importCfvo( const AttributeList& rAttribs ) mpUpperLimit.reset(new ColorScaleRuleModelEntry); pEntry = mpUpperLimit.get(); } - rtl::OUString aType = rAttribs.getString( XML_type, rtl::OUString() ); - double nVal = rAttribs.getDouble( XML_val, 0.0 ); - pEntry->mnVal = nVal; - if (aType == "num") - { - // nothing to do - } - else if( aType == "min" ) - { - pEntry->mbMin = true; - } - else if( aType == "max" ) - { - pEntry->mbMax = true; - } - else if( aType == "percent" ) - { - pEntry->mbPercent = true; - } - else if( aType == "percentile" ) - { - pEntry->mbPercentile = true; - } - else if( aType == "formula" ) - { - rtl::OUString aFormula = rAttribs.getString( XML_val, rtl::OUString() ); - pEntry->maFormula = aFormula; - } + SetCfvoData( pEntry, rAttribs ); } void DataBarRule::importAttribs( const AttributeList& rAttribs ) |