diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-14 07:03:22 +0000 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2012-06-15 16:03:02 +0200 |
commit | eeab3d64fa61d8deeb256145fc37649bf38eb938 (patch) | |
tree | 134c12ffa8e989f8944b779e5a12fc31043add68 /sc | |
parent | 6be6590b2ae5cd289912443a3ea862495351cac7 (diff) |
handle formula is in new conditional format dlg
Change-Id: Ia492b8fb9ad1406800ba855370daafb40f254093
Signed-off-by: Jan Holesovsky <kendy@suse.cz>
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 81a681bdd020..311726c5d68a 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)); @@ -760,6 +775,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) @@ -773,6 +800,9 @@ ScFormatEntry* ScCondFrmtEntry::GetEntry() const case DATABAR: return createDatabarEntry(); break; + case FORMULA: + return createFormulaEntry(); + break; default: break; } @@ -794,7 +824,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; |