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