Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / vcl / qt5 / Qt5Graphics.hxx
blobaf21ee462b18c970b5b723c447964f5a39cccc11
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 <salgdi.hxx>
24 #include <memory>
26 #include <QtGui/QPainter>
27 #include <QtGui/QPainterPath>
28 #include <QtGui/QRegion>
30 class Qt5Font;
31 class Qt5FontFace;
32 class Qt5Frame;
33 class Qt5Painter;
34 class PhysicalFontCollection;
35 class QImage;
37 class Qt5Graphics : public SalGraphics
39 friend class Qt5Bitmap;
40 friend class Qt5Painter;
42 Qt5Frame* m_pFrame;
43 QImage* m_pQImage;
44 QRegion m_aClipRegion;
45 QPainterPath m_aClipPath;
46 Color m_aLineColor;
47 Color m_aFillColor;
48 QPainter::CompositionMode m_eCompositionMode;
50 PhysicalFontCollection* m_pFontCollection;
51 Qt5Font* m_pTextStyle[MAX_FALLBACK];
52 Color m_aTextColor;
54 Qt5Graphics(Qt5Frame* pFrame, QImage* pQImage);
56 public:
57 Qt5Graphics(Qt5Frame* pFrame)
58 : Qt5Graphics(pFrame, nullptr)
61 Qt5Graphics(QImage* pQImage)
62 : Qt5Graphics(nullptr, pQImage)
65 virtual ~Qt5Graphics() override;
67 void ChangeQImage(QImage* pImage);
69 virtual SalGraphicsImpl* GetImpl() const override;
70 virtual SystemGraphicsData GetGraphicsData() const override;
71 virtual bool supportsOperation(OutDevSupportType) const override;
73 #if ENABLE_CAIRO_CANVAS
74 virtual bool SupportsCairo() const override;
75 virtual cairo::SurfaceSharedPtr
76 CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
77 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y,
78 int width, int height) const override;
79 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice,
80 const BitmapSystemData& rData,
81 const Size& rSize) const override;
82 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface,
83 const basegfx::B2ISize& rSize) const override;
84 virtual SystemFontData GetSysFontData(int nFallbacklevel) const override;
85 #endif // ENABLE_CAIRO_CANVAS
87 // GDI
89 virtual bool setClipRegion(const vcl::Region&) override;
90 virtual void ResetClipRegion() override;
92 virtual void drawPixel(long nX, long nY) override;
93 virtual void drawPixel(long nX, long nY, Color nColor) override;
94 virtual void drawLine(long nX1, long nY1, long nX2, long nY2) override;
95 virtual void drawRect(long nX, long nY, long nWidth, long nHeight) override;
96 virtual void drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry) override;
97 virtual void drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry) override;
98 virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
99 PCONSTSALPOINT* pPtAry) override;
100 virtual bool drawPolyPolygon(const basegfx::B2DPolyPolygon&, double fTransparency) override;
101 virtual bool drawPolyLineBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
102 const PolyFlags* pFlgAry) override;
103 virtual bool drawPolygonBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
104 const PolyFlags* pFlgAry) override;
105 virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints,
106 const SalPoint* const* pPtAry,
107 const PolyFlags* const* pFlgAry) override;
108 virtual bool drawPolyLine(const basegfx::B2DPolygon&, double fTransparency,
109 const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin,
110 css::drawing::LineCap eLineCap, double fMiterMinimumAngle) override;
111 virtual bool drawGradient(const tools::PolyPolygon&, const Gradient&) override;
113 virtual void copyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
114 long nSrcHeight, bool bWindowInvalidate) override;
116 virtual void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
117 virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override;
118 virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
119 const SalBitmap& rTransparentBitmap) override;
120 virtual void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
121 Color nMaskColor) override;
123 virtual SalBitmap* getBitmap(long nX, long nY, long nWidth, long nHeight) override;
124 virtual Color getPixel(long nX, long nY) override;
126 virtual void invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) override;
127 virtual void invert(sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags) override;
129 virtual bool drawEPS(long nX, long nY, long nWidth, long nHeight, void* pPtr,
130 sal_uLong nSize) override;
132 virtual bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override;
134 virtual bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap,
135 const SalBitmap& rMaskBitmap,
136 const SalBitmap& rAlphaBitmap) override;
138 virtual bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap,
139 const SalBitmap& rAlphaBitmap) override;
141 bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX,
142 const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
143 const SalBitmap* pAlphaBitmap) override;
145 virtual bool drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
146 sal_uInt8 nTransparency) override;
148 virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
149 virtual sal_uInt16 GetBitCount() const override;
150 virtual long GetGraphicsWidth() const override;
152 virtual void SetLineColor() override;
153 virtual void SetLineColor(Color nColor) override;
154 virtual void SetFillColor() override;
155 virtual void SetFillColor(Color nColor) override;
156 virtual void SetXORMode(bool bSet) override;
157 virtual void SetROPLineColor(SalROPColor nROPColor) override;
158 virtual void SetROPFillColor(SalROPColor nROPColor) override;
160 // Text rendering + font support
162 virtual void SetTextColor(Color nColor) override;
163 virtual void SetFont(const FontSelectPattern*, int nFallbackLevel) override;
164 virtual void GetFontMetric(ImplFontMetricDataRef&, int nFallbackLevel) override;
165 virtual const FontCharMapRef GetFontCharMap() const override;
166 virtual bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const override;
167 virtual void GetDevFontList(PhysicalFontCollection*) override;
168 virtual void ClearDevFontCache() override;
169 virtual bool AddTempDevFont(PhysicalFontCollection*, const OUString& rFileURL,
170 const OUString& rFontName) override;
171 virtual bool CreateFontSubset(const OUString& rToFile, const PhysicalFontFace* pFont,
172 const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding,
173 sal_Int32* pWidths, int nGlyphs,
174 FontSubsetInfo& rInfo // out parameter
175 ) override;
177 virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override;
178 virtual void FreeEmbedFontData(const void* pData, long nDataLen) override;
180 virtual void GetGlyphWidths(const PhysicalFontFace*, bool bVertical,
181 std::vector<sal_Int32>& rWidths, Ucs2UIntMap& rUnicodeEnc) override;
183 virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override;
184 virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override;
186 virtual std::unique_ptr<SalLayout> GetTextLayout(ImplLayoutArgs&, int nFallbackLevel) override;
187 virtual void DrawTextLayout(const GenericSalLayout&) override;
189 // Native control support
191 virtual bool IsNativeControlSupported(ControlType nType, ControlPart nPart) override;
192 virtual bool hitTestNativeControl(ControlType nType, ControlPart nPart,
193 const tools::Rectangle& rControlRegion, const Point& aPos,
194 bool& rIsInside) override;
195 virtual bool drawNativeControl(ControlType nType, ControlPart nPart,
196 const tools::Rectangle& rControlRegion, ControlState nState,
197 const ImplControlValue& aValue,
198 const OUString& aCaption) override;
199 virtual bool getNativeControlRegion(ControlType nType, ControlPart nPart,
200 const tools::Rectangle& rControlRegion, ControlState nState,
201 const ImplControlValue& aValue, const OUString& aCaption,
202 tools::Rectangle& rNativeBoundingRegion,
203 tools::Rectangle& rNativeContentRegion) override;
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */