summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-11-04 11:01:00 -0500
committerJan Holesovsky <kendy@collabora.com>2018-11-08 09:14:42 +0100
commit70d4b1f17f3b056273b9882b63f242e6aa4597cd (patch)
treea6d7729e2d736b5c4ced436f17f53493e9913caf /vcl
parentbf45170261911e55afe6be7c062ffe229595262c (diff)
LOK: custom widgets: reduce theme plugin API surface
Change-Id: I89dcf5a102be19fd1bc314a89538a121522f4a43
Diffstat (limited to 'vcl')
-rw-r--r--vcl/headless/CustomWidgetDraw.cxx23
-rw-r--r--vcl/headless/svpgdi.cxx1
-rw-r--r--vcl/inc/WidgetThemeLibrary.hxx18
-rw-r--r--vcl/inc/WidgetThemeLibraryTypes.hxx92
-rw-r--r--vcl/inc/headless/svpgdi.hxx1
5 files changed, 32 insertions, 103 deletions
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index cadc41e85452..ca0af690a874 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -300,9 +300,26 @@ bool CustomWidgetDraw::getNativeControlRegion(
ControlState eState, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
{
- return s_pWidgetImplementation
- && s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
- rNativeBoundingRegion, rNativeContentRegion);
+ // Translate to POD rectangle and back.
+ const rectangle_t aRegion
+ = { rBoundingControlRegion.getX(), rBoundingControlRegion.getY(),
+ rBoundingControlRegion.GetWidth(), rBoundingControlRegion.GetHeight() };
+ if (s_pWidgetImplementation)
+ {
+ rectangle_t aNativeBoundingRegion;
+ rectangle_t aNativeContentRegion;
+ s_pWidgetImplementation->getRegion(eType, ePart, eState, aRegion, aNativeBoundingRegion,
+ aNativeContentRegion);
+
+ rNativeBoundingRegion
+ = tools::Rectangle(aNativeBoundingRegion.x, aNativeBoundingRegion.y,
+ aNativeBoundingRegion.width, aNativeBoundingRegion.height);
+ rNativeContentRegion
+ = tools::Rectangle(aNativeBoundingRegion.x, aNativeBoundingRegion.y,
+ aNativeBoundingRegion.width, aNativeBoundingRegion.height);
+ }
+
+ return false;
}
bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 3e409a3763bb..0fa655f96a92 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -22,6 +22,7 @@
#include <headless/svpbmp.hxx>
#include <headless/svpframe.hxx>
#include <headless/svpcairotextrender.hxx>
+#include <headless/CustomWidgetDraw.hxx>
#include <saldatabasic.hxx>
#include <o3tl/safeint.hxx>
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 9d916895d43b..84479af7bae5 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -11,11 +11,7 @@
#ifndef INCLUDED_VCL_INC_WIDGETTHEME_HXX
#define INCLUDED_VCL_INC_WIDGETTHEME_HXX
-/**
- * This file expects cairo.h and the definition of
- * the other types used here to be defined before
- * including it.
- */
+#include <cstdint>
namespace vcl
{
@@ -76,6 +72,7 @@ struct WidgetDrawStyle
struct ControlDrawParameters
{
+ typedef struct _cairo cairo_t;
ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState)
: nSize(sizeof(ControlDrawParameters))
, pCairo(i_pCairo)
@@ -98,15 +95,20 @@ struct ControlDrawParameters
typedef struct _WidgetThemeLibrary WidgetThemeLibrary;
+typedef struct _rectangle
+{
+ long x, y;
+ long width, height;
+} rectangle_t;
+
struct _WidgetThemeLibrary
{
uint32_t nSize;
bool (*isNativeControlSupported)(ControlType eType, ControlPart ePart);
bool (*getRegion)(ControlType eType, ControlPart ePart, ControlState eState,
- const tools::Rectangle& rBoundingControlRegion,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion);
+ const rectangle_t& rBoundingControlRegion, rectangle_t& rNativeBoundingRegion,
+ rectangle_t& rNativeContentRegion);
bool (*drawPushButton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
bool (*drawRadiobutton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx
index c8a492313356..af7ff9738471 100644
--- a/vcl/inc/WidgetThemeLibraryTypes.hxx
+++ b/vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -12,7 +12,7 @@
#define INCLUDED_VCL_INC_WIDGETTHEMETYPES_HXX
#include <cstdint>
-#include <type_traits>
+#include <type_traits> // Used for enum operator
/**
* These types are all based on the supported variants
@@ -268,96 +268,6 @@ constexpr uint32_t RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
#define COL_YELLOW_HIGHLIGHT RGB_COLORDATA( 0xFF, 0xF2, 0x00 )
#define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF )
-#ifndef SAL_DLLPUBLIC_EXPORT
-# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
-#endif
-
-namespace tools
-{
-
-#define RECT_EMPTY ((short)-32767)
-
-class SAL_DLLPUBLIC_EXPORT Rectangle
-{
-public:
- Rectangle();
- Rectangle( long nLeft, long nTop,
- long nRight, long nBottom );
-
- long Left() const { return nLeft; }
- long Right() const { return nRight; }
- long Top() const { return nTop; }
- long Bottom() const { return nBottom; }
-
- long& Left() { return nLeft; }
- long& Right() { return nRight; }
- long& Top() { return nTop; }
- long& Bottom() { return nBottom; }
-
- /// Returns the difference between right and left, assuming the range is inclusive.
- inline long GetWidth() const;
- /// Returns the difference between bottom and top, assuming the range is inclusive.
- inline long GetHeight() const;
-
- long getX() const { return nLeft; }
- long getY() const { return nTop; }
-
-private:
- long nLeft;
- long nTop;
- long nRight;
- long nBottom;
-};
-}
-
-inline tools::Rectangle::Rectangle()
-{
- nLeft = nTop = 0;
- nRight = nBottom = RECT_EMPTY;
-}
-
-inline tools::Rectangle::Rectangle( long _nLeft, long _nTop,
- long _nRight, long _nBottom )
-{
- nLeft = _nLeft;
- nTop = _nTop;
- nRight = _nRight;
- nBottom = _nBottom;
-}
-
-inline long tools::Rectangle::GetWidth() const
-{
- long n;
- if ( nRight == RECT_EMPTY )
- n = 0;
- else
- {
- n = nRight - nLeft;
- if( n < 0 )
- n--;
- else
- n++;
- }
-
- return n;
-}
-
-inline long tools::Rectangle::GetHeight() const
-{
- long n;
- if ( nBottom == RECT_EMPTY )
- n = 0;
- else
- {
- n = nBottom - nTop;
- if ( n < 0 )
- n--;
- else
- n++;
- }
-
- return n;
-}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 0c834a0a158a..dcd344350473 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -29,7 +29,6 @@
#include <sallayout.hxx>
#include "svpcairotextrender.hxx"
#include <impfontmetricdata.hxx>
-#include <headless/CustomWidgetDraw.hxx>
#ifdef IOS
#define SvpSalGraphics AquaSalGraphics