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