bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / unx / genpspgraphics.h
blob1185ed9abb2102e780d45831b6a381ff75189c1d
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>
30 #include <unx/GenPspGfxBackend.hxx>
32 class PhysicalFontFace;
33 class PhysicalFontCollection;
35 namespace psp { struct JobData; class PrinterGfx; }
37 class FreetypeFontInstance;
38 class FontAttributes;
39 class SalInfoPrinter;
40 class ImplFontMetricData;
42 class VCL_DLLPUBLIC GenPspGraphics final : public SalGraphicsAutoDelegateToImpl
44 std::unique_ptr<GenPspGfxBackend> m_pBackend;
46 psp::JobData* m_pJobData;
47 psp::PrinterGfx* m_pPrinterGfx;
49 rtl::Reference<FreetypeFontInstance>
50 m_pFreetypeFont[ MAX_FALLBACK ];
51 public:
52 GenPspGraphics();
53 virtual ~GenPspGraphics() override;
55 void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx );
57 // helper methods
58 static const void * DoGetEmbedFontData(psp::fontID aFont, tools::Long* pDataLen);
59 static void DoFreeEmbedFontData( const void* pData, tools::Long nLen );
61 // helper methods for sharing with X11SalGraphics
62 static void DoGetGlyphWidths( psp::fontID aFont,
63 bool bVertical,
64 std::vector< sal_Int32 >& rWidths,
65 Ucs2UIntMap& rUnicodeEnc );
67 static FontAttributes Info2FontAttributes( const psp::FastPrintFontInfo& );
68 static void AnnounceFonts( PhysicalFontCollection*,
69 const psp::FastPrintFontInfo& );
71 // override all pure virtual methods
72 virtual SalGraphicsImpl* GetImpl() const override
74 return m_pBackend.get();
77 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
79 virtual void SetTextColor( Color nColor ) override;
80 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
81 virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
82 virtual FontCharMapRef GetFontCharMap() const override;
83 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
84 virtual void GetDevFontList( PhysicalFontCollection* ) override;
85 // graphics must drop any cached font info
86 virtual void ClearDevFontCache() override;
87 virtual bool AddTempDevFont( PhysicalFontCollection*,
88 const OUString& rFileURL,
89 const OUString& rFontName ) override;
90 static bool AddTempDevFontHelper( PhysicalFontCollection* pFontCollection,
91 const OUString& rFileURL,
92 const OUString& rFontName);
94 virtual bool CreateFontSubset( const OUString& rToFile,
95 const PhysicalFontFace*,
96 const sal_GlyphId* pGlyphIDs,
97 const sal_uInt8* pEncoding,
98 sal_Int32* pWidths,
99 int nGlyphs,
100 FontSubsetInfo& rInfo ) override;
101 virtual const void* GetEmbedFontData(const PhysicalFontFace*, tools::Long* pDataLen) override;
102 virtual void FreeEmbedFontData( const void* pData, tools::Long nDataLen ) override;
103 virtual void GetGlyphWidths( const PhysicalFontFace*,
104 bool bVertical,
105 std::vector< sal_Int32 >& rWidths,
106 Ucs2UIntMap& rUnicodeEnc ) override;
107 virtual std::unique_ptr<GenericSalLayout>
108 GetTextLayout(int nFallbackLevel) override;
109 virtual void DrawTextLayout( const GenericSalLayout& ) override;
111 virtual SystemGraphicsData GetGraphicsData() const override;
113 #if ENABLE_CAIRO_CANVAS
114 virtual bool SupportsCairo() const override;
115 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
116 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
117 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
118 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
119 #endif // ENABLE_CAIRO_CANVAS
122 #endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */