[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 2 commits - vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_kde5.mk vcl/osx vcl/qt5 vcl/source vcl/unx vcl/win
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 28 15:18:53 UTC 2019
vcl/Library_vcl.mk | 1
vcl/Library_vclplug_kde5.mk | 1
vcl/headless/svpframe.cxx | 2
vcl/headless/svpgdi.cxx | 63 -------------
vcl/inc/WidgetDrawInterface.hxx | 57 ++++++++----
vcl/inc/headless/svpgdi.hxx | 21 ----
vcl/inc/qt5/Qt5Graphics.hxx | 49 ----------
vcl/inc/qt5/Qt5Graphics_Controls.hxx | 32 +++---
vcl/inc/qt5/Qt5SvpGraphics.hxx | 11 +-
vcl/inc/quartz/salgdi.h | 10 +-
vcl/inc/salgdi.hxx | 139 +++++++-----------------------
vcl/inc/unx/gtk/gtkgdi.hxx | 17 ++-
vcl/inc/win/salgdi.h | 5 -
vcl/osx/salnativewidgets.cxx | 2
vcl/qt5/Qt5Frame.cxx | 2
vcl/qt5/Qt5Graphics.cxx | 25 ++---
vcl/qt5/Qt5Graphics_Controls.cxx | 4
vcl/qt5/Qt5Instance.cxx | 5 -
vcl/qt5/Qt5SvpGraphics.cxx | 66 +++++++++++++-
vcl/qt5/Qt5SvpVirtualDevice.hxx | 8 -
vcl/source/gdi/salgdilayout.cxx | 56 +++---------
vcl/source/gdi/salnativewidgets-none.cxx | 53 -----------
vcl/source/outdev/nativecontrols.cxx | 2
vcl/unx/gtk/gtksalframe.cxx | 2
vcl/unx/gtk/salnativewidgets-gtk.cxx | 8 +
vcl/unx/gtk3/gtk3gtkframe.cxx | 2
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 49 +++-------
vcl/unx/kde5/KDE5SalFrame.cxx | 3
vcl/unx/kde5/KDE5SalFrame.hxx | 6 -
vcl/unx/kde5/KDE5SalGraphics.cxx | 85 ------------------
vcl/unx/kde5/KDE5SalGraphics.hxx | 84 ------------------
vcl/unx/kde5/KDE5SalInstance.cxx | 17 ---
vcl/unx/kde5/KDE5SalInstance.hxx | 4
vcl/win/gdi/salnativewidgets-luna.cxx | 2
34 files changed, 247 insertions(+), 646 deletions(-)
New commits:
commit 201fbc259cdbd49f0135dae41533693359f821d2
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Sun Jun 16 14:19:09 2019 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jun 28 17:18:27 2019 +0200
tdf#125919 VCL cleanup WidgetDrawInterface
I don't understand why WidgetDrawInterface, which is basically a
copy of the SalGraphics native controls interface, duplicated it,
instead of cleaning things up.
The whole commit message of commit 8fcfa3853a81, which added this
code, is just: "custom widgets: Custom Widget Themes". That's it.
So this patch does, what the original one skipped: replacing the
SalGraphics interface with the WidgetDrawInterface. One result is
the addition of handleDamage to SalGraphics to correctly handle
the damage done by a custom widget theme to the underlying
SalGraphics implementation.
Reviewed-on: https://gerrit.libreoffice.org/74118
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit 4a478227f5af8322164ecce66fd056e9bf2eac89)
Change-Id: I5fda1a64b28e6560fb3c62e02b6dcda827f698e2
Reviewed-on: https://gerrit.libreoffice.org/74772
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index deb7cf049106..c8391717c492 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -300,7 +300,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/gdi/salgdiimpl \
vcl/source/gdi/sallayout \
vcl/source/gdi/salmisc \
- vcl/source/gdi/salnativewidgets-none \
vcl/source/gdi/vectorgraphicdata \
vcl/source/gdi/textlayout \
vcl/source/gdi/virdev \
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index f54103ff1ecc..4259a84d5a0b 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -441,7 +441,7 @@ void SvpSalFrame::UpdateSettings( AllSettings& rSettings )
}
rSettings.SetStyleSettings(aStyleSettings);
#ifndef IOS // For now...
- pGraphics->updateSettings(rSettings);
+ pGraphics->UpdateSettings(rSettings);
#endif
if (bFreeGraphics)
ReleaseGraphics(pGraphics);
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 0f6fda87fd5b..b335d2ed630b 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1866,69 +1866,6 @@ bool SvpSalGraphics::drawEPS( long, long, long, long, void*, sal_uInt32 )
return false;
}
-/* Widget drawing */
-
-bool SvpSalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart)
-{
- if (hasWidgetDraw())
- return m_pWidgetDraw->isNativeControlSupported(eType, ePart);
-
- return false;
-}
-
-bool SvpSalGraphics::hitTestNativeControl(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- const Point& rPosition, bool& rIsInside)
-{
- if (hasWidgetDraw())
- {
- return m_pWidgetDraw->hitTestNativeControl(eType, ePart, rBoundingControlRegion, rPosition, rIsInside);
- }
-
- return false;
-}
-
-bool SvpSalGraphics::drawNativeControl(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rControlRegion,
- ControlState eState, const ImplControlValue& aValue,
- const OUString& aCaptions)
-{
- if (hasWidgetDraw())
- {
- bool bReturn = m_pWidgetDraw->drawNativeControl(eType, ePart, rControlRegion,
- eState, aValue, aCaptions);
- return bReturn;
- }
-
- return false;
-}
-
-bool SvpSalGraphics::getNativeControlRegion(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState,
- const ImplControlValue& aValue,
- const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion)
-{
- if (hasWidgetDraw())
- {
- return m_pWidgetDraw->getNativeControlRegion(eType, ePart, rBoundingControlRegion,
- eState, aValue, aCaption,
- rNativeBoundingRegion, rNativeContentRegion);
- }
-
- return false;
-}
-
-void SvpSalGraphics::updateSettings(AllSettings& rSettings)
-{
- if (hasWidgetDraw())
- {
- m_pWidgetDraw->updateSettings(rSettings);
- }
-}
-
namespace
{
bool isCairoCompatible(const BitmapBuffer* pBuffer)
diff --git a/vcl/inc/WidgetDrawInterface.hxx b/vcl/inc/WidgetDrawInterface.hxx
index 4d1ecce7a3fe..e8c4483339d0 100644
--- a/vcl/inc/WidgetDrawInterface.hxx
+++ b/vcl/inc/WidgetDrawInterface.hxx
@@ -29,7 +29,7 @@ public:
* @param [in] ePart The part of the widget.
* @return true if the platform supports native drawing of the widget type defined by part.
*/
- virtual bool isNativeControlSupported(ControlType eType, ControlPart ePart) = 0;
+ virtual inline bool isNativeControlSupported(ControlType eType, ControlPart ePart);
/**
* Query if a position is inside the native widget part.
@@ -44,10 +44,9 @@ public:
* @param [out] rIsInside true, if \a aPos was inside the native widget.
* @return true, if the query was successful.
*/
- virtual bool hitTestNativeControl(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- const Point& aPos, bool& rIsInside)
- = 0;
+ virtual inline bool hitTestNativeControl(ControlType eType, ControlPart ePart,
+ const tools::Rectangle& rBoundingControlRegion,
+ const Point& aPos, bool& rIsInside);
/**
* Draw the requested control.
@@ -61,11 +60,10 @@ public:
* @param [in] aCaption A caption or title string (like button text etc.).
* @return true, if the control could be drawn.
*/
- virtual bool drawNativeControl(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState, const ImplControlValue& aValue,
- const OUString& aCaptions)
- = 0;
+ virtual inline bool drawNativeControl(ControlType eType, ControlPart ePart,
+ const tools::Rectangle& rBoundingControlRegion,
+ ControlState eState, const ImplControlValue& aValue,
+ const OUString& aCaptions);
/**
* Get the native control regions for the control part.
@@ -86,16 +84,39 @@ public:
* @param [out] rNativeContentRegion The region within the control that can be safely drawn into.
* @return true, if the regions are filled.
*/
- virtual bool getNativeControlRegion(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState, const ImplControlValue& aValue,
- const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion)
- = 0;
+ virtual inline bool getNativeControlRegion(ControlType eType, ControlPart ePart,
+ const tools::Rectangle& rBoundingControlRegion,
+ ControlState eState, const ImplControlValue& aValue,
+ const OUString& aCaption,
+ tools::Rectangle& rNativeBoundingRegion,
+ tools::Rectangle& rNativeContentRegion);
- virtual bool updateSettings(AllSettings& rSettings) = 0;
+ virtual inline bool updateSettings(AllSettings& rSettings);
};
+
+bool WidgetDrawInterface::isNativeControlSupported(ControlType, ControlPart) { return false; }
+
+bool WidgetDrawInterface::hitTestNativeControl(ControlType, ControlPart, const tools::Rectangle&,
+ const Point&, bool&)
+{
+ return false;
+}
+
+bool WidgetDrawInterface::drawNativeControl(ControlType, ControlPart, const tools::Rectangle&,
+ ControlState, const ImplControlValue&, const OUString&)
+{
+ return false;
+}
+
+bool WidgetDrawInterface::getNativeControlRegion(ControlType, ControlPart, const tools::Rectangle&,
+ ControlState, const ImplControlValue&,
+ const OUString&, tools::Rectangle&,
+ tools::Rectangle&)
+{
+ return false;
+}
+
+bool WidgetDrawInterface::updateSettings(AllSettings&) { return false; }
}
#endif
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 73d80da6deb8..a2b9351c5263 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -262,27 +262,6 @@ public:
virtual SystemGraphicsData GetGraphicsData() const override;
- // Native Widget Drawing interface
- bool IsNativeControlSupported(ControlType eType, ControlPart ePart) override;
-
- bool hitTestNativeControl(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- const Point& rPosition, bool& rIsInside) override;
-
- bool drawNativeControl(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState, const ImplControlValue& aValue,
- const OUString& aCaptions) override;
-
- bool getNativeControlRegion(ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState,
- const ImplControlValue& aValue,
- const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion) override;
-
- virtual void updateSettings(AllSettings& rSettings);
#if ENABLE_CAIRO_CANVAS
virtual bool SupportsCairo() const override;
diff --git a/vcl/inc/qt5/Qt5Graphics.hxx b/vcl/inc/qt5/Qt5Graphics.hxx
index fe7e3b3012f0..cd4aa8add45e 100644
--- a/vcl/inc/qt5/Qt5Graphics.hxx
+++ b/vcl/inc/qt5/Qt5Graphics.hxx
@@ -28,7 +28,6 @@
#include <QtGui/QRegion>
#include "Qt5Data.hxx"
-#include "Qt5Graphics_Controls.hxx"
class PhysicalFontCollection;
class QImage;
@@ -43,8 +42,6 @@ class Qt5Graphics : public SalGraphics
friend class Qt5Bitmap;
friend class Qt5Painter;
- Qt5Graphics_Controls m_aControl;
-
Qt5Frame* m_pFrame;
QImage* m_pQImage;
QRegion m_aClipRegion;
@@ -64,6 +61,9 @@ class Qt5Graphics : public SalGraphics
void drawScaledImage(const SalTwoRect& rPosAry, const QImage& rImage);
+protected:
+ void handleDamage(const tools::Rectangle&) override;
+
public:
Qt5Graphics(Qt5Frame* pFrame)
: Qt5Graphics(pFrame, nullptr)
@@ -197,49 +197,6 @@ public:
virtual std::unique_ptr<GenericSalLayout> GetTextLayout(int nFallbackLevel) override;
virtual void DrawTextLayout(const GenericSalLayout&) override;
-
- // Native control support
-
- virtual bool IsNativeControlSupported(ControlType nType, ControlPart nPart) override;
- virtual bool hitTestNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion, const Point& aPos,
- bool& rIsInside) override;
- virtual bool drawNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion, ControlState nState,
- const ImplControlValue& aValue,
- const OUString& aCaption) override;
- virtual bool getNativeControlRegion(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion) override;
};
-inline bool Qt5Graphics::IsNativeControlSupported(ControlType nType, ControlPart nPart)
-{
- if (Qt5Data::noNativeControls())
- return false;
- return Qt5Graphics_Controls::IsNativeControlSupported(nType, nPart);
-}
-
-inline bool Qt5Graphics::hitTestNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion,
- const Point& aPos, bool& rIsInside)
-{
- return Qt5Graphics_Controls::hitTestNativeControl(nType, nPart, rControlRegion, aPos,
- rIsInside);
-}
-
-inline bool Qt5Graphics::getNativeControlRegion(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion,
- ControlState nState, const ImplControlValue& aValue,
- const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion)
-{
- return Qt5Graphics_Controls::getNativeControlRegion(nType, nPart, rControlRegion, nState,
- aValue, aCaption, rNativeBoundingRegion,
- rNativeContentRegion);
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5Graphics_Controls.hxx b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
index f8b5c5a6759c..50d1de3b1cec 100644
--- a/vcl/inc/qt5/Qt5Graphics_Controls.hxx
+++ b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
@@ -20,7 +20,7 @@
#pragma once
#include <vclpluginapi.h>
-#include <salgdi.hxx>
+#include <WidgetDrawInterface.hxx>
#include <memory>
@@ -29,8 +29,7 @@
#include <QtGui/QRegion>
#include <QtWidgets/QPushButton>
-// Native control support
-class VCLPLUG_QT5_PUBLIC Qt5Graphics_Controls
+class VCLPLUG_QT5_PUBLIC Qt5Graphics_Controls final : public vcl::WidgetDrawInterface
{
std::unique_ptr<QPushButton> m_focusedButton;
std::unique_ptr<QImage> m_image;
@@ -41,20 +40,20 @@ class VCLPLUG_QT5_PUBLIC Qt5Graphics_Controls
public:
Qt5Graphics_Controls();
- QImage& getImage() { return *m_image; }
+ QImage* getImage() { return m_image.get(); }
- static bool IsNativeControlSupported(ControlType nType, ControlPart nPart);
- static bool hitTestNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion, const Point& aPos,
- bool& rIsInside);
+ bool isNativeControlSupported(ControlType nType, ControlPart nPart) override;
+ bool hitTestNativeControl(ControlType nType, ControlPart nPart,
+ const tools::Rectangle& rControlRegion, const Point& aPos,
+ bool& rIsInside) override;
bool drawNativeControl(ControlType nType, ControlPart nPart,
const tools::Rectangle& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, const OUString& aCaption);
- static bool getNativeControlRegion(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion);
+ const ImplControlValue& aValue, const OUString& aCaption) override;
+ bool getNativeControlRegion(ControlType nType, ControlPart nPart,
+ const tools::Rectangle& rControlRegion, ControlState nState,
+ const ImplControlValue& aValue, const OUString& aCaption,
+ tools::Rectangle& rNativeBoundingRegion,
+ tools::Rectangle& rNativeContentRegion) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5SvpGraphics.hxx b/vcl/inc/qt5/Qt5SvpGraphics.hxx
index 9dd8a53aeb54..0c2485f2a7ed 100644
--- a/vcl/inc/qt5/Qt5SvpGraphics.hxx
+++ b/vcl/inc/qt5/Qt5SvpGraphics.hxx
@@ -22,15 +22,15 @@
#include <vclpluginapi.h>
#include <headless/svpgdi.hxx>
-#include "Qt5Graphics_Controls.hxx"
-
class Qt5Frame;
class VCLPLUG_QT5_PUBLIC Qt5SvpGraphics : public SvpSalGraphics
{
- Qt5Graphics_Controls m_aControl;
Qt5Frame* const m_pFrame;
+protected:
+ void handleDamage(const tools::Rectangle&) override;
+
public:
Qt5SvpGraphics(Qt5Frame* pFrame);
~Qt5SvpGraphics() override;
@@ -45,42 +45,7 @@ public:
int height) const override;
#endif // ENABLE_CAIRO_CANVAS
- virtual bool IsNativeControlSupported(ControlType, ControlPart) override;
-
- virtual bool hitTestNativeControl(ControlType, ControlPart, const tools::Rectangle&,
- const Point&, bool&) override;
-
- virtual bool drawNativeControl(ControlType, ControlPart, const tools::Rectangle&, ControlState,
- const ImplControlValue&, const OUString&) override;
-
- virtual bool getNativeControlRegion(ControlType, ControlPart, const tools::Rectangle&,
- ControlState, const ImplControlValue&, const OUString&,
- tools::Rectangle&, tools::Rectangle&) override;
-
virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
};
-inline bool Qt5SvpGraphics::IsNativeControlSupported(ControlType nType, ControlPart nPart)
-{
- return Qt5Graphics_Controls::IsNativeControlSupported(nType, nPart);
-}
-
-inline bool Qt5SvpGraphics::hitTestNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion,
- const Point& aPos, bool& rIsInside)
-{
- return Qt5Graphics_Controls::hitTestNativeControl(nType, nPart, rControlRegion, aPos,
- rIsInside);
-}
-
-inline bool Qt5SvpGraphics::getNativeControlRegion(
- ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
-{
- return Qt5Graphics_Controls::getNativeControlRegion(nType, nPart, rControlRegion, nState,
- aValue, aCaption, rNativeBoundingRegion,
- rNativeContentRegion);
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index e3c2b8e7b553..25177416376a 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -295,6 +295,9 @@ public:
// native widget rendering methods that require mirroring
#ifdef MACOSX
+protected:
+ virtual bool isNativeControlSupported( ControlType nType, ControlPart nPart ) override;
+
virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
const Point& aPos, bool& rIsInside ) override;
virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
@@ -303,6 +306,8 @@ public:
virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState,
const ImplControlValue& aValue, const OUString& aCaption,
tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override;
+
+public:
#endif
// get device resolution
@@ -383,11 +388,6 @@ public:
virtual void DrawTextLayout( const GenericSalLayout& ) override;
virtual bool supportsOperation( OutDevSupportType ) const override;
-#ifdef MACOSX
- // Query the platform layer for control support
- virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) override;
-#endif
-
virtual SystemGraphicsData
GetGraphicsData() const override;
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index d7b45f5fcf97..004c2cc90cee 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -71,11 +71,11 @@ typedef std::map< sal_Ucs, sal_uInt32 > Ucs2UIntMap;
// note: all positions are in pixel and relative to
// the top/left-position of the virtual output area
-class VCL_PLUGIN_PUBLIC SalGraphics
+class VCL_PLUGIN_PUBLIC SalGraphics : protected vcl::WidgetDrawInterface
{
public:
- SalGraphics();
- virtual ~SalGraphics();
+ SalGraphics();
+ ~SalGraphics() override;
virtual SalGraphicsImpl* GetImpl() const = 0;
@@ -342,19 +342,12 @@ public:
// native widget rendering functions
/**
- * Query the platform layer for native control support.
- *
- * @param [in] eType The widget type.
- * @param [in] ePart The part of the widget.
- * @return true if the platform supports native drawing of the widget type defined by part.
+ * @see WidgetDrawInterface::isNativeControlSupported
*/
- bool IsSupported(ControlType eType, ControlPart ePart);
-
+ inline bool IsNativeControlSupported(ControlType, ControlPart);
/**
- * Query the native control to determine if it was acted upon
- *
- * @see hitTestNativeControl
+ * @see WidgetDrawInterface::hitTestNativeControl
*/
bool HitTestNativeScrollbar(
ControlPart nPart,
@@ -364,9 +357,7 @@ public:
const OutputDevice *pOutDev );
/**
- * Request rendering of a particular control and/or part
- *
- * @see drawNativeControl
+ * @see WidgetDrawInterface::drawNativeControl
*/
bool DrawNativeControl(
ControlType nType,
@@ -378,9 +369,7 @@ public:
const OutputDevice *pOutDev );
/**
- * Query the native control's actual drawing region (including adornment)
- *
- * @see getNativeControlRegion
+ * @see WidgetDrawInterface::getNativeControlRegion
*/
bool GetNativeControlRegion(
ControlType nType,
@@ -392,6 +381,11 @@ public:
tools::Rectangle &rNativeContentRegion,
const OutputDevice *pOutDev );
+ /**
+ * @see WidgetDrawInterface::updateSettings
+ */
+ inline bool UpdateSettings(AllSettings&);
+
bool BlendBitmap(
const SalTwoRect& rPosAry,
const SalBitmap& rSalBitmap,
@@ -442,11 +436,6 @@ public:
#endif // ENABLE_CAIRO_CANVAS
-private:
- bool callGetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion);
- bool callDrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption);
- bool callHitTestNativeControl(ControlType eType, ControlPart nPart, const tools::Rectangle& rControlRegion, const Point& aPos, bool& rIsInside);
-
protected:
virtual bool setClipRegion( const vcl::Region& ) = 0;
@@ -540,81 +529,6 @@ protected:
void* pPtr,
sal_uInt32 nSize ) = 0;
- /**
- * Query the platform layer for native control support.
- *
- * @param [in] eType The widget type.
- * @param [in] ePart The part of the widget.
- * @return true if the platform supports native drawing of the widget type defined by part.
- */
- virtual bool IsNativeControlSupported(ControlType eType, ControlPart ePart);
-
- /**
- * Query if a position is inside the native widget part.
- *
- * Mainly used for scrollbars.
- *
- * @param [in] eType The widget type.
- * @param [in] ePart The part of the widget.
- * @param [in] rBoundingControlRegion The bounding Rectangle of
- the complete control in VCL frame coordinates.
- * @param [in] aPos The position to check the hit.
- * @param [out] rIsInside true, if \a aPos was inside the native widget.
- * @return true, if the query was successful.
- */
- virtual bool hitTestNativeControl(
- ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- const Point& aPos, bool& rIsInside );
-
- /**
- * Draw the requested control.
- *
- * @param [in] eType The widget type.
- * @param [in] ePart The part of the widget.
- * @param [in] rBoundingControlRegion The bounding rectangle of
- * the complete control in VCL frame coordinates.
- * @param [in] eState The general state of the control (enabled, focused, etc.).
- * @param [in] aValue Addition control specific information.
- * @param [in] aCaption A caption or title string (like button text etc.).
- * @return true, if the control could be drawn.
- */
- virtual bool drawNativeControl(
- ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState,
- const ImplControlValue& aValue,
- const OUString& aCaption );
-
- /**
- * Get the native control regions for the control part.
- *
- * If the return value is true, \a rNativeBoundingRegion contains
- * the true bounding region covered by the control including any
- * adornment, while \a rNativeContentRegion contains the area
- * within the control that can be safely drawn into without drawing over
- * the borders of the control.
- *
- * @param [in] eType Type of the widget.
- * @param [in] ePart Specification of the widget's part if it consists of more than one.
- * @param [in] rBoundingControlRegion The bounding region of the control in VCL frame coordinates.
- * @param [in] eState The general state of the control (enabled, focused, etc.).
- * @param [in] aValue Addition control specific information.
- * @param [in] aCaption A caption or title string (like button text etc.).
- * @param [out] rNativeBoundingRegion The region covered by the control including any adornment.
- * @param [out] rNativeContentRegion The region within the control that can be safely drawn into.
- * @return true, if the regions are filled.
- */
- virtual bool getNativeControlRegion(
- ControlType eType, ControlPart ePart,
- const tools::Rectangle& rBoundingControlRegion,
- ControlState eState,
- const ImplControlValue& aValue,
- const OUString& aCaption,
- tools::Rectangle &rNativeBoundingRegion,
- tools::Rectangle &rNativeContentRegion );
-
-
/** Blend the bitmap with the current buffer */
virtual bool blendBitmap(
const SalTwoRect&,
@@ -680,16 +594,35 @@ protected:
inline long GetDeviceWidth(const OutputDevice* pOutDev) const;
+ /**
+ * Handle damage done by drawing with a widget draw override
+ *
+ * If a m_pWidgetDraw is set and successfully draws using drawNativeControl,
+ * this function is called to handle the damage done to the graphics buffer.
+ *
+ * @param rDamagedRegion the region damaged by drawNativeControl.
+ **/
+ virtual inline void handleDamage(const tools::Rectangle& rDamagedRegion);
+
// native controls
bool initWidgetDrawBackends(bool bForce = false);
- bool hasWidgetDraw()
- {
- return bool(m_pWidgetDraw);
- }
std::unique_ptr<vcl::WidgetDrawInterface> m_pWidgetDraw;
+ vcl::WidgetDrawInterface* forWidget() { return m_pWidgetDraw ? m_pWidgetDraw.get() : this; }
};
+bool SalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart)
+{
+ return forWidget()->isNativeControlSupported(eType, ePart);
+}
+
+bool SalGraphics::UpdateSettings(AllSettings& rSettings)
+{
+ return forWidget()->updateSettings(rSettings);
+}
+
+void SalGraphics::handleDamage(const tools::Rectangle&) {}
+
#endif // INCLUDED_VCL_INC_SALGDI_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 87f1d0e14c3a..c9b7be49f13e 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -101,13 +101,13 @@ typedef void (*gtk_widget_path_iter_set_object_nameFunc)(GtkWidgetPath *, guint,
class GtkSalGraphics : public SvpSalGraphics
{
GtkSalFrame * const mpFrame;
-public:
- GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow );
+
+protected:
+ bool isNativeControlSupported(ControlType, ControlPart) override;
virtual bool drawNativeControl( ControlType nType, ControlPart nPart,
const tools::Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
const OUString& rCaption ) override;
- virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) override;
virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart,
const tools::Rectangle& rControlRegion,
ControlState nState,
@@ -115,8 +115,11 @@ public:
const OUString& rCaption,
tools::Rectangle &rNativeBoundingRegion,
tools::Rectangle &rNativeContentRegion ) override;
+ bool updateSettings(AllSettings&) override;
+ void handleDamage(const tools::Rectangle&) override;
- virtual void updateSettings(AllSettings& rSettings) override;
+public:
+ GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow );
#if ENABLE_CAIRO_CANVAS
@@ -267,8 +270,9 @@ public:
static bool bNeedPixmapPaint;
static bool bNeedTwoPasses;
+protected:
// native widget methods
- virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) override;
+ bool isNativeControlSupported(ControlType, ControlPart) override;
virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
const Point& aPos, bool& rIsInside ) override;
virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
@@ -277,9 +281,10 @@ public:
virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState,
const ImplControlValue& aValue, const OUString& rCaption,
tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override;
+ bool updateSettings(AllSettings&) override;
+public:
//helper methods for frame's UpdateSettings
- void updateSettings( AllSettings& rSettings );
static void refreshFontconfig( GtkSettings *pSettings );
static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 22c4a8f2e8c5..7dc859a1a551 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -264,6 +264,8 @@ protected:
virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uInt32 nSize ) override;
// native widget rendering methods that require mirroring
+protected:
+ virtual bool isNativeControlSupported( ControlType nType, ControlPart nPart ) override;
virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
const Point& aPos, bool& rIsInside ) override;
virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
@@ -273,6 +275,7 @@ protected:
const ImplControlValue& aValue, const OUString& aCaption,
tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) override;
+public:
virtual bool blendBitmap( const SalTwoRect&,
const SalBitmap& rBitmap ) override;
@@ -378,8 +381,6 @@ public:
virtual void DrawTextLayout( const GenericSalLayout& ) override;
virtual bool supportsOperation( OutDevSupportType ) const override;
- // Query the platform layer for control support
- virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) override;
virtual SystemGraphicsData GetGraphicsData() const override;
diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx
index ad1362d438de..6e94cd3e4df3 100644
--- a/vcl/osx/salnativewidgets.cxx
+++ b/vcl/osx/salnativewidgets.cxx
@@ -116,7 +116,7 @@ static bool AquaGetScrollRect( /* TODO: int nScreen, */ ControlPart nPart,
return bRetVal;
}
-bool AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
+bool AquaSalGraphics::isNativeControlSupported( ControlType nType, ControlPart nPart )
{
// Native controls are now defaults
// If you want to disable experimental native controls code,
diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx
index fbf7ae05bf6b..5192f0b42416 100644
--- a/vcl/qt5/Qt5Graphics.cxx
+++ b/vcl/qt5/Qt5Graphics.cxx
@@ -21,6 +21,7 @@
#include <Qt5Font.hxx>
#include <Qt5Frame.hxx>
+#include <Qt5Graphics_Controls.hxx>
#include <Qt5Painter.hxx>
#include <QtGui/QImage>
@@ -39,6 +40,8 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage )
, m_aTextColor( 0x00, 0x00, 0x00 )
{
ResetClipRegion();
+ if (!Qt5Data::noNativeControls())
+ m_pWidgetDraw.reset(new Qt5Graphics_Controls());
}
Qt5Graphics::~Qt5Graphics()
@@ -110,20 +113,16 @@ SystemFontData Qt5Graphics::GetSysFontData(int /*nFallbacklevel*/) const
#endif
-bool Qt5Graphics::drawNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, const OUString& aCaption)
+void Qt5Graphics::handleDamage(const tools::Rectangle& rDamagedRegion)
{
- bool bHandled
- = m_aControl.drawNativeControl(nType, nPart, rControlRegion, nState, aValue, aCaption);
- if (bHandled)
- {
- Qt5Painter aPainter(*this);
- aPainter.drawImage(QPoint(rControlRegion.getX(), rControlRegion.getY()),
- m_aControl.getImage());
- aPainter.update(toQRect(rControlRegion));
- }
- return bHandled;
+ assert(m_pWidgetDraw);
+ assert(dynamic_cast<Qt5Graphics_Controls*>(m_pWidgetDraw.get()));
+ assert(!rDamagedRegion.IsEmpty());
+
+ QImage* pImage = static_cast<Qt5Graphics_Controls*>(m_pWidgetDraw.get())->getImage();
+ Qt5Painter aPainter(*this);
+ aPainter.drawImage(QPoint(rDamagedRegion.getX(), rDamagedRegion.getY()), *pImage);
+ aPainter.update(toQRect(rDamagedRegion));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index 32a376a388b7..32a2d132efc5 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -67,7 +67,7 @@ static QStyle::State vclStateValue2StateFlag(ControlState nControlState,
Qt5Graphics_Controls::Qt5Graphics_Controls() { initStyles(); }
-bool Qt5Graphics_Controls::IsNativeControlSupported(ControlType type, ControlPart part)
+bool Qt5Graphics_Controls::isNativeControlSupported(ControlType type, ControlPart part)
{
switch (type)
{
@@ -194,7 +194,7 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part,
ControlState nControlState,
const ImplControlValue& value, const OUString&)
{
- bool nativeSupport = IsNativeControlSupported(type, part);
+ bool nativeSupport = isNativeControlSupported(type, part);
if (!nativeSupport)
{
assert(!nativeSupport && "drawNativeControl called without native support!");
diff --git a/vcl/qt5/Qt5SvpGraphics.cxx b/vcl/qt5/Qt5SvpGraphics.cxx
index 1e6ae94be070..4edf55d55644 100644
--- a/vcl/qt5/Qt5SvpGraphics.cxx
+++ b/vcl/qt5/Qt5SvpGraphics.cxx
@@ -13,7 +13,9 @@
#include <config_cairo_canvas.h>
+#include <Qt5Data.hxx>
#include <Qt5Frame.hxx>
+#include <Qt5Graphics_Controls.hxx>
#include <Qt5SvpGraphics.hxx>
#include <Qt5SvpSurface.hxx>
#include <Qt5Tools.hxx>
@@ -26,6 +28,8 @@ Qt5SvpGraphics::Qt5SvpGraphics(Qt5Frame* pFrame)
: SvpSalGraphics()
, m_pFrame(pFrame)
{
+ if (!Qt5Data::noNativeControls())
+ m_pWidgetDraw.reset(new Qt5Graphics_Controls());
}
Qt5SvpGraphics::~Qt5SvpGraphics() {}
@@ -57,35 +61,32 @@ cairo::SurfaceSharedPtr Qt5SvpGraphics::CreateSurface(const OutputDevice& /*rRef
#endif
-static void QImage2BitmapBuffer(QImage* pImg, BitmapBuffer* pBuf)
+static void QImage2BitmapBuffer(QImage& rImg, BitmapBuffer& rBuf)
{
- if (pImg->width() != 0 && pImg->height() != 0)
- {
- pBuf->mnWidth = pImg->width();
- pBuf->mnHeight = pImg->height();
- pBuf->mnBitCount = getFormatBits(pImg->format());
- pBuf->mpBits = pImg->bits();
- pBuf->mnScanlineSize = pImg->bytesPerLine();
- }
+ assert(rImg.width());
+ assert(rImg.height());
+
+ rBuf.mnWidth = rImg.width();
+ rBuf.mnHeight = rImg.height();
+ rBuf.mnBitCount = getFormatBits(rImg.format());
+ rBuf.mpBits = rImg.bits();
+ rBuf.mnScanlineSize = rImg.bytesPerLine();
}
-bool Qt5SvpGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, const OUString& aCaption)
+void Qt5SvpGraphics::handleDamage(const tools::Rectangle& rDamagedRegion)
{
- bool bHandled
- = m_aControl.drawNativeControl(nType, nPart, rControlRegion, nState, aValue, aCaption);
- if (bHandled)
- {
- QImage* pImage = &m_aControl.getImage();
- BitmapBuffer* pBuffer = new BitmapBuffer;
- QImage2BitmapBuffer(pImage, pBuffer);
- SalTwoRect aTR(0, 0, pImage->width(), pImage->height(), rControlRegion.getX(),
- rControlRegion.getY(), rControlRegion.GetWidth(),
- rControlRegion.GetHeight());
- drawBitmap(aTR, pBuffer, CAIRO_OPERATOR_OVER);
- }
- return bHandled;
+ assert(m_pWidgetDraw);
+ assert(dynamic_cast<Qt5Graphics_Controls*>(m_pWidgetDraw.get()));
+ assert(!rDamagedRegion.IsEmpty());
+
+ QImage* pImage = static_cast<Qt5Graphics_Controls*>(m_pWidgetDraw.get())->getImage();
+ assert(pImage);
+ BitmapBuffer* pBuffer = new BitmapBuffer;
+
+ QImage2BitmapBuffer(*pImage, *pBuffer);
+ SalTwoRect aTR(0, 0, pImage->width(), pImage->height(), rDamagedRegion.getX(),
+ rDamagedRegion.getY(), rDamagedRegion.GetWidth(), rDamagedRegion.GetHeight());
+ drawBitmap(aTR, pBuffer, CAIRO_OPERATOR_OVER);
}
void Qt5SvpGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 0ab8bb6ccd75..789e323f33de 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -764,22 +764,6 @@ bool SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pP
return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize );
}
-bool SalGraphics::IsSupported(ControlType eType, ControlPart ePart)
-{
- if (m_pWidgetDraw)
- return m_pWidgetDraw->isNativeControlSupported(eType, ePart);
- else
- return IsNativeControlSupported(eType, ePart);
-}
-
-bool SalGraphics::callHitTestNativeControl(ControlType eType, ControlPart nPart, const tools::Rectangle& rControlRegion, const Point& aPos, bool& rIsInside)
-{
- if (m_pWidgetDraw)
- return m_pWidgetDraw->hitTestNativeControl(eType, nPart, rControlRegion, aPos, rIsInside);
- else
- return hitTestNativeControl(eType, nPart, rControlRegion, aPos, rIsInside);
-}
-
bool SalGraphics::HitTestNativeScrollbar( ControlPart nPart, const tools::Rectangle& rControlRegion,
const Point& aPos, bool& rIsInside, const OutputDevice *pOutDev )
{
@@ -789,10 +773,10 @@ bool SalGraphics::HitTestNativeScrollbar( ControlPart nPart, const tools::Rectan
tools::Rectangle rgn( rControlRegion );
pt.setX( mirror2( pt.X(), pOutDev ) );
mirror( rgn, pOutDev );
- return callHitTestNativeControl( ControlType::Scrollbar, nPart, rgn, pt, rIsInside );
+ return forWidget()->hitTestNativeControl( ControlType::Scrollbar, nPart, rgn, pt, rIsInside );
}
else
- return callHitTestNativeControl( ControlType::Scrollbar, nPart, rControlRegion, aPos, rIsInside );
+ return forWidget()->hitTestNativeControl( ControlType::Scrollbar, nPart, rControlRegion, aPos, rIsInside );
}
void SalGraphics::mirror( ImplControlValue& rVal, const OutputDevice* pOutDev ) const
@@ -831,38 +815,28 @@ void SalGraphics::mirror( ImplControlValue& rVal, const OutputDevice* pOutDev )
}
}
-bool SalGraphics::callDrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, const OUString& rCaption)
-{
- if (m_pWidgetDraw)
- return m_pWidgetDraw->drawNativeControl(nType, nPart, rControlRegion, nState, aValue, rCaption);
- else
- return drawNativeControl(nType, nPart, rControlRegion, nState, aValue, rCaption);
-}
-
bool SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& aValue,
const OUString& aCaption, const OutputDevice *pOutDev)
{
+ bool bRet = false;
+ tools::Rectangle aControlRegion(rControlRegion);
+ if (aControlRegion.IsEmpty())
+ return bRet;
+
if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) )
{
- tools::Rectangle rgn( rControlRegion );
- if (rgn != tools::Rectangle())
- mirror(rgn, pOutDev);
+ mirror(aControlRegion, pOutDev);
std::unique_ptr< ImplControlValue > mirrorValue( aValue.clone());
mirror( *mirrorValue, pOutDev );
- bool bRet = callDrawNativeControl(nType, nPart, rgn, nState, *mirrorValue, aCaption);
- return bRet;
+ bRet = forWidget()->drawNativeControl(nType, nPart, aControlRegion, nState, *mirrorValue, aCaption);
}
else
- return callDrawNativeControl(nType, nPart, rControlRegion, nState, aValue, aCaption);
-}
+ bRet = forWidget()->drawNativeControl(nType, nPart, aControlRegion, nState, aValue, aCaption);
-bool SalGraphics::callGetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState, const ImplControlValue& aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion)
-{
- if (m_pWidgetDraw)
- return m_pWidgetDraw->getNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, OUString(), rNativeBoundingRegion, rNativeContentRegion);
- else
- return getNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, OUString(), rNativeBoundingRegion, rNativeContentRegion);
+ if (bRet && m_pWidgetDraw)
+ handleDamage(aControlRegion);
+ return bRet;
}
bool SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState nState,
@@ -875,7 +849,7 @@ bool SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart,
mirror( rgn, pOutDev );
std::unique_ptr< ImplControlValue > mirrorValue( aValue.clone());
mirror( *mirrorValue, pOutDev );
- if (callGetNativeControlRegion(nType, nPart, rgn, nState, *mirrorValue, rNativeBoundingRegion, rNativeContentRegion))
+ if (forWidget()->getNativeControlRegion(nType, nPart, rgn, nState, *mirrorValue, OUString(), rNativeBoundingRegion, rNativeContentRegion))
{
mirror( rNativeBoundingRegion, pOutDev, true );
mirror( rNativeContentRegion, pOutDev, true );
@@ -884,7 +858,7 @@ bool SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart,
return false;
}
else
- return callGetNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, rNativeBoundingRegion, rNativeContentRegion);
+ return forWidget()->getNativeControlRegion(nType, nPart, rControlRegion, nState, aValue, OUString(), rNativeBoundingRegion, rNativeContentRegion);
}
bool SalGraphics::BlendBitmap( const SalTwoRect& rPosAry,
diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx
deleted file mode 100644
index a7086023cad6..000000000000
--- a/vcl/source/gdi/salnativewidgets-none.cxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <salgdi.hxx>
-
-bool SalGraphics::IsNativeControlSupported(ControlType /*eType*/, ControlPart /*ePart*/)
-{
- return false;
-}
-
-bool SalGraphics::hitTestNativeControl(ControlType /*eType*/, ControlPart /*ePart*/,
- const tools::Rectangle& /*rBoundingControlRegion*/,
- const Point& /*rPosition*/, bool& /*rIsInside*/)
-{
- return false;
-}
-
-bool SalGraphics::drawNativeControl(ControlType /*eType*/, ControlPart /*ePart*/,
- const tools::Rectangle& /*rBoundingControlRegion*/,
- ControlState /*eState*/, const ImplControlValue& /*aValue*/,
- const OUString& /*aCaptions*/)
-{
- return false;
-}
-
-bool SalGraphics::getNativeControlRegion(ControlType /*eType*/, ControlPart /*ePart*/,
- const tools::Rectangle& /*rBoundingControlRegion*/,
- ControlState /*eState*/,
- const ImplControlValue& /*aValue*/,
- const OUString& /*aCaption*/,
- tools::Rectangle& /*rNativeBoundingRegion*/,
- tools::Rectangle& /*rNativeContentRegion*/)
-{
- return false;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx
index 09bb8647e8e1..00218344ff7d 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -174,7 +174,7 @@ bool OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPar
if ( !mpGraphics && !AcquireGraphics() )
return false;
- return mpGraphics->IsSupported(nType, nPart);
+ return mpGraphics->IsNativeControlSupported(nType, nPart);
}
bool OutputDevice::HitTestNativeScrollbar(
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 75526e55a59b..acdf9b604833 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -2218,7 +2218,7 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings )
bFreeGraphics = true;
}
- pGraphics->updateSettings( rSettings );
+ pGraphics->UpdateSettings( rSettings );
if( bFreeGraphics )
ReleaseGraphics( pGraphics );
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index b965705eaa1c..948dd2bdb989 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -612,7 +612,7 @@ void GtkSalGraphics::copyBits( const SalTwoRect& rPosAry,
X11SalGraphics::copyBits( rPosAry, pSrcGraphics );
}
-bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
+bool GtkSalGraphics::isNativeControlSupported( ControlType nType, ControlPart nPart )
{
switch(nType)
{
@@ -806,7 +806,7 @@ bool GtkSalGraphics::hitTestNativeControl( ControlType nType,
return true;
}
- if( IsNativeControlSupported(nType, nPart) )
+ if( isNativeControlSupported(nType, nPart) )
{
rIsInside = rControlRegion.IsInside( aPos );
return true;
@@ -3739,7 +3739,7 @@ void GtkSalGraphics::refreshFontconfig( GtkSettings *pSettings )
}
}
-void GtkSalGraphics::updateSettings( AllSettings& rSettings )
+bool GtkSalGraphics::updateSettings( AllSettings& rSettings )
{
gtk_widget_ensure_style( m_pWindow );
GtkStyle* pStyle = gtk_widget_get_style( m_pWindow );
@@ -4057,6 +4057,8 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// finally update the collected settings
rSettings.SetStyleSettings( aStyleSet );
+
+ return true;
}
/************************************************************************
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 888a7fb9aeb4..994fb356eb53 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2241,7 +2241,7 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings )
bFreeGraphics = true;
}
- pGraphics->updateSettings( rSettings );
+ pGraphics->UpdateSettings( rSettings );
if( bFreeGraphics )
ReleaseGraphics( pGraphics );
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 0de96d2be4ca..2beebaf501b1 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -21,7 +21,6 @@
#include <vcl/decoview.hxx>
#include <vcl/settings.hxx>
#include <unx/fontmanager.hxx>
-#include <headless/CustomWidgetDraw.hxx>
#include "cairo_gtk3_cairo.hxx"
#include <boost/optional.hpp>
@@ -2260,21 +2259,17 @@ namespace
}
}
+void GtkSalGraphics::handleDamage(const tools::Rectangle& rDamagedRegion)
+{
+ assert(m_pWidgetDraw);
+ assert(!rDamagedRegion.IsEmpty());
+ mpFrame->damaged(rDamagedRegion.Left(), rDamagedRegion.Top(), rDamagedRegion.GetWidth(), rDamagedRegion.GetHeight());
+}
+
bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
ControlState nState, const ImplControlValue& rValue,
- const OUString& aCaptions)
+ const OUString&)
{
- if (m_pWidgetDraw)
- {
- bool bReturn = SvpSalGraphics::drawNativeControl(nType, nPart, rControlRegion,
- nState, rValue, aCaptions);
-
- if (bReturn && !rControlRegion.IsEmpty())
- mpFrame->damaged(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
-
- return bReturn;
- }
-
RenderType renderType = nPart == ControlPart::Focus ? RenderType::Focus : RenderType::BackgroundAndFrame;
GtkStyleContext *context = nullptr;
const gchar *styleClass = nullptr;
@@ -2687,17 +2682,10 @@ static tools::Rectangle AdjustRectForTextBordersPadding(GtkStyleContext* pStyle,
return aEditRect;
}
-bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState eState,
- const ImplControlValue& rValue, const OUString& aCaption,
+bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion, ControlState,
+ const ImplControlValue& rValue, const OUString&,
tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion )
{
- if (hasWidgetDraw())
- {
- return m_pWidgetDraw->getNativeControlRegion(nType, nPart, rControlRegion,
- eState, rValue, aCaption,
- rNativeBoundingRegion, rNativeContentRegion);
- }
-
/* TODO: all this functions needs improvements */
tools::Rectangle aEditRect = rControlRegion;
gint indicator_size, indicator_spacing, point;
@@ -2945,14 +2933,8 @@ vcl::Font pango_to_vcl(const PangoFontDescription* font, const css::lang::Locale
return aFont;
}
-void GtkSalGraphics::updateSettings(AllSettings& rSettings)
+bool GtkSalGraphics::updateSettings(AllSettings& rSettings)
{
- if (m_pWidgetDraw)
- {
- m_pWidgetDraw->updateSettings(rSettings);
- return;
- }
-
GtkStyleContext* pStyle = gtk_widget_get_style_context( mpWindow );
StyleContextSave aContextState;
aContextState.save(pStyle);
@@ -3293,15 +3275,12 @@ void GtkSalGraphics::updateSettings(AllSettings& rSettings)
fprintf( stderr, "Theme name is \"%s\"\n", pThemeName );
g_free(pThemeName);
#endif
+
+ return true;
}
-bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
+bool GtkSalGraphics::isNativeControlSupported( ControlType nType, ControlPart nPart )
{
- if (m_pWidgetDraw)
- {
- return m_pWidgetDraw->isNativeControlSupported(nType, nPart);
- }
-
switch(nType)
{
case ControlType::Pushbutton:
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 422a86c27045..84a9bda35ec3 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -226,7 +226,7 @@ static HTHEME getThemeHandle( HWND hWnd, LPCWSTR name )
return hTheme;
}
-bool WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
+bool WinSalGraphics::isNativeControlSupported( ControlType nType, ControlPart nPart )
{
HTHEME hTheme = nullptr;
commit 652a47a422827cd09b387dd160979cf4cc262505
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jun 7 22:20:53 2019 +0200
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jun 28 17:18:15 2019 +0200
KDE5 merge KDE5SalGraphics into Qt5SvpGraphics
Nothing KDE specific left in there, so just merge it.
Reviewed-on: https://gerrit.libreoffice.org/73680
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
(cherry picked from commit 3e82710d1e368a4c1a942270efa3ee6f4c936f67)
Change-Id: I11712961f2abc5e11256a158300ec6b388f9ee44
Reviewed-on: https://gerrit.libreoffice.org/74771
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk
index e60ea79c1f5e..d097845bd5ce 100644
--- a/vcl/Library_vclplug_kde5.mk
+++ b/vcl/Library_vclplug_kde5.mk
@@ -81,7 +81,6 @@ $(eval $(call gb_Library_add_libs,vclplug_kde5,\
$(eval $(call gb_Library_add_exception_objects,vclplug_kde5,\
vcl/unx/kde5/KDE5FilePicker2 \
vcl/unx/kde5/KDE5SalFrame \
- vcl/unx/kde5/KDE5SalGraphics \
vcl/unx/kde5/KDE5SalInstance \
))
diff --git a/vcl/inc/qt5/Qt5Graphics_Controls.hxx b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
index c83d3ef458f1..f8b5c5a6759c 100644
--- a/vcl/inc/qt5/Qt5Graphics_Controls.hxx
+++ b/vcl/inc/qt5/Qt5Graphics_Controls.hxx
@@ -24,11 +24,10 @@
#include <memory>
+#include <QtGui/QImage>
#include <QtGui/QPainter>
#include <QtGui/QRegion>
-
-class QImage;
-class QPushButton;
+#include <QtWidgets/QPushButton>
// Native control support
class VCLPLUG_QT5_PUBLIC Qt5Graphics_Controls
diff --git a/vcl/inc/qt5/Qt5SvpGraphics.hxx b/vcl/inc/qt5/Qt5SvpGraphics.hxx
index e6a931b77f55..9dd8a53aeb54 100644
--- a/vcl/inc/qt5/Qt5SvpGraphics.hxx
+++ b/vcl/inc/qt5/Qt5SvpGraphics.hxx
@@ -22,14 +22,17 @@
#include <vclpluginapi.h>
#include <headless/svpgdi.hxx>
-class QWidget;
+#include "Qt5Graphics_Controls.hxx"
+
+class Qt5Frame;
class VCLPLUG_QT5_PUBLIC Qt5SvpGraphics : public SvpSalGraphics
{
- QWidget* m_pQWidget;
+ Qt5Graphics_Controls m_aControl;
+ Qt5Frame* const m_pFrame;
public:
- Qt5SvpGraphics(QWidget* pQWidget);
+ Qt5SvpGraphics(Qt5Frame* pFrame);
~Qt5SvpGraphics() override;
void updateQWidget() const;
@@ -41,6 +44,43 @@ public:
cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width,
int height) const override;
#endif // ENABLE_CAIRO_CANVAS
+
+ virtual bool IsNativeControlSupported(ControlType, ControlPart) override;
+
+ virtual bool hitTestNativeControl(ControlType, ControlPart, const tools::Rectangle&,
+ const Point&, bool&) override;
+
+ virtual bool drawNativeControl(ControlType, ControlPart, const tools::Rectangle&, ControlState,
+ const ImplControlValue&, const OUString&) override;
+
+ virtual bool getNativeControlRegion(ControlType, ControlPart, const tools::Rectangle&,
+ ControlState, const ImplControlValue&, const OUString&,
+ tools::Rectangle&, tools::Rectangle&) override;
+
+ virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
};
+inline bool Qt5SvpGraphics::IsNativeControlSupported(ControlType nType, ControlPart nPart)
+{
+ return Qt5Graphics_Controls::IsNativeControlSupported(nType, nPart);
+}
+
+inline bool Qt5SvpGraphics::hitTestNativeControl(ControlType nType, ControlPart nPart,
+ const tools::Rectangle& rControlRegion,
+ const Point& aPos, bool& rIsInside)
+{
+ return Qt5Graphics_Controls::hitTestNativeControl(nType, nPart, rControlRegion, aPos,
+ rIsInside);
+}
+
+inline bool Qt5SvpGraphics::getNativeControlRegion(
+ ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
+ ControlState nState, const ImplControlValue& aValue, const OUString& aCaption,
+ tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
+{
+ return Qt5Graphics_Controls::getNativeControlRegion(nType, nPart, rControlRegion, nState,
+ aValue, aCaption, rNativeBoundingRegion,
+ rNativeContentRegion);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index f17ae82c819e..a02600b5ec0d 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -245,7 +245,7 @@ SalGraphics* Qt5Frame::AcquireGraphics()
{
if (!m_pOurSvpGraphics.get() || m_bGraphicsInvalid)
{
- m_pOurSvpGraphics.reset(new Qt5SvpGraphics(m_pQWidget));
+ m_pOurSvpGraphics.reset(new Qt5SvpGraphics(this));
InitQt5SvpGraphics(m_pOurSvpGraphics.get());
m_bGraphicsInvalid = false;
}
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index f0818c08be7e..904267d76c48 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -31,6 +31,7 @@
#include <Qt5Menu.hxx>
#include <Qt5Object.hxx>
#include <Qt5OpenGLContext.hxx>
+#include "Qt5SvpVirtualDevice.hxx"
#include <Qt5System.hxx>
#include <Qt5Timer.hxx>
#include <Qt5VirtualDevice.hxx>
@@ -293,10 +294,10 @@ Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, D
{
if (m_bUseCairo)
{
- SvpSalGraphics* pSvpSalGraphics = dynamic_cast<SvpSalGraphics*>(pGraphics);
+ SvpSalGraphics* pSvpSalGraphics = dynamic_cast<Qt5SvpGraphics*>(pGraphics);
assert(pSvpSalGraphics);
std::unique_ptr<SalVirtualDevice> pVD(
- new SvpSalVirtualDevice(eFormat, pSvpSalGraphics->getSurface()));
+ new Qt5SvpVirtualDevice(eFormat, pSvpSalGraphics->getSurface()));
pVD->SetSize(nDX, nDY);
return pVD;
}
diff --git a/vcl/qt5/Qt5SvpGraphics.cxx b/vcl/qt5/Qt5SvpGraphics.cxx
index f746381e6561..1e6ae94be070 100644
--- a/vcl/qt5/Qt5SvpGraphics.cxx
+++ b/vcl/qt5/Qt5SvpGraphics.cxx
@@ -9,17 +9,22 @@
#include <sal/config.h>
#include <sal/log.hxx>
+#include <salbmp.hxx>
#include <config_cairo_canvas.h>
+#include <Qt5Frame.hxx>
#include <Qt5SvpGraphics.hxx>
#include <Qt5SvpSurface.hxx>
+#include <Qt5Tools.hxx>
+#include <QtGui/QScreen>
+#include <QtGui/QWindow>
#include <QtWidgets/QWidget>
-Qt5SvpGraphics::Qt5SvpGraphics(QWidget* pQWidget)
+Qt5SvpGraphics::Qt5SvpGraphics(Qt5Frame* pFrame)
: SvpSalGraphics()
- , m_pQWidget(pQWidget)
+ , m_pFrame(pFrame)
{
}
@@ -27,8 +32,11 @@ Qt5SvpGraphics::~Qt5SvpGraphics() {}
void Qt5SvpGraphics::updateQWidget() const
{
- if (m_pQWidget)
- m_pQWidget->update(m_pQWidget->rect());
+ if (!m_pFrame)
+ return;
+ QWidget* pQWidget = m_pFrame->GetQWidget();
+ if (pQWidget)
+ pQWidget->update(pQWidget->rect());
}
#if ENABLE_CAIRO_CANVAS
@@ -49,4 +57,53 @@ cairo::SurfaceSharedPtr Qt5SvpGraphics::CreateSurface(const OutputDevice& /*rRef
#endif
+static void QImage2BitmapBuffer(QImage* pImg, BitmapBuffer* pBuf)
+{
+ if (pImg->width() != 0 && pImg->height() != 0)
+ {
+ pBuf->mnWidth = pImg->width();
+ pBuf->mnHeight = pImg->height();
+ pBuf->mnBitCount = getFormatBits(pImg->format());
+ pBuf->mpBits = pImg->bits();
+ pBuf->mnScanlineSize = pImg->bytesPerLine();
+ }
+}
+
+bool Qt5SvpGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
+ const tools::Rectangle& rControlRegion, ControlState nState,
+ const ImplControlValue& aValue, const OUString& aCaption)
+{
+ bool bHandled
+ = m_aControl.drawNativeControl(nType, nPart, rControlRegion, nState, aValue, aCaption);
+ if (bHandled)
+ {
+ QImage* pImage = &m_aControl.getImage();
+ BitmapBuffer* pBuffer = new BitmapBuffer;
+ QImage2BitmapBuffer(pImage, pBuffer);
+ SalTwoRect aTR(0, 0, pImage->width(), pImage->height(), rControlRegion.getX(),
+ rControlRegion.getY(), rControlRegion.GetWidth(),
+ rControlRegion.GetHeight());
+ drawBitmap(aTR, pBuffer, CAIRO_OPERATOR_OVER);
+ }
+ return bHandled;
+}
+
+void Qt5SvpGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
+{
+ char* pForceDpi;
+ if ((pForceDpi = getenv("SAL_FORCEDPI")))
+ {
+ OString sForceDPI(pForceDpi);
+ rDPIX = rDPIY = sForceDPI.toInt32();
+ return;
+ }
+
+ if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
+ return;
+
+ QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen();
+ rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
+ rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalVirtualDevice.hxx b/vcl/qt5/Qt5SvpVirtualDevice.hxx
similarity index 84%
rename from vcl/unx/kde5/KDE5SalVirtualDevice.hxx
rename to vcl/qt5/Qt5SvpVirtualDevice.hxx
index baa8a2e31aa8..75c446bafb33 100644
--- a/vcl/unx/kde5/KDE5SalVirtualDevice.hxx
+++ b/vcl/qt5/Qt5SvpVirtualDevice.hxx
@@ -20,17 +20,17 @@
#pragma once
#include <headless/svpvd.hxx>
-#include "KDE5SalGraphics.hxx"
+#include <qt5/Qt5SvpGraphics.hxx>
-class VCL_DLLPUBLIC KDE5SalVirtualDevice : public SvpSalVirtualDevice
+class VCL_DLLPUBLIC Qt5SvpVirtualDevice : public SvpSalVirtualDevice
{
public:
- KDE5SalVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface)
+ Qt5SvpVirtualDevice(DeviceFormat eFormat, cairo_surface_t* pRefSurface)
: SvpSalVirtualDevice(eFormat, pRefSurface)
{
}
- SalGraphics* AcquireGraphics() override { return AddGraphics(new KDE5SalGraphics(nullptr)); }
+ SalGraphics* AcquireGraphics() override { return AddGraphics(new Qt5SvpGraphics(nullptr)); }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 69516132e0dc..efb08a74d832 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -29,7 +29,6 @@
#include <KSharedConfig>
#include "KDE5SalFrame.hxx"
-#include "KDE5SalGraphics.hxx"
#include <tools/color.hxx>
@@ -206,7 +205,7 @@ SalGraphics* KDE5SalFrame::AcquireGraphics()
if (!m_pKDE5Graphics.get())
{
- m_pKDE5Graphics.reset(new KDE5SalGraphics(this));
+ m_pKDE5Graphics.reset(new Qt5SvpGraphics(this));
Qt5Frame::InitQt5SvpGraphics(m_pKDE5Graphics.get());
}
diff --git a/vcl/unx/kde5/KDE5SalFrame.hxx b/vcl/unx/kde5/KDE5SalFrame.hxx
index 4b609bdf85a2..cf3874af7c8c 100644
--- a/vcl/unx/kde5/KDE5SalFrame.hxx
+++ b/vcl/unx/kde5/KDE5SalFrame.hxx
@@ -22,16 +22,14 @@
#include <memory>
#include <qt5/Qt5Frame.hxx>
-
-#include "KDE5SalGraphics.hxx"
+#include <qt5/Qt5SvpGraphics.hxx>
class QWidget;
-class KDE5SalGraphics;
class KDE5SalFrame : public Qt5Frame
{
private:
- std::unique_ptr<KDE5SalGraphics> m_pKDE5Graphics;
+ std::unique_ptr<Qt5SvpGraphics> m_pKDE5Graphics;
bool m_bGraphicsInUse;
public:
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
deleted file mode 100644
index 268f8331f7e7..000000000000
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "KDE5SalGraphics.hxx"
-
-#include <salbmp.hxx>
-
-#include <QtGui/QScreen>
-#include <QtGui/QWindow>
-
-#include <Qt5Tools.hxx>
-#include <Qt5Frame.hxx>
-
-static void QImage2BitmapBuffer(QImage* pImg, BitmapBuffer* pBuf)
-{
- if (pImg->width() != 0 && pImg->height() != 0)
- {
- pBuf->mnWidth = pImg->width();
- pBuf->mnHeight = pImg->height();
- pBuf->mnBitCount = getFormatBits(pImg->format());
- pBuf->mpBits = pImg->bits();
- pBuf->mnScanlineSize = pImg->bytesPerLine();
- }
-}
-
-KDE5SalGraphics::KDE5SalGraphics(Qt5Frame* pFrame)
- : Qt5SvpGraphics(pFrame ? pFrame->GetQWidget() : nullptr)
- , m_pFrame(pFrame)
-{
-}
-
-bool KDE5SalGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion, ControlState nState,
- const ImplControlValue& aValue, const OUString& aCaption)
-{
- bool bHandled
- = m_aControl.drawNativeControl(nType, nPart, rControlRegion, nState, aValue, aCaption);
- if (bHandled)
- {
- QImage* pImage = &m_aControl.getImage();
- BitmapBuffer* pBuffer = new BitmapBuffer;
- QImage2BitmapBuffer(pImage, pBuffer);
- SalTwoRect aTR(0, 0, pImage->width(), pImage->height(), rControlRegion.getX(),
- rControlRegion.getY(), rControlRegion.GetWidth(),
- rControlRegion.GetHeight());
- drawBitmap(aTR, pBuffer, CAIRO_OPERATOR_OVER);
- }
- return bHandled;
-}
-
-void KDE5SalGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
-{
- char* pForceDpi;
- if ((pForceDpi = getenv("SAL_FORCEDPI")))
- {
- OString sForceDPI(pForceDpi);
- rDPIX = rDPIY = sForceDPI.toInt32();
- return;
- }
-
- if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
- return;
-
- QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen();
- rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
- rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalGraphics.hxx b/vcl/unx/kde5/KDE5SalGraphics.hxx
deleted file mode 100644
index 1b12d890278c..000000000000
--- a/vcl/unx/kde5/KDE5SalGraphics.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include <memory>
-
-#include <rtl/string.hxx>
-#include <headless/svpgdi.hxx>
-
-#include <Qt5Graphics_Controls.hxx>
-#include <Qt5SvpGraphics.hxx>
-
-#include <QtGui/QImage>
-#include <QtWidgets/QPushButton>
-
-class Qt5Frame;
-
-/**
- * Handles native graphics requests and performs the needed drawing operations.
- */
-class KDE5SalGraphics : public Qt5SvpGraphics
-{
-public:
- KDE5SalGraphics(Qt5Frame* pFrame);
- virtual bool IsNativeControlSupported(ControlType, ControlPart) override;
-
- virtual bool hitTestNativeControl(ControlType, ControlPart, const tools::Rectangle&,
- const Point&, bool&) override;
-
- virtual bool drawNativeControl(ControlType, ControlPart, const tools::Rectangle&, ControlState,
- const ImplControlValue&, const OUString&) override;
-
- virtual bool getNativeControlRegion(ControlType, ControlPart, const tools::Rectangle&,
- ControlState, const ImplControlValue&, const OUString&,
- tools::Rectangle&, tools::Rectangle&) override;
-
- virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
-
-private:
- Qt5Graphics_Controls m_aControl;
- Qt5Frame* m_pFrame;
-};
-
-inline bool KDE5SalGraphics::IsNativeControlSupported(ControlType nType, ControlPart nPart)
-{
- return Qt5Graphics_Controls::IsNativeControlSupported(nType, nPart);
-}
-
-inline bool KDE5SalGraphics::hitTestNativeControl(ControlType nType, ControlPart nPart,
- const tools::Rectangle& rControlRegion,
- const Point& aPos, bool& rIsInside)
-{
- return Qt5Graphics_Controls::hitTestNativeControl(nType, nPart, rControlRegion, aPos,
- rIsInside);
-}
-
-inline bool KDE5SalGraphics::getNativeControlRegion(
- ControlType nType, ControlPart nPart, const tools::Rectangle& rControlRegion,
- ControlState nState, const ImplControlValue& aValue, const OUString& aCaption,
- tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
-{
- return Qt5Graphics_Controls::getNativeControlRegion(nType, nPart, rControlRegion, nState,
- aValue, aCaption, rNativeBoundingRegion,
- rNativeContentRegion);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index e83d48007712..3a227fc7b2b6 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -30,7 +30,6 @@
#include "KDE5FilePicker.hxx"
#include "KDE5SalFrame.hxx"
#include "KDE5SalInstance.hxx"
-#include "KDE5SalVirtualDevice.hxx"
using namespace com::sun::star;
@@ -70,22 +69,6 @@ Qt5FilePicker* KDE5SalInstance::createPicker(QFileDialog::FileMode eMode)
return Qt5Instance::createPicker(eMode);
}
-std::unique_ptr<SalVirtualDevice> KDE5SalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
- long& nDX, long& nDY,
- DeviceFormat eFormat,
- const SystemGraphicsData*)
-{
- std::unique_ptr<SalVirtualDevice> pVD;
- assert(pGraphics);
- RunInMainThread(std::function([&]() {
- KDE5SalGraphics* pKDE5Graphics = dynamic_cast<KDE5SalGraphics*>(pGraphics);
- assert(pKDE5Graphics);
- pVD.reset(new KDE5SalVirtualDevice(eFormat, pKDE5Graphics->getSurface()));
- pVD->SetSize(nDX, nDY);
- }));
- return pVD;
-}
-
extern "C" {
VCLPLUG_KDE5_PUBLIC SalInstance* create_SalInstance()
{
diff --git a/vcl/unx/kde5/KDE5SalInstance.hxx b/vcl/unx/kde5/KDE5SalInstance.hxx
index 6b9f8eb29806..53993a5ecc34 100644
--- a/vcl/unx/kde5/KDE5SalInstance.hxx
+++ b/vcl/unx/kde5/KDE5SalInstance.hxx
@@ -30,10 +30,6 @@ class KDE5SalInstance final : public Qt5Instance
public:
explicit KDE5SalInstance(std::unique_ptr<QApplication>& pQApp);
-
- std::unique_ptr<SalVirtualDevice>
- CreateVirtualDevice(SalGraphics*, long&, long&, DeviceFormat,
- const SystemGraphicsData* = nullptr) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list