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