[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-text-background-color' - editeng/source include/vcl vcl/source
editeng/source/items/svxfont.cxx |7 ++- include/vcl/font.hxx |2 ++ include/vcl/outdev.hxx|4 ++-- vcl/source/outdev/outdevstate.cxx |5 - vcl/source/outdev/text.cxx| 19 --- 5 files changed, 22 insertions(+), 15 deletions(-) New commits: commit b09cf493611f2521e66159287b88acc3c05d6d33 Author: matteocam matteo.campane...@gmail.com Date: Sat May 24 13:02:43 2014 -0400 Moved Text Filling Color in OutDev. Text Filling occurs in ImplDrawText Change-Id: I9c75066a8dea32721757d0511a2af58c68408438 diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index e9f2a71..718675b 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -459,14 +459,11 @@ void SvxFont::QuickDrawText( OutputDevice *pOut, fprintf(stderr, About to print %s\n, rTxt.getStr()); + + // Font has to be selected in OutputDevice... if ( !IsCaseMap() !IsCapital() !IsKern() !IsEsc() ) { -// set right background -if ( HasBackgroundColor() ) { -Color aColor = COL_RED; -pOut-SetTextFillColor(aColor); -} pOut-DrawTextArray( rPos, rTxt, pDXArray, nIdx, nLen ); return; } diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 7079c8d..0e1358f 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -61,7 +61,9 @@ public: FontAlign GetAlign() const; // XXX: now font has background iff it is (single-y) underlined +// also forces non transparency boolHasBackgroundColor() const { + return GetUnderline() == UNDERLINE_SINGLE; } diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 5336df1..21083ee 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -995,7 +995,7 @@ public: voidSetTextFillColor(); voidSetTextFillColor( const Color rColor ); Color GetTextFillColor() const; -boolIsTextFillColor() const { return !maFont.IsTransparent(); } +boolIsTextFillColor() const { return maFont.GetUnderline() == UNDERLINE_SINGLE; /*return !maFont.IsTransparent();*/ } voidSetTextLineColor(); voidSetTextLineColor( const Color rColor ); @@ -1044,7 +1044,7 @@ private: SAL_DLLPRIVATE void ImplInitAboveTextLineSize(); -SAL_DLLPRIVATE bool ImplDrawTextDirect( SalLayout, bool bTextLines, bool bTextBkg = false, sal_uInt32 flags = 0 ); +SAL_DLLPRIVATE bool ImplDrawTextDirect( SalLayout, bool bTextLines, sal_uInt32 flags = 0 ); SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout ); SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight ); diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 8787a6e..15fa53c 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -521,11 +521,6 @@ void OutputDevice::SetFont( const Font rNewFont ) aFont.SetColor( aTextColor ); mbTextBackground = aFont.HasBackgroundColor(); -if ( mbTextBackground ) -{ -Color aRedColor ( COL_RED ); -SetBackground(aRedColor); -} bool bTransFill = aFont.IsTransparent(); if ( !bTransFill ) diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index eea1569..a1a034c 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -281,7 +281,6 @@ bool OutputDevice::ImplDrawRotateText( SalLayout rSalLayout ) bool OutputDevice::ImplDrawTextDirect( SalLayout rSalLayout, bool bTextLines, -bool bTextBkg, sal_uInt32 flags ) { if( mpFontEntry-mnOwnOrientation ) @@ -289,6 +288,8 @@ bool OutputDevice::ImplDrawTextDirect( SalLayout rSalLayout, return true; + + long nOldX = rSalLayout.DrawBase().X(); if( HasMirroredGraphics() ) { @@ -427,7 +428,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout rSalLayout ) if ( maFont.IsOutline() ) { -if(! ImplDrawTextDirect( rSalLayout, mbTextLines, false, DRAWTEXT_F_OUTLINE)) +if(! ImplDrawTextDirect( rSalLayout, mbTextLines, DRAWTEXT_F_OUTLINE)) { rSalLayout.DrawBase() = aOrigPos + Point(-1,-1); ImplDrawTextDirect( rSalLayout, mbTextLines ); @@ -472,13 +473,24 @@ void OutputDevice::ImplDrawText( SalLayout rSalLayout ) rSalLayout.DrawBase() += Point( mnTextOffX, mnTextOffY ); +/* + if the text has some
[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-text-background-color' - editeng/source include/vcl vcl/source
editeng/source/editeng/impedit3.cxx |9 + editeng/source/items/svxfont.cxx|1 + include/vcl/font.hxx|5 + include/vcl/outdev.hxx |5 +++-- vcl/source/outdev/font.cxx |1 + vcl/source/outdev/outdevstate.cxx |7 +++ vcl/source/outdev/text.cxx | 14 +++--- 7 files changed, 33 insertions(+), 9 deletions(-) New commits: commit 181266201b5e6aaad1dcd9cbc2dd4db44ecf3dc5 Author: matteocam matteo.campane...@gmail.com Date: Thu May 22 13:53:19 2014 -0400 HasBkg method to Font.HasBkg iff HasSingleUnderline.SetBkgColor in OutputDev Change-Id: I10e6e1b916df0c78d26596a37944e8b57b2897e7 diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index fee0219..3bf1b26 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3673,7 +3673,12 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle rRect, OutputDev VirtualDevice* pVDev = GetVirtualDevice( pTarget-GetMapMode(), pTarget-GetDrawMode() ); pVDev-SetDigitLanguage( GetRefDevice()-GetDigitLanguage() ); +/* + * Set the appropriate background color according + * to text criteria +*/ { + Color aBackgroundColor( pView-GetBackgroundColor() ); // #i47161# Check if text is visible on background SvxFont aTmpFont; @@ -3699,11 +3704,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle rRect, OutputDev if( nColorDiff 8 ) aBackgroundColor = aFontColor.IsDark() ? COL_WHITE : COL_BLACK; -// XXX: BEGIN my changes -aBackgroundColor = COL_GRAY; pVDev-SetBackground( aBackgroundColor ); -// END my changes -//pVDev-SetBackground( aBackgroundColor ); // original code } bool bVDevValid = true; diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 7feb70e..895eef6 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -456,6 +456,7 @@ void SvxFont::QuickDrawText( OutputDevice *pOut, const Point rPos, const OUString rTxt, const sal_Int32 nIdx, const sal_Int32 nLen, const sal_Int32* pDXArray ) const { + // Font has to be selected in OutputDevice... if ( !IsCaseMap() !IsCapital() !IsKern() !IsEsc() ) { diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index d9649ba..7079c8d 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -60,6 +60,11 @@ public: voidSetAlign( FontAlign ); FontAlign GetAlign() const; +// XXX: now font has background iff it is (single-y) underlined +boolHasBackgroundColor() const { +return GetUnderline() == UNDERLINE_SINGLE; +} + voidSetName( const OUString rFamilyName ); const OUString GetName() const; voidSetStyleName( const OUString rStyleName ); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 676cf08..5336df1 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -338,6 +338,7 @@ private: mutable boolmbKerning : 1; mutable boolmbNewFont : 1; mutable boolmbTextLines : 1; +mutable boolmbTextBackground : 1; mutable boolmbTextSpecial : 1; mutable boolmbRefPoint : 1; mutable boolmbEnableRTL : 1; @@ -648,7 +649,7 @@ public: ///@} -/** @name Rectangle functions +/** @name Rectangle functionsf */ ///@{ @@ -1043,7 +1044,7 @@ private: SAL_DLLPRIVATE void ImplInitAboveTextLineSize(); -SAL_DLLPRIVATE bool ImplDrawTextDirect( SalLayout, bool bTextLines, sal_uInt32 flags = 0 ); +SAL_DLLPRIVATE bool ImplDrawTextDirect( SalLayout, bool bTextLines, bool bTextBkg = false, sal_uInt32 flags = 0 ); SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout ); SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight ); diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 541df8ef..72e2d0c 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1624,6 +1624,7 @@ bool OutputDevice::ImplNewFont() const mbTextSpecial = maFont.IsShadow() || maFont.IsOutline() || (maFont.GetRelief() != RELIEF_NONE); + // #95414# fix for OLE objects which use scale factors very creatively if( mbMap !aSize.Width() ) { diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 2dcaf11..8787a6e 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -520,6