diff options
author | matteocam <matteo.campanelli@gmail.com> | 2014-05-22 13:53:19 -0400 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2014-06-30 22:54:37 +0200 |
commit | d097bc8e156b50a4fd04dd82c42efa2921f0e886 (patch) | |
tree | b565e8f581fa7856f816995781e204b0693b6981 | |
parent | 285c6cd514eedb0718029906a6189bf39d8232e4 (diff) |
HasBkg method to Font.HasBkg iff HasSingleUnderline.SetBkgColor in OutputDev
Change-Id: I10e6e1b916df0c78d26596a37944e8b57b2897e7
(cherry picked from commit 181266201b5e6aaad1dcd9cbc2dd4db44ecf3dc5)
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 9 | ||||
-rw-r--r-- | editeng/source/items/svxfont.cxx | 1 | ||||
-rw-r--r-- | include/vcl/font.hxx | 5 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 5 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 1 | ||||
-rw-r--r-- | vcl/source/outdev/outdevstate.cxx | 7 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 14 |
7 files changed, 33 insertions, 9 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 436c3754ceb3..b5053b2e16f8 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 7feb70e196ed..895eef60291c 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 5e0b13481005..7102ef9ed05a 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -60,6 +60,11 @@ public: void SetAlign( FontAlign ); FontAlign GetAlign() const; + // XXX: now font has background iff it is (single-y) underlined + bool HasBackgroundColor() const { + return GetUnderline() == UNDERLINE_SINGLE; + } + void SetName( const OUString& rFamilyName ); const OUString& GetName() const; void SetStyleName( const OUString& rStyleName ); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 199ca08392c1..85e307671079 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -340,6 +340,7 @@ private: mutable bool mbKerning : 1; mutable bool mbNewFont : 1; mutable bool mbTextLines : 1; + mutable bool mbTextBackground : 1; mutable bool mbTextSpecial : 1; mutable bool mbRefPoint : 1; mutable bool mbEnableRTL : 1; @@ -644,7 +645,7 @@ public: ///@} - /** @name Rectangle functions + /** @name Rectangle functionsf */ ///@{ @@ -1096,7 +1097,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 5c0333f3e5ad..e1e431c90860 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1594,6 +1594,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 2dcaf11f76a0..8787a6ea0566 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -520,6 +520,13 @@ 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 b7bb028d2963..2f3303bae8fb 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -279,7 +279,10 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) return true; } -bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, bool bTextLines, sal_uInt32 flags ) +bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, + bool bTextLines, + bool bTextBkg, + sal_uInt32 flags ) { if( mpFontEntry->mnOwnOrientation ) if( ImplDrawRotateText( rSalLayout ) ) @@ -327,6 +330,11 @@ bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, bool bTextLines, s maFont.GetStrikeout(), maFont.GetUnderline(), maFont.GetOverline(), maFont.IsWordLineMode(), ImplIsUnderlineAbove( maFont ) ); + // draw background + if ( bTextBkg ) { + + } + // emphasis marks if( maFont.GetEmphasisMark() & EMPHASISMARK_STYLE ) ImplDrawEmphasisMarks( rSalLayout ); @@ -422,7 +430,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) if ( maFont.IsOutline() ) { - if(! ImplDrawTextDirect( rSalLayout, mbTextLines, DRAWTEXT_F_OUTLINE)) + if(! ImplDrawTextDirect( rSalLayout, mbTextLines, false, DRAWTEXT_F_OUTLINE)) { rSalLayout.DrawBase() = aOrigPos + Point(-1,-1); ImplDrawTextDirect( rSalLayout, mbTextLines ); @@ -473,7 +481,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) if( mbTextSpecial ) ImplDrawSpecialText( rSalLayout ); else - ImplDrawTextDirect( rSalLayout, mbTextLines ); + ImplDrawTextDirect( rSalLayout, mbTextLines, mbTextBackground ); } long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, |