1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svppspgraphics.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVP_PSPGRAPHICS_HXX
32 #define _SVP_PSPGRAPHICS_HXX
35 #include "vcl/fontmanager.hxx"
36 #include "vcl/sallayout.hxx"
37 #include "vcl/salgdi.hxx"
39 namespace psp
{ struct JobData
; class PrinterGfx
; }
42 class ImplDevFontAttributes
;
45 class PspGraphics
: public SalGraphics
47 psp::JobData
* m_pJobData
;
48 psp::PrinterGfx
* m_pPrinterGfx
;
51 String m_aPhoneCollection
;
52 bool m_bPhoneCollectionActive
;
54 ServerFont
* m_pServerFont
[ MAX_FALLBACK
];
56 SalInfoPrinter
* m_pInfoPrinter
;
59 virtual bool drawAlphaBitmap( const SalTwoRect
&, const SalBitmap
& rSourceBitmap
, const SalBitmap
& rAlphaBitmap
);
60 virtual bool drawAlphaRect( long nX
, long nY
, long nWidth
, long nHeight
, sal_uInt8 nTransparency
);
63 PspGraphics( psp::JobData
* pJob
, psp::PrinterGfx
* pGfx
, String
* pPhone
, bool bSwallow
, SalInfoPrinter
* pInfoPrinter
)
65 m_pPrinterGfx( pGfx
),
67 m_bSwallowFaxNo( bSwallow
),
68 m_bPhoneCollectionActive( false ),
69 m_bFontVertical( false ),
70 m_pInfoPrinter( pInfoPrinter
)
71 { for( int i
= 0; i
< MAX_FALLBACK
; i
++ ) m_pServerFont
[i
] = 0; }
72 virtual ~PspGraphics();
74 // helper methods for sharing with X11SalGraphics
75 static const void* DoGetEmbedFontData( psp::fontID aFont
, const sal_Ucs
* pUnicodes
, sal_Int32
* pWidths
, FontSubsetInfo
& rInfo
, long* pDataLen
);
76 static void DoFreeEmbedFontData( const void* pData
, long nLen
);
77 static const Ucs2SIntMap
* DoGetFontEncodingVector( psp::fontID aFont
, const Ucs2OStrMap
** pNonEncoded
);
78 static void DoGetGlyphWidths( psp::fontID aFont
,
81 Ucs2UIntMap
& rUnicodeEnc
);
82 static ImplDevFontAttributes
Info2DevFontAttributes( const psp::FastPrintFontInfo
& );
83 static void AnnounceFonts( ImplDevFontList
*, const psp::FastPrintFontInfo
& );
84 static FontWidth
ToFontWidth (psp::width::type eWidth
);
85 static FontWeight
ToFontWeight (psp::weight::type eWeight
);
86 static FontPitch
ToFontPitch (psp::pitch::type ePitch
);
87 static FontItalic
ToFontItalic (psp::italic::type eItalic
);
88 static FontFamily
ToFontFamily (psp::family::type eFamily
);
90 // overload all pure virtual methods
91 virtual void GetResolution( sal_Int32
& rDPIX
, sal_Int32
& rDPIY
);
92 virtual USHORT
GetBitCount();
93 virtual long GetGraphicsWidth() const;
95 virtual void ResetClipRegion();
96 virtual void BeginSetClipRegion( ULONG nCount
);
97 virtual BOOL
unionClipRegion( long nX
, long nY
, long nWidth
, long nHeight
);
98 virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon
& );
99 virtual void EndSetClipRegion();
101 virtual void SetLineColor();
102 virtual void SetLineColor( SalColor nSalColor
);
103 virtual void SetFillColor();
104 virtual void SetFillColor( SalColor nSalColor
);
105 virtual void SetXORMode( bool bSet
, bool );
106 virtual void SetROPLineColor( SalROPColor nROPColor
);
107 virtual void SetROPFillColor( SalROPColor nROPColor
);
109 virtual void SetTextColor( SalColor nSalColor
);
110 virtual USHORT
SetFont( ImplFontSelectData
*, int nFallbackLevel
);
111 virtual void GetFontMetric( ImplFontMetricData
* );
112 virtual ULONG
GetKernPairs( ULONG nPairs
, ImplKernPairData
* pKernPairs
);
113 virtual ImplFontCharMap
* GetImplFontCharMap() const;
114 virtual void GetDevFontList( ImplDevFontList
* );
115 virtual void GetDevFontSubstList( OutputDevice
* );
116 virtual bool AddTempDevFont( ImplDevFontList
*, const String
& rFileURL
, const String
& rFontName
);
117 virtual BOOL
CreateFontSubset( const rtl::OUString
& rToFile
,
119 sal_Int32
* pGlyphIDs
,
120 sal_uInt8
* pEncoding
,
123 FontSubsetInfo
& rInfo
125 virtual const Ucs2SIntMap
* GetFontEncodingVector( const ImplFontData
*, const Ucs2OStrMap
** ppNonEncoded
);
126 virtual const void* GetEmbedFontData( const ImplFontData
*,
127 const sal_Ucs
* pUnicodes
,
129 FontSubsetInfo
& rInfo
,
131 virtual void FreeEmbedFontData( const void* pData
, long nDataLen
);
132 virtual void GetGlyphWidths( const ImplFontData
*,
134 Int32Vector
& rWidths
,
135 Ucs2UIntMap
& rUnicodeEnc
);
136 virtual BOOL
GetGlyphBoundRect( long nIndex
, Rectangle
& );
137 virtual BOOL
GetGlyphOutline( long nIndex
, ::basegfx::B2DPolyPolygon
& );
138 virtual SalLayout
* GetTextLayout( ImplLayoutArgs
&, int nFallbackLevel
);
139 virtual void DrawServerFontLayout( const ServerFontLayout
& );
140 virtual bool supportsOperation( OutDevSupportType
) const;
141 virtual void drawPixel( long nX
, long nY
);
142 virtual void drawPixel( long nX
, long nY
, SalColor nSalColor
);
143 virtual void drawLine( long nX1
, long nY1
, long nX2
, long nY2
);
144 virtual void drawRect( long nX
, long nY
, long nWidth
, long nHeight
);
145 virtual void drawPolyLine( ULONG nPoints
, const SalPoint
* pPtAry
);
146 virtual void drawPolygon( ULONG nPoints
, const SalPoint
* pPtAry
);
147 virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon
&, double fTransparency
);
148 virtual bool drawPolyLine( const ::basegfx::B2DPolygon
&, const ::basegfx::B2DVector
& rLineWidths
, basegfx::B2DLineJoin
);
149 virtual void drawPolyPolygon( sal_uInt32 nPoly
,
150 const sal_uInt32
* pPoints
,
151 PCONSTSALPOINT
* pPtAry
);
152 virtual sal_Bool
drawPolyLineBezier( ULONG nPoints
,
153 const SalPoint
* pPtAry
,
154 const BYTE
* pFlgAry
);
155 virtual sal_Bool
drawPolygonBezier( ULONG nPoints
,
156 const SalPoint
* pPtAry
,
157 const BYTE
* pFlgAry
);
158 virtual sal_Bool
drawPolyPolygonBezier( sal_uInt32 nPoly
,
159 const sal_uInt32
* pPoints
,
160 const SalPoint
* const* pPtAry
,
161 const BYTE
* const* pFlgAry
);
163 virtual void copyArea( long nDestX
,
170 virtual void copyBits( const SalTwoRect
* pPosAry
,
171 SalGraphics
* pSrcGraphics
);
172 virtual void drawBitmap( const SalTwoRect
* pPosAry
,
173 const SalBitmap
& rSalBitmap
);
174 virtual void drawBitmap( const SalTwoRect
* pPosAry
,
175 const SalBitmap
& rSalBitmap
,
176 SalColor nTransparentColor
);
177 virtual void drawBitmap( const SalTwoRect
* pPosAry
,
178 const SalBitmap
& rSalBitmap
,
179 const SalBitmap
& rTransparentBitmap
);
180 virtual void drawMask( const SalTwoRect
* pPosAry
,
181 const SalBitmap
& rSalBitmap
,
182 SalColor nMaskColor
);
183 virtual SalBitmap
* getBitmap( long nX
, long nY
, long nWidth
, long nHeight
);
184 virtual SalColor
getPixel( long nX
, long nY
);
185 virtual void invert( long nX
, long nY
, long nWidth
, long nHeight
, SalInvert nFlags
);
186 virtual void invert( ULONG nPoints
, const SalPoint
* pPtAry
, SalInvert nFlags
);
188 virtual BOOL
drawEPS( long nX
, long nY
, long nWidth
, long nHeight
, void* pPtr
, ULONG nSize
);
189 virtual bool filterText( const String
& rOrigText
, String
& rNewText
, xub_StrLen nIndex
, xub_StrLen
& rLen
, xub_StrLen
& rCutStart
, xub_StrLen
& rCutStop
);
191 virtual SystemGraphicsData
GetGraphicsData() const;
192 virtual SystemFontData
GetSysFontData( int nFallbacklevel
) const;
195 #endif // _SVP_PSPGRAPHICS_HXX