diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-14 09:03:22 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-15 06:44:12 +0200 |
commit | fb4302d489d542ce9afd54a377b3399e1c4cad00 (patch) | |
tree | 017625ad51eca87c384ea35a97b0a789ef0625b4 /sc | |
parent | f14bd201ad7c391b078be1d8e7fb2d072015be70 (diff) |
handle formula is in new conditional format dlg
Change-Id: Ia492b8fb9ad1406800ba855370daafb40f254093
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 36 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlg.hxx | 3 |
2 files changed, 36 insertions, 3 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 8434d5379d11..51e68c22154f 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -219,6 +219,7 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc, const ScForm ScConditionMode eMode = pEntry->GetOperation(); maLbType.SelectEntryPos(1); maEdVal1.SetText(pEntry->GetExpression(maPos, 0)); + SetCondType(); switch(eMode) { case SC_COND_EQUAL: @@ -255,12 +256,11 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc, const ScForm break; case SC_COND_DIRECT: maLbType.SelectEntryPos(2); + SwitchToType(FORMULA); break; case SC_COND_NONE: break; } - SwitchToType(CONDITION); - SetCondType(); } else if( pFormatEntry && pFormatEntry->GetType() == condformat::COLORSCALE ) { @@ -400,6 +400,8 @@ rtl::OUString getTextForType(ScCondFormatEntryType eType) return rtl::OUString("Color scale"); case DATABAR: return rtl::OUString("Data Bar"); + case FORMULA: + return rtl::OUString("Formula is"); default: break; } @@ -517,6 +519,7 @@ void ScCondFrmtEntry::SetHeight() switch (meType) { case CONDITION: + case FORMULA: aSize.Height() = 120; break; case COLORSCALE: @@ -591,6 +594,18 @@ void ScCondFrmtEntry::SetDataBarType() maBtOptions.Show(); } +void ScCondFrmtEntry::SetFormulaType() +{ + SwitchToType(FORMULA); + HideColorScaleElements(); + HideDataBarElements(); + maEdVal1.Show(); + maEdVal2.Hide(); + maLbCondType.Hide(); + maLbStyle.Show(); + maWdPreview.Show(); +} + void ScCondFrmtEntry::Select() { SetControlForeground(Color(COL_RED)); @@ -730,6 +745,18 @@ ScFormatEntry* ScCondFrmtEntry::createDatabarEntry() const return pDataBar; } +ScFormatEntry* ScCondFrmtEntry::createFormulaEntry() const +{ + ScConditionMode eMode = SC_COND_DIRECT; + rtl::OUString aFormula = maEdVal1.GetText(); + if(aFormula.isEmpty()) + return NULL; + + rtl::OUString aExpr2; + ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aFormula, aExpr2, mpDoc, maPos, maLbStyle.GetSelectEntry()); + return pEntry; +} + ScFormatEntry* ScCondFrmtEntry::GetEntry() const { switch(meType) @@ -743,6 +770,9 @@ ScFormatEntry* ScCondFrmtEntry::GetEntry() const case DATABAR: return createDatabarEntry(); break; + case FORMULA: + return createFormulaEntry(); + break; default: break; } @@ -764,7 +794,7 @@ IMPL_LINK_NOARG(ScCondFrmtEntry, TypeListHdl) SetDataBarType(); break; case 2: - SetCondType(); + SetFormulaType(); break; default: break; diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index e66c090a2295..2794cfdb0e0e 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -51,6 +51,7 @@ enum ScCondFormatEntryType CONDITION, COLORSCALE, DATABAR, + FORMULA, COLLAPSED }; @@ -107,6 +108,7 @@ private: void SetCondType(); void SetColorScaleType(); void SetDataBarType(); + void SetFormulaType(); void HideCondElements(); void HideColorScaleElements(); void HideDataBarElements(); @@ -117,6 +119,7 @@ private: ScFormatEntry* createConditionEntry() const; ScFormatEntry* createColorscaleEntry() const; ScFormatEntry* createDatabarEntry() const; + ScFormatEntry* createFormulaEntry() const; ScDocument* mpDoc; ScAddress maPos; |