Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / vcl / inc / unx / genpspgraphics.h
blobb37bb909d1f29d9437edf3b3d17a65c180db6158
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>
24 #include <config_cairo_canvas.h>
26 #include "unx/fontmanager.hxx"
27 #include "salgdi.hxx"
28 #include "sallayout.hxx"
29 #include "vclpluginapi.h"
31 class PhysicalFontFace;
32 class PhysicalFontCollection;
34 namespace psp { struct JobData; class PrinterGfx; }
36 class FreetypeFont;
37 class FontAttributes;
38 class SalInfoPrinter;
39 class GlyphCache;
40 class ImplFontMetricData;
42 class VCL_DLLPUBLIC GenPspGraphics : public SalGraphics
44 protected:
45 psp::JobData* m_pJobData;
46 psp::PrinterGfx* m_pPrinterGfx;
48 FreetypeFont* m_pFreetypeFont[ MAX_FALLBACK ];
49 bool m_bFontVertical;
50 SalInfoPrinter* m_pInfoPrinter;
51 public:
52 GenPspGraphics();
53 virtual ~GenPspGraphics() override;
55 void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx,
56 SalInfoPrinter* pInfoPrinter );
58 // helper methods
59 static const void * DoGetEmbedFontData(psp::fontID aFont, long* pDataLen);
60 static void DoFreeEmbedFontData( const void* pData, long nLen );
62 // helper methods for sharing with X11SalGraphics
63 static void DoGetGlyphWidths( psp::fontID aFont,
64 bool bVertical,
65 std::vector< sal_Int32 >& rWidths,
66 Ucs2UIntMap& rUnicodeEnc );
68 static FontAttributes Info2FontAttributes( const psp::FastPrintFontInfo& );
69 static void AnnounceFonts( PhysicalFontCollection*,
70 const psp::FastPrintFontInfo& );
72 // override all pure virtual methods
73 virtual SalGraphicsImpl*GetImpl() const override { return nullptr; };
74 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
75 virtual sal_uInt16 GetBitCount() const override;
76 virtual long GetGraphicsWidth() const override;
78 virtual void ResetClipRegion() override;
79 virtual bool setClipRegion( const vcl::Region& ) override;
81 virtual void SetLineColor() override;
82 virtual void SetLineColor( SalColor nSalColor ) override;
83 virtual void SetFillColor() override;
84 virtual void SetFillColor( SalColor nSalColor ) override;
85 virtual void SetXORMode( bool bSet ) override;
86 virtual void SetROPLineColor( SalROPColor nROPColor ) override;
87 virtual void SetROPFillColor( SalROPColor nROPColor ) override;
89 virtual void SetTextColor( SalColor nSalColor ) override;
90 virtual void SetFont( FontSelectPattern*, int nFallbackLevel ) override;
91 virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
92 virtual const FontCharMapRef GetFontCharMap() const override;
93 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
94 virtual void GetDevFontList( PhysicalFontCollection* ) override;
95 // graphics must drop any cached font info
96 virtual void ClearDevFontCache() override;
97 virtual bool AddTempDevFont( PhysicalFontCollection*,
98 const OUString& rFileURL,
99 const OUString& rFontName ) override;
100 static bool AddTempDevFontHelper( PhysicalFontCollection* pFontCollection,
101 const OUString& rFileURL,
102 const OUString& rFontName,
103 GlyphCache &rGC );
105 virtual bool CreateFontSubset( const OUString& rToFile,
106 const PhysicalFontFace*,
107 const sal_GlyphId* pGlyphIDs,
108 const sal_uInt8* pEncoding,
109 sal_Int32* pWidths,
110 int nGlyphs,
111 FontSubsetInfo& rInfo ) override;
112 virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override;
113 virtual void FreeEmbedFontData( const void* pData, long nDataLen ) override;
114 virtual void GetGlyphWidths( const PhysicalFontFace*,
115 bool bVertical,
116 std::vector< sal_Int32 >& rWidths,
117 Ucs2UIntMap& rUnicodeEnc ) override;
118 virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
119 virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
120 virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
121 virtual void DrawTextLayout( const CommonSalLayout& ) override;
122 virtual bool supportsOperation( OutDevSupportType ) const override;
123 virtual void drawPixel( long nX, long nY ) override;
124 virtual void drawPixel( long nX, long nY, SalColor nSalColor ) override;
125 virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) override;
126 virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override;
127 virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
128 virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
129 virtual void drawPolyPolygon( sal_uInt32 nPoly,
130 const sal_uInt32* pPoints,
131 PCONSTSALPOINT* pPtAry ) override;
132 virtual bool drawPolyPolygon( const basegfx::B2DPolyPolygon&,
133 double fTransparency ) override;
134 virtual bool drawPolyLine( const basegfx::B2DPolygon&,
135 double fTransparency,
136 const basegfx::B2DVector& rLineWidths,
137 basegfx::B2DLineJoin,
138 css::drawing::LineCap,
139 double fMiterMinimumAngle) override;
140 virtual bool drawPolyLineBezier( sal_uInt32 nPoints,
141 const SalPoint* pPtAry,
142 const PolyFlags* pFlgAry ) override;
143 virtual bool drawPolygonBezier( sal_uInt32 nPoints,
144 const SalPoint* pPtAry,
145 const PolyFlags* pFlgAry ) override;
146 virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly,
147 const sal_uInt32* pPoints,
148 const SalPoint* const* pPtAry,
149 const PolyFlags* const* pFlgAry ) override;
150 virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override { return false; };
152 virtual void copyArea( long nDestX,
153 long nDestY,
154 long nSrcX,
155 long nSrcY,
156 long nSrcWidth,
157 long nSrcHeight,
158 bool bWindowInvalidate) override;
159 virtual void copyBits( const SalTwoRect& rPosAry,
160 SalGraphics* pSrcGraphics ) override;
161 virtual void drawBitmap( const SalTwoRect& rPosAry,
162 const SalBitmap& rSalBitmap ) override;
163 virtual void drawBitmap( const SalTwoRect& rPosAry,
164 const SalBitmap& rSalBitmap,
165 const SalBitmap& rTransparentBitmap ) override;
166 virtual void drawMask( const SalTwoRect& rPosAry,
167 const SalBitmap& rSalBitmap,
168 SalColor nMaskColor ) override;
169 virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) override;
170 virtual SalColor getPixel( long nX, long nY ) override;
171 virtual void invert( long nX, long nY, long nWidth, long nHeight,
172 SalInvert nFlags ) override;
173 virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry,
174 SalInvert nFlags ) override;
176 virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight,
177 void* pPtr, sal_uIntPtr nSize ) override;
178 virtual bool blendBitmap( const SalTwoRect&,
179 const SalBitmap& rBitmap ) override;
180 virtual bool blendAlphaBitmap( const SalTwoRect&,
181 const SalBitmap& rSrcBitmap,
182 const SalBitmap& rMaskBitmap,
183 const SalBitmap& rAlphaBitmap ) override;
184 virtual bool drawAlphaBitmap( const SalTwoRect&,
185 const SalBitmap& rSourceBitmap,
186 const SalBitmap& rAlphaBitmap ) override;
187 virtual bool drawTransformedBitmap( const basegfx::B2DPoint& rNull,
188 const basegfx::B2DPoint& rX,
189 const basegfx::B2DPoint& rY,
190 const SalBitmap& rSourceBitmap,
191 const SalBitmap* pAlphaBitmap) override;
192 virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight,
193 sal_uInt8 nTransparency ) override;
195 virtual SystemGraphicsData GetGraphicsData() const override;
197 #if ENABLE_CAIRO_CANVAS
198 virtual bool SupportsCairo() const override;
199 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
200 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
201 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
202 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
204 virtual SystemFontData GetSysFontData( int nFallbacklevel ) const override;
205 #endif // ENABLE_CAIRO_CANVAS
208 #endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */