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