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