xref: /trunk/main/vcl/inc/unx/pspgraphics.h (revision 54ae6a37)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _VCL_PSPGRAPHICS_H
25 #define _VCL_PSPGRAPHICS_H
26 
27 
28 #include "vcl/fontmanager.hxx"
29 
30 #include "vclpluginapi.h"
31 #include "salgdi.hxx"
32 #include "sallayout.hxx"
33 
34 namespace psp { struct JobData; class PrinterGfx; }
35 
36 class ServerFont;
37 class ImplDevFontAttributes;
38 class SalInfoPrinter;
39 
40 class VCLPLUG_GEN_PUBLIC PspGraphics : public SalGraphics
41 {
42     psp::JobData*				m_pJobData;
43     psp::PrinterGfx*			m_pPrinterGfx;
44     String*						m_pPhoneNr;
45     bool						m_bSwallowFaxNo;
46     String						m_aPhoneCollection;
47     bool						m_bPhoneCollectionActive;
48 
49     ServerFont*					m_pServerFont[ MAX_FALLBACK ];
50     bool						m_bFontVertical;
51     SalInfoPrinter*             m_pInfoPrinter;
52 public:
PspGraphics(psp::JobData * pJob,psp::PrinterGfx * pGfx,String * pPhone,bool bSwallow,SalInfoPrinter * pInfoPrinter)53     PspGraphics( psp::JobData* pJob, psp::PrinterGfx* pGfx, String* pPhone, bool bSwallow, SalInfoPrinter* pInfoPrinter )
54             : m_pJobData( pJob ),
55               m_pPrinterGfx( pGfx ),
56               m_pPhoneNr( pPhone ),
57               m_bSwallowFaxNo( bSwallow ),
58               m_bPhoneCollectionActive( false ),
59               m_bFontVertical( false ),
60               m_pInfoPrinter( pInfoPrinter )
61     { for( int i = 0; i < MAX_FALLBACK; i++ ) m_pServerFont[i] = 0; }
62     virtual ~PspGraphics();
63 
64     // helper methods for sharing with X11SalGraphics
65     static const void* DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, FontSubsetInfo& rInfo, long* pDataLen );
66     static void DoFreeEmbedFontData( const void* pData, long nLen );
67     static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont, const Ucs2OStrMap** pNonEncoded );
68     static void DoGetGlyphWidths( psp::fontID aFont,
69                                   bool bVertical,
70                                   Int32Vector& rWidths,
71                                   Ucs2UIntMap& rUnicodeEnc );
72 
73     static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& );
74     static void AnnounceFonts( ImplDevFontList*, const psp::FastPrintFontInfo& );
75     static FontWidth	ToFontWidth (psp::width::type eWidth);
76     static FontWeight	ToFontWeight (psp::weight::type eWeight);
77     static FontPitch	ToFontPitch (psp::pitch::type ePitch);
78     static FontItalic	ToFontItalic (psp::italic::type eItalic);
79     static FontFamily	ToFontFamily (psp::family::type eFamily);
80 
81     // overload all pure virtual methods
82     virtual void			GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
83     virtual sal_uInt16			GetBitCount();
84     virtual long			GetGraphicsWidth() const;
85 
86     virtual void			ResetClipRegion();
87     virtual bool            setClipRegion( const Region& );
88 
89     virtual void			SetLineColor();
90     virtual void			SetLineColor( SalColor nSalColor );
91     virtual void			SetFillColor();
92     virtual void          	SetFillColor( SalColor nSalColor );
93     virtual void			SetXORMode( bool bSet, bool );
94     virtual void			SetROPLineColor( SalROPColor nROPColor );
95     virtual void			SetROPFillColor( SalROPColor nROPColor );
96 
97     virtual void			SetTextColor( SalColor nSalColor );
98     virtual sal_uInt16          SetFont( ImplFontSelectData*, int nFallbackLevel );
99     virtual void			GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
100     virtual sal_uLong			GetKernPairs( sal_uLong nMaxPairs, ImplKernPairData* );
101     virtual const ImplFontCharMap* GetImplFontCharMap() const;
102     virtual void			GetDevFontList( ImplDevFontList* );
103     virtual void			GetDevFontSubstList( OutputDevice* );
104     virtual bool			AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
105     virtual sal_Bool			CreateFontSubset( const rtl::OUString& rToFile,
106                                               const ImplFontData*,
107                                               sal_GlyphId* pGlyphIds,
108                                               sal_uInt8* pEncoding,
109                                               sal_Int32* pWidths,
110                                               int nGlyphs,
111                                               FontSubsetInfo& rInfo
112                                               );
113     virtual const Ucs2SIntMap* GetFontEncodingVector( const ImplFontData*, const Ucs2OStrMap** ppNonEncoded );
114     virtual const void*	GetEmbedFontData( const ImplFontData*,
115                                           const sal_Ucs* pUnicodes,
116                                           sal_Int32* pWidths,
117                                           FontSubsetInfo& rInfo,
118                                           long* pDataLen );
119     virtual void			FreeEmbedFontData( const void* pData, long nDataLen );
120     virtual void            GetGlyphWidths( const ImplFontData*,
121                                             bool bVertical,
122                                             Int32Vector& rWidths,
123                                             Ucs2UIntMap& rUnicodeEnc );
124     virtual bool			GetGlyphBoundRect( sal_GlyphId, Rectangle& );
125     virtual bool			GetGlyphOutline( sal_GlyphId, ::basegfx::B2DPolyPolygon& );
126     virtual SalLayout*		GetTextLayout( ImplLayoutArgs&, int nFallbackLevel );
127     virtual void			DrawServerFontLayout( const ServerFontLayout& );
128     virtual bool            supportsOperation( OutDevSupportType ) const;
129     virtual void			drawPixel( long nX, long nY );
130     virtual void			drawPixel( long nX, long nY, SalColor nSalColor );
131     virtual void			drawLine( long nX1, long nY1, long nX2, long nY2 );
132     virtual void			drawRect( long nX, long nY, long nWidth, long nHeight );
133     virtual void			drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry );
134     virtual void			drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry );
135     virtual void			drawPolyPolygon( sal_uInt32 nPoly,
136                                              const sal_uInt32* pPoints,
137                                              PCONSTSALPOINT* pPtAry );
138     virtual bool			drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency );
139     virtual bool            drawPolyLine(
140         const basegfx::B2DPolygon&,
141         double fTransparency,
142         const basegfx::B2DVector& rLineWidths,
143         basegfx::B2DLineJoin,
144         com::sun::star::drawing::LineCap);
145     virtual sal_Bool		drawPolyLineBezier( sal_uInt32 nPoints,
146                                                 const SalPoint* pPtAry,
147                                                 const sal_uInt8* pFlgAry );
148     virtual sal_Bool		drawPolygonBezier( sal_uInt32 nPoints,
149                                                const SalPoint* pPtAry,
150                                                const sal_uInt8* pFlgAry );
151     virtual sal_Bool		drawPolyPolygonBezier( sal_uInt32 nPoly,
152                                                    const sal_uInt32* pPoints,
153                                                    const SalPoint* const* pPtAry,
154                                                    const sal_uInt8* const* pFlgAry );
155     virtual void			copyArea( long nDestX,
156                                       long nDestY,
157                                       long nSrcX,
158                                       long nSrcY,
159                                       long nSrcWidth,
160                                       long nSrcHeight,
161                                       sal_uInt16 nFlags );
162     virtual void			copyBits( const SalTwoRect& rPosAry,
163                                       SalGraphics* pSrcGraphics );
164     virtual void			drawBitmap( const SalTwoRect& rPosAry,
165                                         const SalBitmap& rSalBitmap );
166     virtual void			drawBitmap( const SalTwoRect& rPosAry,
167                                         const SalBitmap& rSalBitmap,
168                                         SalColor nTransparentColor );
169     virtual void			drawBitmap( const SalTwoRect& rPosAry,
170                                         const SalBitmap& rSalBitmap,
171                                         const SalBitmap& rTransparentBitmap );
172     virtual void			drawMask( const SalTwoRect& rPosAry,
173                                       const SalBitmap& rSalBitmap,
174                                       SalColor nMaskColor );
175     virtual SalBitmap*		getBitmap( long nX, long nY, long nWidth, long nHeight );
176     virtual SalColor		getPixel( long nX, long nY );
177     virtual void			invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags );
178     virtual void			invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags );
179 
180     virtual sal_Bool			drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize );
181     virtual bool            filterText( const String& rOrigText, String& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, xub_StrLen& rCutStop );
182 
183     virtual bool            drawAlphaBitmap( const SalTwoRect&,
184                                              const SalBitmap& rSourceBitmap,
185                                              const SalBitmap& rAlphaBitmap );
186     virtual bool drawTransformedBitmap(
187         const basegfx::B2DPoint& rNull,
188         const basegfx::B2DPoint& rX,
189         const basegfx::B2DPoint& rY,
190         const SalBitmap& rSourceBitmap,
191         const SalBitmap* pAlphaBitmap);
192     virtual bool            drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
193 
194     virtual SystemGraphicsData GetGraphicsData() const;
195     virtual SystemFontData     GetSysFontData( int nFallbacklevel ) const;
196 };
197 
198 #endif // _VCL_PSPGRAPHICS_H
199