Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / inc / unx / genpspgraphics.h
blobcad46f77f57a21c0c1f9d509688342a78aba9fd7
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 #pragma once
22 #include <sal/config.h>
24 #include <config_cairo_canvas.h>
26 #include <salgdi.hxx>
27 #include <sallayout.hxx>
29 #include <unx/cairotextrender.hxx>
31 #include <headless/SvpGraphicsBackend.hxx>
32 #include <headless/CairoCommon.hxx>
34 namespace vcl::font
36 class PhysicalFontFace;
37 class PhysicalFontCollection;
40 namespace psp { struct JobData; }
42 class FreetypeFontInstance;
43 class FontAttributes;
44 class SalInfoPrinter;
45 class FontMetricData;
47 class VCL_DLLPUBLIC GenPspGraphics final : public SalGraphicsAutoDelegateToImpl
50 psp::JobData* m_pJobData;
52 CairoCommon m_aCairoCommon;
53 CairoTextRender m_aTextRenderImpl;
54 std::unique_ptr<SvpGraphicsBackend> m_pBackend;
56 public:
57 GenPspGraphics();
58 virtual ~GenPspGraphics() override;
60 void Init(psp::JobData* pJob);
62 // override all pure virtual methods
63 virtual SalGraphicsImpl* GetImpl() const override
65 return m_pBackend.get();
68 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
70 virtual void SetTextColor( Color nColor ) override;
71 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
72 virtual void GetFontMetric( FontMetricDataRef&, int nFallbackLevel ) override;
73 virtual FontCharMapRef GetFontCharMap() const override;
74 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
75 virtual void GetDevFontList( vcl::font::PhysicalFontCollection* ) override;
76 // graphics must drop any cached font info
77 virtual void ClearDevFontCache() override;
78 virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*,
79 const OUString& rFileURL,
80 const OUString& rFontName ) override;
82 virtual std::unique_ptr<GenericSalLayout>
83 GetTextLayout(int nFallbackLevel) override;
84 virtual void DrawTextLayout( const GenericSalLayout& ) override;
86 virtual SystemGraphicsData GetGraphicsData() const override;
88 #if ENABLE_CAIRO_CANVAS
89 virtual bool SupportsCairo() const override;
90 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
91 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
92 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
93 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
94 #endif // ENABLE_CAIRO_CANVAS
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */