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