Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / inc / generic / genpspgraphics.h
blob2049e26aa6518907dd147a48dc80a410b4eff1d6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
21 #define INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
23 #include <vcl/vclenum.hxx>
25 #include "fontmanager.hxx"
26 #include "salgdi.hxx"
27 #include "sallayout.hxx"
28 #include "vclpluginapi.h"
30 class PhysicalFontFace;
31 class PhysicalFontCollection;
33 namespace psp { struct JobData; class PrinterGfx; }
35 class ServerFont;
36 class ImplDevFontAttributes;
37 class SalInfoPrinter;
39 class VCL_DLLPUBLIC GenPspGraphics : public SalGraphics
41 protected:
42 psp::JobData* m_pJobData;
43 psp::PrinterGfx* m_pPrinterGfx;
45 ServerFont* m_pServerFont[ MAX_FALLBACK ];
46 bool m_bFontVertical;
47 SalInfoPrinter* m_pInfoPrinter;
48 public:
49 GenPspGraphics();
50 virtual ~GenPspGraphics();
52 void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx,
53 SalInfoPrinter* pInfoPrinter );
55 // helper methods
56 static const void * DoGetEmbedFontData ( psp::fontID aFont, const sal_Ucs* pUnicodes,
57 sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo,
58 long* pDataLen );
59 static void DoFreeEmbedFontData( const void* pData, long nLen );
61 // helper methods for sharing with X11SalGraphics
62 static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont,
63 const Ucs2OStrMap** pNonEncoded,
64 std::set<sal_Unicode> const** ppPriority);
65 static void DoGetGlyphWidths( psp::fontID aFont,
66 bool bVertical,
67 Int32Vector& rWidths,
68 Ucs2UIntMap& rUnicodeEnc );
70 static ImplDevFontAttributes Info2DevFontAttributes( const psp::FastPrintFontInfo& );
71 static void AnnounceFonts( PhysicalFontCollection*,
72 const psp::FastPrintFontInfo& );
74 // override all pure virtual methods
75 virtual SalGraphicsImpl*GetImpl() const SAL_OVERRIDE { return NULL; };
76 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) SAL_OVERRIDE;
77 virtual sal_uInt16 GetBitCount() const SAL_OVERRIDE;
78 virtual long GetGraphicsWidth() const SAL_OVERRIDE;
80 virtual void ResetClipRegion() SAL_OVERRIDE;
81 virtual bool setClipRegion( const vcl::Region& ) SAL_OVERRIDE;
83 virtual void SetLineColor() SAL_OVERRIDE;
84 virtual void SetLineColor( SalColor nSalColor ) SAL_OVERRIDE;
85 virtual void SetFillColor() SAL_OVERRIDE;
86 virtual void SetFillColor( SalColor nSalColor ) SAL_OVERRIDE;
87 virtual void SetXORMode( bool bSet, bool ) SAL_OVERRIDE;
88 virtual void SetROPLineColor( SalROPColor nROPColor ) SAL_OVERRIDE;
89 virtual void SetROPFillColor( SalROPColor nROPColor ) SAL_OVERRIDE;
91 virtual void SetTextColor( SalColor nSalColor ) SAL_OVERRIDE;
92 virtual sal_uInt16 SetFont( FontSelectPattern*, int nFallbackLevel ) SAL_OVERRIDE;
93 virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel ) SAL_OVERRIDE;
94 virtual const FontCharMapPtr GetFontCharMap() const SAL_OVERRIDE;
95 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const SAL_OVERRIDE;
96 virtual void GetDevFontList( PhysicalFontCollection* ) SAL_OVERRIDE;
97 // graphics must drop any cached font info
98 virtual void ClearDevFontCache() SAL_OVERRIDE;
99 virtual bool AddTempDevFont( PhysicalFontCollection*,
100 const OUString& rFileURL,
101 const OUString& rFontName ) SAL_OVERRIDE;
103 virtual bool CreateFontSubset( const OUString& rToFile,
104 const PhysicalFontFace*,
105 const sal_GlyphId* pGlyphIDs,
106 const sal_uInt8* pEncoding,
107 sal_Int32* pWidths,
108 int nGlyphs,
109 FontSubsetInfo& rInfo ) SAL_OVERRIDE;
110 virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*,
111 const Ucs2OStrMap** ppNonEncoded,
112 std::set<sal_Unicode> const** ppPriority) SAL_OVERRIDE;
113 virtual const void* GetEmbedFontData( const PhysicalFontFace*,
114 const sal_Ucs* pUnicodes,
115 sal_Int32* pWidths,
116 size_t nLen,
117 FontSubsetInfo& rInfo,
118 long* pDataLen ) SAL_OVERRIDE;
119 virtual void FreeEmbedFontData( const void* pData, long nDataLen ) SAL_OVERRIDE;
120 virtual void GetGlyphWidths( const PhysicalFontFace*,
121 bool bVertical,
122 Int32Vector& rWidths,
123 Ucs2UIntMap& rUnicodeEnc ) SAL_OVERRIDE;
124 virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) SAL_OVERRIDE;
125 virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) SAL_OVERRIDE;
126 virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) SAL_OVERRIDE;
127 virtual void DrawServerFontLayout( const ServerFontLayout& ) SAL_OVERRIDE;
128 virtual bool supportsOperation( OutDevSupportType ) const SAL_OVERRIDE;
129 virtual void drawPixel( long nX, long nY ) SAL_OVERRIDE;
130 virtual void drawPixel( long nX, long nY, SalColor nSalColor ) SAL_OVERRIDE;
131 virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) SAL_OVERRIDE;
132 virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) SAL_OVERRIDE;
133 virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) SAL_OVERRIDE;
134 virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) SAL_OVERRIDE;
135 virtual void drawPolyPolygon( sal_uInt32 nPoly,
136 const sal_uInt32* pPoints,
137 PCONSTSALPOINT* pPtAry ) SAL_OVERRIDE;
138 virtual bool drawPolyPolygon( const basegfx::B2DPolyPolygon&,
139 double fTransparency ) SAL_OVERRIDE;
140 virtual bool drawPolyLine( const basegfx::B2DPolygon&,
141 double fTransparency,
142 const basegfx::B2DVector& rLineWidths,
143 basegfx::B2DLineJoin,
144 css::drawing::LineCap) SAL_OVERRIDE;
145 virtual bool drawPolyLineBezier( sal_uInt32 nPoints,
146 const SalPoint* pPtAry,
147 const sal_uInt8* pFlgAry ) SAL_OVERRIDE;
148 virtual bool drawPolygonBezier( sal_uInt32 nPoints,
149 const SalPoint* pPtAry,
150 const sal_uInt8* pFlgAry ) SAL_OVERRIDE;
151 virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly,
152 const sal_uInt32* pPoints,
153 const SalPoint* const* pPtAry,
154 const sal_uInt8* const* pFlgAry ) SAL_OVERRIDE;
155 virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) SAL_OVERRIDE { return false; };
157 virtual void copyArea( long nDestX,
158 long nDestY,
159 long nSrcX,
160 long nSrcY,
161 long nSrcWidth,
162 long nSrcHeight,
163 sal_uInt16 nFlags ) SAL_OVERRIDE;
164 virtual void copyBits( const SalTwoRect& rPosAry,
165 SalGraphics* pSrcGraphics ) SAL_OVERRIDE;
166 virtual void drawBitmap( const SalTwoRect& rPosAry,
167 const SalBitmap& rSalBitmap ) SAL_OVERRIDE;
168 virtual void drawBitmap( const SalTwoRect& rPosAry,
169 const SalBitmap& rSalBitmap,
170 SalColor nTransparentColor ) SAL_OVERRIDE;
171 virtual void drawBitmap( const SalTwoRect& rPosAry,
172 const SalBitmap& rSalBitmap,
173 const SalBitmap& rTransparentBitmap ) SAL_OVERRIDE;
174 virtual void drawMask( const SalTwoRect& rPosAry,
175 const SalBitmap& rSalBitmap,
176 SalColor nMaskColor ) SAL_OVERRIDE;
177 virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) SAL_OVERRIDE;
178 virtual SalColor getPixel( long nX, long nY ) SAL_OVERRIDE;
179 virtual void invert( long nX, long nY, long nWidth, long nHeight,
180 SalInvert nFlags ) SAL_OVERRIDE;
181 virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry,
182 SalInvert nFlags ) SAL_OVERRIDE;
184 virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight,
185 void* pPtr, sal_uIntPtr nSize ) SAL_OVERRIDE;
186 virtual bool blendBitmap( const SalTwoRect&,
187 const SalBitmap& rBitmap ) SAL_OVERRIDE;
188 virtual bool blendAlphaBitmap( const SalTwoRect&,
189 const SalBitmap& rSrcBitmap,
190 const SalBitmap& rMaskBitmap,
191 const SalBitmap& rAlphaBitmap ) SAL_OVERRIDE;
192 virtual bool drawAlphaBitmap( const SalTwoRect&,
193 const SalBitmap& rSourceBitmap,
194 const SalBitmap& rAlphaBitmap ) SAL_OVERRIDE;
195 virtual bool drawTransformedBitmap( const basegfx::B2DPoint& rNull,
196 const basegfx::B2DPoint& rX,
197 const basegfx::B2DPoint& rY,
198 const SalBitmap& rSourceBitmap,
199 const SalBitmap* pAlphaBitmap) SAL_OVERRIDE;
200 virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight,
201 sal_uInt8 nTransparency ) SAL_OVERRIDE;
203 virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
204 virtual bool SupportsCairo() const SAL_OVERRIDE;
205 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const SAL_OVERRIDE;
206 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const SAL_OVERRIDE;
207 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const SAL_OVERRIDE;
208 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const SAL_OVERRIDE;
210 virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
213 #endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
215 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */