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@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@fbihome.de>
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index deb7cf0..c839171 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -300,7 +300,6 @@
    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 f54103f..4259a84 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -441,7 +441,7 @@
        }
        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 0f6fda8..b335d2e 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1866,69 +1866,6 @@
    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 4d1ecce..e8c44833 100644
--- a/vcl/inc/WidgetDrawInterface.hxx
+++ b/vcl/inc/WidgetDrawInterface.hxx
@@ -29,7 +29,7 @@
     * @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 @@
     * @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 @@
     * @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 @@
     * @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 73d80da..a2b9351 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -262,27 +262,6 @@

    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 fe7e3b3..cd4aa8a 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 @@
    friend class Qt5Bitmap;
    friend class Qt5Painter;

    Qt5Graphics_Controls m_aControl;

    Qt5Frame* m_pFrame;
    QImage* m_pQImage;
    QRegion m_aClipRegion;
@@ -64,6 +61,9 @@

    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 @@

    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 f8b5c5a..50d1de3 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 @@
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 9dd8a53..0c2485f 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 @@
                                          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 e3c2b8e..2517741 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -295,6 +295,9 @@

    // 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 @@
    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 @@
    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 d7b45f5..004c2cc 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -71,11 +71,11 @@
// 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 @@
    //  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 @@
                                    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 @@
                                    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 @@
                                    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 @@

#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 @@
                                    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 @@

    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 87f1d0e..c9b7be4 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -101,13 +101,13 @@
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 @@
                                                    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 @@
    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 @@
    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 22c4a8f2..7dc859a 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -264,6 +264,8 @@
    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 @@
                                                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 @@
    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 ad1362d..6e94cd3e 100644
--- a/vcl/osx/salnativewidgets.cxx
+++ b/vcl/osx/salnativewidgets.cxx
@@ -116,7 +116,7 @@
    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 fbf7ae0..5192f0b 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 @@
    , m_aTextColor( 0x00, 0x00, 0x00 )
{
    ResetClipRegion();
    if (!Qt5Data::noNativeControls())
        m_pWidgetDraw.reset(new Qt5Graphics_Controls());
}

Qt5Graphics::~Qt5Graphics()
@@ -110,20 +113,16 @@

#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 32a376a..32a2d13 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -67,7 +67,7 @@

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 @@
                                             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 1e6ae94..4edf55d 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 @@
    : SvpSalGraphics()
    , m_pFrame(pFrame)
{
    if (!Qt5Data::noNativeControls())
        m_pWidgetDraw.reset(new Qt5Graphics_Controls());
}

Qt5SvpGraphics::~Qt5SvpGraphics() {}
@@ -57,35 +61,32 @@

#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 0ab8bb6..789e323 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -764,22 +764,6 @@
    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 @@
        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 @@
    }
}

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 @@
        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 @@
        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 a708602..0000000
--- 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 09bb864..0021834 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -174,7 +174,7 @@
    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 75526e5..acdf9b6 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -2218,7 +2218,7 @@
        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 b965705..948dd2b 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -612,7 +612,7 @@
    X11SalGraphics::copyBits( rPosAry, pSrcGraphics );
}

bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
bool GtkSalGraphics::isNativeControlSupported( ControlType nType, ControlPart nPart )
{
    switch(nType)
    {
@@ -806,7 +806,7 @@
        return true;
    }

    if( IsNativeControlSupported(nType, nPart) )
    if( isNativeControlSupported(nType, nPart) )
    {
        rIsInside = rControlRegion.IsInside( aPos );
        return true;
@@ -3739,7 +3739,7 @@
    }
}

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 @@

    // 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 888a7fb..994fb35 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2241,7 +2241,7 @@
        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 0de96d2..2beebaf 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 @@
    }
}

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 @@
    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 @@
    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 @@
    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 422a86c..84a9bda 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -226,7 +226,7 @@
    return hTheme;
}

bool WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
bool WinSalGraphics::isNativeControlSupported( ControlType nType, ControlPart nPart )
{
    HTHEME hTheme = nullptr;