xref: /trunk/main/vcl/unx/headless/svppspgraphics.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 #ifndef _SVP_PSPGRAPHICS_HXX
29 #define _SVP_PSPGRAPHICS_HXX
30 
31 
32 #include "vcl/fontmanager.hxx"
33 
34 #include "sallayout.hxx"
35 #include "salgdi.hxx"
36 
37 namespace psp { struct JobData; class PrinterGfx; }
38 
39 class ServerFont;
40 class ImplDevFontAttributes;
41 class SalInfoPrinter;
42 
43 class PspGraphics : public SalGraphics
44 {
45     psp::JobData*				m_pJobData;
46     psp::PrinterGfx*			m_pPrinterGfx;
47     String*						m_pPhoneNr;
48     bool						m_bSwallowFaxNo;
49     String						m_aPhoneCollection;
50     bool						m_bPhoneCollectionActive;
51 
52     ServerFont*					m_pServerFont[ MAX_FALLBACK ];
53     bool						m_bFontVertical;
54     SalInfoPrinter*             m_pInfoPrinter;
55 
56 protected:
57     virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap );
58     virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
59 
60 public:
61     PspGraphics( psp::JobData* pJob, psp::PrinterGfx* pGfx, String* pPhone, bool bSwallow, SalInfoPrinter* pInfoPrinter )
62             : m_pJobData( pJob ),
63               m_pPrinterGfx( pGfx ),
64               m_pPhoneNr( pPhone ),
65               m_bSwallowFaxNo( bSwallow ),
66               m_bPhoneCollectionActive( false ),
67               m_bFontVertical( false ),
68               m_pInfoPrinter( pInfoPrinter )
69     { for( int i = 0; i < MAX_FALLBACK; i++ ) m_pServerFont[i] = 0; }
70     virtual ~PspGraphics();
71 
72     // helper methods for sharing with X11SalGraphics
73     static const void* DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, FontSubsetInfo& rInfo, long* pDataLen );
74     static void DoFreeEmbedFontData( const void* pData, long nLen );
75     static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont, const Ucs2OStrMap** pNonEncoded );
76     static void DoGetGlyphWidths( psp::fontID aFont,
77                                   bool bVertical,
78                                   Int32Vector& rWidths,
79                                   Ucs2UIntMap& rUnicodeEnc );
80     static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& );
81     static void AnnounceFonts( ImplDevFontList*, const psp::FastPrintFontInfo& );
82     static FontWidth	ToFontWidth (psp::width::type eWidth);
83     static FontWeight	ToFontWeight (psp::weight::type eWeight);
84     static FontPitch	ToFontPitch (psp::pitch::type ePitch);
85     static FontItalic	ToFontItalic (psp::italic::type eItalic);
86     static FontFamily	ToFontFamily (psp::family::type eFamily);
87 
88     // overload all pure virtual methods
89     virtual void			GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
90     virtual sal_uInt16			GetBitCount();
91     virtual long			GetGraphicsWidth() const;
92 
93     virtual void			ResetClipRegion();
94     virtual bool            setClipRegion( const Region& );
95 
96     virtual void			SetLineColor();
97     virtual void			SetLineColor( SalColor nSalColor );
98     virtual void			SetFillColor();
99     virtual void          	SetFillColor( SalColor nSalColor );
100     virtual void			SetXORMode( bool bSet, bool );
101     virtual void			SetROPLineColor( SalROPColor nROPColor );
102     virtual void			SetROPFillColor( SalROPColor nROPColor );
103 
104     virtual void			SetTextColor( SalColor nSalColor );
105     virtual sal_uInt16          SetFont( ImplFontSelectData*, int nFallbackLevel );
106     virtual void			GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
107     virtual sal_uLong			GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKernPairs );
108     virtual const ImplFontCharMap* GetImplFontCharMap() const;
109     virtual void			GetDevFontList( ImplDevFontList* );
110     virtual void			GetDevFontSubstList( OutputDevice* );
111     virtual bool			AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
112     virtual sal_Bool			CreateFontSubset( const rtl::OUString& rToFile,
113                                               const ImplFontData*,
114                                               sal_Int32* pGlyphIDs,
115                                               sal_uInt8* pEncoding,
116                                               sal_Int32* pWidths,
117                                               int nGlyphs,
118                                               FontSubsetInfo& rInfo
119                                               );
120     virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded );
121     virtual const void*	GetEmbedFontData( const ImplFontData*,
122                                           const sal_Ucs* pUnicodes,
123                                           sal_Int32* pWidths,
124                                           FontSubsetInfo& rInfo,
125                                           long* pDataLen );
126     virtual void			FreeEmbedFontData( const void* pData, long nDataLen );
127     virtual void            GetGlyphWidths( const ImplFontData*,
128                                             bool bVertical,
129                                             Int32Vector& rWidths,
130                                             Ucs2UIntMap& rUnicodeEnc );
131     virtual sal_Bool			GetGlyphBoundRect( long nIndex, Rectangle& );
132     virtual sal_Bool			GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& );
133     virtual SalLayout*		GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
134     virtual void			DrawServerFontLayout( const ServerFontLayout& );
135     virtual bool            supportsOperation( OutDevSupportType ) const;
136     virtual void			drawPixel( long nX, long nY );
137     virtual void			drawPixel( long nX, long nY, SalColor nSalColor );
138     virtual void			drawLine( long nX1, long nY1, long nX2, long nY2 );
139     virtual void			drawRect( long nX, long nY, long nWidth, long nHeight );
140     virtual void			drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry );
141     virtual void			drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry );
142     virtual bool            drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
143     virtual bool            drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
144     virtual void			drawPolyPolygon( sal_uInt32 nPoly,
145                                              const sal_uInt32* pPoints,
146                                              PCONSTSALPOINT* pPtAry );
147     virtual sal_Bool		drawPolyLineBezier( sal_uLong nPoints,
148                                                 const SalPoint* pPtAry,
149                                                 const sal_uInt8* pFlgAry );
150     virtual sal_Bool		drawPolygonBezier( sal_uLong nPoints,
151                                                const SalPoint* pPtAry,
152                                                const sal_uInt8* pFlgAry );
153     virtual sal_Bool		drawPolyPolygonBezier( sal_uInt32 nPoly,
154                                                    const sal_uInt32* pPoints,
155                                                    const SalPoint* const* pPtAry,
156                                                    const sal_uInt8* const* pFlgAry );
157 
158     virtual void			copyArea( long nDestX,
159                                       long nDestY,
160                                       long nSrcX,
161                                       long nSrcY,
162                                       long nSrcWidth,
163                                       long nSrcHeight,
164                                       sal_uInt16 nFlags );
165     virtual void			copyBits( const SalTwoRect* pPosAry,
166                                       SalGraphics* pSrcGraphics );
167     virtual void			drawBitmap( const SalTwoRect* pPosAry,
168                                         const SalBitmap& rSalBitmap );
169     virtual void			drawBitmap( const SalTwoRect* pPosAry,
170                                         const SalBitmap& rSalBitmap,
171                                         SalColor nTransparentColor );
172     virtual void			drawBitmap( const SalTwoRect* pPosAry,
173                                         const SalBitmap& rSalBitmap,
174                                         const SalBitmap& rTransparentBitmap );
175     virtual void			drawMask( const SalTwoRect* pPosAry,
176                                       const SalBitmap& rSalBitmap,
177                                       SalColor nMaskColor );
178     virtual SalBitmap*		getBitmap( long nX, long nY, long nWidth, long nHeight );
179     virtual SalColor		getPixel( long nX, long nY );
180     virtual void			invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags );
181     virtual void			invert( sal_uLong nPoints, const SalPoint* pPtAry, SalInvert nFlags );
182 
183     virtual sal_Bool			drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize );
184     virtual bool            filterText( const String& rOrigText, String& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, xub_StrLen& rCutStop );
185 
186     virtual SystemGraphicsData 		GetGraphicsData() const;
187     virtual SystemFontData          GetSysFontData( int nFallbacklevel ) const;
188 };
189 
190 #endif // _SVP_PSPGRAPHICS_HXX
191 
192