diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-12-14 10:29:48 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-12-15 07:51:29 +0100 |
commit | 4578832a84b1818943da907c4e292af64c49beee (patch) | |
tree | 4fb73b3915855d21b1996278fc71f53374181111 /sc | |
parent | 7073310431becb1a69af0c7187b9844ce7901cd5 (diff) |
use correct cond format dlg setUp for colorscales, fdo#58232
Change-Id: Ib119b09b110d6563bc0abd304f60031a8592d7f1
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlgentry.cxx | 17 |
2 files changed, 14 insertions, 11 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 62364323f239..c9667ce800cc 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -84,7 +84,13 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum } break; case condformat::COLORSCALE: - maEntries.push_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos, static_cast<const ScColorScaleFormat*>( pEntry ) ) ); + { + const ScColorScaleFormat* pColorScale = static_cast<const ScColorScaleFormat*>( pEntry ); + if( pColorScale->size() == 2 ) + maEntries.push_back(new ScColorScale2FrmtEntry( this, mpDoc, maPos, pColorScale ) ); + else + maEntries.push_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos, pColorScale ) ); + } break; case condformat::DATABAR: maEntries.push_back(new ScDataBarFrmtEntry( this, mpDoc, maPos, static_cast<const ScDataBarFormat*>( pEntry ) ) ); diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 96c9bdab6445..3c27da6e70ac 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -582,7 +582,10 @@ namespace { void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol ) { - rLbType.SelectEntryPos(rEntry.GetType()); + // entry Automatic is not available for color scales + sal_Int32 nIndex = static_cast<sal_Int32>(rEntry.GetType()); + assert(nIndex > 0); + rLbType.SelectEntryPos(nIndex - 1); switch(rEntry.GetType()) { case COLORSCALE_MIN: @@ -818,17 +821,11 @@ ScColorScale3FrmtEntry::ScColorScale3FrmtEntry( Window* pParent, ScDocument* pDo maLbType.SelectEntryPos(0); if(pFormat) { - if(pFormat->size() == 2) - maLbColorFormat.SelectEntryPos(0); - else - maLbColorFormat.SelectEntryPos(1); ScColorScaleFormat::const_iterator itr = pFormat->begin(); SetColorScaleEntryTypes(*itr, maLbEntryTypeMin, maEdMin, maLbColMin); - if(pFormat->size() == 3) - { - ++itr; - SetColorScaleEntryTypes(*itr, maLbEntryTypeMiddle, maEdMiddle, maLbColMiddle); - } + assert(pFormat->size() == 3); + ++itr; + SetColorScaleEntryTypes(*itr, maLbEntryTypeMiddle, maEdMiddle, maLbColMiddle); ++itr; SetColorScaleEntryTypes(*itr, maLbEntryTypeMax, maEdMax, maLbColMax); } |