bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / qt5 / Qt5Graphics.hxx
bloba7c7aaa727ac17c7a02752585c5f6153e2294d7e
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 #include "Qt5Data.hxx"
32 class PhysicalFontCollection;
33 class QImage;
34 class QPushButton;
35 class Qt5Font;
36 class Qt5FontFace;
37 class Qt5Frame;
38 class Qt5Painter;
40 class Qt5Graphics : public SalGraphics
42 friend class Qt5Bitmap;
43 friend class Qt5Painter;
45 Qt5Frame* m_pFrame;
46 QImage* m_pQImage;
47 QRegion m_aClipRegion;
48 QPainterPath m_aClipPath;
49 Color m_aLineColor;
50 Color m_aFillColor;
51 QPainter::CompositionMode m_eCompositionMode;
53 PhysicalFontCollection* m_pFontCollection;
54 rtl::Reference<Qt5Font> m_pTextStyle[MAX_FALLBACK];
55 Color m_aTextColor;
56 std::unique_ptr<QPushButton> m_focusedButton;
57 std::unique_ptr<QImage> m_image;
58 QRect m_lastPopupRect;
60 Qt5Graphics(Qt5Frame* pFrame, QImage* pQImage);
62 void drawScaledImage(const SalTwoRect& rPosAry, const QImage& rImage);
64 protected:
65 void handleDamage(const tools::Rectangle&) override;
67 public:
68 Qt5Graphics(Qt5Frame* pFrame)
69 : Qt5Graphics(pFrame, nullptr)
72 Qt5Graphics(QImage* pQImage)
73 : Qt5Graphics(nullptr, pQImage)
76 virtual ~Qt5Graphics() override;
78 void ChangeQImage(QImage* pImage);
80 virtual SalGraphicsImpl* GetImpl() const override;
81 virtual SystemGraphicsData GetGraphicsData() const override;
82 virtual bool supportsOperation(OutDevSupportType) const override;
84 #if ENABLE_CAIRO_CANVAS
85 virtual bool SupportsCairo() const override;
86 virtual cairo::SurfaceSharedPtr
87 CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
88 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y,
89 int width, int height) const override;
90 virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice,
91 const BitmapSystemData& rData,
92 const Size& rSize) const override;
93 virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface,
94 const basegfx::B2ISize& rSize) const override;
95 virtual SystemFontData GetSysFontData(int nFallbacklevel) const override;
96 #endif // ENABLE_CAIRO_CANVAS
98 // GDI
100 virtual bool setClipRegion(const vcl::Region&) override;
101 virtual void ResetClipRegion() override;
103 virtual void drawPixel(long nX, long nY) override;
104 virtual void drawPixel(long nX, long nY, Color nColor) override;
105 virtual void drawLine(long nX1, long nY1, long nX2, long nY2) override;
106 virtual void drawRect(long nX, long nY, long nWidth, long nHeight) override;
107 virtual void drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry) override;
108 virtual void drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry) override;
109 virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
110 PCONSTSALPOINT* pPtAry) override;
111 virtual bool drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
112 const basegfx::B2DPolyPolygon&, double fTransparency) override;
113 virtual bool drawPolyLineBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
114 const PolyFlags* pFlgAry) override;
115 virtual bool drawPolygonBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
116 const PolyFlags* pFlgAry) override;
117 virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints,
118 const SalPoint* const* pPtAry,
119 const PolyFlags* const* pFlgAry) override;
120 virtual bool drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice,
121 const basegfx::B2DPolygon&, double fTransparency,
122 const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin,
123 css::drawing::LineCap eLineCap, double fMiterMinimumAngle,
124 bool bPixelSnapHairline) override;
125 virtual bool drawGradient(const tools::PolyPolygon&, const Gradient&) override;
127 virtual void copyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
128 long nSrcHeight, bool bWindowInvalidate) override;
130 virtual void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
131 virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override;
132 virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
133 const SalBitmap& rTransparentBitmap) override;
134 virtual void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
135 Color nMaskColor) override;
137 virtual std::shared_ptr<SalBitmap> getBitmap(long nX, long nY, long nWidth,
138 long nHeight) override;
139 virtual Color getPixel(long nX, long nY) override;
141 virtual void invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) override;
142 virtual void invert(sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags) override;
144 virtual bool drawEPS(long nX, long nY, long nWidth, long nHeight, void* pPtr,
145 sal_uInt32 nSize) override;
147 virtual bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override;
149 virtual bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap,
150 const SalBitmap& rMaskBitmap,
151 const SalBitmap& rAlphaBitmap) override;
153 virtual bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap,
154 const SalBitmap& rAlphaBitmap) override;
156 bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX,
157 const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
158 const SalBitmap* pAlphaBitmap) override;
160 virtual bool drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
161 sal_uInt8 nTransparency) override;
163 virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
164 virtual sal_uInt16 GetBitCount() const override;
165 virtual long GetGraphicsWidth() const override;
167 virtual void SetLineColor() override;
168 virtual void SetLineColor(Color nColor) override;
169 virtual void SetFillColor() override;
170 virtual void SetFillColor(Color nColor) override;
171 virtual void SetXORMode(bool bSet, bool bInvertOnly) override;
172 virtual void SetROPLineColor(SalROPColor nROPColor) override;
173 virtual void SetROPFillColor(SalROPColor nROPColor) override;
175 // Text rendering + font support
177 virtual void SetTextColor(Color nColor) override;
178 virtual void SetFont(LogicalFontInstance*, int nFallbackLevel) override;
179 virtual void GetFontMetric(ImplFontMetricDataRef&, int nFallbackLevel) override;
180 virtual FontCharMapRef GetFontCharMap() const override;
181 virtual bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const override;
182 virtual void GetDevFontList(PhysicalFontCollection*) override;
183 virtual void ClearDevFontCache() override;
184 virtual bool AddTempDevFont(PhysicalFontCollection*, const OUString& rFileURL,
185 const OUString& rFontName) override;
186 virtual bool CreateFontSubset(const OUString& rToFile, const PhysicalFontFace* pFont,
187 const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding,
188 sal_Int32* pWidths, int nGlyphs,
189 FontSubsetInfo& rInfo // out parameter
190 ) override;
192 virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override;
193 virtual void FreeEmbedFontData(const void* pData, long nDataLen) override;
195 virtual void GetGlyphWidths(const PhysicalFontFace*, bool bVertical,
196 std::vector<sal_Int32>& rWidths, Ucs2UIntMap& rUnicodeEnc) override;
198 virtual std::unique_ptr<GenericSalLayout> GetTextLayout(int nFallbackLevel) override;
199 virtual void DrawTextLayout(const GenericSalLayout&) override;
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */