Moved Text Filling Color in OutDev. Text Filling occurs in ImplDrawText

Change-Id: I9c75066a8dea32721757d0511a2af58c68408438
(cherry picked from commit b09cf493611f2521e66159287b88acc3c05d6d33)
This commit is contained in:
matteocam
2014-05-24 13:02:43 -04:00
committed by Fridrich Štrba
parent 039599e9d5
commit be085bf523
5 changed files with 22 additions and 15 deletions

View File

@@ -459,14 +459,11 @@ void SvxFont::QuickDrawText( OutputDevice *pOut,
fprintf(stderr, "About to print %s\n", rTxt.getStr()); fprintf(stderr, "About to print %s\n", rTxt.getStr());
// Font has to be selected in OutputDevice... // Font has to be selected in OutputDevice...
if ( !IsCaseMap() && !IsCapital() && !IsKern() && !IsEsc() ) if ( !IsCaseMap() && !IsCapital() && !IsKern() && !IsEsc() )
{ {
// set right background
if ( HasBackgroundColor() ) {
Color aColor = COL_RED;
pOut->SetTextFillColor(aColor);
}
pOut->DrawTextArray( rPos, rTxt, pDXArray, nIdx, nLen ); pOut->DrawTextArray( rPos, rTxt, pDXArray, nIdx, nLen );
return; return;
} }

View File

@@ -61,7 +61,9 @@ public:
FontAlign GetAlign() const; FontAlign GetAlign() const;
// XXX: now font has background iff it is (single-y) underlined // XXX: now font has background iff it is (single-y) underlined
// also forces non transparency
bool HasBackgroundColor() const { bool HasBackgroundColor() const {
return GetUnderline() == UNDERLINE_SINGLE; return GetUnderline() == UNDERLINE_SINGLE;
} }

View File

@@ -1040,7 +1040,7 @@ public:
void SetTextFillColor(); void SetTextFillColor();
void SetTextFillColor( const Color& rColor ); void SetTextFillColor( const Color& rColor );
Color GetTextFillColor() const; Color GetTextFillColor() const;
bool IsTextFillColor() const { return !maFont.IsTransparent(); } bool IsTextFillColor() const { return maFont.GetUnderline() == UNDERLINE_SINGLE; /*return !maFont.IsTransparent();*/ }
void SetTextLineColor(); void SetTextLineColor();
void SetTextLineColor( const Color& rColor ); void SetTextLineColor( const Color& rColor );
@@ -1097,7 +1097,7 @@ private:
SAL_DLLPRIVATE void ImplInitAboveTextLineSize(); 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 ImplDrawSpecialText( SalLayout& );
SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight ); SAL_DLLPRIVATE void ImplDrawTextRect( long nBaseX, long nBaseY, long nX, long nY, long nWidth, long nHeight );

View File

@@ -521,11 +521,6 @@ void OutputDevice::SetFont( const Font& rNewFont )
aFont.SetColor( aTextColor ); aFont.SetColor( aTextColor );
mbTextBackground = aFont.HasBackgroundColor(); mbTextBackground = aFont.HasBackgroundColor();
if ( mbTextBackground )
{
Color aRedColor ( COL_RED );
SetBackground(aRedColor);
}
bool bTransFill = aFont.IsTransparent(); bool bTransFill = aFont.IsTransparent();
if ( !bTransFill ) if ( !bTransFill )

View File

@@ -281,7 +281,6 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )
bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout,
bool bTextLines, bool bTextLines,
bool bTextBkg,
sal_uInt32 flags ) sal_uInt32 flags )
{ {
if( mpFontEntry->mnOwnOrientation ) if( mpFontEntry->mnOwnOrientation )
@@ -289,6 +288,8 @@ bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout,
return true; return true;
long nOldX = rSalLayout.DrawBase().X(); long nOldX = rSalLayout.DrawBase().X();
if( HasMirroredGraphics() ) if( HasMirroredGraphics() )
{ {
@@ -427,7 +428,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout )
if ( maFont.IsOutline() ) if ( maFont.IsOutline() )
{ {
if(! ImplDrawTextDirect( rSalLayout, mbTextLines, false, DRAWTEXT_F_OUTLINE)) if(! ImplDrawTextDirect( rSalLayout, mbTextLines, DRAWTEXT_F_OUTLINE))
{ {
rSalLayout.DrawBase() = aOrigPos + Point(-1,-1); rSalLayout.DrawBase() = aOrigPos + Point(-1,-1);
ImplDrawTextDirect( rSalLayout, mbTextLines ); ImplDrawTextDirect( rSalLayout, mbTextLines );
@@ -472,13 +473,24 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout )
rSalLayout.DrawBase() += Point( mnTextOffX, mnTextOffY ); 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() ) if( IsTextFillColor() )
ImplDrawTextBackground( rSalLayout ); ImplDrawTextBackground( rSalLayout );
if( mbTextSpecial ) if( mbTextSpecial )
ImplDrawSpecialText( rSalLayout ); ImplDrawSpecialText( rSalLayout );
else else
ImplDrawTextDirect( rSalLayout, mbTextLines, mbTextBackground ); ImplDrawTextDirect( rSalLayout, mbTextLines );
} }
long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
@@ -836,6 +848,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr,
nLen = rStr.getLength() - nIndex; nLen = rStr.getLength() - nIndex;
} }
if( mpOutDevData && mpOutDevData->mpRecordLayout ) if( mpOutDevData && mpOutDevData->mpRecordLayout )
{ {
pVector = &mpOutDevData->mpRecordLayout->m_aUnicodeBoundRects; pVector = &mpOutDevData->mpRecordLayout->m_aUnicodeBoundRects;