diff options
author | matteocam <matteo.campanelli@gmail.com> | 2014-05-24 13:02:43 -0400 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2014-06-30 22:54:37 +0200 |
commit | be085bf52324f8b1c7f59a3d49a39e14e04824df (patch) | |
tree | a0203ad18eb78e02a602e610c8de96e2da079f6f | |
parent | 039599e9d52461ea57a9690f847bbfe5bae6f3aa (diff) |
Moved Text Filling Color in OutDev. Text Filling occurs in ImplDrawText
Change-Id: I9c75066a8dea32721757d0511a2af58c68408438
(cherry picked from commit b09cf493611f2521e66159287b88acc3c05d6d33)
-rw-r--r-- | editeng/source/items/svxfont.cxx | 7 | ||||
-rw-r--r-- | include/vcl/font.hxx | 2 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 4 | ||||
-rw-r--r-- | vcl/source/outdev/outdevstate.cxx | 5 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 19 |
5 files changed, 22 insertions, 15 deletions
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index e9f2a710623f..718675b01924 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 7102ef9ed05a..1a728f34bba9 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 bool HasBackgroundColor() const { + return GetUnderline() == UNDERLINE_SINGLE; } diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 85e307671079..a0edcc7554c4 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1040,7 +1040,7 @@ public: void SetTextFillColor(); void SetTextFillColor( const Color& rColor ); Color GetTextFillColor() const; - bool IsTextFillColor() const { return !maFont.IsTransparent(); } + bool IsTextFillColor() const { return maFont.GetUnderline() == UNDERLINE_SINGLE; /*return !maFont.IsTransparent();*/ } void SetTextLineColor(); void SetTextLineColor( const Color& rColor ); @@ -1097,7 +1097,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 8787a6ea0566..15fa53ccb1f3 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 52c05374d543..eeb1575f504b 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 background get it (XXX: now getting fixed color) + and the set it as the new filling color + */ + if (mbTextBackground) { + // set right background + Color aColor = COL_PINK; + // SetBackground does not work + SetFillColor(aColor); + } + if( IsTextFillColor() ) ImplDrawTextBackground( rSalLayout ); if( mbTextSpecial ) ImplDrawSpecialText( rSalLayout ); else - ImplDrawTextDirect( rSalLayout, mbTextLines, mbTextBackground ); + ImplDrawTextDirect( rSalLayout, mbTextLines ); } long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, @@ -836,6 +848,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr, nLen = rStr.getLength() - nIndex; } + if( mpOutDevData && mpOutDevData->mpRecordLayout ) { pVector = &mpOutDevData->mpRecordLayout->m_aUnicodeBoundRects; |