summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-05 17:49:45 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-05 17:49:45 +0000
commita99237ba49d1d84dcff274f8baca46b4e7f940aa (patch)
treeb6cd12d7cbc0c0a22e058cfe4b16d47b10c6d367 /vcl
parent347a1622743363ae11cd12bc00d5827c5c952f79 (diff)
CWS-TOOLING: integrate CWS overline3
2008-12-11 15:24:46 +0100 fredrikh r265314 : i97099 2008-12-11 15:20:37 +0100 fredrikh r265313 : i97099 2008-12-11 15:18:00 +0100 fredrikh r265312 : i97099 2008-12-11 15:17:00 +0100 fredrikh r265311 : i97099 2008-12-11 15:13:20 +0100 fredrikh r265309 : i97144 2008-12-11 15:06:24 +0100 fredrikh r265306 : i97099 2008-11-24 10:41:42 +0100 fme r264213 : #i5991# Overline support 2008-11-24 10:39:53 +0100 fme r264212 : #i5991# Overline support 2008-11-24 10:02:13 +0100 fme r264209 : #5991# Overline support 2008-11-24 10:01:26 +0100 fme r264208 : #5991# Overline support 2008-11-24 09:59:11 +0100 fme r264207 : #5991# Overline support 2008-11-24 09:57:11 +0100 fme r264206 : #5991# Overline support 2008-11-14 10:36:44 +0100 fme r263667 : CWS-TOOLING: rebase CWS overline3 to trunk@263288 (milestone: DEV300:m35) 2008-11-13 16:12:13 +0100 fme r263649 : #i5991# migrate CWS overline3 to SVN.
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/font.hxx4
-rw-r--r--vcl/inc/vcl/impfont.hxx3
-rw-r--r--vcl/inc/vcl/metaact.hxx30
-rw-r--r--vcl/inc/vcl/outdev.hxx17
-rw-r--r--vcl/inc/vcl/pdfwriter.hxx5
-rw-r--r--vcl/source/gdi/cvtsvm.cxx10
-rw-r--r--vcl/source/gdi/font.cxx34
-rw-r--r--vcl/source/gdi/gdimtf.cxx19
-rw-r--r--vcl/source/gdi/metaact.cxx78
-rw-r--r--vcl/source/gdi/outdev.cxx23
-rw-r--r--vcl/source/gdi/outdev3.cxx901
-rw-r--r--vcl/source/gdi/pdfwriter.cxx15
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx623
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx35
-rw-r--r--vcl/source/window/window.cxx6
15 files changed, 1092 insertions, 711 deletions
diff --git a/vcl/inc/vcl/font.hxx b/vcl/inc/vcl/font.hxx
index ad737c19ee01..2dfdef148a1d 100644
--- a/vcl/inc/vcl/font.hxx
+++ b/vcl/inc/vcl/font.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: font.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -116,6 +116,8 @@ public:
FontRelief GetRelief() const;
void SetUnderline( FontUnderline );
FontUnderline GetUnderline() const;
+ void SetOverline( FontUnderline );
+ FontUnderline GetOverline() const;
void SetStrikeout( FontStrikeout );
FontStrikeout GetStrikeout() const;
void SetEmphasisMark( FontEmphasisMark );
diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx
index 6607bf2a70d0..90d8793f513f 100644
--- a/vcl/inc/vcl/impfont.hxx
+++ b/vcl/inc/vcl/impfont.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: impfont.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -77,6 +77,7 @@ private:
FontWidth meWidthType;
FontItalic meItalic;
FontUnderline meUnderline;
+ FontUnderline meOverline;
FontStrikeout meStrikeout;
FontRelief meRelief;
FontEmphasisMark meEmphasisMark;
diff --git a/vcl/inc/vcl/metaact.hxx b/vcl/inc/vcl/metaact.hxx
index a3e75b1c4d32..5c502399d24b 100644
--- a/vcl/inc/vcl/metaact.hxx
+++ b/vcl/inc/vcl/metaact.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: metaact.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.3.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -104,6 +104,7 @@ class SvStream;
#define META_GRADIENTEX_ACTION (148)
#define META_LAYOUTMODE_ACTION (149)
#define META_TEXTLANGUAGE_ACTION (150)
+#define META_OVERLINECOLOR_ACTION (151)
#define META_COMMENT_ACTION (512)
@@ -631,6 +632,7 @@ private:
long mnWidth;
FontStrikeout meStrikeout;
FontUnderline meUnderline;
+ FontUnderline meOverline;
virtual sal_Bool Compare( const MetaAction& ) const;
@@ -639,7 +641,8 @@ public:
MetaTextLineAction( const Point& rPos, long nWidth,
FontStrikeout eStrikeout,
- FontUnderline eUnderline );
+ FontUnderline eUnderline,
+ FontUnderline eOverline );
virtual void Move( long nHorzMove, long nVertMove );
virtual void Scale( double fScaleX, double fScaleY );
@@ -647,6 +650,7 @@ public:
long GetWidth() const { return mnWidth; }
FontStrikeout GetStrikeout() const { return meStrikeout; }
FontUnderline GetUnderline() const { return meUnderline; }
+ FontUnderline GetOverline() const { return meOverline; }
};
// -----------------
@@ -1221,6 +1225,28 @@ public:
BOOL IsSetting() const { return mbSet; }
};
+// ---------------------------
+// - MetaOverlineColorAction -
+// ---------------------------
+
+class VCL_DLLPUBLIC MetaOverlineColorAction : public MetaAction
+{
+private:
+
+ Color maColor;
+ BOOL mbSet;
+
+ virtual sal_Bool Compare( const MetaAction& ) const;
+
+public:
+ DECL_META_ACTION( OverlineColor, META_OVERLINECOLOR_ACTION )
+
+ MetaOverlineColorAction( const Color& rColor, BOOL bSet );
+
+ const Color& GetColor() const { return maColor; }
+ BOOL IsSetting() const { return mbSet; }
+};
+
// -----------------------
// - MetaTextAlignAction -
// -----------------------
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 98c096087a66..0736a83d2c72 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -158,7 +158,8 @@ struct KerningPair
#define PUSH_TEXTLINECOLOR ((USHORT)0x0400)
#define PUSH_TEXTLAYOUTMODE ((USHORT)0x0800)
#define PUSH_TEXTLANGUAGE ((USHORT)0x1000)
-#define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE)
+#define PUSH_OVERLINECOLOR ((USHORT)0x2000)
+#define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE)
#define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT)
#define PUSH_ALL ((USHORT)0xFFFF)
@@ -364,6 +365,7 @@ private:
Font maFont;
Color maTextColor;
Color maTextLineColor;
+ Color maOverlineColor;
TextAlign meTextAlign;
RasterOp meRasterOp;
Wallpaper maBackground;
@@ -430,7 +432,7 @@ public:
const String& rOrigStr, USHORT nStyle,
MetricVector* pVector, String* pDisplayText );
SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& );
- SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, BOOL bWordLine, BOOL bUnderlineAbove );
+ SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove );
SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& );
SAL_DLLPRIVATE void ImplDrawTextDirect( SalLayout&, BOOL bTextLines );
SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& );
@@ -443,7 +445,11 @@ public:
SAL_DLLPRIVATE void ImplInitTextLineSize();
SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
SAL_DLLPRIVATE void ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor );
- SAL_DLLPRIVATE void ImplDrawTextLine( long nBaseX, long nX, long nY, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, BOOL bUnderlineAbove );
+ SAL_DLLPRIVATE void ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, BOOL bIsAbove );
+ SAL_DLLPRIVATE void ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, BOOL bIsAbove );
+ SAL_DLLPRIVATE void ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
+ SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor );
+ SAL_DLLPRIVATE void ImplDrawTextLine( long nBaseX, long nX, long nY, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bUnderlineAbove );
SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth );
SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient );
SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 );
@@ -581,6 +587,7 @@ public:
void DrawTextLine( const Point& rPos, long nWidth,
FontStrikeout eStrikeout,
FontUnderline eUnderline,
+ FontUnderline eOverline,
BOOL bUnderlineAbove = FALSE );
static BOOL IsTextUnderlineAbove( const Font& rFont );
@@ -886,6 +893,10 @@ public:
void SetTextLineColor( const Color& rColor );
const Color& GetTextLineColor() const { return maTextLineColor; }
BOOL IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); }
+ void SetOverlineColor();
+ void SetOverlineColor( const Color& rColor );
+ const Color& GetOverlineColor() const { return maOverlineColor; }
+ BOOL IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
void SetTextAlign( TextAlign eAlign );
TextAlign GetTextAlign() const { return maFont.GetAlign(); }
diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx
index c69553b8f3de..bdf636754c77 100644
--- a/vcl/inc/vcl/pdfwriter.hxx
+++ b/vcl/inc/vcl/pdfwriter.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: pdfwriter.hxx,v $
- * $Revision: 1.8.86.1 $
+ * $Revision: 1.8.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -693,6 +693,8 @@ The following structure describes the permissions used in PDF security
void SetTextLineColor();
void SetTextLineColor( const Color& rColor );
+ void SetOverlineColor();
+ void SetOverlineColor( const Color& rColor );
void SetTextAlign( ::TextAlign eAlign );
void SetMapMode();
@@ -705,6 +707,7 @@ The following structure describes the permissions used in PDF security
void DrawTextLine( const Point& rPos, long nWidth,
FontStrikeout eStrikeout,
FontUnderline eUnderline,
+ FontUnderline eOverline,
BOOL bUnderlineAbove = FALSE );
void DrawTextArray( const Point& rStartPt, const XubString& rStr,
const sal_Int32* pDXAry = NULL,
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 0f999573ef89..14c211e4e045 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: cvtsvm.cxx,v $
- * $Revision: 1.16 $
+ * $Revision: 1.16.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -1087,7 +1087,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
ImplSkipActions( rIStm, nFollowingActionCount );
rMtf.AddAction( new MetaTextLineAction( aStartPt, nWidth,
(FontStrikeout) nStrikeout,
- (FontUnderline) nUnderline ) );
+ (FontUnderline) nUnderline,
+ UNDERLINE_NONE ) );
#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
i += nFollowingActionCount;
@@ -2062,6 +2063,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
}
break;
+#if 0
+ case( META_OVERLINECOLOR_ACTION ):
+ break;
+#endif
+
case( META_TEXTLINE_ACTION ):
{
const MetaTextLineAction* pA = (MetaTextLineAction*) pAction;
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index 33eadd075aa3..5c228072eb65 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: font.cxx,v $
- * $Revision: 1.19 $
+ * $Revision: 1.19.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -64,6 +64,7 @@ Impl_Font::Impl_Font() :
meWidthType = WIDTH_DONTKNOW;
meItalic = ITALIC_NONE;
meUnderline = UNDERLINE_NONE;
+ meOverline = UNDERLINE_NONE;
meStrikeout = STRIKEOUT_NONE;
meRelief = RELIEF_NONE;
meEmphasisMark = EMPHASISMARK_NONE;
@@ -97,6 +98,7 @@ Impl_Font::Impl_Font( const Impl_Font& rImplFont )
meWidthType = rImplFont.meWidthType;
meItalic = rImplFont.meItalic;
meUnderline = rImplFont.meUnderline;
+ meOverline = rImplFont.meOverline;
meStrikeout = rImplFont.meStrikeout;
meRelief = rImplFont.meRelief;
meEmphasisMark = rImplFont.meEmphasisMark;
@@ -141,6 +143,7 @@ bool Impl_Font::operator==( const Impl_Font& rOther ) const
return false;
if( (meUnderline != rOther.meUnderline)
+ || (meOverline != rOther.meOverline)
|| (meStrikeout != rOther.meStrikeout)
|| (meRelief != rOther.meRelief)
|| (meEmphasisMark != rOther.meEmphasisMark)
@@ -593,6 +596,19 @@ void Font::SetUnderline( FontUnderline eUnderline )
// -----------------------------------------------------------------------
+void Font::SetOverline( FontUnderline eOverline )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ if( mpImplFont->meOverline != eOverline )
+ {
+ MakeUnique();
+ mpImplFont->meOverline = eOverline;
+ }
+}
+
+// -----------------------------------------------------------------------
+
void Font::SetStrikeout( FontStrikeout eStrikeout )
{
DBG_CHKTHIS( Font, NULL );
@@ -718,6 +734,11 @@ void Font::Merge( const Font& rFont )
SetUnderline( rFont.GetUnderline() );
SetWordLineMode( rFont.IsWordLineMode() );
}
+ if ( rFont.GetOverline() != UNDERLINE_DONTKNOW )
+ {
+ SetOverline( rFont.GetOverline() );
+ SetWordLineMode( rFont.IsWordLineMode() );
+ }
if ( rFont.GetStrikeout() != STRIKEOUT_DONTKNOW )
{
SetStrikeout( rFont.GetStrikeout() );
@@ -785,6 +806,10 @@ SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font )
rIStm >> bTmp; rImpl_Font.mbVertical = bTmp;
rIStm >> nTmp16; rImpl_Font.meEmphasisMark = (FontEmphasisMark)nTmp16;
}
+ if( aCompat.GetVersion() >= 3 )
+ {
+ rIStm >> nTmp16; rImpl_Font.meOverline = (FontUnderline) nTmp16;
+ }
// Relief
// CJKContextLanguage
@@ -795,7 +820,7 @@ SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font )
SvStream& operator<<( SvStream& rOStm, const Impl_Font& rImpl_Font )
{
- VersionCompat aCompat( rOStm, STREAM_WRITE, 2 );
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 3 );
rOStm.WriteByteString( rImpl_Font.maFamilyName, rOStm.GetStreamCharSet() );
rOStm.WriteByteString( rImpl_Font.maStyleName, rOStm.GetStreamCharSet() );
rOStm << rImpl_Font.maSize;
@@ -823,6 +848,9 @@ SvStream& operator<<( SvStream& rOStm, const Impl_Font& rImpl_Font )
rOStm << (BOOL) rImpl_Font.mbVertical;
rOStm << (UINT16) rImpl_Font.meEmphasisMark;
+ // new in version 3
+ rOStm << (UINT16) rImpl_Font.meOverline;
+
return rOStm;
}
@@ -1082,8 +1110,8 @@ BOOL Font::IsOutline() const { return mpImplFont->mbOutline; }
BOOL Font::IsShadow() const { return mpImplFont->mbShadow; }
FontRelief Font::GetRelief() const { return mpImplFont->meRelief; }
FontUnderline Font::GetUnderline() const { return mpImplFont->meUnderline; }
+FontUnderline Font::GetOverline() const { return mpImplFont->meOverline; }
FontStrikeout Font::GetStrikeout() const { return mpImplFont->meStrikeout; }
FontEmphasisMark Font::GetEmphasisMark() const { return mpImplFont->meEmphasisMark; }
BOOL Font::IsWordLineMode() const { return mpImplFont->mbWordLine; }
BOOL Font::IsSameInstance( const Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); }
-
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 3c68eab59bf1..3a29e6d56095 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gdimtf.cxx,v $
- * $Revision: 1.24 $
+ * $Revision: 1.24.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -759,6 +759,8 @@ BOOL GDIMetaFile::SaveStatus()
pOutDev->IsTextFillColor() ) );
AddAction( new MetaTextLineColorAction( pOutDev->GetTextLineColor(),
pOutDev->IsTextLineColor() ) );
+ AddAction( new MetaOverlineColorAction( pOutDev->GetOverlineColor(),
+ pOutDev->IsOverlineColor() ) );
AddAction( new MetaTextAlignAction( pOutDev->GetTextAlign() ) );
AddAction( new MetaRasterOpAction( pOutDev->GetRasterOp() ) );
AddAction( new MetaMapModeAction( pOutDev->GetMapMode() ) );
@@ -1097,7 +1099,7 @@ void GDIMetaFile::Rotate( long nAngle10 )
{
MetaTextLineAction* pAct = (MetaTextLineAction*) pAction;
aMtf.AddAction( new MetaTextLineAction( ImplGetRotatedPoint( pAct->GetStartPoint(), aRotAnchor, aRotOffset, fSin, fCos ),
- pAct->GetWidth(), pAct->GetStrikeout(), pAct->GetUnderline() ) );
+ pAct->GetWidth(), pAct->GetStrikeout(), pAct->GetUnderline(), pAct->GetOverline() ) );
}
break;
@@ -1591,6 +1593,19 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol
}
break;
+ case( META_OVERLINECOLOR_ACTION ):
+ {
+ MetaOverlineColorAction* pAct = (MetaOverlineColorAction*) pAction;
+
+ if( !pAct->IsSetting() )
+ pAct->Duplicate();
+ else
+ pAct = new MetaOverlineColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE );
+
+ aMtf.Insert( pAct, LIST_APPEND );
+ }
+ break;
+
case( META_FONT_ACTION ):
{
MetaFontAction* pAct = (MetaFontAction*) pAction;
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 4b90699eed3d..4fe9a41be797 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: metaact.cxx,v $
- * $Revision: 1.21 $
+ * $Revision: 1.21.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -231,6 +231,7 @@ MetaAction* MetaAction::ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData
case( META_TEXTCOLOR_ACTION ): pAction = new MetaTextColorAction; break;
case( META_TEXTFILLCOLOR_ACTION ): pAction = new MetaTextFillColorAction; break;
case( META_TEXTLINECOLOR_ACTION ): pAction = new MetaTextLineColorAction; break;
+ case( META_OVERLINECOLOR_ACTION ): pAction = new MetaOverlineColorAction; break;
case( META_TEXTALIGN_ACTION ): pAction = new MetaTextAlignAction; break;
case( META_MAPMODE_ACTION ): pAction = new MetaMapModeAction; break;
case( META_FONT_ACTION ): pAction = new MetaFontAction; break;
@@ -1677,12 +1678,14 @@ IMPL_META_ACTION( TextLine, META_TEXTLINE_ACTION )
MetaTextLineAction::MetaTextLineAction( const Point& rPos, long nWidth,
FontStrikeout eStrikeout,
- FontUnderline eUnderline ) :
+ FontUnderline eUnderline,
+ FontUnderline eOverline ) :
MetaAction ( META_TEXTLINE_ACTION ),
maPos ( rPos ),
mnWidth ( nWidth ),
meStrikeout ( eStrikeout ),
- meUnderline ( eUnderline )
+ meUnderline ( eUnderline ),
+ meOverline ( eOverline )
{
}
@@ -1690,7 +1693,7 @@ MetaTextLineAction::MetaTextLineAction( const Point& rPos, long nWidth,
void MetaTextLineAction::Execute( OutputDevice* pOut )
{
- pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline );
+ pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline, meOverline );
}
// ------------------------------------------------------------------------
@@ -1724,7 +1727,8 @@ sal_Bool MetaTextLineAction::Compare( const MetaAction& rMetaAction ) const
return ( maPos == ((MetaTextLineAction&)rMetaAction).maPos ) &&
( mnWidth == ((MetaTextLineAction&)rMetaAction).mnWidth ) &&
( meStrikeout == ((MetaTextLineAction&)rMetaAction).meStrikeout ) &&
- ( meUnderline == ((MetaTextLineAction&)rMetaAction).meUnderline );
+ ( meUnderline == ((MetaTextLineAction&)rMetaAction).meUnderline ) &&
+ ( meOverline == ((MetaTextLineAction&)rMetaAction).meOverline );
}
// ------------------------------------------------------------------------
@@ -1737,6 +1741,8 @@ void MetaTextLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
rOStm << mnWidth;
rOStm << static_cast<sal_uInt32>(meStrikeout);
rOStm << static_cast<sal_uInt32>(meUnderline);
+ // new in version 2
+ rOStm << static_cast<sal_uInt32>(meOverline);
}
// ------------------------------------------------------------------------
@@ -1752,6 +1758,10 @@ void MetaTextLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
meStrikeout = (FontStrikeout)nTemp;
rIStm >> nTemp;
meUnderline = (FontUnderline)nTemp;
+ if ( aCompat.GetVersion() >= 2 ) {
+ rIStm >> nTemp;
+ meUnderline = (FontUnderline)nTemp;
+ }
}
// ========================================================================
@@ -3264,6 +3274,64 @@ void MetaTextLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
// ========================================================================
+IMPL_META_ACTION( OverlineColor, META_OVERLINECOLOR_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaOverlineColorAction::MetaOverlineColorAction( const Color& rColor, BOOL bSet ) :
+ MetaAction ( META_OVERLINECOLOR_ACTION ),
+ maColor ( rColor ),
+ mbSet ( bSet )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaOverlineColorAction::Execute( OutputDevice* pOut )
+{
+ if( mbSet )
+ pOut->SetOverlineColor( maColor );
+ else
+ pOut->SetOverlineColor();
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaOverlineColorAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaOverlineColorAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool MetaOverlineColorAction::Compare( const MetaAction& rMetaAction ) const
+{
+ return ( maColor == ((MetaOverlineColorAction&)rMetaAction).maColor ) &&
+ ( mbSet == ((MetaOverlineColorAction&)rMetaAction).mbSet );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaOverlineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ maColor.Write( rOStm, TRUE );
+ rOStm << mbSet;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaOverlineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ maColor.Read( rIStm, TRUE );
+ rIStm >> mbSet;
+}
+
+// ========================================================================
+
IMPL_META_ACTION( TextAlign, META_TEXTALIGN_ACTION )
// ------------------------------------------------------------------------
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index 2c33d069b007..4f8003722f15 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: outdev.cxx,v $
- * $Revision: 1.60.30.1 $
+ * $Revision: 1.59.74.2 $
*
* This file is part of OpenOffice.org.
*
@@ -117,6 +117,7 @@ struct ImplObjStack
Color* mpTextColor;
Color* mpTextFillColor;
Color* mpTextLineColor;
+ Color* mpOverlineColor;
Point* mpRefPoint;
TextAlign meTextAlign;
RasterOp meRasterOp;
@@ -153,6 +154,11 @@ static void ImplDeleteObjStack( ImplObjStack* pObjStack )
if ( pObjStack->mpTextLineColor )
delete pObjStack->mpTextLineColor;
}
+ if ( pObjStack->mnFlags & PUSH_OVERLINECOLOR )
+ {
+ if ( pObjStack->mpOverlineColor )
+ delete pObjStack->mpOverlineColor;
+ }
if ( pObjStack->mnFlags & PUSH_MAPMODE )
{
if ( pObjStack->mpMapMode )
@@ -464,6 +470,7 @@ OutputDevice::OutputDevice() :
mbDevOutput = FALSE;
mbOutputClipped = FALSE;
maTextColor = Color( COL_BLACK );
+ maOverlineColor = Color( COL_TRANSPARENT );
meTextAlign = maFont.GetAlign();
meRasterOp = ROP_OVERPAINT;
mnAntialiasing = 0;
@@ -2872,6 +2879,13 @@ void OutputDevice::Push( USHORT nFlags )
else
pData->mpTextLineColor = NULL;
}
+ if ( nFlags & PUSH_OVERLINECOLOR )
+ {
+ if ( IsOverlineColor() )
+ pData->mpOverlineColor = new Color( GetOverlineColor() );
+ else
+ pData->mpOverlineColor = NULL;
+ }
if ( nFlags & PUSH_TEXTALIGN )
pData->meTextAlign = GetTextAlign();
if( nFlags & PUSH_TEXTLAYOUTMODE )
@@ -2963,6 +2977,13 @@ void OutputDevice::Pop()
else
SetTextLineColor();
}
+ if ( pData->mnFlags & PUSH_OVERLINECOLOR )
+ {
+ if ( pData->mpOverlineColor )
+ SetOverlineColor( *pData->mpOverlineColor );
+ else
+ SetOverlineColor();
+ }
if ( pData->mnFlags & PUSH_TEXTALIGN )
SetTextAlign( pData->meTextAlign );
if( pData->mnFlags & PUSH_TEXTLAYOUTMODE )
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 60db5cc152c2..8fd0acfc3644 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -3561,6 +3561,7 @@ bool OutputDevice::ImplNewFont() const
}
mbTextLines = ((maFont.GetUnderline() != UNDERLINE_NONE) && (maFont.GetUnderline() != UNDERLINE_DONTKNOW)) ||
+ ((maFont.GetOverline() != UNDERLINE_NONE) && (maFont.GetOverline() != UNDERLINE_DONTKNOW)) ||
((maFont.GetStrikeout() != STRIKEOUT_NONE) && (maFont.GetStrikeout() != STRIKEOUT_DONTKNOW));
mbTextSpecial = maFont.IsShadow() || maFont.IsOutline() ||
(maFont.GetRelief() != RELIEF_NONE);
@@ -3884,45 +3885,36 @@ void ImplFontMetricData::ImplInitAboveTextLineSize()
long nIntLeading = mnIntLeading;
// TODO: assess usage of nLeading below (changed in extleading CWS)
// if no leading is available, we assume 15% of the ascent
- nIntLeading = mnAscent*15/100;
- if ( !nIntLeading )
- nIntLeading = 1;
+ if ( nIntLeading <= 0 )
+ {
+ nIntLeading = mnAscent*15/100;
+ if ( !nIntLeading )
+ nIntLeading = 1;
+ }
long nLineHeight = ((nIntLeading*25)+50) / 100;
if ( !nLineHeight )
nLineHeight = 1;
- long nLineHeight2 = nLineHeight / 2;
- if ( !nLineHeight2 )
- nLineHeight2 = 1;
long nBLineHeight = ((nIntLeading*50)+50) / 100;
if ( nBLineHeight == nLineHeight )
nBLineHeight++;
- long nBLineHeight2 = nBLineHeight/2;
- if ( !nBLineHeight2 )
- nBLineHeight2 = 1;
long n2LineHeight = ((nIntLeading*16)+50) / 100;
if ( !n2LineHeight )
n2LineHeight = 1;
- long n2LineDY = n2LineHeight;
- if ( n2LineDY <= 0 )
- n2LineDY = 1;
- long n2LineDY2 = n2LineDY/2;
- if ( !n2LineDY2 )
- n2LineDY2 = 1;
- long nUnderlineOffset = -(mnAscent - ((nIntLeading/2)-1) );
+ long nCeiling = -mnAscent;
mnAboveUnderlineSize = nLineHeight;
- mnAboveUnderlineOffset = nUnderlineOffset - nLineHeight2;
+ mnAboveUnderlineOffset = nCeiling + (nIntLeading - nLineHeight + 1) / 2;
mnAboveBUnderlineSize = nBLineHeight;
- mnAboveBUnderlineOffset = nUnderlineOffset - nBLineHeight2;
+ mnAboveBUnderlineOffset = nCeiling + (nIntLeading - nBLineHeight + 1) / 2;
mnAboveDUnderlineSize = n2LineHeight;
- mnAboveDUnderlineOffset1 = nUnderlineOffset - n2LineDY2 - n2LineHeight;
- mnAboveDUnderlineOffset2 = mnAboveDUnderlineOffset1 + n2LineDY + n2LineHeight;
+ mnAboveDUnderlineOffset1 = nCeiling + (nIntLeading - 3*n2LineHeight + 1) / 2;
+ mnAboveDUnderlineOffset2 = nCeiling + (nIntLeading + n2LineHeight + 1) / 2;
long nWCalcSize = nIntLeading;
if ( nWCalcSize < 6 )
@@ -3935,7 +3927,7 @@ void ImplFontMetricData::ImplInitAboveTextLineSize()
else
mnAboveWUnderlineSize = ((nWCalcSize*50)+50) / 100;
- mnAboveWUnderlineOffset = nUnderlineOffset;
+ mnAboveWUnderlineOffset = nCeiling + (nIntLeading + 1) / 2;
}
// -----------------------------------------------------------------------
@@ -4087,227 +4079,122 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
// -----------------------------------------------------------------------
-void OutputDevice::ImplDrawTextLine( long nBaseX,
- long nX, long nY, long nWidth,
- FontStrikeout eStrikeout,
- FontUnderline eUnderline,
- BOOL bUnderlineAbove )
+void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY,
+ long nX, long nY, long nWidth,
+ FontUnderline eTextLine,
+ Color aColor,
+ BOOL bIsAbove )
{
- if ( !nWidth )
- return;
-
ImplFontEntry* pFontEntry = mpFontEntry;
- Color aUnderlineColor = GetTextLineColor();
- Color aStrikeoutColor = GetTextColor();
- long nBaseY = nY;
long nLineHeight;
- long nLinePos = 0;
- long nLinePos2 = 0;
- long nLeft;
- BOOL bNormalLines = TRUE;
+ long nLinePos;
- // TODO: fix rotated text
- if( IsRTLEnabled() )
- // --- RTL --- mirror at basex
- nX = nBaseX - nWidth - (nX - nBaseX - 1);
-
- if ( !IsTextLineColor() )
- aUnderlineColor = GetTextColor();
-
- if ( (eUnderline == UNDERLINE_SMALLWAVE) ||
- (eUnderline == UNDERLINE_WAVE) ||
- (eUnderline == UNDERLINE_DOUBLEWAVE) ||
- (eUnderline == UNDERLINE_BOLDWAVE) )
+ if ( bIsAbove )
{
- if ( bUnderlineAbove )
- {
- nLinePos = pFontEntry->maMetric.mnAboveWUnderlineOffset;
- nLineHeight = pFontEntry->maMetric.mnAboveWUnderlineSize;
- }
- else
- {
- nLinePos = pFontEntry->maMetric.mnWUnderlineOffset;
- nLineHeight = pFontEntry->maMetric.mnWUnderlineSize;
- }
- if ( (eUnderline == UNDERLINE_SMALLWAVE) &&
- (nLineHeight > 3) )
- nLineHeight = 3;
- long nLineWidth = (mnDPIX/300);
- if ( !nLineWidth )
- nLineWidth = 1;
- if ( eUnderline == UNDERLINE_BOLDWAVE )
- nLineWidth *= 2;
- nLinePos += nY - (nLineHeight / 2);
- long nLineWidthHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY;
- if ( eUnderline == UNDERLINE_DOUBLEWAVE )
- {
- long nOrgLineHeight = nLineHeight;
- nLineHeight /= 3;
- if ( nLineHeight < 2 )
- {
- if ( nOrgLineHeight > 1 )
- nLineHeight = 2;
- else
- nLineHeight = 1;
- }
- long nLineDY = nOrgLineHeight-(nLineHeight*2);
- if ( nLineDY < nLineWidthHeight )
- nLineDY = nLineWidthHeight;
- long nLineDY2 = nLineDY/2;
- if ( !nLineDY2 )
- nLineDY2 = 1;
-
- nLinePos -= nLineWidthHeight-nLineDY2;
- ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
- nLineWidth, mpFontEntry->mnOrientation, aUnderlineColor );
- nLinePos += nLineWidthHeight+nLineDY;
- ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
- nLineWidth, mpFontEntry->mnOrientation, aUnderlineColor );
- }
- else
- {
- nLinePos -= nLineWidthHeight/2;
- ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
- nLineWidth, mpFontEntry->mnOrientation, aUnderlineColor );
- }
-
-
- if ( (eStrikeout == STRIKEOUT_NONE) ||
- (eStrikeout == STRIKEOUT_DONTKNOW) )
- bNormalLines = FALSE;
+ nLineHeight = pFontEntry->maMetric.mnAboveWUnderlineSize;
+ nLinePos = pFontEntry->maMetric.mnAboveWUnderlineOffset;
}
-
- if ( bNormalLines &&
- ((eStrikeout == STRIKEOUT_SLASH) || (eStrikeout == STRIKEOUT_X)) )
+ else
{
- BOOL bOldMap = IsMapModeEnabled();
- EnableMapMode( FALSE );
- Color aOldColor = GetTextColor();
- SetTextColor( aStrikeoutColor );
- ImplInitTextColor();
- xub_Unicode pChars[5];
- if ( eStrikeout == STRIKEOUT_SLASH )
- pChars[0] = '/';
- else // ( eStrikeout == STRIKEOUT_X )
- pChars[0] = 'X';
- pChars[3]=pChars[2]=pChars[1]=pChars[0];
- // calculate approximation of strikeout atom size
- long nStrikeoutWidth = nWidth;
- String aStrikeoutTest( pChars, 4 );
- SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, 4 );
- if( pLayout )
- {
- nStrikeoutWidth = (pLayout->GetTextWidth() + 2) / 4;
- pLayout->Release();
- if( nStrikeoutWidth <= 0 ) // sanity check
- nStrikeoutWidth = 1;
- }
- // calculate acceptable strikeout length
- // allow the strikeout to be one pixel larger than the text it strikes out
- long nMaxWidth = nStrikeoutWidth/2;
- if ( nMaxWidth < 2 )
- nMaxWidth = 2;
- nMaxWidth += nWidth + 1;
- // build strikeout string
- long nFullStrikeoutWidth = 0;
- String aStrikeoutText( pChars, 0 );
- while( (nFullStrikeoutWidth+=nStrikeoutWidth) < nMaxWidth+1 )
- aStrikeoutText += pChars[0];
- // 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( (aStrikeoutText.Len() > 0)
- && !(mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) )
- {
- if( mpFontEntry->mnOrientation )
- ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation );
-
- // strikeout text has to be left aligned
- ULONG nOrigTLM = mnTextLayoutMode;
- mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED;
- SalLayout* pSalLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN );
- mnTextLayoutMode = nOrigTLM;
-
- if( pSalLayout )
- {
- pSalLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY );
- pSalLayout->DrawText( *mpGraphics );
- pSalLayout->Release();
- }
- }
+ nLineHeight = pFontEntry->maMetric.mnWUnderlineSize;
+ nLinePos = pFontEntry->maMetric.mnWUnderlineOffset;
+ }
+ if ( (eTextLine == UNDERLINE_SMALLWAVE) && (nLineHeight > 3) )
+ nLineHeight = 3;
+ long nLineWidth = (mnDPIX/300);
+ if ( !nLineWidth )
+ nLineWidth = 1;
+ if ( eTextLine == UNDERLINE_BOLDWAVE )
+ nLineWidth *= 2;
+ nLinePos += nY - (nLineHeight / 2);
+ long nLineWidthHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY;
+ if ( eTextLine == UNDERLINE_DOUBLEWAVE )
+ {
+ long nOrgLineHeight = nLineHeight;
+ nLineHeight /= 3;
+ if ( nLineHeight < 2 )
+ {
+ if ( nOrgLineHeight > 1 )
+ nLineHeight = 2;
+ else
+ nLineHeight = 1;
+ }
+ long nLineDY = nOrgLineHeight-(nLineHeight*2);
+ if ( nLineDY < nLineWidthHeight )
+ nLineDY = nLineWidthHeight;
+ long nLineDY2 = nLineDY/2;
+ if ( !nLineDY2 )
+ nLineDY2 = 1;
+
+ nLinePos -= nLineWidthHeight-nLineDY2;
+ ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ nLineWidth, mpFontEntry->mnOrientation, aColor );
+ nLinePos += nLineWidthHeight+nLineDY;
+ ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ nLineWidth, mpFontEntry->mnOrientation, aColor );
+ }
+ else
+ {
+ nLinePos -= nLineWidthHeight/2;
+ ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ nLineWidth, mpFontEntry->mnOrientation, aColor );
+ }
+}
- SetTextColor( aOldColor );
- ImplInitTextColor();
- EnableMapMode( bOldMap );
+// -----------------------------------------------------------------------
- switch( eUnderline )
- {
- case UNDERLINE_NONE:
- case UNDERLINE_DONTKNOW:
- case UNDERLINE_SMALLWAVE:
- case UNDERLINE_WAVE:
- case UNDERLINE_DOUBLEWAVE:
- case UNDERLINE_BOLDWAVE:
- {
- bNormalLines = FALSE;
- }
- break;
- default:
- {
- ; // We don't want a gcc warning...
- }
+void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY,
+ long nX, long nY, long nWidth,
+ FontUnderline eTextLine,
+ Color aColor,
+ BOOL bIsAbove )
+{
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long nLineHeight = 0;
+ long nLinePos = 0;
+ long nLinePos2 = 0;
- }
- }
+ if ( eTextLine > UNDERLINE_LAST )
+ eTextLine = UNDERLINE_SINGLE;
- if ( bNormalLines )
+ switch ( eTextLine )
{
- if ( eUnderline > UNDERLINE_LAST )
- eUnderline = UNDERLINE_SINGLE;
-
- if ( (eUnderline == UNDERLINE_SINGLE) ||
- (eUnderline == UNDERLINE_DOTTED) ||
- (eUnderline == UNDERLINE_DASH) ||
- (eUnderline == UNDERLINE_LONGDASH) ||
- (eUnderline == UNDERLINE_DASHDOT) ||
- (eUnderline == UNDERLINE_DASHDOTDOT) )
- {
- if ( bUnderlineAbove )
+ case UNDERLINE_SINGLE:
+ case UNDERLINE_DOTTED:
+ case UNDERLINE_DASH:
+ case UNDERLINE_LONGDASH:
+ case UNDERLINE_DASHDOT:
+ case UNDERLINE_DASHDOTDOT:
+ if ( bIsAbove )
{
nLineHeight = pFontEntry->maMetric.mnAboveUnderlineSize;
nLinePos = nY + pFontEntry->maMetric.mnAboveUnderlineOffset;
}
else
{
- if ( !pFontEntry->maMetric.mnUnderlineSize )
- ImplInitTextLineSize();
nLineHeight = pFontEntry->maMetric.mnUnderlineSize;
nLinePos = nY + pFontEntry->maMetric.mnUnderlineOffset;
}
- }
- else if ( (eUnderline == UNDERLINE_BOLD) ||
- (eUnderline == UNDERLINE_BOLDDOTTED) ||
- (eUnderline == UNDERLINE_BOLDDASH) ||
- (eUnderline == UNDERLINE_BOLDLONGDASH) ||
- (eUnderline == UNDERLINE_BOLDDASHDOT) ||
- (eUnderline == UNDERLINE_BOLDDASHDOTDOT) )
- {
- if ( bUnderlineAbove )
+ break;
+ case UNDERLINE_BOLD:
+ case UNDERLINE_BOLDDOTTED:
+ case UNDERLINE_BOLDDASH:
+ case UNDERLINE_BOLDLONGDASH:
+ case UNDERLINE_BOLDDASHDOT:
+ case UNDERLINE_BOLDDASHDOTDOT:
+ if ( bIsAbove )
{
nLineHeight = pFontEntry->maMetric.mnAboveBUnderlineSize;
nLinePos = nY + pFontEntry->maMetric.mnAboveBUnderlineOffset;
}
else
{
- if ( !pFontEntry->maMetric.mnBUnderlineSize )
- ImplInitTextLineSize();
nLineHeight = pFontEntry->maMetric.mnBUnderlineSize;
nLinePos = nY + pFontEntry->maMetric.mnBUnderlineOffset;
}
- }
- else if ( eUnderline == UNDERLINE_DOUBLE )
- {
- if ( bUnderlineAbove )
+ break;
+ case UNDERLINE_DOUBLE:
+ if ( bIsAbove )
{
nLineHeight = pFontEntry->maMetric.mnAboveDUnderlineSize;
nLinePos = nY + pFontEntry->maMetric.mnAboveDUnderlineOffset1;
@@ -4315,221 +4202,379 @@ void OutputDevice::ImplDrawTextLine( long nBaseX,
}
else
{
- if ( !pFontEntry->maMetric.mnDUnderlineSize )
- ImplInitTextLineSize();
nLineHeight = pFontEntry->maMetric.mnDUnderlineSize;
nLinePos = nY + pFontEntry->maMetric.mnDUnderlineOffset1;
nLinePos2 = nY + pFontEntry->maMetric.mnDUnderlineOffset2;
}
- }
- else
- nLineHeight = 0;
+ break;
+ default:
+ break;
+ }
- if ( nLineHeight )
+ if ( nLineHeight )
+ {
+ if ( mbLineColor || mbInitLineColor )
{
- if ( mbLineColor || mbInitLineColor )
- {
- mpGraphics->SetLineColor();
- mbInitLineColor = TRUE;
- }
- mpGraphics->SetFillColor( ImplColorToSal( aUnderlineColor ) );
- mbInitFillColor = TRUE;
+ mpGraphics->SetLineColor();
+ mbInitLineColor = TRUE;
+ }
+ mpGraphics->SetFillColor( ImplColorToSal( aColor ) );
+ mbInitFillColor = TRUE;
- nLeft = nX;
+ long nLeft = nX;
- if ( (eUnderline == UNDERLINE_SINGLE) ||
- (eUnderline == UNDERLINE_BOLD) )
- ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
- else if ( eUnderline == UNDERLINE_DOUBLE )
- {
+ switch ( eTextLine )
+ {
+ case UNDERLINE_SINGLE:
+ case UNDERLINE_BOLD:
ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
+ break;
+ case UNDERLINE_DOUBLE:
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos2, nWidth, nLineHeight );
- }
- else if ( (eUnderline == UNDERLINE_DOTTED) ||
- (eUnderline == UNDERLINE_BOLDDOTTED) )
- {
- long nDotWidth = nLineHeight*mnDPIY;
- nDotWidth += mnDPIY/2;
- nDotWidth /= mnDPIY;
- long nTempWidth = nDotWidth;
- long nEnd = nLeft+nWidth;
- while ( nLeft < nEnd )
- {
- if ( nLeft+nTempWidth > nEnd )
- nTempWidth = nEnd-nLeft;
- ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight );
- nLeft += nDotWidth*2;
-
- }
- }
- else if ( (eUnderline == UNDERLINE_DASH) ||
- (eUnderline == UNDERLINE_LONGDASH) ||
- (eUnderline == UNDERLINE_BOLDDASH) ||
- (eUnderline == UNDERLINE_BOLDLONGDASH) )
- {
- long nDotWidth = nLineHeight*mnDPIY;
- nDotWidth += mnDPIY/2;
- nDotWidth /= mnDPIY;
- long nMinDashWidth;
-
- long nMinSpaceWidth;
- long nSpaceWidth;
- long nDashWidth;
- if ( (eUnderline == UNDERLINE_LONGDASH) ||
- (eUnderline == UNDERLINE_BOLDLONGDASH) )
- {
- nMinDashWidth = nDotWidth*6;
- nMinSpaceWidth = nDotWidth*2;
- nDashWidth = 200;
- nSpaceWidth = 100;
- }
- else
+ break;
+ case UNDERLINE_DOTTED:
+ case UNDERLINE_BOLDDOTTED:
{
- nMinDashWidth = nDotWidth*4;
- nMinSpaceWidth = (nDotWidth*150)/100;
- nDashWidth = 100;
- nSpaceWidth = 50;
+ long nDotWidth = nLineHeight*mnDPIY;
+ nDotWidth += mnDPIY/2;
+ nDotWidth /= mnDPIY;
+ long nTempWidth = nDotWidth;
+ long nEnd = nLeft+nWidth;
+ while ( nLeft < nEnd )
+ {
+ if ( nLeft+nTempWidth > nEnd )
+ nTempWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight );
+ nLeft += nDotWidth*2;
+ }
}
- nDashWidth = ((nDashWidth*mnDPIX)+1270)/2540;
- nSpaceWidth = ((nSpaceWidth*mnDPIX)+1270)/2540;
- // DashWidth wird gegebenenfalls verbreitert, wenn
- // die dicke der Linie im Verhaeltnis zur Laenge
- // zu dick wird
- if ( nDashWidth < nMinDashWidth )
- nDashWidth = nMinDashWidth;
- if ( nSpaceWidth < nMinSpaceWidth )
- nSpaceWidth = nMinSpaceWidth;
- long nTempWidth = nDashWidth;
- long nEnd = nLeft+nWidth;
- while ( nLeft < nEnd )
+ break;
+ case UNDERLINE_DASH:
+ case UNDERLINE_LONGDASH:
+ case UNDERLINE_BOLDDASH:
+ case UNDERLINE_BOLDLONGDASH:
{
- if ( nLeft+nTempWidth > nEnd )
- nTempWidth = nEnd-nLeft;
- ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight );
- nLeft += nDashWidth+nSpaceWidth;
+ long nDotWidth = nLineHeight*mnDPIY;
+ nDotWidth += mnDPIY/2;
+ nDotWidth /= mnDPIY;
+ long nMinDashWidth;
+ long nMinSpaceWidth;
+ long nSpaceWidth;
+ long nDashWidth;
+ if ( (eTextLine == UNDERLINE_LONGDASH) ||
+ (eTextLine == UNDERLINE_BOLDLONGDASH) )
+ {
+ nMinDashWidth = nDotWidth*6;
+ nMinSpaceWidth = nDotWidth*2;
+ nDashWidth = 200;
+ nSpaceWidth = 100;
+ }
+ else
+ {
+ nMinDashWidth = nDotWidth*4;
+ nMinSpaceWidth = (nDotWidth*150)/100;
+ nDashWidth = 100;
+ nSpaceWidth = 50;
+ }
+ nDashWidth = ((nDashWidth*mnDPIX)+1270)/2540;
+ nSpaceWidth = ((nSpaceWidth*mnDPIX)+1270)/2540;
+ // DashWidth wird gegebenenfalls verbreitert, wenn
+ // die dicke der Linie im Verhaeltnis zur Laenge
+ // zu dick wird
+ if ( nDashWidth < nMinDashWidth )
+ nDashWidth = nMinDashWidth;
+ if ( nSpaceWidth < nMinSpaceWidth )
+ nSpaceWidth = nMinSpaceWidth;
+ long nTempWidth = nDashWidth;
+ long nEnd = nLeft+nWidth;
+ while ( nLeft < nEnd )
+ {
+ if ( nLeft+nTempWidth > nEnd )
+ nTempWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight );
+ nLeft += nDashWidth+nSpaceWidth;
+ }
}
- }
- else if ( (eUnderline == UNDERLINE_DASHDOT) ||
- (eUnderline == UNDERLINE_BOLDDASHDOT) )
- {
- long nDotWidth = nLineHeight*mnDPIY;
- nDotWidth += mnDPIY/2;
- nDotWidth /= mnDPIY;
- long nDashWidth = ((100*mnDPIX)+1270)/2540;
- long nMinDashWidth = nDotWidth*4;
- // DashWidth wird gegebenenfalls verbreitert, wenn
- // die dicke der Linie im Verhaeltnis zur Laenge
- // zu dick wird
- if ( nDashWidth < nMinDashWidth )
- nDashWidth = nMinDashWidth;
- long nTempDotWidth = nDotWidth;
- long nTempDashWidth = nDashWidth;
- long nEnd = nLeft+nWidth;
- while ( nLeft < nEnd )
+ break;
+ case UNDERLINE_DASHDOT:
+ case UNDERLINE_BOLDDASHDOT:
{
- if ( nLeft+nTempDotWidth > nEnd )
- nTempDotWidth = nEnd-nLeft;
- ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
- nLeft += nDotWidth*2;
- if ( nLeft > nEnd )
- break;
- if ( nLeft+nTempDashWidth > nEnd )
- nTempDashWidth = nEnd-nLeft;
- ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight );
- nLeft += nDashWidth+nDotWidth;
+ long nDotWidth = nLineHeight*mnDPIY;
+ nDotWidth += mnDPIY/2;
+ nDotWidth /= mnDPIY;
+ long nDashWidth = ((100*mnDPIX)+1270)/2540;
+ long nMinDashWidth = nDotWidth*4;
+ // DashWidth wird gegebenenfalls verbreitert, wenn
+ // die dicke der Linie im Verhaeltnis zur Laenge
+ // zu dick wird
+ if ( nDashWidth < nMinDashWidth )
+ nDashWidth = nMinDashWidth;
+ long nTempDotWidth = nDotWidth;
+ long nTempDashWidth = nDashWidth;
+ long nEnd = nLeft+nWidth;
+ while ( nLeft < nEnd )
+ {
+ if ( nLeft+nTempDotWidth > nEnd )
+ nTempDotWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
+ nLeft += nDotWidth*2;
+ if ( nLeft > nEnd )
+ break;
+ if ( nLeft+nTempDashWidth > nEnd )
+ nTempDashWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight );
+ nLeft += nDashWidth+nDotWidth;
+ }
}
- }
- else if ( (eUnderline == UNDERLINE_DASHDOTDOT) ||
-
- (eUnderline == UNDERLINE_BOLDDASHDOTDOT) )
- {
- long nDotWidth = nLineHeight*mnDPIY;
- nDotWidth += mnDPIY/2;
-
- nDotWidth /= mnDPIY;
- long nDashWidth = ((100*mnDPIX)+1270)/2540;
- long nMinDashWidth = nDotWidth*4;
- // DashWidth wird gegebenenfalls verbreitert, wenn
- // die dicke der Linie im Verhaeltnis zur Laenge
- // zu dick wird
- if ( nDashWidth < nMinDashWidth )
- nDashWidth = nMinDashWidth;
- long nTempDotWidth = nDotWidth;
- long nTempDashWidth = nDashWidth;
- long nEnd = nLeft+nWidth;
- while ( nLeft < nEnd )
+ break;
+ case UNDERLINE_DASHDOTDOT:
+ case UNDERLINE_BOLDDASHDOTDOT:
{
- if ( nLeft+nTempDotWidth > nEnd )
- nTempDotWidth = nEnd-nLeft;
- ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
- nLeft += nDotWidth*2;
- if ( nLeft > nEnd )
- break;
- if ( nLeft+nTempDotWidth > nEnd )
- nTempDotWidth = nEnd-nLeft;
- ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
- nLeft += nDotWidth*2;
- if ( nLeft > nEnd )
- break;
- if ( nLeft+nTempDashWidth > nEnd )
- nTempDashWidth = nEnd-nLeft;
- ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight );
- nLeft += nDashWidth+nDotWidth;
+ long nDotWidth = nLineHeight*mnDPIY;
+ nDotWidth += mnDPIY/2;
+ nDotWidth /= mnDPIY;
+ long nDashWidth = ((100*mnDPIX)+1270)/2540;
+ long nMinDashWidth = nDotWidth*4;
+ // DashWidth wird gegebenenfalls verbreitert, wenn
+ // die dicke der Linie im Verhaeltnis zur Laenge
+ // zu dick wird
+ if ( nDashWidth < nMinDashWidth )
+ nDashWidth = nMinDashWidth;
+ long nTempDotWidth = nDotWidth;
+ long nTempDashWidth = nDashWidth;
+ long nEnd = nLeft+nWidth;
+ while ( nLeft < nEnd )
+ {
+ if ( nLeft+nTempDotWidth > nEnd )
+ nTempDotWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
+ nLeft += nDotWidth*2;
+ if ( nLeft > nEnd )
+ break;
+ if ( nLeft+nTempDotWidth > nEnd )
+ nTempDotWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
+ nLeft += nDotWidth*2;
+ if ( nLeft > nEnd )
+ break;
+ if ( nLeft+nTempDashWidth > nEnd )
+ nTempDashWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight );
+ nLeft += nDashWidth+nDotWidth;
+ }
}
- }
+ break;
+ default:
+ break;
}
+ }
+}
- if ( eStrikeout > STRIKEOUT_LAST )
- eStrikeout = STRIKEOUT_SINGLE;
+// -----------------------------------------------------------------------
- if ( eStrikeout == STRIKEOUT_SINGLE )
- {
+void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY,
+ long nX, long nY, long nWidth,
+ FontStrikeout eStrikeout,
+ Color aColor )
+{
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long nLineHeight = 0;
+ long nLinePos = 0;
+ long nLinePos2 = 0;
+
+ if ( eStrikeout > STRIKEOUT_LAST )
+ eStrikeout = STRIKEOUT_SINGLE;
+
+ switch ( eStrikeout )
+ {
+ case STRIKEOUT_SINGLE:
nLineHeight = pFontEntry->maMetric.mnStrikeoutSize;
nLinePos = nY + pFontEntry->maMetric.mnStrikeoutOffset;
- }
- else if ( eStrikeout == STRIKEOUT_BOLD )
- {
+ break;
+ case STRIKEOUT_BOLD:
nLineHeight = pFontEntry->maMetric.mnBStrikeoutSize;
nLinePos = nY + pFontEntry->maMetric.mnBStrikeoutOffset;
- }
- else if ( eStrikeout == STRIKEOUT_DOUBLE )
- {
+ break;
+ case STRIKEOUT_DOUBLE:
nLineHeight = pFontEntry->maMetric.mnDStrikeoutSize;
nLinePos = nY + pFontEntry->maMetric.mnDStrikeoutOffset1;
nLinePos2 = nY + pFontEntry->maMetric.mnDStrikeoutOffset2;
- }
- else
- nLineHeight = 0;
+ break;
+ default:
+ break;
+ }
- if ( nLineHeight )
+ if ( nLineHeight )
+ {
+ if ( mbLineColor || mbInitLineColor )
{
- if ( mbLineColor || mbInitLineColor )
- {
- mpGraphics->SetLineColor();
- mbInitLineColor = TRUE;
- }
- mpGraphics->SetFillColor( ImplColorToSal( aStrikeoutColor ) );
- mbInitFillColor = TRUE;
+ mpGraphics->SetLineColor();
+ mbInitLineColor = TRUE;
+ }
+ mpGraphics->SetFillColor( ImplColorToSal( aColor ) );
+ mbInitFillColor = TRUE;
- nLeft = nX;
+ long nLeft = nX;
- if ( (eStrikeout == STRIKEOUT_SINGLE) ||
- (eStrikeout == STRIKEOUT_BOLD) )
+ switch ( eStrikeout )
+ {
+ case STRIKEOUT_SINGLE:
+ case STRIKEOUT_BOLD:
ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
- else if ( eStrikeout == STRIKEOUT_DOUBLE )
- {
+ break;
+ case STRIKEOUT_DOUBLE:
ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos2, nWidth, nLineHeight );
- }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
+ long nX, long nY, long nWidth,
+ FontStrikeout eStrikeout,
+ Color aColor )
+{
+ BOOL bOldMap = IsMapModeEnabled();
+ EnableMapMode( FALSE );
+
+ Color aOldColor = GetTextColor();
+ SetTextColor( aColor );
+ ImplInitTextColor();
+
+ xub_Unicode pChars[5];
+ if ( eStrikeout == STRIKEOUT_SLASH )
+ pChars[0] = '/';
+ else // ( eStrikeout == STRIKEOUT_X )
+ pChars[0] = 'X';
+ pChars[3]=pChars[2]=pChars[1]=pChars[0];
+
+ // calculate approximation of strikeout atom size
+ long nStrikeoutWidth = nWidth;
+ String aStrikeoutTest( pChars, 4 );
+ SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, 4 );
+ if ( pLayout )
+ {
+ nStrikeoutWidth = (pLayout->GetTextWidth() + 2) / 4;
+ pLayout->Release();
+ if ( nStrikeoutWidth <= 0 ) // sanity check
+ nStrikeoutWidth = 1;
+ }
+
+ // calculate acceptable strikeout length
+ // allow the strikeout to be one pixel larger than the text it strikes out
+ long nMaxWidth = nStrikeoutWidth/2;
+ if ( nMaxWidth < 2 )
+ nMaxWidth = 2;
+ nMaxWidth += nWidth + 1;
+
+ // build strikeout string
+ long nFullStrikeoutWidth = 0;
+ String aStrikeoutText( pChars, 0 );
+ while ( (nFullStrikeoutWidth+=nStrikeoutWidth) < nMaxWidth+1 )
+ aStrikeoutText += pChars[0];
+
+ // 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 ( (aStrikeoutText.Len() > 0)
+ && !(mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) )
+ {
+ if ( mpFontEntry->mnOrientation )
+ ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation );
+
+ // strikeout text has to be left aligned
+ ULONG nOrigTLM = mnTextLayoutMode;
+ mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED;
+ SalLayout* pSalLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN );
+ mnTextLayoutMode = nOrigTLM;
+
+ if ( pSalLayout )
+ {
+ pSalLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY );
+ pSalLayout->DrawText( *mpGraphics );
+ pSalLayout->Release();
}
+ }
+
+ SetTextColor( aOldColor );
+ ImplInitTextColor();
+ EnableMapMode( bOldMap );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawTextLine( long nBaseX,
+ long nX, long nY, long nWidth,
+ FontStrikeout eStrikeout,
+ FontUnderline eUnderline,
+ FontUnderline eOverline,
+ BOOL bUnderlineAbove )
+{
+ if ( !nWidth )
+ return;
+
+ Color aStrikeoutColor = GetTextColor();
+ Color aUnderlineColor = GetTextLineColor();
+ Color aOverlineColor = GetOverlineColor();
+ BOOL bStrikeoutDone = FALSE;
+ BOOL bUnderlineDone = FALSE;
+ BOOL bOverlineDone = FALSE;
+ // TODO: fix rotated text
+ if ( IsRTLEnabled() )
+ // --- RTL --- mirror at basex
+ nX = nBaseX - nWidth - (nX - nBaseX - 1);
+
+ if ( !IsTextLineColor() )
+ aUnderlineColor = GetTextColor();
+
+ if ( !IsOverlineColor() )
+ aOverlineColor = GetTextColor();
+
+ if ( (eUnderline == UNDERLINE_SMALLWAVE) ||
+ (eUnderline == UNDERLINE_WAVE) ||
+ (eUnderline == UNDERLINE_DOUBLEWAVE) ||
+ (eUnderline == UNDERLINE_BOLDWAVE) )
+ {
+ ImplDrawWaveTextLine( nBaseX, nY, nX, nY, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove );
+ bUnderlineDone = TRUE;
+ }
+ if ( (eOverline == UNDERLINE_SMALLWAVE) ||
+ (eOverline == UNDERLINE_WAVE) ||
+ (eOverline == UNDERLINE_DOUBLEWAVE) ||
+ (eOverline == UNDERLINE_BOLDWAVE) )
+ {
+ ImplDrawWaveTextLine( nBaseX, nY, nX, nY, nWidth, eOverline, aOverlineColor, TRUE );
+ bOverlineDone = TRUE;
+ }
+
+ if ( (eStrikeout == STRIKEOUT_SLASH) ||
+ (eStrikeout == STRIKEOUT_X) )
+ {
+ ImplDrawStrikeoutChar( nBaseX, nY, nX, nY, nWidth, eStrikeout, aStrikeoutColor );
+ bStrikeoutDone = TRUE;
}
+
+ if ( !bUnderlineDone )
+ ImplDrawStraightTextLine( nBaseX, nY, nX, nY, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove );
+
+ if ( !bOverlineDone )
+ ImplDrawStraightTextLine( nBaseX, nY, nX, nY, nWidth, eOverline, aOverlineColor, TRUE );
+
+ if ( !bStrikeoutDone )
+ ImplDrawStrikeoutLine( nBaseX, nY, nX, nY, nWidth, eStrikeout, aStrikeoutColor );
}
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout,
- FontStrikeout eStrikeout, FontUnderline eUnderline, BOOL bWordLine, BOOL bUnderlineAbove )
+ FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove )
{
if( bWordLine )
{
@@ -4553,7 +4598,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout,
else if( nWidth > 0 )
{
ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth,
- eStrikeout, eUnderline, bUnderlineAbove );
+ eStrikeout, eUnderline, eOverline, bUnderlineAbove );
nWidth = 0;
}
}
@@ -4561,7 +4606,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout,
if( nWidth > 0 )
{
ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth,
- eStrikeout, eUnderline, bUnderlineAbove );
+ eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
}
else
@@ -4569,7 +4614,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout,
Point aStartPt = rSalLayout.GetDrawPosition();
int nWidth = rSalLayout.GetTextWidth() / rSalLayout.GetUnitsPerPixel();
ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth,
- eStrikeout, eUnderline, bUnderlineAbove );
+ eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
}
@@ -4587,7 +4632,7 @@ void OutputDevice::ImplDrawMnemonicLine( long nX, long nY, long nWidth )
nX = nBaseX - nWidth - (nX - nBaseX - 1);
}
- ImplDrawTextLine( nBaseX, nX, nY, nWidth, STRIKEOUT_NONE, UNDERLINE_SINGLE, FALSE );
+ ImplDrawTextLine( nBaseX, nX, nY, nWidth, STRIKEOUT_NONE, UNDERLINE_SINGLE, UNDERLINE_NONE, FALSE );
}
// -----------------------------------------------------------------------
@@ -4994,7 +5039,7 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, BOOL bTextLines )
if( bTextLines )
ImplDrawTextLines( rSalLayout,
- maFont.GetStrikeout(), maFont.GetUnderline(),
+ maFont.GetStrikeout(), maFont.GetUnderline(), maFont.GetOverline(),
maFont.IsWordLineMode(), ImplIsUnderlineAbove( maFont ) );
// emphasis marks
@@ -5008,6 +5053,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout )
{
Color aOldColor = GetTextColor();
Color aOldTextLineColor = GetTextLineColor();
+ Color aOldOverlineColor = GetOverlineColor();
FontRelief eRelief = maFont.GetRelief();
Point aOrigPos = rSalLayout.DrawBase();
@@ -5017,18 +5063,22 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout )
Color aTextColor( aOldColor );
Color aTextLineColor( aOldTextLineColor );
+ Color aOverlineColor( aOldOverlineColor );
// we don't have a automatic color, so black is always drawn on white
if ( aTextColor.GetColor() == COL_BLACK )
aTextColor = Color( COL_WHITE );
if ( aTextLineColor.GetColor() == COL_BLACK )
aTextLineColor = Color( COL_WHITE );
+ if ( aOverlineColor.GetColor() == COL_BLACK )
+ aOverlineColor = Color( COL_WHITE );
// relief-color is black for white text, in all other cases
// we set this to LightGray
if ( aTextColor.GetColor() == COL_WHITE )
aReliefColor = Color( COL_BLACK );
SetTextLineColor( aReliefColor );
+ SetOverlineColor( aReliefColor );
SetTextColor( aReliefColor );
ImplInitTextColor();
@@ -5044,11 +5094,13 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout )
rSalLayout.DrawOffset() -= Point( nOff, nOff);
SetTextLineColor( aTextLineColor );
+ SetOverlineColor( aOverlineColor );
SetTextColor( aTextColor );
ImplInitTextColor();
ImplDrawTextDirect( rSalLayout, mbTextLines );
SetTextLineColor( aOldTextLineColor );
+ SetOverlineColor( aOldOverlineColor );
if ( aTextColor != aOldColor )
{
@@ -5064,6 +5116,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout )
if ( maFont.IsOutline() )
nOff++;
SetTextLineColor();
+ SetOverlineColor();
if ( (GetTextColor().GetColor() == COL_BLACK)
|| (GetTextColor().GetLuminance() < 8) )
SetTextColor( Color( COL_LIGHTGRAY ) );
@@ -5075,6 +5128,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout )
rSalLayout.DrawBase() -= Point( nOff, nOff );
SetTextColor( aOldColor );
SetTextLineColor( aOldTextLineColor );
+ SetOverlineColor( aOldOverlineColor );
ImplInitTextColor();
if ( !maFont.IsOutline() )
@@ -5103,10 +5157,12 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout )
SetTextColor( Color( COL_WHITE ) );
SetTextLineColor( Color( COL_WHITE ) );
+ SetOverlineColor( Color( COL_WHITE ) );
ImplInitTextColor();
ImplDrawTextDirect( rSalLayout, mbTextLines );
SetTextColor( aOldColor );
SetTextLineColor( aOldTextLineColor );
+ SetOverlineColor( aOldOverlineColor );
ImplInitTextColor();
}
}
@@ -5704,6 +5760,65 @@ void OutputDevice::SetTextLineColor( const Color& rColor )
// -----------------------------------------------------------------------
+void OutputDevice::SetOverlineColor()
+{
+ DBG_TRACE( "OutputDevice::SetOverlineColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaOverlineColorAction( Color(), FALSE ) );
+
+ maOverlineColor = Color( COL_TRANSPARENT );
+
+ if( mpAlphaVDev )
+ mpAlphaVDev->SetOverlineColor();
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetOverlineColor( const Color& rColor )
+{
+ DBG_TRACE( "OutputDevice::SetOverlineColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color aColor( rColor );
+
+ if ( mnDrawMode & ( DRAWMODE_BLACKTEXT | DRAWMODE_WHITETEXT |
+ DRAWMODE_GRAYTEXT | DRAWMODE_GHOSTEDTEXT |
+ DRAWMODE_SETTINGSTEXT ) )
+ {
+ if ( mnDrawMode & DRAWMODE_BLACKTEXT )
+ aColor = Color( COL_BLACK );
+ else if ( mnDrawMode & DRAWMODE_WHITETEXT )
+ aColor = Color( COL_WHITE );
+ else if ( mnDrawMode & DRAWMODE_GRAYTEXT )
+ {
+ const UINT8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+ else if ( mnDrawMode & DRAWMODE_SETTINGSTEXT )
+ aColor = GetSettings().GetStyleSettings().GetFontColor();
+
+ if( (mnDrawMode & DRAWMODE_GHOSTEDTEXT)
+ && (aColor.GetColor() != COL_TRANSPARENT) )
+ {
+ aColor = Color( (aColor.GetRed() >> 1) | 0x80,
+ (aColor.GetGreen() >> 1) | 0x80,
+ (aColor.GetBlue() >> 1) | 0x80 );
+ }
+ }
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaOverlineColorAction( aColor, TRUE ) );
+
+ maOverlineColor = aColor;
+
+ if( mpAlphaVDev )
+ mpAlphaVDev->SetOverlineColor( COL_BLACK );
+}
+
+// -----------------------------------------------------------------------
+
void OutputDevice::SetTextAlign( TextAlign eAlign )
{
@@ -5728,15 +5843,17 @@ void OutputDevice::SetTextAlign( TextAlign eAlign )
void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
FontStrikeout eStrikeout,
FontUnderline eUnderline,
+ FontUnderline eOverline,
BOOL bUnderlineAbove )
{
DBG_TRACE( "OutputDevice::DrawTextLine()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
- mpMetaFile->AddAction( new MetaTextLineAction( rPos, nWidth, eStrikeout, eUnderline ) );
+ mpMetaFile->AddAction( new MetaTextLineAction( rPos, nWidth, eStrikeout, eUnderline, eOverline ) );
if ( ((eUnderline == UNDERLINE_NONE) || (eUnderline == UNDERLINE_DONTKNOW)) &&
+ ((eOverline == UNDERLINE_NONE) || (eOverline == UNDERLINE_DONTKNOW)) &&
((eStrikeout == STRIKEOUT_NONE) || (eStrikeout == STRIKEOUT_DONTKNOW)) )
return;
@@ -5762,10 +5879,10 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
Point aPos = ImplLogicToDevicePixel( rPos );
nWidth = ImplLogicWidthToDevicePixel( nWidth );
aPos += Point( mnTextOffX, mnTextOffY );
- ImplDrawTextLine( aPos.X(), aPos.X(), aPos.Y(), nWidth, eStrikeout, eUnderline, bUnderlineAbove );
+ ImplDrawTextLine( aPos.X(), aPos.X(), aPos.Y(), nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
if( mpAlphaVDev )
- mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, bUnderlineAbove );
+ mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
// ------------------------------------------------------------------------
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 7aeb8a226835..9293ebf1aab2 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: pdfwriter.cxx,v $
- * $Revision: 1.24 $
+ * $Revision: 1.24.134.1 $
*
* This file is part of OpenOffice.org.
*
@@ -102,9 +102,10 @@ void PDFWriter::DrawTextLine(
long nWidth,
FontStrikeout eStrikeout,
FontUnderline eUnderline,
+ FontUnderline eOverline,
BOOL bUnderlineAbove )
{
- ((PDFWriterImpl*)pImplementation)->drawTextLine( rPos, nWidth, eStrikeout, eUnderline, bUnderlineAbove );
+ ((PDFWriterImpl*)pImplementation)->drawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
void PDFWriter::DrawTextArray(
@@ -405,6 +406,16 @@ void PDFWriter::SetTextLineColor( const Color& rColor )
((PDFWriterImpl*)pImplementation)->setTextLineColor( rColor );
}
+void PDFWriter::SetOverlineColor()
+{
+ ((PDFWriterImpl*)pImplementation)->setOverlineColor();
+}
+
+void PDFWriter::SetOverlineColor( const Color& rColor )
+{
+ ((PDFWriterImpl*)pImplementation)->setOverlineColor( rColor );
+}
+
void PDFWriter::SetTextAlign( ::TextAlign eAlign )
{
((PDFWriterImpl*)pImplementation)->setTextAlign( eAlign );
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 8b26f019a4bb..69f4674cae9c 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: pdfwriter_impl.cxx,v $
- * $Revision: 1.133.16.2 $
+ * $Revision: 1.132.72.2 $
*
* This file is part of OpenOffice.org.
*
@@ -6458,11 +6458,14 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bT
Color aTextColor = m_aCurrentPDFState.m_aFont.GetColor();
Color aTextLineColor = m_aCurrentPDFState.m_aTextLineColor;
+ Color aOverlineColor = m_aCurrentPDFState.m_aOverlineColor;
Color aReliefColor( COL_LIGHTGRAY );
if( aTextColor == COL_BLACK )
aTextColor = Color( COL_WHITE );
if( aTextLineColor == COL_BLACK )
aTextLineColor = Color( COL_WHITE );
+ if( aOverlineColor == COL_BLACK )
+ aOverlineColor = Color( COL_WHITE );
if( aTextColor == COL_WHITE )
aReliefColor = Color( COL_BLACK );
@@ -6471,7 +6474,8 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bT
aSetFont.SetShadow( FALSE );
aSetFont.SetColor( aReliefColor );
- setTextLineColor( aTextLineColor );
+ setTextLineColor( aReliefColor );
+ setOverlineColor( aReliefColor );
setFont( aSetFont );
long nOff = 1 + getReferenceDevice()->mnDPIX/300;
if( eRelief == RELIEF_ENGRAVED )
@@ -6483,6 +6487,7 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bT
rLayout.DrawOffset() -= Point( nOff, nOff );
setTextLineColor( aTextLineColor );
+ setOverlineColor( aOverlineColor );
aSetFont.SetColor( aTextColor );
setFont( aSetFont );
updateGraphicsState();
@@ -6496,6 +6501,7 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const String& rText, bool bT
{
Font aSaveFont = m_aCurrentPDFState.m_aFont;
Color aSaveTextLineColor = m_aCurrentPDFState.m_aTextLineColor;
+ Color aSaveOverlineColor = m_aCurrentPDFState.m_aOverlineColor;
Font& rFont = m_aCurrentPDFState.m_aFont;
if( rFont.GetColor() == Color( COL_BLACK ) || rFont.GetColor().GetLuminance() < 8 )
@@ -6506,6 +6512,7 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const String& rText, bool bT
rFont.SetOutline( FALSE );
setFont( rFont );
setTextLineColor( rFont.GetColor() );
+ setOverlineColor( rFont.GetColor() );
updateGraphicsState();
long nOff = 1 + ((m_pReferenceDevice->mpFontEntry->mnLineHeight-24)/24);
@@ -6517,6 +6524,7 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const String& rText, bool bT
setFont( aSaveFont );
setTextLineColor( aSaveTextLineColor );
+ setOverlineColor( aSaveOverlineColor );
updateGraphicsState();
}
@@ -6908,9 +6916,11 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
// draw eventual textlines
FontStrikeout eStrikeout = m_aCurrentPDFState.m_aFont.GetStrikeout();
FontUnderline eUnderline = m_aCurrentPDFState.m_aFont.GetUnderline();
+ FontUnderline eOverline = m_aCurrentPDFState.m_aFont.GetOverline();
if( bTextLines &&
(
( eUnderline != UNDERLINE_NONE && eUnderline != UNDERLINE_DONTKNOW ) ||
+ ( eOverline != UNDERLINE_NONE && eOverline != UNDERLINE_DONTKNOW ) ||
( eStrikeout != STRIKEOUT_NONE && eStrikeout != STRIKEOUT_DONTKNOW )
)
)
@@ -6937,7 +6947,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
{
drawTextLine( m_pReferenceDevice->PixelToLogic( aStartPt ),
m_pReferenceDevice->ImplDevicePixelToLogicWidth( nWidth ),
- eStrikeout, eUnderline, bUnderlineAbove );
+ eStrikeout, eUnderline, eOverline, bUnderlineAbove );
nWidth = 0;
}
}
@@ -6946,7 +6956,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
{
drawTextLine( m_pReferenceDevice->PixelToLogic( aStartPt ),
m_pReferenceDevice->ImplDevicePixelToLogicWidth( nWidth ),
- eStrikeout, eUnderline, bUnderlineAbove );
+ eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
}
else
@@ -6955,7 +6965,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT
int nWidth = rLayout.GetTextWidth() / rLayout.GetUnitsPerPixel();
drawTextLine( m_pReferenceDevice->PixelToLogic( aStartPt ),
m_pReferenceDevice->ImplDevicePixelToLogicWidth( nWidth ),
- eStrikeout, eUnderline, bUnderlineAbove );
+ eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
}
@@ -7364,188 +7374,96 @@ void PDFWriterImpl::drawWaveLine( const Point& rStart, const Point& rStop, sal_I
#define WCONV( x ) m_pReferenceDevice->ImplDevicePixelToLogicWidth( x )
#define HCONV( x ) m_pReferenceDevice->ImplDevicePixelToLogicHeight( x )
-void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, bool bUnderlineAbove )
+void PDFWriterImpl::drawWaveTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove )
{
- if ( !nWidth ||
- ( ((eStrikeout == STRIKEOUT_NONE)||(eStrikeout == STRIKEOUT_DONTKNOW)) &&
- ((eUnderline == UNDERLINE_NONE)||(eUnderline == UNDERLINE_DONTKNOW)) ) )
- return;
-
- MARK( "drawTextLine" );
- updateGraphicsState();
-
// note: units in pFontEntry are ref device pixel
ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry;
- Color aUnderlineColor = m_aCurrentPDFState.m_aTextLineColor;
- Color aStrikeoutColor = m_aCurrentPDFState.m_aFont.GetColor();
long nLineHeight = 0;
long nLinePos = 0;
- long nLinePos2 = 0;
- bool bNormalLines = true;
-
- if ( bNormalLines &&
- ((eStrikeout == STRIKEOUT_SLASH) || (eStrikeout == STRIKEOUT_X)) )
- {
- String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" );
- String aStrikeout = aStrikeoutChar;
- while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth )
- aStrikeout.Append( aStrikeout );
-
- // do not get broader than nWidth modulo 1 character
- while( m_pReferenceDevice->GetTextWidth( aStrikeout ) >= nWidth )
- aStrikeout.Erase( 0, 1 );
- aStrikeout.Append( aStrikeoutChar );
- BOOL bShadow = m_aCurrentPDFState.m_aFont.IsShadow();
- if( bShadow )
- {
- Font aFont = m_aCurrentPDFState.m_aFont;
- aFont.SetShadow( FALSE );
- setFont( aFont );
- updateGraphicsState();
- }
-
- // strikeout string is left aligned non-CTL text
- ULONG nOrigTLM = m_pReferenceDevice->GetLayoutMode();
- m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED );
- drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false );
- m_pReferenceDevice->SetLayoutMode( nOrigTLM );
- if( bShadow )
- {
- Font aFont = m_aCurrentPDFState.m_aFont;
- aFont.SetShadow( TRUE );
- setFont( aFont );
- updateGraphicsState();
- }
+ appendStrokingColor( aColor, aLine );
+ aLine.append( "\n" );
- switch( eUnderline )
- {
- case UNDERLINE_NONE:
- case UNDERLINE_DONTKNOW:
- case UNDERLINE_SMALLWAVE:
- case UNDERLINE_WAVE:
- case UNDERLINE_DOUBLEWAVE:
- case UNDERLINE_BOLDWAVE:
- {
- bNormalLines = FALSE;
- }
- break;
- default:
- {
- ; // No gcc warning
- }
- }
+ if ( bIsAbove )
+ {
+ if ( !pFontEntry->maMetric.mnAboveWUnderlineSize )
+ m_pReferenceDevice->ImplInitAboveTextLineSize();
+ nLineHeight = HCONV( pFontEntry->maMetric.mnAboveWUnderlineSize );
+ nLinePos = HCONV( pFontEntry->maMetric.mnAboveWUnderlineOffset );
}
+ else
+ {
+ if ( !pFontEntry->maMetric.mnWUnderlineSize )
+ m_pReferenceDevice->ImplInitTextLineSize();
+ nLineHeight = HCONV( pFontEntry->maMetric.mnWUnderlineSize );
+ nLinePos = HCONV( pFontEntry->maMetric.mnWUnderlineOffset );
+ }
+ if ( (eTextLine == UNDERLINE_SMALLWAVE) && (nLineHeight > 3) )
+ nLineHeight = 3;
- Point aPos( rPos );
- TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlign();
- if( eAlign == ALIGN_TOP )
- aPos.Y() += HCONV( pFontEntry->maMetric.mnAscent );
- else if( eAlign == ALIGN_BOTTOM )
- aPos.Y() -= HCONV( pFontEntry->maMetric.mnDescent );
-
- OStringBuffer aLine( 512 );
- // save GS
- aLine.append( "q " );
+ long nLineWidth = getReferenceDevice()->mnDPIX/450;
+ if ( ! nLineWidth )
+ nLineWidth = 1;
- // rotate and translate matrix
- double fAngle = (double)m_aCurrentPDFState.m_aFont.GetOrientation() * M_PI / 1800.0;
- Matrix3 aMat;
- aMat.rotate( fAngle );
- aMat.translate( aPos.X(), aPos.Y() );
- aMat.append( m_aPages.back(), aLine );
- aLine.append( " cm\n" );
+ if ( eTextLine == UNDERLINE_BOLDWAVE )
+ nLineWidth = 3*nLineWidth;
- if ( aUnderlineColor.GetTransparency() != 0 )
- aUnderlineColor = aStrikeoutColor;
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineWidth, aLine );
+ aLine.append( " w " );
- if ( (eUnderline == UNDERLINE_SMALLWAVE) ||
- (eUnderline == UNDERLINE_WAVE) ||
- (eUnderline == UNDERLINE_DOUBLEWAVE) ||
- (eUnderline == UNDERLINE_BOLDWAVE) )
+ if ( eTextLine == UNDERLINE_DOUBLEWAVE )
{
- appendStrokingColor( aUnderlineColor, aLine );
- aLine.append( "\n" );
-
- if ( bUnderlineAbove )
- {
- if ( !pFontEntry->maMetric.mnAboveWUnderlineSize )
- m_pReferenceDevice->ImplInitAboveTextLineSize();
- nLinePos = HCONV( pFontEntry->maMetric.mnAboveWUnderlineOffset );
- nLineHeight = HCONV( pFontEntry->maMetric.mnAboveWUnderlineSize );
- }
- else
+ long nOrgLineHeight = nLineHeight;
+ nLineHeight /= 3;
+ if ( nLineHeight < 2 )
{
- if ( !pFontEntry->maMetric.mnWUnderlineSize )
- m_pReferenceDevice->ImplInitTextLineSize();
- nLinePos = HCONV( pFontEntry->maMetric.mnWUnderlineOffset );
- nLineHeight = HCONV( pFontEntry->maMetric.mnWUnderlineSize );
-
+ if ( nOrgLineHeight > 1 )
+ nLineHeight = 2;
+ else
+ nLineHeight = 1;
}
- if ( (eUnderline == UNDERLINE_SMALLWAVE) &&
- (nLineHeight > 3) )
- nLineHeight = 3;
-
- long nLineWidth = getReferenceDevice()->mnDPIX/450;
- if( ! nLineWidth )
- nLineWidth = 1;
+ long nLineDY = nOrgLineHeight-(nLineHeight*2);
+ if ( nLineDY < nLineWidth )
+ nLineDY = nLineWidth;
+ long nLineDY2 = nLineDY/2;
+ if ( !nLineDY2 )
+ nLineDY2 = 1;
- if ( eUnderline == UNDERLINE_BOLDWAVE )
- nLineWidth = 3*nLineWidth;
+ nLinePos -= nLineWidth-nLineDY2;
- m_aPages.back().appendMappedLength( (sal_Int32)nLineWidth, aLine );
- aLine.append( " w " );
+ m_aPages.back().appendWaveLine( nWidth, -nLinePos, 2*nLineHeight, aLine );
- if ( eUnderline == UNDERLINE_DOUBLEWAVE )
- {
- long nOrgLineHeight = nLineHeight;
- nLineHeight /= 3;
- if ( nLineHeight < 2 )
- {
- if ( nOrgLineHeight > 1 )
- nLineHeight = 2;
- else
- nLineHeight = 1;
- }
- long nLineDY = nOrgLineHeight-(nLineHeight*2);
- if ( nLineDY < nLineWidth )
- nLineDY = nLineWidth;
- long nLineDY2 = nLineDY/2;
- if ( !nLineDY2 )
- nLineDY2 = 1;
-
- nLinePos -= nLineWidth-nLineDY2;
-
- m_aPages.back().appendWaveLine( nWidth, -nLinePos, 2*nLineHeight, aLine );
+ nLinePos += nLineWidth+nLineDY;
+ m_aPages.back().appendWaveLine( nWidth, -nLinePos, 2*nLineHeight, aLine );
+ }
+ else
+ {
+ if ( eTextLine != UNDERLINE_BOLDWAVE )
+ nLinePos -= nLineWidth/2;
+ m_aPages.back().appendWaveLine( nWidth, -nLinePos, nLineHeight, aLine );
+ }
+}
- nLinePos += nLineWidth+nLineDY;
- m_aPages.back().appendWaveLine( nWidth, -nLinePos, 2*nLineHeight, aLine );
- }
- else
- {
- if( eUnderline != UNDERLINE_BOLDWAVE )
- nLinePos -= nLineWidth/2;
- m_aPages.back().appendWaveLine( nWidth, -nLinePos, nLineHeight, aLine );
- }
+void PDFWriterImpl::drawStraightTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove )
+{
+ // note: units in pFontEntry are ref device pixel
+ ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry;
+ long nLineHeight = 0;
+ long nLinePos = 0;
+ long nLinePos2 = 0;
- if ( (eStrikeout == STRIKEOUT_NONE) ||
- (eStrikeout == STRIKEOUT_DONTKNOW) )
- bNormalLines = false;
- }
+ if ( eTextLine > UNDERLINE_BOLDWAVE )
+ eTextLine = UNDERLINE_SINGLE;
- if ( bNormalLines )
+ switch ( eTextLine )
{
- if ( eUnderline > UNDERLINE_BOLDWAVE )
- eUnderline = UNDERLINE_SINGLE;
-
- if ( (eUnderline == UNDERLINE_SINGLE) ||
- (eUnderline == UNDERLINE_DOTTED) ||
- (eUnderline == UNDERLINE_DASH) ||
- (eUnderline == UNDERLINE_LONGDASH) ||
- (eUnderline == UNDERLINE_DASHDOT) ||
- (eUnderline == UNDERLINE_DASHDOTDOT) )
- {
- if ( bUnderlineAbove )
+ case UNDERLINE_SINGLE:
+ case UNDERLINE_DOTTED:
+ case UNDERLINE_DASH:
+ case UNDERLINE_LONGDASH:
+ case UNDERLINE_DASHDOT:
+ case UNDERLINE_DASHDOTDOT:
+ if ( bIsAbove )
{
if ( !pFontEntry->maMetric.mnAboveUnderlineSize )
m_pReferenceDevice->ImplInitAboveTextLineSize();
@@ -7559,16 +7477,14 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout
nLineHeight = HCONV( pFontEntry->maMetric.mnUnderlineSize );
nLinePos = HCONV( pFontEntry->maMetric.mnUnderlineOffset );
}
- }
- else if ( (eUnderline == UNDERLINE_BOLD) ||
- (eUnderline == UNDERLINE_BOLDDOTTED) ||
- (eUnderline == UNDERLINE_BOLDDASH) ||
-
- (eUnderline == UNDERLINE_BOLDLONGDASH) ||
- (eUnderline == UNDERLINE_BOLDDASHDOT) ||
- (eUnderline == UNDERLINE_BOLDDASHDOTDOT) )
- {
- if ( bUnderlineAbove )
+ break;
+ case UNDERLINE_BOLD:
+ case UNDERLINE_BOLDDOTTED:
+ case UNDERLINE_BOLDDASH:
+ case UNDERLINE_BOLDLONGDASH:
+ case UNDERLINE_BOLDDASHDOT:
+ case UNDERLINE_BOLDDASHDOTDOT:
+ if ( bIsAbove )
{
if ( !pFontEntry->maMetric.mnAboveBUnderlineSize )
m_pReferenceDevice->ImplInitAboveTextLineSize();
@@ -7583,10 +7499,9 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout
nLinePos = HCONV( pFontEntry->maMetric.mnBUnderlineOffset );
nLinePos += nLineHeight/2;
}
- }
- else if ( eUnderline == UNDERLINE_DOUBLE )
- {
- if ( bUnderlineAbove )
+ break;
+ case UNDERLINE_DOUBLE:
+ if ( bIsAbove )
{
if ( !pFontEntry->maMetric.mnAboveDUnderlineSize )
m_pReferenceDevice->ImplInitAboveTextLineSize();
@@ -7602,152 +7517,282 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout
nLinePos = HCONV( pFontEntry->maMetric.mnDUnderlineOffset1 );
nLinePos2 = HCONV( pFontEntry->maMetric.mnDUnderlineOffset2 );
}
- }
- else
- nLineHeight = 0;
-
- if ( nLineHeight )
- {
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, true );
- aLine.append( " w " );
- appendStrokingColor( aUnderlineColor, aLine );
- aLine.append( "\n" );
-
- if ( (eUnderline == UNDERLINE_DOTTED) ||
- (eUnderline == UNDERLINE_BOLDDOTTED) )
- {
- aLine.append( "[ " );
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
- aLine.append( " ] 0 d\n" );
- }
- else if ( (eUnderline == UNDERLINE_DASH) ||
- (eUnderline == UNDERLINE_LONGDASH) ||
- (eUnderline == UNDERLINE_BOLDDASH) ||
- (eUnderline == UNDERLINE_BOLDLONGDASH) )
- {
- sal_Int32 nDashLength = 4*nLineHeight;
- sal_Int32 nVoidLength = 2*nLineHeight;
- if ( ( eUnderline == UNDERLINE_LONGDASH ) || ( eUnderline == UNDERLINE_BOLDLONGDASH ) )
- nDashLength = 8*nLineHeight;
+ default:
+ break;
+ }
- aLine.append( "[ " );
- m_aPages.back().appendMappedLength( nDashLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( " ] 0 d\n" );
- }
- else if ( (eUnderline == UNDERLINE_DASHDOT) ||
- (eUnderline == UNDERLINE_BOLDDASHDOT) )
- {
- sal_Int32 nDashLength = 4*nLineHeight;
- sal_Int32 nVoidLength = 2*nLineHeight;
- aLine.append( "[ " );
- m_aPages.back().appendMappedLength( nDashLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( " ] 0 d\n" );
- }
- else if ( (eUnderline == UNDERLINE_DASHDOTDOT) ||
+ if ( nLineHeight )
+ {
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, true );
+ aLine.append( " w " );
+ appendStrokingColor( aColor, aLine );
+ aLine.append( "\n" );
- (eUnderline == UNDERLINE_BOLDDASHDOTDOT) )
- {
- sal_Int32 nDashLength = 4*nLineHeight;
- sal_Int32 nVoidLength = 2*nLineHeight;
+ switch ( eTextLine )
+ {
+ case UNDERLINE_DOTTED:
+ case UNDERLINE_BOLDDOTTED:
aLine.append( "[ " );
- m_aPages.back().appendMappedLength( nDashLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( ' ' );
m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
aLine.append( " ] 0 d\n" );
- }
+ break;
+ case UNDERLINE_DASH:
+ case UNDERLINE_LONGDASH:
+ case UNDERLINE_BOLDDASH:
+ case UNDERLINE_BOLDLONGDASH:
+ {
+ sal_Int32 nDashLength = 4*nLineHeight;
+ sal_Int32 nVoidLength = 2*nLineHeight;
+ if ( ( eTextLine == UNDERLINE_LONGDASH ) || ( eTextLine == UNDERLINE_BOLDLONGDASH ) )
+ nDashLength = 8*nLineHeight;
+
+ aLine.append( "[ " );
+ m_aPages.back().appendMappedLength( nDashLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( " ] 0 d\n" );
+ }
+ break;
+ case UNDERLINE_DASHDOT:
+ case UNDERLINE_BOLDDASHDOT:
+ {
+ sal_Int32 nDashLength = 4*nLineHeight;
+ sal_Int32 nVoidLength = 2*nLineHeight;
+ aLine.append( "[ " );
+ m_aPages.back().appendMappedLength( nDashLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( " ] 0 d\n" );
+ }
+ break;
+ case UNDERLINE_DASHDOTDOT:
+ case UNDERLINE_BOLDDASHDOTDOT:
+ {
+ sal_Int32 nDashLength = 4*nLineHeight;
+ sal_Int32 nVoidLength = 2*nLineHeight;
+ aLine.append( "[ " );
+ m_aPages.back().appendMappedLength( nDashLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( nVoidLength, aLine, false );
+ aLine.append( " ] 0 d\n" );
+ }
+ break;
+ default:
+ break;
+ }
+ aLine.append( "0 " );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true );
+ aLine.append( " m " );
+ m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true );
+ aLine.append( " l S\n" );
+ if ( eTextLine == UNDERLINE_DOUBLE )
+ {
aLine.append( "0 " );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true );
aLine.append( " m " );
m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false );
aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true );
aLine.append( " l S\n" );
- if ( eUnderline == UNDERLINE_DOUBLE )
- {
- aLine.append( "0 " );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true );
- aLine.append( " m " );
- m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true );
- aLine.append( " l S\n" );
- }
}
+ }
+}
+
+void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontStrikeout eStrikeout, Color aColor )
+{
+ // note: units in pFontEntry are ref device pixel
+ ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry;
+ long nLineHeight = 0;
+ long nLinePos = 0;
+ long nLinePos2 = 0;
- if ( eStrikeout > STRIKEOUT_X )
- eStrikeout = STRIKEOUT_SINGLE;
+ if ( eStrikeout > STRIKEOUT_X )
+ eStrikeout = STRIKEOUT_SINGLE;
- if ( eStrikeout == STRIKEOUT_SINGLE )
- {
+ switch ( eStrikeout )
+ {
+ case STRIKEOUT_SINGLE:
if ( !pFontEntry->maMetric.mnStrikeoutSize )
m_pReferenceDevice->ImplInitTextLineSize();
nLineHeight = HCONV( pFontEntry->maMetric.mnStrikeoutSize );
nLinePos = HCONV( pFontEntry->maMetric.mnStrikeoutOffset );
- }
- else if ( eStrikeout == STRIKEOUT_BOLD )
- {
+ break;
+ case STRIKEOUT_BOLD:
if ( !pFontEntry->maMetric.mnBStrikeoutSize )
m_pReferenceDevice->ImplInitTextLineSize();
nLineHeight = HCONV( pFontEntry->maMetric.mnBStrikeoutSize );
nLinePos = HCONV( pFontEntry->maMetric.mnBStrikeoutOffset );
-
- }
- else if ( eStrikeout == STRIKEOUT_DOUBLE )
- {
+ break;
+ case STRIKEOUT_DOUBLE:
if ( !pFontEntry->maMetric.mnDStrikeoutSize )
m_pReferenceDevice->ImplInitTextLineSize();
nLineHeight = HCONV( pFontEntry->maMetric.mnDStrikeoutSize );
nLinePos = HCONV( pFontEntry->maMetric.mnDStrikeoutOffset1 );
nLinePos2 = HCONV( pFontEntry->maMetric.mnDStrikeoutOffset2 );
- }
- else
- nLineHeight = 0;
+ break;
+ default:
+ break;
+ }
- if ( nLineHeight )
- {
- m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, true );
- aLine.append( " w " );
- appendStrokingColor( aStrikeoutColor, aLine );
- aLine.append( "\n" );
+ if ( nLineHeight )
+ {
+ m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, true );
+ aLine.append( " w " );
+ appendStrokingColor( aColor, aLine );
+ aLine.append( "\n" );
+
+ aLine.append( "0 " );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true );
+ aLine.append( " m " );
+ m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, true );
+ aLine.append( ' ' );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true );
+ aLine.append( " l S\n" );
+ if ( eStrikeout == STRIKEOUT_DOUBLE )
+ {
aLine.append( "0 " );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true );
aLine.append( " m " );
m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, true );
aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true );
+ m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true );
aLine.append( " l S\n" );
+ }
+ }
+}
- if ( eStrikeout == STRIKEOUT_DOUBLE )
- {
- aLine.append( "0 " );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true );
- aLine.append( " m " );
- m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, true );
- aLine.append( ' ' );
- m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true );
- aLine.append( " l S\n" );
+void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout )
+{
+ String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" );
+ String aStrikeout = aStrikeoutChar;
+ while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth )
+ aStrikeout.Append( aStrikeout );
- }
- }
+ // do not get broader than nWidth modulo 1 character
+ while( m_pReferenceDevice->GetTextWidth( aStrikeout ) >= nWidth )
+ aStrikeout.Erase( 0, 1 );
+ aStrikeout.Append( aStrikeoutChar );
+ BOOL bShadow = m_aCurrentPDFState.m_aFont.IsShadow();
+ if ( bShadow )
+ {
+ Font aFont = m_aCurrentPDFState.m_aFont;
+ aFont.SetShadow( FALSE );
+ setFont( aFont );
+ updateGraphicsState();
}
+
+ // strikeout string is left aligned non-CTL text
+ ULONG nOrigTLM = m_pReferenceDevice->GetLayoutMode();
+ m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED );
+ drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false );
+ m_pReferenceDevice->SetLayoutMode( nOrigTLM );
+
+ if ( bShadow )
+ {
+ Font aFont = m_aCurrentPDFState.m_aFont;
+ aFont.SetShadow( TRUE );
+ setFont( aFont );
+ updateGraphicsState();
+ }
+}
+
+void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove )
+{
+ if ( !nWidth ||
+ ( ((eStrikeout == STRIKEOUT_NONE)||(eStrikeout == STRIKEOUT_DONTKNOW)) &&
+ ((eUnderline == UNDERLINE_NONE)||(eUnderline == UNDERLINE_DONTKNOW)) &&
+ ((eOverline == UNDERLINE_NONE)||(eOverline == UNDERLINE_DONTKNOW)) ) )
+ return;
+
+ MARK( "drawTextLine" );
+ updateGraphicsState();
+
+ // note: units in pFontEntry are ref device pixel
+ ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry;
+ Color aUnderlineColor = m_aCurrentPDFState.m_aTextLineColor;
+ Color aOverlineColor = m_aCurrentPDFState.m_aOverlineColor;
+ Color aStrikeoutColor = m_aCurrentPDFState.m_aFont.GetColor();
+ bool bStrikeoutDone = false;
+ bool bUnderlineDone = false;
+ bool bOverlineDone = false;
+
+ if ( (eStrikeout == STRIKEOUT_SLASH) || (eStrikeout == STRIKEOUT_X) )
+ {
+ drawStrikeoutChar( rPos, nWidth, eStrikeout );
+ bStrikeoutDone = true;
+ }
+
+ Point aPos( rPos );
+ TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlign();
+ if( eAlign == ALIGN_TOP )
+ aPos.Y() += HCONV( pFontEntry->maMetric.mnAscent );
+ else if( eAlign == ALIGN_BOTTOM )
+ aPos.Y() -= HCONV( pFontEntry->maMetric.mnDescent );
+
+ OStringBuffer aLine( 512 );
+ // save GS
+ aLine.append( "q " );
+
+ // rotate and translate matrix
+ double fAngle = (double)m_aCurrentPDFState.m_aFont.GetOrientation() * M_PI / 1800.0;
+ Matrix3 aMat;
+ aMat.rotate( fAngle );
+ aMat.translate( aPos.X(), aPos.Y() );
+ aMat.append( m_aPages.back(), aLine );
+ aLine.append( " cm\n" );
+
+ if ( aUnderlineColor.GetTransparency() != 0 )
+ aUnderlineColor = aStrikeoutColor;
+
+ if ( (eUnderline == UNDERLINE_SMALLWAVE) ||
+ (eUnderline == UNDERLINE_WAVE) ||
+ (eUnderline == UNDERLINE_DOUBLEWAVE) ||
+ (eUnderline == UNDERLINE_BOLDWAVE) )
+ {
+ drawWaveTextLine( aLine, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove );
+ bUnderlineDone = true;
+ }
+
+ if ( (eOverline == UNDERLINE_SMALLWAVE) ||
+ (eOverline == UNDERLINE_WAVE) ||
+ (eOverline == UNDERLINE_DOUBLEWAVE) ||
+ (eOverline == UNDERLINE_BOLDWAVE) )
+ {
+ drawWaveTextLine( aLine, nWidth, eOverline, aOverlineColor, true );
+ bOverlineDone = true;
+ }
+
+ if ( !bUnderlineDone )
+ {
+ drawStraightTextLine( aLine, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove );
+ }
+
+ if ( !bOverlineDone )
+ {
+ drawStraightTextLine( aLine, nWidth, eOverline, aOverlineColor, true );
+ }
+
+ if ( !bStrikeoutDone )
+ {
+ drawStrikeoutLine( aLine, nWidth, eStrikeout, aStrikeoutColor );
+ }
+
aLine.append( "Q\n" );
writeBuffer( aLine.getStr(), aLine.getLength() );
}
@@ -9972,6 +10017,8 @@ void PDFWriterImpl::pop()
rOld.m_aClipRegion = aState.m_aClipRegion;
if( ! (aState.m_nFlags & PUSH_TEXTLINECOLOR ) )
setTextLineColor( aState.m_aTextLineColor );
+ if( ! (aState.m_nFlags & PUSH_OVERLINECOLOR ) )
+ setOverlineColor( aState.m_aOverlineColor );
if( ! (aState.m_nFlags & PUSH_TEXTALIGN ) )
setTextAlign( aState.m_aFont.GetAlign() );
if( ! (aState.m_nFlags & PUSH_TEXTFILLCOLOR) )
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index dcdd7cab4721..50c0bafc0489 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: pdfwriter_impl.hxx,v $
- * $Revision: 1.56 $
+ * $Revision: 1.55.134.2 $
*
* This file is part of OpenOffice.org.
*
@@ -654,6 +654,7 @@ private:
Color m_aLineColor;
Color m_aFillColor;
Color m_aTextLineColor;
+ Color m_aOverlineColor;
Region m_aClipRegion;
sal_Int32 m_nAntiAlias;
sal_Int32 m_nLayoutMode;
@@ -667,16 +668,18 @@ private:
static const sal_uInt16 updateLineColor = 0x0004;
static const sal_uInt16 updateFillColor = 0x0008;
static const sal_uInt16 updateTextLineColor = 0x0010;
- static const sal_uInt16 updateClipRegion = 0x0020;
- static const sal_uInt16 updateAntiAlias = 0x0040;
- static const sal_uInt16 updateLayoutMode = 0x0080;
- static const sal_uInt16 updateTransparentPercent = 0x0100;
- static const sal_uInt16 updateDigitLanguage = 0x0200;
+ static const sal_uInt16 updateOverlineColor = 0x0020;
+ static const sal_uInt16 updateClipRegion = 0x0040;
+ static const sal_uInt16 updateAntiAlias = 0x0080;
+ static const sal_uInt16 updateLayoutMode = 0x0100;
+ static const sal_uInt16 updateTransparentPercent = 0x0200;
+ static const sal_uInt16 updateDigitLanguage = 0x0400;
GraphicsState() :
m_aLineColor( COL_TRANSPARENT ),
m_aFillColor( COL_TRANSPARENT ),
m_aTextLineColor( COL_TRANSPARENT ),
+ m_aOverlineColor( COL_TRANSPARENT ),
m_nAntiAlias( 1 ),
m_nLayoutMode( 0 ),
m_nTransparentPercent( 0 ),
@@ -689,6 +692,7 @@ private:
m_aLineColor( rState.m_aLineColor ),
m_aFillColor( rState.m_aFillColor ),
m_aTextLineColor( rState.m_aTextLineColor ),
+ m_aOverlineColor( rState.m_aOverlineColor ),
m_aClipRegion( rState.m_aClipRegion ),
m_nAntiAlias( rState.m_nAntiAlias ),
m_nLayoutMode( rState.m_nLayoutMode ),
@@ -705,6 +709,7 @@ private:
m_aLineColor = rState.m_aLineColor;
m_aFillColor = rState.m_aFillColor;
m_aTextLineColor = rState.m_aTextLineColor;
+ m_aOverlineColor = rState.m_aOverlineColor;
m_aClipRegion = rState.m_aClipRegion;
m_nAntiAlias = rState.m_nAntiAlias;
m_nLayoutMode = rState.m_nLayoutMode;
@@ -1120,6 +1125,18 @@ public:
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateTextLineColor;
}
+ void setOverlineColor()
+ {
+ m_aGraphicsStack.front().m_aOverlineColor = Color( COL_TRANSPARENT );
+ m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateOverlineColor;
+ }
+
+ void setOverlineColor( const Color& rColor )
+ {
+ m_aGraphicsStack.front().m_aOverlineColor = rColor;
+ m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateOverlineColor;
+ }
+
void setTextFillColor( const Color& rColor )
{
m_aGraphicsStack.front().m_aFont.SetFillColor( rColor );
@@ -1183,7 +1200,11 @@ public:
xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
bool bTextLines = true );
void drawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, bool bTextLines = true );
- void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, bool bUnderlineAbove );
+ void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove );
+ void drawWaveTextLine( rtl::OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
+ void drawStraightTextLine( rtl::OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove );
+ void drawStrikeoutLine( rtl::OStringBuffer& aLine, long nWidth, FontStrikeout eStrikeout, Color aColor );
+ void drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout );
void drawLine( const Point& rStart, const Point& rStop );
void drawLine( const Point& rStart, const Point& rStop, const LineInfo& rInfo );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index cb8e5655c0c6..d9891430f29d 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: window.cxx,v $
- * $Revision: 1.286 $
+ * $Revision: 1.285.38.2 $
*
* This file is part of OpenOffice.org.
*
@@ -9750,6 +9750,10 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP
SetTextLineColor( GetTextLineColor() );
else
SetTextLineColor();
+ if( IsOverlineColor() )
+ SetOverlineColor( GetOverlineColor() );
+ else
+ SetOverlineColor();
if( IsTextFillColor() )
SetTextFillColor( GetTextFillColor() );
else