|
|
@ -13,7 +13,7 @@ diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
|
|
|
|
index 02febe3..d43c163 100644
|
|
|
|
index 02febe3..d43c163 100644
|
|
|
|
--- a/vcl/source/gdi/outdev3.cxx
|
|
|
|
--- a/vcl/source/gdi/outdev3.cxx
|
|
|
|
+++ b/vcl/source/gdi/outdev3.cxx
|
|
|
|
+++ b/vcl/source/gdi/outdev3.cxx
|
|
|
|
@@ -4005,6 +4005,11 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
|
|
|
|
@@ -3967,6 +3967,11 @@
|
|
|
|
FontStrikeout eStrikeout,
|
|
|
|
FontStrikeout eStrikeout,
|
|
|
|
Color aColor )
|
|
|
|
Color aColor )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -25,50 +25,37 @@ index 02febe3..d43c163 100644
|
|
|
|
// PDF-export does its own strikeout drawing... why again?
|
|
|
|
// PDF-export does its own strikeout drawing... why again?
|
|
|
|
if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) )
|
|
|
|
if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
@@ -4017,35 +4022,23 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
|
|
|
|
@@ -3984,25 +3989,7 @@
|
|
|
|
cStrikeoutChar = 'X';
|
|
|
|
|
|
|
|
static const int nTestStrLen = 4;
|
|
|
|
|
|
|
|
static const int nMaxStrikeStrLen = 2048;
|
|
|
|
|
|
|
|
- xub_Unicode aChars[ nMaxStrikeStrLen +1]; // +1 for valgrind...
|
|
|
|
|
|
|
|
+ xub_Unicode aChars[nMaxStrikeStrLen+1]; // +1 for valgrind...
|
|
|
|
|
|
|
|
for( int i = 0; i < nTestStrLen; ++i)
|
|
|
|
|
|
|
|
aChars[i] = cStrikeoutChar;
|
|
|
|
aChars[i] = cStrikeoutChar;
|
|
|
|
const String aStrikeoutTest( aChars, nTestStrLen );
|
|
|
|
const String aStrikeoutTest( aChars, nTestStrLen );
|
|
|
|
|
|
|
|
|
|
|
|
// calculate approximation of strikeout atom size
|
|
|
|
- // calculate approximation of strikeout atom size
|
|
|
|
- long nStrikeoutWidth = nWidth;
|
|
|
|
- long nStrikeoutWidth = nWidth;
|
|
|
|
+ long nStrikeoutWidth = 0;
|
|
|
|
- SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen );
|
|
|
|
SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen );
|
|
|
|
- if( pLayout )
|
|
|
|
if( pLayout )
|
|
|
|
- {
|
|
|
|
{
|
|
|
|
|
|
|
|
- nStrikeoutWidth = (pLayout->GetTextWidth() +nTestStrLen/2) / (nTestStrLen * pLayout->GetUnitsPerPixel());
|
|
|
|
- nStrikeoutWidth = (pLayout->GetTextWidth() +nTestStrLen/2) / (nTestStrLen * pLayout->GetUnitsPerPixel());
|
|
|
|
+ nStrikeoutWidth = pLayout->GetTextWidth() / (nTestStrLen * pLayout->GetUnitsPerPixel());
|
|
|
|
- pLayout->Release();
|
|
|
|
pLayout->Release();
|
|
|
|
- }
|
|
|
|
}
|
|
|
|
- if( nStrikeoutWidth <= 0 ) // sanity check
|
|
|
|
if( nStrikeoutWidth <= 0 ) // sanity check
|
|
|
|
- return;
|
|
|
|
return;
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
- // calculate acceptable strikeout length
|
|
|
|
- // calculate acceptable strikeout length
|
|
|
|
- // allow the strikeout to be one pixel larger than the text it strikes out
|
|
|
|
- // allow the strikeout to be one pixel larger than the text it strikes out
|
|
|
|
- long nMaxWidth = nStrikeoutWidth * 3 / 4;
|
|
|
|
- long nMaxWidth = nStrikeoutWidth / 2;
|
|
|
|
- if ( nMaxWidth < 2 )
|
|
|
|
- if ( nMaxWidth < 2 )
|
|
|
|
- nMaxWidth = 2;
|
|
|
|
- nMaxWidth = 2;
|
|
|
|
- nMaxWidth += nWidth + 1;
|
|
|
|
- nMaxWidth += nWidth + 1;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- int nStrikeStrLen = (nMaxWidth - 1) / nStrikeoutWidth;
|
|
|
|
- int nStrikeStrLen = (nMaxWidth + nStrikeoutWidth - 1) / nStrikeoutWidth;
|
|
|
|
- // if the text width is smaller than the strikeout text, then do not
|
|
|
|
|
|
|
|
- // strike out at all. This case requires user interaction, e.g. adding
|
|
|
|
|
|
|
|
- // a space to the text
|
|
|
|
|
|
|
|
- if( nStrikeStrLen <= 0 )
|
|
|
|
|
|
|
|
- return;
|
|
|
|
|
|
|
|
+ int nStrikeStrLen = (nWidth+(nStrikeoutWidth-1)) / nStrikeoutWidth;
|
|
|
|
+ int nStrikeStrLen = (nWidth+(nStrikeoutWidth-1)) / nStrikeoutWidth;
|
|
|
|
if( nStrikeStrLen > nMaxStrikeStrLen )
|
|
|
|
// if the text width is smaller than the strikeout text, then do not
|
|
|
|
nStrikeStrLen = nMaxStrikeStrLen;
|
|
|
|
// strike out at all. This case requires user interaction, e.g. adding
|
|
|
|
|
|
|
|
// a space to the text
|
|
|
|
@@ -4074,8 +4067,29 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
|
|
|
|
@@ -4034,8 +4021,28 @@
|
|
|
|
ImplInitTextColor();
|
|
|
|
ImplInitTextColor();
|
|
|
|
|
|
|
|
|
|
|
|
pLayout->DrawBase() = Point( nBaseX+mnTextOffX, nBaseY+mnTextOffY );
|
|
|
|
pLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Rectangle aPixelRect;
|
|
|
|
+ Rectangle aPixelRect;
|
|
|
|
+ aPixelRect.nLeft = nBaseX+mnTextOffX;
|
|
|
|
+ aPixelRect.nLeft = nBaseX+mnTextOffX;
|
|
|
@ -89,7 +76,6 @@ index 02febe3..d43c163 100644
|
|
|
|
+ ImplInitClipRegion();
|
|
|
|
+ ImplInitClipRegion();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
pLayout->DrawText( *mpGraphics );
|
|
|
|
pLayout->DrawText( *mpGraphics );
|
|
|
|
+
|
|
|
|
|
|
|
|
pLayout->Release();
|
|
|
|
pLayout->Release();
|
|
|
|
+ Pop();
|
|
|
|
+ Pop();
|
|
|
|
|
|
|
|
|
|
|
@ -99,7 +85,7 @@ diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.c
|
|
|
|
index 442a25d..485dad3 100644
|
|
|
|
index 442a25d..485dad3 100644
|
|
|
|
--- a/vcl/source/gdi/pdfwriter_impl.cxx
|
|
|
|
--- a/vcl/source/gdi/pdfwriter_impl.cxx
|
|
|
|
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
|
|
|
|
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
|
|
|
|
@@ -8264,6 +8264,9 @@ void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontSt
|
|
|
|
@@ -8223,6 +8223,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout )
|
|
|
|
void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -109,9 +95,9 @@ index 442a25d..485dad3 100644
|
|
|
|
String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" );
|
|
|
|
String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" );
|
|
|
|
String aStrikeout = aStrikeoutChar;
|
|
|
|
String aStrikeout = aStrikeoutChar;
|
|
|
|
while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth )
|
|
|
|
while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth )
|
|
|
|
@@ -8285,7 +8288,27 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik
|
|
|
|
@@ -8244,7 +8247,28 @@
|
|
|
|
// strikeout string is left aligned non-CTL text
|
|
|
|
// strikeout string is left aligned non-CTL text
|
|
|
|
sal_uLong nOrigTLM = m_pReferenceDevice->GetLayoutMode();
|
|
|
|
ULONG nOrigTLM = m_pReferenceDevice->GetLayoutMode();
|
|
|
|
m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED );
|
|
|
|
m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ push( PUSH_CLIPREGION );
|
|
|
|
+ push( PUSH_CLIPREGION );
|
|
|
@ -131,6 +117,7 @@ index 442a25d..485dad3 100644
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ intersectClipRegion( aRect );
|
|
|
|
+ intersectClipRegion( aRect );
|
|
|
|
|
|
|
|
+
|
|
|
|
drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false );
|
|
|
|
drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false );
|
|
|
|
+ pop();
|
|
|
|
+ pop();
|
|
|
|
+
|
|
|
|
+
|
|
|
|