xref: /trunk/main/vcl/inc/unx/pspgraphics.h (revision 24f6443d)
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:
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_Int32* 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 sal_Bool			GetGlyphBoundRect( long nIndex, Rectangle& );
125     virtual sal_Bool			GetGlyphOutline( long nIndex, ::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_uIntPtr nPoints, const SalPoint* pPtAry );
134     virtual void			drawPolygon( sal_uIntPtr 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( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin);
140     virtual sal_Bool		drawPolyLineBezier( sal_uIntPtr nPoints,
141                                                 const SalPoint* pPtAry,
142                                                 const sal_uInt8* pFlgAry );
143     virtual sal_Bool		drawPolygonBezier( sal_uIntPtr nPoints,
144                                                const SalPoint* pPtAry,
145                                                const sal_uInt8* pFlgAry );
146     virtual sal_Bool		drawPolyPolygonBezier( sal_uInt32 nPoly,
147                                                    const sal_uInt32* pPoints,
148                                                    const SalPoint* const* pPtAry,
149                                                    const sal_uInt8* const* pFlgAry );
150     virtual void			copyArea( long nDestX,
151                                       long nDestY,
152                                       long nSrcX,
153                                       long nSrcY,
154                                       long nSrcWidth,
155                                       long nSrcHeight,
156                                       sal_uInt16 nFlags );
157     virtual void			copyBits( const SalTwoRect* pPosAry,
158                                       SalGraphics* pSrcGraphics );
159     virtual void			drawBitmap( const SalTwoRect* pPosAry,
160                                         const SalBitmap& rSalBitmap );
161     virtual void			drawBitmap( const SalTwoRect* pPosAry,
162                                         const SalBitmap& rSalBitmap,
163                                         SalColor nTransparentColor );
164     virtual void			drawBitmap( const SalTwoRect* pPosAry,
165                                         const SalBitmap& rSalBitmap,
166                                         const SalBitmap& rTransparentBitmap );
167     virtual void			drawMask( const SalTwoRect* pPosAry,
168                                       const SalBitmap& rSalBitmap,
169                                       SalColor nMaskColor );
170     virtual SalBitmap*		getBitmap( long nX, long nY, long nWidth, long nHeight );
171     virtual SalColor		getPixel( long nX, long nY );
172     virtual void			invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags );
173     virtual void			invert( sal_uIntPtr nPoints, const SalPoint* pPtAry, SalInvert nFlags );
174 
175     virtual sal_Bool			drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uIntPtr nSize );
176     virtual bool            filterText( const String& rOrigText, String& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, xub_StrLen& rCutStop );
177 
178     virtual bool            drawAlphaBitmap( const SalTwoRect&,
179                                              const SalBitmap& rSourceBitmap,
180                                              const SalBitmap& rAlphaBitmap );
181     virtual bool            drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
182 
183     virtual SystemGraphicsData GetGraphicsData() const;
184     virtual SystemFontData     GetSysFontData( int nFallbacklevel ) const;
185 };
186 
187 #endif // _VCL_PSPGRAPHICS_H
188