vcl/Library_vcl.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 | 27 ++--- vcl/inc/qt5/Qt5SvpGraphics.hxx | 41 -------- 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/Qt5Graphics.cxx | 25 ++--- vcl/qt5/Qt5Graphics_Controls.cxx | 4 vcl/qt5/Qt5SvpGraphics.cxx | 51 +++++------ 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/win/gdi/salnativewidgets-luna.cxx | 2 24 files changed, 193 insertions(+), 495 deletions(-)
New commits: commit 4a478227f5af8322164ecce66fd056e9bf2eac89 Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Sun Jun 16 14:19:09 2019 +0000 Commit: Jan-Marek Glogowski <glo...@fbihome.de> CommitDate: Tue Jun 18 20:27:49 2019 +0200 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. Change-Id: I5fda1a64b28e6560fb3c62e02b6dcda827f698e2 Reviewed-on: https://gerrit.libreoffice.org/74118 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glo...@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 5a4f0bc5b88c..b5c9df074932 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -261,27 +261,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 cdc3aee155f8..1219ad951d23 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 a8c2d87969d0..36f70b2a8b57 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -69,11 +69,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; @@ -340,19 +340,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, @@ -362,9 +355,7 @@ public: const OutputDevice *pOutDev ); /** - * Request rendering of a particular control and/or part - * - * @see drawNativeControl + * @see WidgetDrawInterface::drawNativeControl */ bool DrawNativeControl( ControlType nType, @@ -376,9 +367,7 @@ public: const OutputDevice *pOutDev ); /** - * Query the native control's actual drawing region (including adornment) - * - * @see getNativeControlRegion + * @see WidgetDrawInterface::getNativeControlRegion */ bool GetNativeControlRegion( ControlType nType, @@ -390,6 +379,11 @@ public: tools::Rectangle &rNativeContentRegion, const OutputDevice *pOutDev ); + /** + * @see WidgetDrawInterface::updateSettings + */ + inline bool UpdateSettings(AllSettings&); + bool BlendBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, @@ -440,11 +434,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; @@ -538,81 +527,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&, @@ -678,16 +592,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 4cc108f55043..6cefef623a73 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) { @@ -170,7 +170,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 af51d2c279d9..ef2295808a6d 100644 --- a/vcl/source/outdev/nativecontrols.cxx +++ b/vcl/source/outdev/nativecontrols.cxx @@ -166,7 +166,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 425ad0562d82..91c08ef23cb4 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -2219,7 +2219,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 1061345344bc..de4c124244ab 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -2242,7 +2242,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 17929b296581..e7e194e50a62 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -22,7 +22,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> @@ -2261,21 +2260,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; @@ -2688,17 +2683,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; @@ -2946,14 +2934,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); @@ -3294,15 +3276,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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits