diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-08-05 14:48:51 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-08-05 14:52:16 +0200 |
commit | 76ccb5fe45aef020f51a6c0d5ed14c95390a471f (patch) | |
tree | 92332524ea08d5fce2cc593d22d1944fadaab89d /sc | |
parent | 7b322f9aa315740625f265ce78dd06effd61531a (diff) |
highlight invalid formulas in cond format dlg, fdo#43653, bnc#730048
Change-Id: I4893eb176aca976c037f8196dd3043e98fbf91dc
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatdlg.hxx | 1 |
2 files changed, 22 insertions, 1 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 641b02e9eb8e..cd850ac6a7ce 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -320,8 +320,11 @@ void ScCondFrmtEntry::Init() maLbEntryTypeMin.SetSelectHdl( LINK( this, ScCondFrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax.SetSelectHdl( LINK( this, ScCondFrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMiddle.SetSelectHdl( LINK( this, ScCondFrmtEntry, EntryTypeHdl ) ); + maEdVal1.SetStyle( maEdVal1.GetStyle() | WB_FORCECTRLBACKGROUND ); + maEdVal2.SetStyle( maEdVal2.GetStyle() | WB_FORCECTRLBACKGROUND ); - + maEdVal1.SetModifyHdl( LINK( this, ScCondFrmtEntry, EdModifyHdl ) ); + maEdVal2.SetModifyHdl( LINK( this, ScCondFrmtEntry, EdModifyHdl ) ); SfxStyleSheetIterator aStyleIter( mpDoc->GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA ); for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() ) @@ -813,6 +816,23 @@ IMPL_LINK_NOARG(ScCondFrmtEntry, TypeListHdl) return 0; } +IMPL_LINK(ScCondFrmtEntry, EdModifyHdl, Edit*, pEdit) +{ + rtl::OUString aFormula = pEdit->GetText(); + ScCompiler aComp( mpDoc, maPos ); + aComp.SetGrammar( mpDoc->GetGrammar() ); + boost::scoped_ptr<ScTokenArray> mpCode(aComp.CompileString(aFormula)); + if(mpCode->GetCodeError()) + { + pEdit->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor()); + } + else + { + pEdit->SetControlBackground(GetSettings().GetStyleSettings().GetWindowColor()); + } + return 0; +} + IMPL_LINK_NOARG(ScCondFrmtEntry, ColFormatTypeHdl) { if(maLbColorFormat.GetSelectEntryPos() < 2) diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index 3100d9b6fa60..98e59263298b 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -125,6 +125,7 @@ private: DECL_LINK( DataBarTypeSelectHdl, void* ); DECL_LINK( ConditionTypeSelectHdl, void* ); DECL_LINK( EntryTypeHdl, ListBox* ); + DECL_LINK( EdModifyHdl, Edit* ); public: ScCondFrmtEntry( Window* pParent, ScDocument* pDoc, const ScAddress& rPos ); |