LibreOffice Module vcl (master) 1
unx/salgdi.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <X11/Xlib.h>
25#include <X11/Xutil.h>
26
27#include <vcl/salgtype.hxx>
28#include <vcl/vclenum.hxx>
29
30#include <unx/saldisp.hxx>
31#include <salgdi.hxx>
32#include <salgeom.hxx>
33#include <sallayout.hxx>
34#include <vclpluginapi.h>
35#include <ControlCacheKey.hxx>
36
38
39#include "saltype.h"
40#include "saldisp.hxx"
41
42#include <memory>
43
44/* From <X11/Intrinsic.h> */
45typedef unsigned long Pixel;
46
47class SalBitmap;
48class SalColormap;
49class SalDisplay;
50class SalFrame;
51class X11SalFrame;
54namespace vcl::font
55{
56class PhysicalFontCollection;
57class PhysicalFontFace;
58}
59class SalGraphicsImpl;
60class TextRenderImpl;
61
62namespace basegfx {
63 class B2DTrapezoid;
64}
65
67{
68public:
69 Drawable m_hDrawable;
71
73
74 const SalColormap& GetColormap() const { return *m_pColormap; }
75 const SalDisplay* GetDisplay() const { return GetColormap().GetDisplay(); }
76 const SalVisual& GetVisual() const { return GetColormap().GetVisual(); }
77 Display* GetXDisplay() const { return GetColormap().GetXDisplay(); }
78 Drawable GetDrawable() const { return m_hDrawable; }
79};
80
82{
84 friend class X11CairoTextRender;
85
86public:
88 virtual ~X11SalGraphics() COVERITY_NOEXCEPT_FALSE override;
89
90 void Init(X11SalFrame& rFrame, Drawable aDrawable, SalX11Screen nXScreen);
91 void Init(X11SalVirtualDevice *pVirtualDevice, SalColormap* pColormap = nullptr,
92 bool bDeleteColormap = false);
93 void Init( X11SkiaSalVirtualDevice *pVirtualDevice );
94 void DeInit();
95
96 virtual SalGraphicsImpl* GetImpl() const override;
98 void SetDrawable(Drawable d, cairo_surface_t* surface, SalX11Screen nXScreen);
99
100 const SalX11Screen& GetScreenNumber() const { return m_nXScreen; }
101
102 void Flush();
103
104 // override all pure virtual methods
105 virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
106
107 virtual void SetTextColor( Color nColor ) override;
108 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
109 virtual void GetFontMetric( FontMetricDataRef&, int nFallbackLevel ) override;
110 virtual FontCharMapRef GetFontCharMap() const override;
111 virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
113 virtual void ClearDevFontCache() override;
114 virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
115
116 virtual std::unique_ptr<GenericSalLayout>
117 GetTextLayout(int nFallbackLevel) override;
118 virtual void DrawTextLayout( const GenericSalLayout& ) override;
119
120 virtual SystemGraphicsData GetGraphicsData() const override;
121
122#if ENABLE_CAIRO_CANVAS
123 virtual bool SupportsCairo() const override;
124 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
125 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
126 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
127 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
128#endif // ENABLE_CAIRO_CANVAS
129
130private:
132
134
135 SalFrame* m_pFrame; // the SalFrame which created this Graphics or NULL
136 SalVirtualDevice* m_pVDev; // the SalVirtualDevice which created this Graphics or NULL
137
138
139 std::unique_ptr<SalColormap> m_pDeleteColormap;
140
142
143 std::unique_ptr<SalGraphicsImpl> mxImpl;
144 std::unique_ptr<TextRenderImpl> mxTextRenderImpl;
147
148public:
149 Drawable GetDrawable() const { return maX11Common.GetDrawable(); }
150 const SalDisplay* GetDisplay() const { return maX11Common.GetDisplay(); }
151 const SalVisual& GetVisual() const { return maX11Common.GetVisual(); }
153};
154
155/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _cairo_surface cairo_surface_t
Definition: CairoCommon.hxx:46
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
Display * GetXDisplay() const
Definition: saldisp.hxx:354
const SalDisplay * GetDisplay() const
Definition: saldisp.hxx:124
const SalVisual & GetVisual() const
Definition: saldisp.hxx:126
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
Interface used to share logic on sizing between SalVirtualDevices and SalFrames.
Definition: salgeom.hxx:80
Implementation class for SalGraphics.
Definition: salgdiimpl.hxx:51
Color GetPixel(tools::Long nX, tools::Long nY, const OutputDevice &rOutDev)
A non-visible drawable/buffer (e.g. an X11 Pixmap).
Definition: salvd.hxx:30
Drawable m_hDrawable
Definition: unx/salgdi.h:69
const SalColormap * m_pColormap
Definition: unx/salgdi.h:70
const SalColormap & GetColormap() const
Definition: unx/salgdi.h:74
const SalVisual & GetVisual() const
Definition: unx/salgdi.h:76
const SalDisplay * GetDisplay() const
Definition: unx/salgdi.h:75
Drawable GetDrawable() const
Definition: unx/salgdi.h:78
Display * GetXDisplay() const
Definition: unx/salgdi.h:77
SalX11Screen m_nXScreen
Definition: unx/salgdi.h:141
friend class X11CairoTextRender
Definition: unx/salgdi.h:84
virtual SystemGraphicsData GetGraphicsData() const override
Display * GetXDisplay() const
Definition: unx/salgdi.h:152
CairoCommon maCairoCommon
Definition: unx/salgdi.h:146
std::unique_ptr< TextRenderImpl > mxTextRenderImpl
Definition: unx/salgdi.h:144
Drawable GetDrawable() const
Definition: unx/salgdi.h:149
void Init(X11SalFrame &rFrame, Drawable aDrawable, SalX11Screen nXScreen)
X11Common maX11Common
Definition: unx/salgdi.h:145
std::unique_ptr< SalColormap > m_pDeleteColormap
Definition: unx/salgdi.h:139
virtual void SetTextColor(Color nColor) override
const SalVisual & GetVisual() const
Definition: unx/salgdi.h:151
virtual void SetFont(LogicalFontInstance *, int nFallbackLevel) override
const SalDisplay * GetDisplay() const
Definition: unx/salgdi.h:150
virtual SalGraphicsImpl * GetImpl() const override
SalVirtualDevice * m_pVDev
Definition: unx/salgdi.h:136
friend class X11CairoSalGraphicsImpl
Definition: unx/salgdi.h:83
virtual std::unique_ptr< GenericSalLayout > GetTextLayout(int nFallbackLevel) override
SalGeometryProvider * GetGeometryProvider() const
virtual FontCharMapRef GetFontCharMap() const override
virtual ~X11SalGraphics() COVERITY_NOEXCEPT_FALSE override
std::unique_ptr< SalGraphicsImpl > mxImpl
Definition: unx/salgdi.h:143
virtual void DrawTextLayout(const GenericSalLayout &) override
virtual void GetDevFontList(vcl::font::PhysicalFontCollection *) override
virtual bool AddTempDevFont(vcl::font::PhysicalFontCollection *, const OUString &rFileURL, const OUString &rFontName) override
virtual void ClearDevFontCache() override
const SalX11Screen & GetScreenNumber() const
Definition: unx/salgdi.h:100
void SetDrawable(Drawable d, cairo_surface_t *surface, SalX11Screen nXScreen)
SalFrame * m_pFrame
Definition: unx/salgdi.h:135
virtual void GetResolution(sal_Int32 &rDPIX, sal_Int32 &rDPIY) override
virtual void GetFontMetric(FontMetricDataRef &, int nFallbackLevel) override
void freeResources()
virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override
std::shared_ptr< Surface > SurfaceSharedPtr
Definition: cairo.hxx:72
std::shared_ptr< cairo_surface_t > CairoSurfaceSharedPtr
Definition: cairo.hxx:70
Display
A PhysicalFontFaceCollection is created by a PhysicalFontCollection and becomes invalid when original...
unsigned long Pixel
Definition: unx/salgdi.h:45