sc/inc/colorscale.hxx | 10 + sc/source/core/data/colorscale.cxx | 13 -- sc/source/filter/excel/xecontent.cxx | 22 ++-- sc/source/filter/excel/xeextlst.cxx | 22 ++-- sc/source/filter/inc/xecontent.hxx | 3 sc/source/filter/inc/xeextlst.hxx | 3 sc/source/filter/oox/extlstcontext.cxx | 4 sc/source/filter/xml/xmlcondformat.cxx | 6 - sc/source/filter/xml/xmlexprt.cxx | 16 +- sc/source/ui/condformat/colorformat.cxx | 78 +++----------- sc/source/ui/condformat/condformatdlgentry.cxx | 135 +++++++++---------------- sc/source/ui/src/colorformat.src | 5 sc/source/ui/src/condformatdlg.src | 9 - 13 files changed, 126 insertions(+), 200 deletions(-)
New commits: commit 1818256fb39d292cc7ed7d24f1db4b4b03e74c58 Author: Markus Mohrhard <[email protected]> Date: Wed Oct 10 06:33:55 2012 +0200 adapt indexes in databar dlg Change-Id: I381a34b5b7422c5f3a7b6f8f4a8d37859cfb12be diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index 963137d..532c692 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -252,15 +252,15 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl ) //check that min < max bool bWarn = false; sal_Int32 nSelectMin = maLbTypeMin.GetSelectEntryPos(); - if( nSelectMin == COLORSCALE_MIN ) + if( nSelectMin == COLORSCALE_MAX ) bWarn = true; sal_Int32 nSelectMax = maLbTypeMax.GetSelectEntryPos(); - if( nSelectMax == COLORSCALE_MAX ) + if( nSelectMax == COLORSCALE_MIN ) bWarn = true; if(!bWarn && maLbTypeMin.GetSelectEntryPos() == maLbTypeMax.GetSelectEntryPos()) { - if(maLbTypeMax.GetSelectEntryPos() != 5) + if(maLbTypeMax.GetSelectEntryPos() != COLORSCALE_FORMULA) { rtl::OUString aMinString = maEdMin.GetText(); rtl::OUString aMaxString = maEdMax.GetText(); commit 616662f48df7a13dd957918f43202ccb2d1899b3 Author: Markus Mohrhard <[email protected]> Date: Wed Oct 10 06:08:42 2012 +0200 forgot to hide this list box when deactivating an entry Change-Id: I9313a5ac542ca83be418b9c9aeca46e500c3ddaa diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 14b7bd4..97706f8 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -674,6 +674,8 @@ ScFormatEntry* ScColorScale2FrmtEntry::GetEntry() const void ScColorScale2FrmtEntry::SetActive() { + maLbColorFormat.Show(); + maLbEntryTypeMin.Show(); maLbEntryTypeMax.Show(); @@ -688,6 +690,8 @@ void ScColorScale2FrmtEntry::SetActive() void ScColorScale2FrmtEntry::SetInactive() { + maLbColorFormat.Hide(); + maLbEntryTypeMin.Hide(); maLbEntryTypeMax.Hide(); @@ -839,6 +843,7 @@ ScFormatEntry* ScColorScale3FrmtEntry::GetEntry() const void ScColorScale3FrmtEntry::SetActive() { + maLbColorFormat.Show(); maLbEntryTypeMin.Show(); maLbEntryTypeMiddle.Show(); maLbEntryTypeMax.Show(); @@ -856,6 +861,8 @@ void ScColorScale3FrmtEntry::SetActive() void ScColorScale3FrmtEntry::SetInactive() { + maLbColorFormat.Hide(); + maLbEntryTypeMin.Hide(); maLbEntryTypeMiddle.Hide(); maLbEntryTypeMax.Hide(); @@ -1002,6 +1009,8 @@ ScFormatEntry* ScDataBarFrmtEntry::createDatabarEntry() const void ScDataBarFrmtEntry::SetActive() { + maLbColorFormat.Show(); + maLbDataBarMinType.Show(); maLbDataBarMaxType.Show(); maEdDataBarMin.Show(); @@ -1013,6 +1022,8 @@ void ScDataBarFrmtEntry::SetActive() void ScDataBarFrmtEntry::SetInactive() { + maLbColorFormat.Hide(); + maLbDataBarMinType.Hide(); maLbDataBarMaxType.Hide(); maEdDataBarMin.Hide(); commit 2757c7450de3369872a247cf4876bb1723cc48fa Author: Markus Mohrhard <[email protected]> Date: Wed Oct 10 06:06:23 2012 +0200 unify the list box entry handling a bit Change-Id: Ia42e56dd21567ac65ca952dc66471cfb326a9e1c diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 7ee92ce..92f88f3 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -45,15 +45,18 @@ class ScFormulaCell; class ScTokenArray; struct ScDataBarInfo; +// don't change the order +// they are also used in the dialog to determine the position +// in the list box enum ScColorScaleEntryType { - COLORSCALE_VALUE, + COLORSCALE_AUTO, COLORSCALE_MIN, COLORSCALE_MAX, - COLORSCALE_PERCENT, COLORSCALE_PERCENTILE, + COLORSCALE_VALUE, + COLORSCALE_PERCENT, COLORSCALE_FORMULA, - COLORSCALE_AUTO, }; class SC_DLLPUBLIC ScColorScaleEntry diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index 7dfa918..963137d 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -69,62 +69,26 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDocument* pDoc): namespace { -void SetType(const ScColorScaleEntry* pEntry, ListBox& aLstBox) +void SetType(const ScColorScaleEntry* pEntry, ListBox& rLstBox) { - switch(pEntry->GetType()) - { - case COLORSCALE_AUTO: - aLstBox.SelectEntryPos(0); - break; - case COLORSCALE_MIN: - aLstBox.SelectEntryPos(1); - break; - case COLORSCALE_MAX: - aLstBox.SelectEntryPos(2); - break; - case COLORSCALE_PERCENTILE: - aLstBox.SelectEntryPos(3); - break; - case COLORSCALE_PERCENT: - aLstBox.SelectEntryPos(4); - break; - case COLORSCALE_FORMULA: - aLstBox.SelectEntryPos(6); - break; - case COLORSCALE_VALUE: - aLstBox.SelectEntryPos(5); - break; - } + rLstBox.SelectEntryPos(pEntry->GetType()); } void GetType(const ListBox& rLstBox, const Edit& rEd, ScColorScaleEntry* pEntry, SvNumberFormatter* pNumberFormatter ) { double nVal = 0; sal_uInt32 nIndex = 0; + pEntry->SetType(static_cast<ScColorScaleEntryType>(rLstBox.GetSelectEntryPos())); switch(rLstBox.GetSelectEntryPos()) { - case 0: - pEntry->SetType(COLORSCALE_AUTO); - break; - case 1: - pEntry->SetType(COLORSCALE_MIN); - break; - case 2: - pEntry->SetType(COLORSCALE_MAX); - break; - case 3: - pEntry->SetType(COLORSCALE_PERCENTILE); - pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); - pEntry->SetValue(nVal); - break; - case 4: - pEntry->SetType(COLORSCALE_PERCENT); - pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); - pEntry->SetValue(nVal); + case COLORSCALE_AUTO: + case COLORSCALE_MIN: + case COLORSCALE_MAX: break; - case 5: + case COLORSCALE_PERCENTILE: + case COLORSCALE_VALUE: + case COLORSCALE_PERCENT: pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); - pEntry->SetType(COLORSCALE_VALUE); pEntry->SetValue(nVal); break; case 6: @@ -288,10 +252,10 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl ) //check that min < max bool bWarn = false; sal_Int32 nSelectMin = maLbTypeMin.GetSelectEntryPos(); - if( nSelectMin == 1 || nSelectMin == 7) + if( nSelectMin == COLORSCALE_MIN ) bWarn = true; sal_Int32 nSelectMax = maLbTypeMax.GetSelectEntryPos(); - if( nSelectMax == 0 || nSelectMax == 6 ) + if( nSelectMax == COLORSCALE_MAX ) bWarn = true; if(!bWarn && maLbTypeMin.GetSelectEntryPos() == maLbTypeMax.GetSelectEntryPos()) @@ -327,14 +291,14 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, OkBtnHdl ) IMPL_LINK_NOARG( ScDataBarSettingsDlg, TypeSelectHdl ) { sal_Int32 nSelectMin = maLbTypeMin.GetSelectEntryPos(); - if( nSelectMin == 0 || nSelectMin == 1 || nSelectMin == 6 || nSelectMin == 7) + if( nSelectMin <= COLORSCALE_MAX) maEdMin.Disable(); else { maEdMin.Enable(); if(!maEdMin.GetText().Len()) { - if(nSelectMin == 2 || nSelectMin == 3) + if(nSelectMin == COLORSCALE_PERCENTILE || nSelectMin == COLORSCALE_PERCENT) maEdMin.SetText(rtl::OUString::valueOf(static_cast<sal_Int32>(50))); else maEdMin.SetText(rtl::OUString::valueOf(static_cast<sal_Int32>(0))); @@ -342,14 +306,14 @@ IMPL_LINK_NOARG( ScDataBarSettingsDlg, TypeSelectHdl ) } sal_Int32 nSelectMax = maLbTypeMax.GetSelectEntryPos(); - if(nSelectMax == 0 || nSelectMax == 1 || nSelectMax == 6 || nSelectMax == 7) + if(nSelectMax <= COLORSCALE_MAX) maEdMax.Disable(); else { maEdMax.Enable(); if(!maEdMax.GetText().Len()) { - if(nSelectMax == 2 || nSelectMax == 3) + if(nSelectMax == COLORSCALE_PERCENTILE || nSelectMax == COLORSCALE_PERCENT) maEdMax.SetText(rtl::OUString::valueOf(static_cast<sal_Int32>(50))); else maEdMax.SetText(rtl::OUString::valueOf(static_cast<sal_Int32>(0))); diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index c252238..14b7bd4 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -515,29 +515,19 @@ namespace { void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol ) { + rLbType.SelectEntryPos(rEntry.GetType()); switch(rEntry.GetType()) { case COLORSCALE_MIN: - rLbType.SelectEntryPos(1); - break; case COLORSCALE_MAX: - rLbType.SelectEntryPos(2); break; case COLORSCALE_PERCENTILE: - rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(3); - break; + case COLORSCALE_VALUE: case COLORSCALE_PERCENT: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(5); break; case COLORSCALE_FORMULA: rEdit.SetText(rEntry.GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); - rLbType.SelectEntryPos(6); - break; - case COLORSCALE_VALUE: - rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(4); break; case COLORSCALE_AUTO: abort(); @@ -558,33 +548,23 @@ void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const if(!bDataBar) ++nPos; + pEntry->SetType(static_cast<ScColorScaleEntryType>(nPos)); switch(nPos) { - case 1: - pEntry->SetType(COLORSCALE_MIN); - break; - case 2: - pEntry->SetType(COLORSCALE_MAX); + case COLORSCALE_AUTO: + case COLORSCALE_MIN: + case COLORSCALE_MAX: break; - case 3: - pEntry->SetType(COLORSCALE_PERCENTILE); - pEntry->SetValue(nVal); break; - case 4: - pEntry->SetType(COLORSCALE_VALUE); - pEntry->SetValue(nVal); break; - case 5: - pEntry->SetType(COLORSCALE_PERCENT); + case COLORSCALE_PERCENTILE: + case COLORSCALE_VALUE: + case COLORSCALE_PERCENT: pEntry->SetValue(nVal); break; - case 6: - pEntry->SetType(COLORSCALE_FORMULA); + case COLORSCALE_FORMULA: pEntry->SetFormula(rValue.GetText(), pDoc, rPos); break; - case 0: - pEntry->SetType(COLORSCALE_AUTO); - break; default: break; } @@ -724,7 +704,7 @@ IMPL_LINK( ScColorScale2FrmtEntry, EntryTypeHdl, ListBox*, pBox ) { bool bEnableEdit = true; sal_Int32 nPos = pBox->GetSelectEntryPos(); - if(nPos == 0 || nPos == 1) + if(nPos < 2) { bEnableEdit = false; } @@ -895,7 +875,7 @@ IMPL_LINK( ScColorScale3FrmtEntry, EntryTypeHdl, ListBox*, pBox ) { bool bEnableEdit = true; sal_Int32 nPos = pBox->GetSelectEntryPos(); - if(nPos == 0 || nPos == 1) + if(nPos < 2) { bEnableEdit = false; } @@ -936,32 +916,24 @@ namespace { void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit ) { + rLbType.SelectEntryPos(rEntry.GetType()); switch(rEntry.GetType()) { + case COLORSCALE_AUTO: case COLORSCALE_MIN: - rLbType.SelectEntryPos(1); - break; case COLORSCALE_MAX: - rLbType.SelectEntryPos(2); break; case COLORSCALE_PERCENTILE: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(3); break; case COLORSCALE_PERCENT: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(5); break; case COLORSCALE_FORMULA: rEdit.SetText(rEntry.GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); - rLbType.SelectEntryPos(6); break; case COLORSCALE_VALUE: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(4); - break; - case COLORSCALE_AUTO: - rLbType.SelectEntryPos(0); break; } } @@ -990,6 +962,7 @@ ScDataBarFrmtEntry::ScDataBarFrmtEntry( Window* pParent, ScDocument* pDoc, const { maLbDataBarMinType.SelectEntryPos(0); maLbDataBarMaxType.SelectEntryPos(0); + DataBarTypeSelectHdl(NULL); } Init(); @@ -1052,13 +1025,13 @@ void ScDataBarFrmtEntry::SetInactive() IMPL_LINK_NOARG( ScDataBarFrmtEntry, DataBarTypeSelectHdl ) { sal_Int32 nSelectPos = maLbDataBarMinType.GetSelectEntryPos(); - if(nSelectPos == 0 || nSelectPos == 1) + if(nSelectPos <= COLORSCALE_MAX) maEdDataBarMin.Disable(); else maEdDataBarMin.Enable(); nSelectPos = maLbDataBarMaxType.GetSelectEntryPos(); - if(nSelectPos == 0 || nSelectPos == 1) + if(nSelectPos <= COLORSCALE_MAX) maEdDataBarMax.Disable(); else maEdDataBarMax.Enable(); diff --git a/sc/source/ui/src/colorformat.src b/sc/source/ui/src/colorformat.src index dd702e1..2cc5852 100644 --- a/sc/source/ui/src/colorformat.src +++ b/sc/source/ui/src/colorformat.src @@ -138,8 +138,8 @@ ModalDialog RID_SCDLG_DATABAR "Minimum"; "Maximum"; "Percentile"; - "Percent"; "Value"; + "Percent"; "Formula"; }; }; commit 8816aa1b8301bce189ee4582fa1b8f04864726a4 Author: Markus Mohrhard <[email protected]> Date: Wed Oct 10 05:37:27 2012 +0200 remove commented out code Change-Id: I393ae93fa59530cccd9550f11957e03cb8fa6038 diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index ef022c0..c252238 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -648,25 +648,6 @@ void ScColorScale2FrmtEntry::Init() DBG_ASSERT( pDocSh, "DocShell not found!" ); - /* - Point aPointLb = maLbEntryTypeMiddle.GetPosPixel(); - Point aPointEd = maEdMiddle.GetPosPixel(); - Point aPointCol = maLbColMiddle.GetPosPixel(); - const long nMovePos = maLbEntryTypeMiddle.GetSizePixel().Width() * 1.2; - aPointLb.X() += nMovePos; - aPointEd.X() += nMovePos; - aPointCol.X() += nMovePos; - maLbEntryTypeMiddle.SetPosPixel(aPointLb); - maEdMiddle.SetPosPixel(aPointEd); - maLbColMiddle.SetPosPixel(aPointCol); - aPointLb.X() += nMovePos; - aPointEd.X() += nMovePos; - aPointCol.X() += nMovePos; - maLbEntryTypeMax.SetPosPixel(aPointLb); - maEdMax.SetPosPixel(aPointEd); - maLbColMax.SetPosPixel(aPointCol); - */ - if ( pDocSh ) { pItem = pDocSh->GetItem( SID_COLOR_TABLE ); commit e7ff934f128b34ce2cdf636f9117615ae5a26fb0 Author: Markus Mohrhard <[email protected]> Date: Wed Oct 10 05:36:22 2012 +0200 rename autoMin and autoMax to Automatic, disable it for color scales Change-Id: I1f92acfc5603d965b1bc84e7968da56901385eac diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 146c10b..7ee92ce 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -53,8 +53,7 @@ enum ScColorScaleEntryType COLORSCALE_PERCENT, COLORSCALE_PERCENTILE, COLORSCALE_FORMULA, - COLORSCALE_AUTOMIN, - COLORSCALE_AUTOMAX + COLORSCALE_AUTO, }; class SC_DLLPUBLIC ScColorScaleEntry diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 6951e8b..1f6779f 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -397,12 +397,8 @@ double ScColorScaleFormat::CalcValue(double nMin, double nMax, ScColorScaleForma return nMin + (nMax-nMin)*(itr->GetValue()/100); case COLORSCALE_MIN: return nMin; - case COLORSCALE_AUTOMIN: - return std::min<double>(0, nMin); case COLORSCALE_MAX: return nMax; - case COLORSCALE_AUTOMAX: - return std::max<double>(0, nMax); case COLORSCALE_PERCENTILE: { std::vector<double>& rValues = getValues(); @@ -526,8 +522,6 @@ bool ScColorScaleFormat::CheckEntriesForRel(const ScRange& rRange) const { case COLORSCALE_MIN: case COLORSCALE_MAX: - case COLORSCALE_AUTOMIN: - case COLORSCALE_AUTOMAX: bNeedUpdate = true; break; case COLORSCALE_FORMULA: @@ -634,8 +628,7 @@ bool NeedUpdate(ScColorScaleEntry* pEntry) case COLORSCALE_MIN: case COLORSCALE_MAX: case COLORSCALE_FORMULA: - case COLORSCALE_AUTOMIN: - case COLORSCALE_AUTOMAX: + case COLORSCALE_AUTO: return true; default: return false; @@ -678,7 +671,7 @@ double ScDataBarFormat::getMin(double nMin, double nMax) const case COLORSCALE_MIN: return nMin; - case COLORSCALE_AUTOMIN: + case COLORSCALE_AUTO: return std::min<double>(0, nMin); case COLORSCALE_PERCENT: @@ -704,7 +697,7 @@ double ScDataBarFormat::getMax(double nMin, double nMax) const { case COLORSCALE_MAX: return nMax; - case COLORSCALE_AUTOMAX: + case COLORSCALE_AUTO: return std::max<double>(0, nMax); case COLORSCALE_PERCENT: return nMin + (nMax-nMin)/100*mpFormatData->mpUpperLimit->GetValue(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index c6bffc3..c73155b 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -885,17 +885,18 @@ void XclExpCF::SaveXml( XclExpXmlStream& rStrm ) mxImpl->SaveXml( rStrm ); } -XclExpCfvo::XclExpCfvo(const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rAddr): +XclExpCfvo::XclExpCfvo(const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rAddr, bool bFirst): XclExpRecord(), XclExpRoot( rRoot ), mrEntry(rEntry), - maSrcPos(rAddr) + maSrcPos(rAddr), + mbFirst(bFirst) { } namespace { -rtl::OString getColorScaleType( const ScColorScaleEntry& rEntry ) +rtl::OString getColorScaleType( const ScColorScaleEntry& rEntry, bool bFirst ) { switch(rEntry.GetType()) { @@ -907,10 +908,11 @@ rtl::OString getColorScaleType( const ScColorScaleEntry& rEntry ) return "percent"; case COLORSCALE_FORMULA: return "formula"; - case COLORSCALE_AUTOMIN: - return "min"; - case COLORSCALE_AUTOMAX: - return "max"; + case COLORSCALE_AUTO: + if(bFirst) + return "min"; + else + return "max"; case COLORSCALE_PERCENTILE: return "percentile"; default: @@ -938,7 +940,7 @@ void XclExpCfvo::SaveXml( XclExpXmlStream& rStrm ) } rWorksheet->startElement( XML_cfvo, - XML_type, getColorScaleType(mrEntry).getStr(), + XML_type, getColorScaleType(mrEntry, mbFirst).getStr(), XML_val, aValue.getStr(), FSEND ); @@ -1115,8 +1117,8 @@ XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rF const ScRange* pRange = rFormat.GetRange().front(); ScAddress aAddr = pRange->aStart; // exact position is not important, we allow only absolute refs - mpCfvoLowerLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpLowerLimit.get(), aAddr ) ); - mpCfvoUpperLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpUpperLimit.get(), aAddr ) ); + mpCfvoLowerLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpLowerLimit.get(), aAddr, true ) ); + mpCfvoUpperLimit.reset( new XclExpCfvo( GetRoot(), *mrFormat.GetDataBarData()->mpUpperLimit.get(), aAddr, false ) ); mpCol.reset( new XclExpColScaleCol( GetRoot(), mrFormat.GetDataBarData()->maPositiveColor ) ); if(xExtLst.get()) diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index 32041c5..53ab66b 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -51,9 +51,10 @@ void XclExpExtAxisColor::SaveXml( XclExpXmlStream& rStrm ) FSEND ); } -XclExpExtCfvo::XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rSrcPos ): +XclExpExtCfvo::XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rSrcPos, bool bFirst ): XclExpRoot(rRoot), - meType(rEntry.GetType()) + meType(rEntry.GetType()), + mbFirst(bFirst) { if( rEntry.GetType() == COLORSCALE_FORMULA ) { @@ -66,7 +67,7 @@ XclExpExtCfvo::XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& namespace { -const char* getColorScaleType( ScColorScaleEntryType eType ) +const char* getColorScaleType( ScColorScaleEntryType eType, bool bFirst ) { switch(eType) { @@ -78,10 +79,11 @@ const char* getColorScaleType( ScColorScaleEntryType eType ) return "percent"; case COLORSCALE_FORMULA: return "formula"; - case COLORSCALE_AUTOMIN: - return "autoMin"; - case COLORSCALE_AUTOMAX: - return "autoMax"; + case COLORSCALE_AUTO: + if(bFirst) + return "autoMin"; + else + return "autoMax"; case COLORSCALE_PERCENTILE: return "percentile"; default: @@ -96,7 +98,7 @@ void XclExpExtCfvo::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->singleElementNS( XML_x14, XML_cfvo, - XML_type, getColorScaleType(meType), + XML_type, getColorScaleType(meType, mbFirst), XML_value, maValue.getStr(), FSEND ); } @@ -105,8 +107,8 @@ XclExpExtDataBar::XclExpExtDataBar( const XclExpRoot& rRoot, const ScDataBarForm XclExpRoot(rRoot) { const ScDataBarFormatData& rFormatData = *rFormat.GetDataBarData(); - mpLowerLimit.reset( new XclExpExtCfvo( *this, *rFormatData.mpLowerLimit.get(), rPos ) ); - mpUpperLimit.reset( new XclExpExtCfvo( *this, *rFormatData.mpUpperLimit.get(), rPos ) ); + mpLowerLimit.reset( new XclExpExtCfvo( *this, *rFormatData.mpLowerLimit.get(), rPos, true ) ); + mpUpperLimit.reset( new XclExpExtCfvo( *this, *rFormatData.mpUpperLimit.get(), rPos, false ) ); if(rFormatData.mpNegativeColor.get()) mpNegativeColor.reset( new XclExpExtNegativeColor( *rFormatData.mpNegativeColor.get() ) ); else diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx index 23ca6e4..9417ab2 100644 --- a/sc/source/filter/inc/xecontent.hxx +++ b/sc/source/filter/inc/xecontent.hxx @@ -194,13 +194,14 @@ private: class XclExpCfvo : public XclExpRecord, protected XclExpRoot { public: - explicit XclExpCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rFormatEntry, const ScAddress& rPos); + explicit XclExpCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rFormatEntry, const ScAddress& rPos, bool bFirst = true); virtual ~XclExpCfvo() {} virtual void SaveXml( XclExpXmlStream& rStrm ); private: const ScColorScaleEntry& mrEntry; ScAddress maSrcPos; + bool mbFirst; }; class XclExpColScaleCol : public XclExpRecord, protected XclExpRoot diff --git a/sc/source/filter/inc/xeextlst.hxx b/sc/source/filter/inc/xeextlst.hxx index 6ce7b70..4668111 100644 --- a/sc/source/filter/inc/xeextlst.hxx +++ b/sc/source/filter/inc/xeextlst.hxx @@ -40,12 +40,13 @@ protected: class XclExpExtCfvo : public XclExpRecordBase, protected XclExpRoot { public: - XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rPos ); + XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rPos, bool bFirst ); virtual void SaveXml( XclExpXmlStream& rStrm ); private: ScColorScaleEntryType meType; rtl::OString maValue; + bool mbFirst; }; class XclExpExtNegativeColor diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index 78fd832..43a3859 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -131,9 +131,9 @@ void ExtCfRuleContext::importCfvo( const AttributeList& rAttribs ) else if (aColorScaleType == "max") pEntry->SetType(COLORSCALE_MAX); else if (aColorScaleType == "autoMin") - pEntry->SetType(COLORSCALE_AUTOMIN); + pEntry->SetType(COLORSCALE_AUTO); else if (aColorScaleType == "autoMax") - pEntry->SetType(COLORSCALE_AUTOMAX); + pEntry->SetType(COLORSCALE_AUTO); else if (aColorScaleType == "percentile") pEntry->SetType(COLORSCALE_PERCENTILE); else if (aColorScaleType == "percent") diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx index 32e0751..9733bd2 100644 --- a/sc/source/filter/xml/xmlcondformat.cxx +++ b/sc/source/filter/xml/xmlcondformat.cxx @@ -436,11 +436,9 @@ void setColorEntryType(const rtl::OUString& rType, ScColorScaleEntry* pEntry, co pEntry->SetFormula(rFormula, rImport.GetDocument(), ScAddress(0,0,rImport.GetTables().GetCurrentSheet()), formula::FormulaGrammar::GRAM_ODFF); } else if(rType == "auto-minimum") - pEntry->SetType(COLORSCALE_AUTOMIN); + pEntry->SetType(COLORSCALE_AUTO); else if(rType == "auto-maximum") - pEntry->SetType(COLORSCALE_AUTOMAX); - - //TODO: add formulas + pEntry->SetType(COLORSCALE_AUTO); } } diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index a9eaf1b..98e15c6 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3784,7 +3784,7 @@ void ScXMLExport::WriteNamedRange(ScRangeName* pRangeName) namespace { -rtl::OUString getCondFormatEntryType(const ScColorScaleEntry& rEntry) +rtl::OUString getCondFormatEntryType(const ScColorScaleEntry& rEntry, bool bFirst = true) { switch(rEntry.GetType()) { @@ -3800,10 +3800,12 @@ rtl::OUString getCondFormatEntryType(const ScColorScaleEntry& rEntry) return rtl::OUString("formula"); case COLORSCALE_VALUE: return rtl::OUString("number"); - case COLORSCALE_AUTOMIN: - return rtl::OUString("auto-minimum"); - case COLORSCALE_AUTOMAX: - return rtl::OUString("auto-maximum"); + case COLORSCALE_AUTO: + // only important for data bars + if(bFirst) + return rtl::OUString("auto-minimum"); + else + return rtl::OUString("auto-maximum"); } return rtl::OUString(); } @@ -3977,7 +3979,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) } else AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpLowerLimit->GetValue())); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit)); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit, true)); SvXMLElementExport aElementDataBarEntryLower(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, true, true); } @@ -3989,7 +3991,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) } else AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpUpperLimit->GetValue())); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit)); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit, false)); SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, true, true); } } diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index 77acc7d..7dfa918 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -63,7 +63,7 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDocument* pDoc): FreeResource(); maLbTypeMin.SelectEntryPos(0); - maLbTypeMax.SelectEntryPos(1); + maLbTypeMax.SelectEntryPos(0); maLbAxisPos.SelectEntryPos(0); } @@ -73,29 +73,26 @@ void SetType(const ScColorScaleEntry* pEntry, ListBox& aLstBox) { switch(pEntry->GetType()) { - case COLORSCALE_MIN: + case COLORSCALE_AUTO: aLstBox.SelectEntryPos(0); break; - case COLORSCALE_MAX: + case COLORSCALE_MIN: aLstBox.SelectEntryPos(1); break; - case COLORSCALE_PERCENTILE: + case COLORSCALE_MAX: aLstBox.SelectEntryPos(2); break; - case COLORSCALE_PERCENT: + case COLORSCALE_PERCENTILE: aLstBox.SelectEntryPos(3); break; - case COLORSCALE_FORMULA: - aLstBox.SelectEntryPos(5); - break; - case COLORSCALE_VALUE: + case COLORSCALE_PERCENT: aLstBox.SelectEntryPos(4); break; - case COLORSCALE_AUTOMIN: + case COLORSCALE_FORMULA: aLstBox.SelectEntryPos(6); break; - case COLORSCALE_AUTOMAX: - aLstBox.SelectEntryPos(7); + case COLORSCALE_VALUE: + aLstBox.SelectEntryPos(5); break; } } @@ -107,34 +104,31 @@ void GetType(const ListBox& rLstBox, const Edit& rEd, ScColorScaleEntry* pEntry, switch(rLstBox.GetSelectEntryPos()) { case 0: - pEntry->SetType(COLORSCALE_MIN); + pEntry->SetType(COLORSCALE_AUTO); break; case 1: - pEntry->SetType(COLORSCALE_MAX); + pEntry->SetType(COLORSCALE_MIN); break; case 2: + pEntry->SetType(COLORSCALE_MAX); + break; + case 3: pEntry->SetType(COLORSCALE_PERCENTILE); pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); pEntry->SetValue(nVal); break; - case 3: + case 4: pEntry->SetType(COLORSCALE_PERCENT); pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); pEntry->SetValue(nVal); break; - case 4: + case 5: pNumberFormatter->IsNumberFormat( rEd.GetText(), nIndex, nVal ); pEntry->SetType(COLORSCALE_VALUE); pEntry->SetValue(nVal); break; - case 5: - //TODO: moggi - break; case 6: - pEntry->SetType(COLORSCALE_AUTOMIN); - break; - case 7: - pEntry->SetType(COLORSCALE_AUTOMAX); + //TODO: moggi break; } } diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 707462f..ef022c0 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -518,72 +518,72 @@ void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, switch(rEntry.GetType()) { case COLORSCALE_MIN: - rLbType.SelectEntryPos(0); + rLbType.SelectEntryPos(1); break; case COLORSCALE_MAX: - rLbType.SelectEntryPos(1); + rLbType.SelectEntryPos(2); break; case COLORSCALE_PERCENTILE: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(2); + rLbType.SelectEntryPos(3); break; case COLORSCALE_PERCENT: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(4); + rLbType.SelectEntryPos(5); break; case COLORSCALE_FORMULA: rEdit.SetText(rEntry.GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); - rLbType.SelectEntryPos(5); + rLbType.SelectEntryPos(6); break; case COLORSCALE_VALUE: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(3); - break; - case COLORSCALE_AUTOMIN: - rLbType.SelectEntryPos(6); + rLbType.SelectEntryPos(4); break; - case COLORSCALE_AUTOMAX: - rLbType.SelectEntryPos(7); + case COLORSCALE_AUTO: + abort(); break; } rLbCol.SelectEntry(rEntry.GetColor()); } -void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) +void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos, bool bDataBar ) { sal_uInt32 nIndex = 0; double nVal = 0; SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable(); pNumberFormatter->IsNumberFormat(rValue.GetText(), nIndex, nVal); - switch(rType.GetSelectEntryPos()) + + // color scale does not have the automatic entry + sal_Int32 nPos = rType.GetSelectEntryPos(); + if(!bDataBar) + ++nPos; + + switch(nPos) { - case 0: + case 1: pEntry->SetType(COLORSCALE_MIN); break; - case 1: + case 2: pEntry->SetType(COLORSCALE_MAX); break; - case 2: + case 3: pEntry->SetType(COLORSCALE_PERCENTILE); pEntry->SetValue(nVal); break; - case 3: + case 4: pEntry->SetType(COLORSCALE_VALUE); pEntry->SetValue(nVal); break; - case 4: + case 5: pEntry->SetType(COLORSCALE_PERCENT); pEntry->SetValue(nVal); break; - case 5: + case 6: pEntry->SetType(COLORSCALE_FORMULA); pEntry->SetFormula(rValue.GetText(), pDoc, rPos); break; - case 6: - pEntry->SetType(COLORSCALE_AUTOMIN); - break; - case 7: - pEntry->SetType(COLORSCALE_AUTOMAX); + case 0: + pEntry->SetType(COLORSCALE_AUTO); break; default: break; @@ -594,7 +594,7 @@ ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const ColorListB { ScColorScaleEntry* pEntry = new ScColorScaleEntry(); - SetColorScaleEntry( pEntry, rType, rValue, pDoc, rPos ); + SetColorScaleEntry( pEntry, rType, rValue, pDoc, rPos, false ); Color aColor = rColor.GetSelectEntryColor(); pEntry->SetColor(aColor); return pEntry; @@ -612,6 +612,10 @@ ScColorScale2FrmtEntry::ScColorScale2FrmtEntry( Window* pParent, ScDocument* pDo maLbColMin( this, ScResId( LB_COL_MIN ) ), maLbColMax( this, ScResId( LB_COL_MAX ) ) { + // remove the automatic entry from color scales + maLbEntryTypeMin.RemoveEntry(0); + maLbEntryTypeMax.RemoveEntry(0); + maLbType.SelectEntryPos(0); maLbColorFormat.SelectEntryPos(0); if(pFormat) @@ -771,6 +775,11 @@ ScColorScale3FrmtEntry::ScColorScale3FrmtEntry( Window* pParent, ScDocument* pDo maLbColMiddle( this, ScResId( LB_COL_MIDDLE ) ), maLbColMax( this, ScResId( LB_COL_MAX ) ) { + // remove the automatic entry from color scales + maLbEntryTypeMin.RemoveEntry(0); + maLbEntryTypeMiddle.RemoveEntry(0); + maLbEntryTypeMax.RemoveEntry(0); + maLbType.SelectEntryPos(0); if(pFormat) { @@ -949,32 +958,29 @@ void SetDataBarEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Ed switch(rEntry.GetType()) { case COLORSCALE_MIN: - rLbType.SelectEntryPos(0); + rLbType.SelectEntryPos(1); break; case COLORSCALE_MAX: - rLbType.SelectEntryPos(1); + rLbType.SelectEntryPos(2); break; case COLORSCALE_PERCENTILE: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(2); + rLbType.SelectEntryPos(3); break; case COLORSCALE_PERCENT: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(4); + rLbType.SelectEntryPos(5); break; case COLORSCALE_FORMULA: rEdit.SetText(rEntry.GetFormula(formula::FormulaGrammar::GRAM_DEFAULT)); - rLbType.SelectEntryPos(5); + rLbType.SelectEntryPos(6); break; case COLORSCALE_VALUE: rEdit.SetText(rtl::OUString::valueOf(rEntry.GetValue())); - rLbType.SelectEntryPos(3); - break; - case COLORSCALE_AUTOMIN: - rLbType.SelectEntryPos(6); + rLbType.SelectEntryPos(4); break; - case COLORSCALE_AUTOMAX: - rLbType.SelectEntryPos(7); + case COLORSCALE_AUTO: + rLbType.SelectEntryPos(0); break; } } @@ -1002,7 +1008,7 @@ ScDataBarFrmtEntry::ScDataBarFrmtEntry( Window* pParent, ScDocument* pDoc, const else { maLbDataBarMinType.SelectEntryPos(0); - maLbDataBarMaxType.SelectEntryPos(1); + maLbDataBarMaxType.SelectEntryPos(0); } Init(); @@ -1033,8 +1039,8 @@ void ScDataBarFrmtEntry::Init() ScFormatEntry* ScDataBarFrmtEntry::createDatabarEntry() const { - SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos); - SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos); + SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos, true); ScDataBarFormat* pDataBar = new ScDataBarFormat(mpDoc); pDataBar->SetDataBarData(new ScDataBarFormatData(*mpDataBarData.get())); return pDataBar; @@ -1081,8 +1087,8 @@ IMPL_LINK_NOARG( ScDataBarFrmtEntry, DataBarTypeSelectHdl ) IMPL_LINK_NOARG( ScDataBarFrmtEntry, OptionBtnHdl ) { - SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos); - SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos); + SetColorScaleEntry(mpDataBarData->mpLowerLimit.get(), maLbDataBarMinType, maEdDataBarMin, mpDoc, maPos, true); + SetColorScaleEntry(mpDataBarData->mpUpperLimit.get(), maLbDataBarMaxType, maEdDataBarMax, mpDoc, maPos, true); ScDataBarSettingsDlg* pDlg = new ScDataBarSettingsDlg(this, *mpDataBarData, mpDoc); if( pDlg->Execute() == RET_OK) { diff --git a/sc/source/ui/src/colorformat.src b/sc/source/ui/src/colorformat.src index ce07fcb..dd702e1 100644 --- a/sc/source/ui/src/colorformat.src +++ b/sc/source/ui/src/colorformat.src @@ -134,14 +134,13 @@ ModalDialog RID_SCDLG_DATABAR DropDown = TRUE; StringList [ en-US ] = { + "Automatic"; "Minimum"; "Maximum"; "Percentile"; "Percent"; "Value"; "Formula"; - "AutoMin"; - "AutoMax"; }; }; ListBox LB_AXIS_POSITION diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src index 4adff8f..5bd45a0 100644 --- a/sc/source/ui/src/condformatdlg.src +++ b/sc/source/ui/src/condformatdlg.src @@ -199,14 +199,13 @@ Control RID_COND_ENTRY DropDown = TRUE; StringList [ en-US ] = { + "Automatic"; "Min"; "Max"; "Percentile"; "Value"; "Percent"; "Formula"; - "AutoMin"; - "AutoMax"; }; }; ListBox LB_TYPE_COL_SCALE_MIDDLE @@ -217,14 +216,13 @@ Control RID_COND_ENTRY DropDown = TRUE; StringList [ en-US ] = { + "Automatic"; "Min"; "Max"; "Percentile"; "Value"; "Percent"; "Formula"; - "AutoMin"; - "AutoMax"; }; }; ListBox LB_TYPE_COL_SCALE_MAX @@ -235,14 +233,13 @@ Control RID_COND_ENTRY DropDown = TRUE; StringList [ en-US ] = { + "Automatic"; "Min"; "Max"; "Percentile"; "Value"; "Percent"; "Formula"; - "AutoMin"; - "AutoMax"; }; }; Window WD_PREVIEW _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
