sc/source/ui/condformat/condformatdlg.cxx | 22 +++++++++++++++++++++- sc/source/ui/inc/condformatdlg.hxx | 1 + vcl/inc/vcl/edit.hxx | 1 + vcl/source/control/edit.cxx | 17 ++++++++++++++--- 4 files changed, 37 insertions(+), 4 deletions(-)
New commits: commit 76ccb5fe45aef020f51a6c0d5ed14c95390a471f Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sun Aug 5 14:48:51 2012 +0200 highlight invalid formulas in cond format dlg, fdo#43653, bnc#730048 Change-Id: I4893eb176aca976c037f8196dd3043e98fbf91dc diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 641b02e..cd850ac 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 3100d9b..98e5926 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 ); commit 7b322f9aa315740625f265ce78dd06effd61531a Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sun Aug 5 14:24:02 2012 +0200 paint Edit's native borders after background color Change-Id: I3b5865d862ac7b9958d22d2ff1d3dc693cea2536 diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx index 16c0e2f..58f88be 100644 --- a/vcl/inc/vcl/edit.hxx +++ b/vcl/inc/vcl/edit.hxx @@ -105,6 +105,7 @@ private: SAL_DLLPRIVATE void ImplInsertText( const rtl::OUString& rStr, const Selection* pNewSelection = 0, sal_Bool bIsUserInput = sal_False ); SAL_DLLPRIVATE String ImplGetValidString( const String& rString ) const; SAL_DLLPRIVATE void ImplClearBackground( long nXStart, long nXEnd ); + SAL_DLLPRIVATE void ImplPaintBorder( long nXStart, long nXEnd ); SAL_DLLPRIVATE void ImplShowCursor( sal_Bool bOnlyIfVisible = sal_True ); SAL_DLLPRIVATE void ImplAlign(); SAL_DLLPRIVATE void ImplAlignAndPaint(); diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 8c47e2c..2d5e53e 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -556,7 +556,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) Push( PUSH_FILLCOLOR | PUSH_LINECOLOR ); SetLineColor(); SetFillColor( GetControlBackground() ); - DrawRect( Rectangle( aPos, Size( GetOutputSizePixel().Width() - 2*mnXOffset, nTH ) ) ); + DrawRect( Rectangle( aPos, Size( GetOutputSizePixel().Width() - 2*mnXOffset, GetOutputSizePixel().Height() ) ) ); Pop(); SetTextFillColor( GetControlBackground() ); @@ -566,6 +566,8 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) else SetTextFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() ); + ImplPaintBorder( 0, GetOutputSizePixel().Width() ); + sal_Bool bDrawSelection = maSelection.Len() && ( HasFocus() || ( GetStyle() & WB_NOHIDESELECTION ) || mbActivePopup ); long nPos = nStart ? pDX[2*nStart] : 0; @@ -1095,6 +1097,17 @@ void Edit::ImplClearBackground( long nXStart, long nXEnd ) aRect.Left() = nXStart; aRect.Right() = nXEnd; + if( !(ImplUseNativeBorder( GetStyle() ) || IsPaintTransparent()) ) + Erase( aRect ); +} + +void Edit::ImplPaintBorder( long nXStart, long nXEnd ) +{ + Point aTmpPoint; + Rectangle aRect( aTmpPoint, GetOutputSizePixel() ); + aRect.Left() = nXStart; + aRect.Right() = nXEnd; + if( ImplUseNativeBorder( GetStyle() ) || IsPaintTransparent() ) { // draw the inner part by painting the whole control using its border window @@ -1150,8 +1163,6 @@ void Edit::ImplClearBackground( long nXStart, long nXEnd ) } } - else - Erase( aRect ); } // ----------------------------------------------------------------------- _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits