[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 38 commits - chart2/source desktop/qa include/LibreOfficeKit include/tools include/vcl sc/source sd/source sfx2/source solenv/clang-format svtools/source sw/qa sw/source toolkit/source vcl/headless vcl/inc vcl/Library_vcl.mk vcl/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 8 08:16:40 UTC 2018
chart2/source/view/main/AbstractShapeFactory.cxx | 1
desktop/qa/desktop_lib/test_desktop_lib.cxx | 5
include/LibreOfficeKit/LibreOfficeKitInit.h | 2
include/tools/solar.h | 10
include/tools/svlibrary.h | 15
include/vcl/button.hxx | 11
include/vcl/edit.hxx | 2
include/vcl/salnativewidgets.hxx | 13
sc/source/ui/attrdlg/scabstdlg.cxx | 1
sc/source/ui/docshell/impex.cxx | 1
sd/source/filter/sdfilter.cxx | 1
sfx2/source/appl/app.cxx | 1
sfx2/source/appl/appinit.cxx | 1
sfx2/source/appl/appserv.cxx | 1
solenv/clang-format/blacklist | 1
svtools/source/misc/svtaccessiblefactory.cxx | 2
sw/qa/unit/sw-dialogs-test.cxx | 1
sw/qa/unit/sw-dialogs-test_2.cxx | 1
sw/source/filter/basflt/fltini.cxx | 1
toolkit/source/helper/accessibilityclient.cxx | 2
vcl/Library_vcl.mk | 1
vcl/headless/CustomWidgetDraw.cxx | 398 +++++++++++++++++++++++
vcl/headless/svpframe.cxx | 22 +
vcl/headless/svpgdi.cxx | 65 +++
vcl/inc/WidgetDrawInterface.hxx | 103 +++++
vcl/inc/WidgetThemeLibrary.hxx | 146 ++++++++
vcl/inc/WidgetThemeLibraryTypes.hxx | 240 +++++++++++++
vcl/inc/headless/CustomWidgetDraw.hxx | 56 +++
vcl/inc/headless/svpgdi.hxx | 22 +
vcl/inc/salgdi.hxx | 7
vcl/inc/unx/gtk/gtkgdi.hxx | 4
vcl/source/control/button.cxx | 6
vcl/source/control/edit.cxx | 15
vcl/source/control/imp_listbox.cxx | 4
vcl/source/control/slider.cxx | 44 +-
vcl/source/filter/FilterConfigCache.cxx | 1
vcl/source/gdi/salgdilayout.cxx | 4
vcl/source/gdi/salnativewidgets-none.cxx | 29 -
vcl/source/window/builder.cxx | 5
vcl/source/window/menufloatingwindow.cxx | 17
vcl/source/window/paint.cxx | 77 ++++
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 42 ++
42 files changed, 1314 insertions(+), 67 deletions(-)
New commits:
commit 09293ff54d1b13991d9925b4d4b74ec80114460e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Nov 4 11:45:45 2018 -0500
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:42 2018 +0100
LOK: custom widgets: simplify and correct colors
Also remove macroni.
Change-Id: I0b2914e9f0e2aba9d8ca10338b515b598126e315
diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx
index af7ff9738471..9b069d3dc066 100644
--- a/vcl/inc/WidgetThemeLibraryTypes.hxx
+++ b/vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -235,39 +235,6 @@ enum class ButtonValue {
Mixed
};
-// Color types
-
-constexpr uint32_t RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
- return uint32_t(b) | (uint32_t(g) << 8) | (uint32_t(r) << 16);
-}
-
-#define COLORDATA_RED( n ) ((uint8_t)((n)>>16))
-#define COLORDATA_GREEN( n ) ((uint8_t)(((uint16_t)(n)) >> 8))
-#define COLORDATA_BLUE( n ) ((uint8_t)(n))
-#define COLORDATA_RGB( n ) ((uint32_t)((n) & 0x00FFFFFF))
-
-#define COL_BLACK RGB_COLORDATA( 0x00, 0x00, 0x00 )
-#define COL_BLUE RGB_COLORDATA( 0x00, 0x00, 0x80 )
-#define COL_GREEN RGB_COLORDATA( 0x00, 0x80, 0x00 )
-#define COL_CYAN RGB_COLORDATA( 0x00, 0x80, 0x80 )
-#define COL_RED RGB_COLORDATA( 0x80, 0x00, 0x00 )
-#define COL_RED_FONTCOLOR RGB_COLORDATA( 0xCE, 0x18, 0x1E )
-#define COL_MAGENTA RGB_COLORDATA( 0x80, 0x00, 0x80 )
-#define COL_BROWN RGB_COLORDATA( 0x80, 0x80, 0x00 )
-#define COL_GRAY RGB_COLORDATA( 0x80, 0x80, 0x80 )
-#define COL_GRAY3 RGB_COLORDATA( 0xCC, 0xCC, 0xCC )
-#define COL_GRAY7 RGB_COLORDATA( 0x66, 0x66, 0x66 )
-#define COL_LIGHTGRAY RGB_COLORDATA( 0xC0, 0xC0, 0xC0 )
-#define COL_LIGHTBLUE RGB_COLORDATA( 0x00, 0x00, 0xFF )
-#define COL_LIGHTGREEN RGB_COLORDATA( 0x00, 0xFF, 0x00 )
-#define COL_LIGHTCYAN RGB_COLORDATA( 0x00, 0xFF, 0xFF )
-#define COL_LIGHTRED RGB_COLORDATA( 0xFF, 0x00, 0x00 )
-#define COL_LIGHTMAGENTA RGB_COLORDATA( 0xFF, 0x00, 0xFF )
-#define COL_LIGHTGRAYBLUE RGB_COLORDATA( 0xE0, 0xE0, 0xFF )
-#define COL_YELLOW RGB_COLORDATA( 0xFF, 0xFF, 0x00 )
-#define COL_YELLOW_HIGHLIGHT RGB_COLORDATA( 0xFF, 0xF2, 0x00 )
-#define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF )
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 70d4b1f17f3b056273b9882b63f242e6aa4597cd
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Nov 4 11:01:00 2018 -0500
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:42 2018 +0100
LOK: custom widgets: reduce theme plugin API surface
Change-Id: I89dcf5a102be19fd1bc314a89538a121522f4a43
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
commit bf45170261911e55afe6be7c062ffe229595262c
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 3 17:57:44 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:41 2018 +0100
LOK: custom widgets: reduce Color into an int to reduce API surface
Change-Id: Ib1afbb0b5647048f24d4ea6f9859b76328568dac
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index d1454911489f..cadc41e85452 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -318,55 +318,55 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
StyleSettings aStyleSet = rSettings.GetStyleSettings();
aStyleSet.SetFaceColor(aStyle.maFaceColor);
- aStyleSet.SetCheckedColor(Color(0xCC, 0xCC, 0xCC));
+ aStyleSet.SetCheckedColor(aStyle.maCheckedColor);
aStyleSet.SetLightColor(aStyle.maLightColor);
aStyleSet.SetLightBorderColor(aStyle.maLightBorderColor);
aStyleSet.SetShadowColor(aStyle.maShadowColor);
aStyleSet.SetDarkShadowColor(aStyle.maDarkShadowColor);
- aStyleSet.SetButtonTextColor(Color(COL_BLACK));
- aStyleSet.SetButtonRolloverTextColor(Color(COL_BLACK));
- aStyleSet.SetRadioCheckTextColor(Color(COL_BLACK));
- aStyleSet.SetGroupTextColor(Color(COL_BLACK));
- aStyleSet.SetLabelTextColor(Color(COL_BLACK));
+ aStyleSet.SetButtonTextColor(aStyle.maButtonTextColor);
+ aStyleSet.SetButtonRolloverTextColor(aStyle.maButtonRolloverTextColor);
+ aStyleSet.SetRadioCheckTextColor(aStyle.maRadioCheckTextColor);
+ aStyleSet.SetGroupTextColor(aStyle.maGroupTextColor);
+ aStyleSet.SetLabelTextColor(aStyle.maLabelTextColor);
aStyleSet.SetWindowColor(aStyle.maWindowColor);
aStyleSet.SetWindowTextColor(aStyle.maWindowTextColor);
aStyleSet.SetDialogColor(aStyle.maDialogColor);
aStyleSet.SetDialogTextColor(aStyle.maDialogTextColor);
- aStyleSet.SetWorkspaceColor(Color(0xDF, 0xDF, 0xDE));
- aStyleSet.SetMonoColor(Color(COL_BLACK));
- aStyleSet.SetFieldColor(Color(aStyle.maFaceColor));
- aStyleSet.SetFieldTextColor(Color(COL_BLACK));
- aStyleSet.SetFieldRolloverTextColor(Color(COL_BLACK));
- aStyleSet.SetActiveColor(Color(COL_BLUE));
- aStyleSet.SetActiveTextColor(Color(COL_WHITE));
- aStyleSet.SetActiveBorderColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetDeactiveColor(Color(COL_GRAY));
- aStyleSet.SetDeactiveTextColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetDeactiveBorderColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuColor(Color(COL_WHITE));
- aStyleSet.SetMenuBarColor(Color(COL_WHITE));
- aStyleSet.SetMenuBarRolloverColor(aStyle.maHighlightColor);
- aStyleSet.SetMenuBorderColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuBarTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuBarRolloverTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuBarHighlightTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuHighlightColor(aStyle.maHighlightColor);
- aStyleSet.SetMenuHighlightTextColor(Color(COL_BLACK));
+ aStyleSet.SetWorkspaceColor(aStyle.maWorkspaceColor);
+ aStyleSet.SetMonoColor(aStyle.maMonoColor);
+ aStyleSet.SetFieldColor(Color(aStyle.maFieldColor));
+ aStyleSet.SetFieldTextColor(aStyle.maFieldTextColor);
+ aStyleSet.SetFieldRolloverTextColor(aStyle.maFieldRolloverTextColor);
+ aStyleSet.SetActiveColor(aStyle.maActiveColor);
+ aStyleSet.SetActiveTextColor(aStyle.maActiveTextColor);
+ aStyleSet.SetActiveBorderColor(aStyle.maActiveBorderColor);
+ aStyleSet.SetDeactiveColor(aStyle.maDeactiveColor);
+ aStyleSet.SetDeactiveTextColor(aStyle.maDeactiveTextColor);
+ aStyleSet.SetDeactiveBorderColor(aStyle.maDeactiveBorderColor);
+ aStyleSet.SetMenuColor(aStyle.maMenuColor);
+ aStyleSet.SetMenuBarColor(aStyle.maMenuBarColor);
+ aStyleSet.SetMenuBarRolloverColor(aStyle.maMenuBarRolloverColor);
+ aStyleSet.SetMenuBorderColor(aStyle.maMenuBorderColor);
+ aStyleSet.SetMenuTextColor(aStyle.maMenuTextColor);
+ aStyleSet.SetMenuBarTextColor(aStyle.maMenuBarTextColor);
+ aStyleSet.SetMenuBarRolloverTextColor(aStyle.maMenuBarRolloverTextColor);
+ aStyleSet.SetMenuBarHighlightTextColor(aStyle.maMenuBarHighlightTextColor);
+ aStyleSet.SetMenuHighlightColor(aStyle.maMenuHighlightColor);
+ aStyleSet.SetMenuHighlightTextColor(aStyle.maMenuHighlightTextColor);
aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
aStyleSet.SetActiveTabColor(aStyle.maActiveTabColor);
aStyleSet.SetInactiveTabColor(aStyle.maInactiveTabColor);
- aStyleSet.SetTabTextColor(Color(COL_BLACK));
- aStyleSet.SetTabRolloverTextColor(Color(COL_BLACK));
- aStyleSet.SetTabHighlightTextColor(Color(COL_BLACK));
- aStyleSet.SetDisableColor(Color(COL_GRAY));
- aStyleSet.SetHelpColor(Color(0xFF, 0xFF, 0xE0));
- aStyleSet.SetHelpTextColor(Color(COL_BLACK));
- aStyleSet.SetLinkColor(Color(COL_BLUE));
- aStyleSet.SetVisitedLinkColor(Color(0x00, 0x00, 0xCC));
- aStyleSet.SetToolTextColor(Color(COL_BLACK));
- aStyleSet.SetFontColor(Color(COL_BLACK));
+ aStyleSet.SetTabTextColor(aStyle.maTabTextColor);
+ aStyleSet.SetTabRolloverTextColor(aStyle.maTabRolloverTextColor);
+ aStyleSet.SetTabHighlightTextColor(aStyle.maTabHighlightTextColor);
+ aStyleSet.SetDisableColor(aStyle.maDisableColor);
+ aStyleSet.SetHelpColor(aStyle.maHelpColor);
+ aStyleSet.SetHelpTextColor(aStyle.maHelpTextColor);
+ aStyleSet.SetLinkColor(aStyle.maLinkColor);
+ aStyleSet.SetVisitedLinkColor(aStyle.maVisitedLinkColor);
+ aStyleSet.SetToolTextColor(aStyle.maToolTextColor);
+ aStyleSet.SetFontColor(aStyle.maFontColor);
rSettings.SetStyleSettings(aStyleSet);
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 488781496cad..9d916895d43b 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -22,19 +22,56 @@ namespace vcl
struct WidgetDrawStyle
{
uint32_t nSize;
- Color maFaceColor;
- Color maLightColor;
- Color maLightBorderColor;
- Color maShadowColor;
- Color maDarkShadowColor;
- Color maHighlightColor;
- Color maHighlightTextColor;
- Color maActiveTabColor;
- Color maInactiveTabColor;
- Color maWindowColor;
- Color maWindowTextColor;
- Color maDialogColor;
- Color maDialogTextColor;
+ uint32_t maFaceColor;
+ uint32_t maCheckedColor;
+ uint32_t maLightColor;
+ uint32_t maLightBorderColor;
+ uint32_t maShadowColor;
+ uint32_t maDarkShadowColor;
+ uint32_t maButtonTextColor;
+ uint32_t maButtonRolloverTextColor;
+ uint32_t maRadioCheckTextColor;
+ uint32_t maGroupTextColor;
+ uint32_t maLabelTextColor;
+ uint32_t maWindowColor;
+ uint32_t maWindowTextColor;
+ uint32_t maDialogColor;
+ uint32_t maDialogTextColor;
+ uint32_t maWorkspaceColor;
+ uint32_t maMonoColor;
+ uint32_t maFieldColor;
+ uint32_t maFieldTextColor;
+ uint32_t maFieldRolloverTextColor;
+ uint32_t maActiveColor;
+ uint32_t maActiveTextColor;
+ uint32_t maActiveBorderColor;
+ uint32_t maDeactiveColor;
+ uint32_t maDeactiveTextColor;
+ uint32_t maDeactiveBorderColor;
+ uint32_t maMenuColor;
+ uint32_t maMenuBarColor;
+ uint32_t maMenuBarRolloverColor;
+ uint32_t maMenuBorderColor;
+ uint32_t maMenuTextColor;
+ uint32_t maMenuBarTextColor;
+ uint32_t maMenuBarRolloverTextColor;
+ uint32_t maMenuBarHighlightTextColor;
+ uint32_t maMenuHighlightColor;
+ uint32_t maMenuHighlightTextColor;
+ uint32_t maHighlightColor;
+ uint32_t maHighlightTextColor;
+ uint32_t maActiveTabColor;
+ uint32_t maInactiveTabColor;
+ uint32_t maTabTextColor;
+ uint32_t maTabRolloverTextColor;
+ uint32_t maTabHighlightTextColor;
+ uint32_t maDisableColor;
+ uint32_t maHelpColor;
+ uint32_t maHelpTextColor;
+ uint32_t maLinkColor;
+ uint32_t maVisitedLinkColor;
+ uint32_t maToolTextColor;
+ uint32_t maFontColor;
};
struct ControlDrawParameters
diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx
index a5a32109142d..c8a492313356 100644
--- a/vcl/inc/WidgetThemeLibraryTypes.hxx
+++ b/vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -236,16 +236,15 @@ enum class ButtonValue {
};
// Color types
-typedef uint32_t ColorData;
-constexpr ColorData RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
+constexpr uint32_t RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
return uint32_t(b) | (uint32_t(g) << 8) | (uint32_t(r) << 16);
}
#define COLORDATA_RED( n ) ((uint8_t)((n)>>16))
#define COLORDATA_GREEN( n ) ((uint8_t)(((uint16_t)(n)) >> 8))
#define COLORDATA_BLUE( n ) ((uint8_t)(n))
-#define COLORDATA_RGB( n ) ((ColorData)((n) & 0x00FFFFFF))
+#define COLORDATA_RGB( n ) ((uint32_t)((n) & 0x00FFFFFF))
#define COL_BLACK RGB_COLORDATA( 0x00, 0x00, 0x00 )
#define COL_BLUE RGB_COLORDATA( 0x00, 0x00, 0x80 )
@@ -273,46 +272,6 @@ constexpr ColorData RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
# define SAL_DLLPUBLIC_EXPORT __attribute__ ((visibility("default")))
#endif
-class SAL_DLLPUBLIC_EXPORT Color final
-{
- ColorData mnColor;
-
-public:
- explicit Color(ColorData nColor = COL_BLACK)
- : mnColor(nColor)
- {}
- Color(uint8_t nRed, uint8_t nGreen, uint8_t nBlue)
- : mnColor(RGB_COLORDATA(nRed, nGreen, nBlue))
- {}
-
- bool operator<(const Color& b) const
- {
- return mnColor < b.GetColor();
- }
-
- void SetColor(ColorData nColor)
- {
- mnColor = nColor;
- }
- ColorData GetColor() const
- {
- return mnColor;
- }
- ColorData GetRGBColor() const
- {
- return COLORDATA_RGB(mnColor);
- }
-
- bool operator==(const Color& rColor) const
- {
- return mnColor == rColor.mnColor;
- }
- bool operator!=(const Color& rColor) const
- {
- return !(Color::operator==(rColor));
- }
-};
-
namespace tools
{
commit f4100192c33ce17e2190388812ad5b2fe5e58acc
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Nov 2 09:24:19 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:41 2018 +0100
LOK: custom widgets: check size of API structures
Change-Id: Iff50f7aeb471870230e9e822657deed6aefad268
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index d7eb359311a8..d1454911489f 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -311,6 +311,7 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
return false;
WidgetDrawStyle aStyle;
+ aStyle.nSize = sizeof(WidgetDrawStyle);
if (s_pWidgetImplementation->updateSettings(aStyle))
{
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index cfd10522b30d..488781496cad 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -21,6 +21,7 @@ namespace vcl
{
struct WidgetDrawStyle
{
+ uint32_t nSize;
Color maFaceColor;
Color maLightColor;
Color maLightBorderColor;
@@ -39,7 +40,8 @@ struct WidgetDrawStyle
struct ControlDrawParameters
{
ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState)
- : pCairo(i_pCairo)
+ : nSize(sizeof(ControlDrawParameters))
+ , pCairo(i_pCairo)
, ePart(i_ePart)
, eState(i_eState)
, eButtonValue(ButtonValue::DontKnow)
@@ -48,6 +50,7 @@ struct ControlDrawParameters
{
}
+ uint32_t nSize;
cairo_t* pCairo;
ControlPart ePart;
ControlState eState;
@@ -92,7 +95,7 @@ struct _WidgetThemeLibrary
bool (*drawListNet)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
bool (*drawListHeader)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- bool (*updateSettings)(WidgetDrawStyle& rSettings);
+ bool (*updateSettings)(WidgetDrawStyle& rStyle);
};
extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary();
commit 438169ebbbcb32bca1a6feb42285d1950a1ce89d
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Nov 2 13:28:52 2018 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:41 2018 +0100
LOK: custom widgets: No need for SAL_DLLPUBLIC_RTTI here any more.
Change-Id: I7cae61e1fa9cf74b98627d557890fd41047421df
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 44708bd30ee1..cfd10522b30d 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -56,10 +56,6 @@ struct ControlDrawParameters
int64_t nValue;
};
-#ifndef SAL_DLLPUBLIC_RTTI
-#define SAL_DLLPUBLIC_RTTI
-#endif
-
typedef struct _WidgetThemeLibrary WidgetThemeLibrary;
struct _WidgetThemeLibrary
commit a66386f936117a4449fb43c5044fb5ee5fdb9c5c
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Thu Nov 1 23:33:32 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:40 2018 +0100
LOK: custom widgets: convert WidgetThemeLibrary to POD for ABI compatibility
Change-Id: Ibc425d8e630460547d66723ccabeaf4ac29d2719
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 8f08669254c6..44708bd30ee1 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -60,47 +60,43 @@ struct ControlDrawParameters
#define SAL_DLLPUBLIC_RTTI
#endif
-class SAL_DLLPUBLIC_RTTI WidgetThemeLibrary
+typedef struct _WidgetThemeLibrary WidgetThemeLibrary;
+
+struct _WidgetThemeLibrary
{
-public:
- WidgetThemeLibrary();
- virtual ~WidgetThemeLibrary();
+ uint32_t nSize;
- virtual bool isNativeControlSupported(ControlType eType, ControlPart ePart);
- virtual bool getRegion(ControlType eType, ControlPart ePart, ControlState eState,
- const tools::Rectangle& rBoundingControlRegion,
- tools::Rectangle& rNativeBoundingRegion,
- tools::Rectangle& rNativeContentRegion);
+ bool (*isNativeControlSupported)(ControlType eType, ControlPart ePart);
+ bool (*getRegion)(ControlType eType, ControlPart ePart, ControlState eState,
+ const tools::Rectangle& rBoundingControlRegion,
+ tools::Rectangle& rNativeBoundingRegion,
+ tools::Rectangle& rNativeContentRegion);
- virtual bool drawPushButton(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
- virtual bool drawRadiobutton(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
- virtual bool drawCheckbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawCombobox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawEditbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawScrollbar(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawSpinButtons(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
- virtual bool drawSpinbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawTabItem(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawTabPane(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawTabHeader(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawTabBody(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawSlider(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawFixedline(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawToolbar(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawProgress(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawWindowsBackground(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
- virtual bool drawListbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawFrame(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawListNode(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawListNet(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool drawListHeader(ControlDrawParameters const& rParameters, long nWidth,
- long nHeight);
+ bool (*drawPushButton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawRadiobutton)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawCheckbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawCombobox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawEditbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawScrollbar)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawSpinButtons)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawSpinbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawTabItem)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawTabPane)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawTabHeader)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawTabBody)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawSlider)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawFixedline)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawToolbar)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawProgress)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawWindowsBackground)(ControlDrawParameters const& rParameters, long nWidth,
+ long nHeight);
+ bool (*drawListbox)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawFrame)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawListNode)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawListNet)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ bool (*drawListHeader)(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
- virtual bool updateSettings(WidgetDrawStyle& rSettings);
+ bool (*updateSettings)(WidgetDrawStyle& rSettings);
};
extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary();
commit efe2b74aa3239654a518491c7e1648cf8a88d851
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Thu Nov 1 23:04:12 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:40 2018 +0100
LOK: custom themes: isolate LO internals headers from theme plugin
Change-Id: Ic189aecf092b9cffd800e410d2d6e88016c43052
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index f0128a230229..6f8857e5591e 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -17955,6 +17955,7 @@ vcl/inc/unx/x11_cursors/wsshow_curs.h
vcl/inc/unx/x11_cursors/wsshow_mask.h
vcl/inc/vcleventlisteners.hxx
vcl/inc/vclpluginapi.h
+vcl/inc/WidgetThemeLibraryTypes.hxx
vcl/inc/wall2.hxx
vcl/inc/win/DWriteTextRenderer.hxx
vcl/inc/win/ScopedHDC.hxx
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 38d52dedcfa2..d7eb359311a8 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -8,14 +8,13 @@
*
*/
+#include <cairo.h>
#include <headless/CustomWidgetDraw.hxx>
-#include <vcl/salnativewidgets.hxx>
#include <sal/main.h>
#include <sal/config.h>
#include <rtl/bootstrap.hxx>
#include <tools/svlibrary.h>
#include <osl/module.hxx>
-#include <cairo.h>
#include <svdata.hxx>
namespace vcl
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 59692de60012..8f08669254c6 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -11,10 +11,11 @@
#ifndef INCLUDED_VCL_INC_WIDGETTHEME_HXX
#define INCLUDED_VCL_INC_WIDGETTHEME_HXX
-#include <cairo.h>
-#include <vcl/dllapi.h>
-#include <vcl/salnativewidgets.hxx>
-#include <tools/color.hxx>
+/**
+ * This file expects cairo.h and the definition of
+ * the other types used here to be defined before
+ * including it.
+ */
namespace vcl
{
@@ -52,9 +53,13 @@ struct ControlDrawParameters
ControlState eState;
ButtonValue eButtonValue;
bool bIsStock;
- sal_Int64 nValue;
+ int64_t nValue;
};
+#ifndef SAL_DLLPUBLIC_RTTI
+#define SAL_DLLPUBLIC_RTTI
+#endif
+
class SAL_DLLPUBLIC_RTTI WidgetThemeLibrary
{
public:
diff --git a/vcl/inc/WidgetThemeLibraryTypes.hxx b/vcl/inc/WidgetThemeLibraryTypes.hxx
new file mode 100644
index 000000000000..a5a32109142d
--- /dev/null
+++ b/vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -0,0 +1,404 @@
+/* -*- 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/.
+ *
+ */
+
+#ifndef INCLUDED_VCL_INC_WIDGETTHEMETYPES_HXX
+#define INCLUDED_VCL_INC_WIDGETTHEMETYPES_HXX
+
+#include <cstdint>
+#include <type_traits>
+
+/**
+ * These types are all based on the supported variants
+ * vcl/salnativewidgets.hxx and must be kept in-sync.
+ **/
+
+/* Control Types:
+ *
+ * Specify the overall, whole control
+ * type (as opposed to parts of the
+ * control if it were composite).
+ */
+
+enum class ControlType {
+// for use in general purpose ImplControlValue
+ Generic = 0,
+// Normal PushButton/Command Button
+ Pushbutton = 1,
+// Normal single radio button
+ Radiobutton = 2,
+// Normal single checkbox
+ Checkbox = 10,
+// Combobox, i.e. a ListBox
+// that allows data entry by user
+ Combobox = 20,
+// Control that allows text entry
+ Editbox = 30,
+// Control that allows text entry, but without the usual border
+// Has to be handled separately, because this one cannot handle
+// ControlPart::HasBackgroundTexture, which is drawn in the edit box'es
+// border window.
+ EditboxNoBorder = 31,
+// Control that allows text entry
+// ( some systems distinguish between single and multi line edit boxes )
+ MultilineEditbox = 32,
+// Control that pops up a menu,
+// but does NOT allow data entry
+ Listbox = 35,
+// An edit field together with two little
+// buttons on the side (aka spin field)
+ Spinbox = 40,
+// Two standalone spin buttons
+// without an edit field
+ SpinButtons = 45,
+// A single tab
+ TabItem = 50,
+// The border around a tab area,
+// but without the tabs themselves.
+// May have a gap at the top for
+// the active tab
+ TabPane = 55,
+// The background to the tab area
+ TabHeader = 56,
+// Background of a Tab Pane
+ TabBody = 57,
+// Normal scrollbar, including
+// all parts like slider, buttons
+ Scrollbar = 60,
+ Slider = 65,
+// A separator line
+ Fixedline = 80,
+// A toolbar control with buttons and a grip
+ Toolbar = 100,
+// The menubar
+ Menubar = 120,
+// popup menu
+ MenuPopup = 121,
+ Progress = 131,
+// Progress bar for the intro window
+// (aka splash screen), in case some
+// wants native progress bar in the
+// application but not for the splash
+// screen (used in desktop/)
+ IntroProgress = 132,
+// tool tips
+ Tooltip = 140,
+// to draw the implemented theme
+ WindowBackground = 150,
+//to draw border of frames natively
+ Frame = 160,
+// for nodes in listviews
+// used in svtools/source/contnr/svtreebx.cxx
+ ListNode = 170,
+// nets between elements of listviews
+// with nodes
+ ListNet = 171,
+// for list headers
+ ListHeader = 172,
+};
+
+
+/* Control Parts:
+ *
+ * Uniquely identify a part of a control,
+ * for example the slider of a scroll bar.
+ */
+
+enum class ControlPart
+{
+ NONE = 0,
+ Entire = 1,
+ ListboxWindow = 5, // the static listbox window containing the list
+ Button = 100,
+ ButtonUp = 101,
+ ButtonDown = 102, // Also for ComboBoxes/ListBoxes
+ ButtonLeft = 103,
+ ButtonRight = 104,
+ AllButtons = 105,
+ SeparatorHorz = 106,
+ SeparatorVert = 107,
+ TrackHorzLeft = 200,
+ TrackVertUpper = 201,
+ TrackHorzRight = 202,
+ TrackVertLower = 203,
+ TrackHorzArea = 204,
+ TrackVertArea = 205,
+ Arrow = 220,
+ ThumbHorz = 210, // Also used as toolbar grip
+ ThumbVert = 211, // Also used as toolbar grip
+ MenuItem = 250,
+ MenuItemCheckMark = 251,
+ MenuItemRadioMark = 252,
+ Separator = 253,
+ SubmenuArrow = 254,
+
+/* #i77549#
+ HACK: for scrollbars in case of thumb rect, page up and page down rect we
+ abuse the HitTestNativeScrollbar interface. All theming engines but aqua
+ are actually able to draw the thumb according to our internal representation.
+ However aqua draws a little outside. The canonical way would be to enhance the
+ HitTestNativeScrollbar passing a ScrollbarValue additionally so all necessary
+ information is available in the call.
+ .
+ However since there is only this one small exception we will deviate a little and
+ instead pass the respective rect as control region to allow for a small correction.
+
+ So all places using HitTestNativeScrollbar on ControlPart::ThumbHorz, ControlPart::ThumbVert,
+ ControlPart::TrackHorzLeft, ControlPart::TrackHorzRight, ControlPart::TrackVertUpper, ControlPart::TrackVertLower
+ do not use the control rectangle as region but the actuall part rectangle, making
+ only small deviations feasible.
+*/
+
+/** The edit field part of a control, e.g. of the combo box.
+
+ Currently used just for combo boxes and just for GetNativeControlRegion().
+ It is valid only if GetNativeControlRegion() supports ControlPart::ButtonDown as
+ well.
+*/
+ SubEdit = 300,
+
+// For controls that require the entire background
+// to be drawn first, and then other pieces over top.
+// (GTK+ scrollbars for example). Control region passed
+// in to draw this part is expected to be the entire
+// area of the control.
+// A control may respond to one or both.
+ DrawBackgroundHorz = 1000,
+ DrawBackgroundVert = 1001,
+
+// GTK+ also draws tabs right->left since there is a
+// hardcoded 2 pixel overlap between adjacent tabs
+ TabsDrawRtl = 3000,
+
+// For themes that do not want to have the focus
+// rectangle part drawn by VCL but take care of the
+// whole inner control part by themselves
+// eg, listboxes or comboboxes or spinbuttons
+ HasBackgroundTexture = 4000,
+
+// For scrollbars that have 3 buttons (most KDE themes)
+ HasThreeButtons = 5000,
+
+ BackgroundWindow = 6000,
+ BackgroundDialog = 6001,
+
+//to draw natively the border of frames
+ Border = 7000,
+
+//to draw natively the focus rects
+ Focus = 8000
+};
+
+/* Control State:
+ *
+ * Specify how a particular part of the control
+ * is to be drawn. Constants are bitwise OR-ed
+ * together to compose a final drawing state.
+ * A _disabled_ state is assumed by the drawing
+ * functions until an ENABLED or HIDDEN is passed
+ * in the ControlState.
+ */
+enum class ControlState {
+ NONE = 0,
+ ENABLED = 0x0001,
+ FOCUSED = 0x0002,
+ PRESSED = 0x0004,
+ ROLLOVER = 0x0008,
+ DEFAULT = 0x0020,
+ SELECTED = 0x0040,
+ DOUBLEBUFFERING = 0x4000, ///< Set when the control is painted using double-buffering via VirtualDevice.
+ CACHING_ALLOWED = 0x8000, ///< Set when the control is completely visible (i.e. not clipped).
+};
+
+inline bool operator& (const ControlState& lhs, const ControlState& rhs)
+{
+ return static_cast<std::underlying_type<ControlState>::type>(lhs)
+ & static_cast<std::underlying_type<ControlState>::type>(rhs);
+}
+
+/* ButtonValue:
+ *
+ * Identifies the tri-state value options
+ * that buttons allow
+ */
+
+enum class ButtonValue {
+ DontKnow,
+ On,
+ Off,
+ Mixed
+};
+
+// Color types
+typedef uint32_t ColorData;
+
+constexpr ColorData RGB_COLORDATA(uint8_t r, uint8_t g, uint8_t b) {
+ return uint32_t(b) | (uint32_t(g) << 8) | (uint32_t(r) << 16);
+}
+
+#define COLORDATA_RED( n ) ((uint8_t)((n)>>16))
+#define COLORDATA_GREEN( n ) ((uint8_t)(((uint16_t)(n)) >> 8))
+#define COLORDATA_BLUE( n ) ((uint8_t)(n))
+#define COLORDATA_RGB( n ) ((ColorData)((n) & 0x00FFFFFF))
+
+#define COL_BLACK RGB_COLORDATA( 0x00, 0x00, 0x00 )
+#define COL_BLUE RGB_COLORDATA( 0x00, 0x00, 0x80 )
+#define COL_GREEN RGB_COLORDATA( 0x00, 0x80, 0x00 )
+#define COL_CYAN RGB_COLORDATA( 0x00, 0x80, 0x80 )
+#define COL_RED RGB_COLORDATA( 0x80, 0x00, 0x00 )
+#define COL_RED_FONTCOLOR RGB_COLORDATA( 0xCE, 0x18, 0x1E )
+#define COL_MAGENTA RGB_COLORDATA( 0x80, 0x00, 0x80 )
+#define COL_BROWN RGB_COLORDATA( 0x80, 0x80, 0x00 )
+#define COL_GRAY RGB_COLORDATA( 0x80, 0x80, 0x80 )
+#define COL_GRAY3 RGB_COLORDATA( 0xCC, 0xCC, 0xCC )
+#define COL_GRAY7 RGB_COLORDATA( 0x66, 0x66, 0x66 )
+#define COL_LIGHTGRAY RGB_COLORDATA( 0xC0, 0xC0, 0xC0 )
+#define COL_LIGHTBLUE RGB_COLORDATA( 0x00, 0x00, 0xFF )
+#define COL_LIGHTGREEN RGB_COLORDATA( 0x00, 0xFF, 0x00 )
+#define COL_LIGHTCYAN RGB_COLORDATA( 0x00, 0xFF, 0xFF )
+#define COL_LIGHTRED RGB_COLORDATA( 0xFF, 0x00, 0x00 )
+#define COL_LIGHTMAGENTA RGB_COLORDATA( 0xFF, 0x00, 0xFF )
+#define COL_LIGHTGRAYBLUE RGB_COLORDATA( 0xE0, 0xE0, 0xFF )
+#define COL_YELLOW RGB_COLORDATA( 0xFF, 0xFF, 0x00 )
+#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
+
+class SAL_DLLPUBLIC_EXPORT Color final
+{
+ ColorData mnColor;
+
+public:
+ explicit Color(ColorData nColor = COL_BLACK)
+ : mnColor(nColor)
+ {}
+ Color(uint8_t nRed, uint8_t nGreen, uint8_t nBlue)
+ : mnColor(RGB_COLORDATA(nRed, nGreen, nBlue))
+ {}
+
+ bool operator<(const Color& b) const
+ {
+ return mnColor < b.GetColor();
+ }
+
+ void SetColor(ColorData nColor)
+ {
+ mnColor = nColor;
+ }
+ ColorData GetColor() const
+ {
+ return mnColor;
+ }
+ ColorData GetRGBColor() const
+ {
+ return COLORDATA_RGB(mnColor);
+ }
+
+ bool operator==(const Color& rColor) const
+ {
+ return mnColor == rColor.mnColor;
+ }
+ bool operator!=(const Color& rColor) const
+ {
+ return !(Color::operator==(rColor));
+ }
+};
+
+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/CustomWidgetDraw.hxx b/vcl/inc/headless/CustomWidgetDraw.hxx
index 89082803abc3..d0ddcea430bc 100644
--- a/vcl/inc/headless/CustomWidgetDraw.hxx
+++ b/vcl/inc/headless/CustomWidgetDraw.hxx
@@ -12,7 +12,6 @@
#define INCLUDED_VCL_INC_CUSTOMWIDGETDRAW_HXX
#include <vcl/dllapi.h>
-#include <vcl/salnativewidgets.hxx>
#include <WidgetDrawInterface.hxx>
#include <WidgetThemeLibrary.hxx>
#include <headless/svpgdi.hxx>
commit f504413398d73095d913ed9f2d2ef87e854acc3c
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Oct 30 22:55:44 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:40 2018 +0100
LOK: custom widgets: draw focused listbox text in highlight colors
Change-Id: I8fc90458204d93044f7293f4bc74737debd72c23
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index e4c9cf363100..9c946ad09f73 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -2675,7 +2675,11 @@ void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout)
if( bNativeOK && (nState & ControlState::ROLLOVER) )
aColor = rStyleSettings.GetFieldRolloverTextColor();
else
+ {
aColor = rStyleSettings.GetHighlightTextColor();
+ rRenderContext.SetFillColor(rStyleSettings.GetHighlightColor());
+ }
+
rRenderContext.SetTextColor( aColor );
rRenderContext.DrawRect( maFocusRect );
}
commit 9c5bc82fdfa67d0149806a0b55962edc7925dd0f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Oct 30 18:46:07 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:39 2018 +0100
lok: custom widgets: render editbox borders
Change-Id: I1962a4a1397363b1c15e49d57b0bbcc9c232ce30
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 9588da8b6fe6..45006a407414 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -111,7 +111,7 @@ private:
SAL_DLLPRIVATE void ImplInsertText( const OUString& rStr, const Selection* pNewSelection = nullptr, bool bIsUserInput = false );
SAL_DLLPRIVATE static OUString ImplGetValidString( const OUString& rString );
SAL_DLLPRIVATE void ImplClearBackground(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRectangle, long nXStart, long nXEnd);
- SAL_DLLPRIVATE void ImplPaintBorder(vcl::RenderContext const & rRenderContext, long nXStart, long nXEnd);
+ SAL_DLLPRIVATE void ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, long nXEnd);
SAL_DLLPRIVATE void ImplShowCursor( bool bOnlyIfVisible = true );
SAL_DLLPRIVATE void ImplAlign();
SAL_DLLPRIVATE void ImplAlignAndPaint();
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 7560860de9de..38797d68c783 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -57,6 +57,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <comphelper/lok.hxx>
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
@@ -1000,7 +1001,7 @@ void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, const tools::
}
}
-void Edit::ImplPaintBorder(vcl::RenderContext const & rRenderContext, long nXStart, long nXEnd)
+void Edit::ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, long nXEnd)
{
// this is not needed when double-buffering
if (SupportsDoubleBuffering())
@@ -1062,7 +1063,17 @@ void Edit::ImplPaintBorder(vcl::RenderContext const & rRenderContext, long nXSta
}
else
{
- pBorder->Paint(*pBorder, tools::Rectangle());
+ // For some mysterious reaon, in headless/svp rendering,
+ // pBorder has bad clipping region (shows as 1x1 at 0,0),
+ // and therefore doesn't render anything at all.
+ // In the case that we know we're in headless/svp, we
+ // render directly on the current context (the edit control).
+ // But if we (the editbox) are part of a more complex control
+ // (e.g. spinbox), we render not (i.e. we let pBorder pretend).
+ if (!mbIsSubEdit && comphelper::LibreOfficeKit::isActive())
+ pBorder->Paint(rRenderContext, tools::Rectangle());
+ else
+ pBorder->Paint(*pBorder, tools::Rectangle());
}
}
}
commit e9f5fce4e514bd15094e8588e835325e5027c80a
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Oct 27 13:23:46 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:39 2018 +0100
custom widgets: rework colors and cleanup
Use ColorData for custom widget themes to
make it more readable and consistent.
Renamed and split out colors to be more accurately
named and representative of how they are used.
Fixed a number of inconsistencies in how colors
were used across widgets.
Change-Id: I1cbb5f19223bd55107379b049beccaf1de4e26b2
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index c428213c6000..38d52dedcfa2 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -334,7 +334,7 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetDialogTextColor(aStyle.maDialogTextColor);
aStyleSet.SetWorkspaceColor(Color(0xDF, 0xDF, 0xDE));
aStyleSet.SetMonoColor(Color(COL_BLACK));
- aStyleSet.SetFieldColor(Color(COL_WHITE));
+ aStyleSet.SetFieldColor(Color(aStyle.maFaceColor));
aStyleSet.SetFieldTextColor(Color(COL_BLACK));
aStyleSet.SetFieldRolloverTextColor(Color(COL_BLACK));
aStyleSet.SetActiveColor(Color(COL_BLUE));
@@ -349,10 +349,10 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetMenuBorderColor(Color(COL_LIGHTGRAY));
aStyleSet.SetMenuTextColor(Color(COL_BLACK));
aStyleSet.SetMenuBarTextColor(Color(COL_BLACK));
- aStyleSet.SetMenuBarRolloverTextColor(Color(COL_WHITE));
- aStyleSet.SetMenuBarHighlightTextColor(Color(COL_WHITE));
+ aStyleSet.SetMenuBarRolloverTextColor(Color(COL_BLACK));
+ aStyleSet.SetMenuBarHighlightTextColor(Color(COL_BLACK));
aStyleSet.SetMenuHighlightColor(aStyle.maHighlightColor);
- aStyleSet.SetMenuHighlightTextColor(Color(COL_WHITE));
+ aStyleSet.SetMenuHighlightTextColor(Color(COL_BLACK));
aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
aStyleSet.SetActiveTabColor(aStyle.maActiveTabColor);
commit a64bb41e2180818187563f92e0134eac459584fe
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Oct 27 10:53:43 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:38 2018 +0100
LOK: custom widgets: don't clobber the custom colors
The old logic threw away the result of updateSettings
by applying the styles saved and modified after calling
it, which lost all the custom colors thereby breaking
custom-widgets and themeing altogether.
Change-Id: Ic3750f145b67cd6a379f3b628a10c213a31656e7
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 835b77f39add..e9770392127f 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -437,13 +437,14 @@ void SvpSalFrame::UpdateSettings( AllSettings& rSettings )
}
bFreeGraphics = true;
}
+ rSettings.SetStyleSettings(aStyleSettings);
pGraphics->updateSettings(rSettings);
if (bFreeGraphics)
ReleaseGraphics(pGraphics);
}
-
- rSettings.SetStyleSettings( aStyleSettings );
+ else
+ rSettings.SetStyleSettings(aStyleSettings);
}
void SvpSalFrame::Beep()
commit c8ae3b1e9806cee83466087df989fc05d0c448f2
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Oct 27 10:50:44 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:38 2018 +0100
LOK: custom widgets: support custom menu colors
Change-Id: Icd6367fa40f9655cd58816461f0d2fca6f6932e2
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index bdae8cea8ade..c428213c6000 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -343,15 +343,15 @@ bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
aStyleSet.SetDeactiveColor(Color(COL_GRAY));
aStyleSet.SetDeactiveTextColor(Color(COL_LIGHTGRAY));
aStyleSet.SetDeactiveBorderColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuBarColor(Color(COL_LIGHTGRAY));
- aStyleSet.SetMenuBarRolloverColor(Color(COL_BLUE));
+ aStyleSet.SetMenuColor(Color(COL_WHITE));
+ aStyleSet.SetMenuBarColor(Color(COL_WHITE));
+ aStyleSet.SetMenuBarRolloverColor(aStyle.maHighlightColor);
aStyleSet.SetMenuBorderColor(Color(COL_LIGHTGRAY));
aStyleSet.SetMenuTextColor(Color(COL_BLACK));
aStyleSet.SetMenuBarTextColor(Color(COL_BLACK));
aStyleSet.SetMenuBarRolloverTextColor(Color(COL_WHITE));
aStyleSet.SetMenuBarHighlightTextColor(Color(COL_WHITE));
- aStyleSet.SetMenuHighlightColor(Color(COL_BLUE));
+ aStyleSet.SetMenuHighlightColor(aStyle.maHighlightColor);
aStyleSet.SetMenuHighlightTextColor(Color(COL_WHITE));
aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index c66510cf8f1a..7a6730c3ef49 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -21,6 +21,7 @@
#include "menuitemlist.hxx"
#include "menubarwindow.hxx"
+#include <salframe.hxx>
#include <svdata.hxx>
#include <vcl/decoview.hxx>
#include <vcl/settings.hxx>
@@ -135,8 +136,22 @@ void MenuFloatingWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{
FloatingWindow::ApplySettings(rRenderContext);
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ if (IsNativeControlSupported(ControlType::MenuPopup, ControlPart::MenuItem) &&
+ IsNativeControlSupported(ControlType::MenuPopup, ControlPart::Entire))
+ {
+ AllSettings aSettings(GetSettings());
+ ImplGetFrame()->UpdateSettings(aSettings); // Update theme colors.
+ StyleSettings aStyle(aSettings.GetStyleSettings());
+ Color aHighlightTextColor = ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor;
+ if (aHighlightTextColor != Color(COL_TRANSPARENT))
+ {
+ aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
+ }
+ aSettings.SetStyleSettings(aStyle);
+ OutputDevice::SetSettings(aSettings);
+ }
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
SetPointFont(rRenderContext, rStyleSettings.GetMenuFont());
if (rRenderContext.IsNativeControlSupported(ControlType::MenuPopup, ControlPart::Entire))
commit ef70918177d244a4e984f629a5856cca2ec9ac00
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Oct 14 20:06:13 2018 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:37 2018 +0100
custom widgets: correct focus colors and render button-up in listboxes
Change-Id: I70f46f94747f468a2bb79f8baa4576e4460bef31
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 5698f0ac34d8..bdae8cea8ade 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -53,9 +53,8 @@ CustomWidgetDraw::~CustomWidgetDraw() {}
bool CustomWidgetDraw::isNativeControlSupported(ControlType eType, ControlPart ePart)
{
- if (!s_pWidgetImplementation)
- return false;
- return s_pWidgetImplementation->isNativeControlSupported(eType, ePart);
+ return s_pWidgetImplementation
+ && s_pWidgetImplementation->isNativeControlSupported(eType, ePart);
}
bool CustomWidgetDraw::hitTestNativeControl(ControlType /*eType*/, ControlPart /*ePart*/,
@@ -302,11 +301,9 @@ bool CustomWidgetDraw::getNativeControlRegion(
ControlState eState, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
{
- if (!s_pWidgetImplementation)
- return false;
-
- return s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
- rNativeBoundingRegion, rNativeContentRegion);
+ return s_pWidgetImplementation
+ && s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
+ rNativeBoundingRegion, rNativeContentRegion);
}
bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
commit e08293b0d3c11f5299aa9236feaafdb7628da10e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Sep 20 00:12:25 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:37 2018 +0100
custom widgets: comment unused params. to avoid compile warnings
Change-Id: I45b7ffdce2d470ed2f30b5408d8d861deb00514a
diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx
index 5fa71d19eb0b..a7086023cad6 100644
--- a/vcl/source/gdi/salnativewidgets-none.cxx
+++ b/vcl/source/gdi/salnativewidgets-none.cxx
@@ -19,33 +19,33 @@
#include <salgdi.hxx>
-bool SalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart)
+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)
+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)
+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)
+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;
}
commit 241822e4ebba3bd7c6b8fc9cb1430eb939493d3c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Sep 20 00:06:52 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:36 2018 +0100
custom widgets: setup style setting in the widget library
Some theme colors are set using the style settings, which are
implemented by each backend to correspond to the system theme.
For custom widgets these need to also be set by the library
itself. This commit adds the ground work and sets some of the
colors for windows backgrounds.
Change-Id: Ia65b1605b2b7bef7f01ff1feff2e7470479e626a
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 5cf2ccf83f55..5698f0ac34d8 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -309,6 +309,76 @@ bool CustomWidgetDraw::getNativeControlRegion(
rNativeBoundingRegion, rNativeContentRegion);
}
+bool CustomWidgetDraw::updateSettings(AllSettings& rSettings)
+{
+ if (!s_pWidgetImplementation)
+ return false;
+
+ WidgetDrawStyle aStyle;
+
+ if (s_pWidgetImplementation->updateSettings(aStyle))
+ {
+ StyleSettings aStyleSet = rSettings.GetStyleSettings();
+
+ aStyleSet.SetFaceColor(aStyle.maFaceColor);
+ aStyleSet.SetCheckedColor(Color(0xCC, 0xCC, 0xCC));
+ aStyleSet.SetLightColor(aStyle.maLightColor);
+ aStyleSet.SetLightBorderColor(aStyle.maLightBorderColor);
+ aStyleSet.SetShadowColor(aStyle.maShadowColor);
+ aStyleSet.SetDarkShadowColor(aStyle.maDarkShadowColor);
+ aStyleSet.SetButtonTextColor(Color(COL_BLACK));
+ aStyleSet.SetButtonRolloverTextColor(Color(COL_BLACK));
+ aStyleSet.SetRadioCheckTextColor(Color(COL_BLACK));
+ aStyleSet.SetGroupTextColor(Color(COL_BLACK));
+ aStyleSet.SetLabelTextColor(Color(COL_BLACK));
+ aStyleSet.SetWindowColor(aStyle.maWindowColor);
+ aStyleSet.SetWindowTextColor(aStyle.maWindowTextColor);
+ aStyleSet.SetDialogColor(aStyle.maDialogColor);
+ aStyleSet.SetDialogTextColor(aStyle.maDialogTextColor);
+ aStyleSet.SetWorkspaceColor(Color(0xDF, 0xDF, 0xDE));
+ aStyleSet.SetMonoColor(Color(COL_BLACK));
+ aStyleSet.SetFieldColor(Color(COL_WHITE));
+ aStyleSet.SetFieldTextColor(Color(COL_BLACK));
+ aStyleSet.SetFieldRolloverTextColor(Color(COL_BLACK));
+ aStyleSet.SetActiveColor(Color(COL_BLUE));
+ aStyleSet.SetActiveTextColor(Color(COL_WHITE));
+ aStyleSet.SetActiveBorderColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetDeactiveColor(Color(COL_GRAY));
+ aStyleSet.SetDeactiveTextColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetDeactiveBorderColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetMenuColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetMenuBarColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetMenuBarRolloverColor(Color(COL_BLUE));
+ aStyleSet.SetMenuBorderColor(Color(COL_LIGHTGRAY));
+ aStyleSet.SetMenuTextColor(Color(COL_BLACK));
+ aStyleSet.SetMenuBarTextColor(Color(COL_BLACK));
+ aStyleSet.SetMenuBarRolloverTextColor(Color(COL_WHITE));
+ aStyleSet.SetMenuBarHighlightTextColor(Color(COL_WHITE));
+ aStyleSet.SetMenuHighlightColor(Color(COL_BLUE));
+ aStyleSet.SetMenuHighlightTextColor(Color(COL_WHITE));
+ aStyleSet.SetHighlightColor(aStyle.maHighlightColor);
+ aStyleSet.SetHighlightTextColor(aStyle.maHighlightTextColor);
+ aStyleSet.SetActiveTabColor(aStyle.maActiveTabColor);
+ aStyleSet.SetInactiveTabColor(aStyle.maInactiveTabColor);
+ aStyleSet.SetTabTextColor(Color(COL_BLACK));
+ aStyleSet.SetTabRolloverTextColor(Color(COL_BLACK));
+ aStyleSet.SetTabHighlightTextColor(Color(COL_BLACK));
+ aStyleSet.SetDisableColor(Color(COL_GRAY));
+ aStyleSet.SetHelpColor(Color(0xFF, 0xFF, 0xE0));
+ aStyleSet.SetHelpTextColor(Color(COL_BLACK));
+ aStyleSet.SetLinkColor(Color(COL_BLUE));
+ aStyleSet.SetVisitedLinkColor(Color(0x00, 0x00, 0xCC));
+ aStyleSet.SetToolTextColor(Color(COL_BLACK));
+ aStyleSet.SetFontColor(Color(COL_BLACK));
+
+ rSettings.SetStyleSettings(aStyleSet);
+
+ return true;
+ }
+
+ return false;
+}
+
} // end vcl namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 25419302dc5f..835b77f39add 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -424,6 +424,23 @@ void SvpSalFrame::UpdateSettings( AllSettings& rSettings )
aStdFont.SetFontSize(Size(0, 12));
aStyleSettings.SetMenuFont(aStdFont);
+
+ SvpSalGraphics* pGraphics = m_aGraphics.back();
+ bool bFreeGraphics = false;
+ if (!pGraphics)
+ {
+ pGraphics = dynamic_cast<SvpSalGraphics*>(AcquireGraphics());
+ if (!pGraphics)
+ {
+ SAL_WARN("vcl.gtk3", "Could not get graphics - unable to update settings");
+ return;
+ }
+ bFreeGraphics = true;
+ }
+ pGraphics->updateSettings(rSettings);
+
+ if (bFreeGraphics)
+ ReleaseGraphics(pGraphics);
}
rSettings.SetStyleSettings( aStyleSettings );
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 6d533e08641b..3e409a3763bb 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1541,6 +1541,13 @@ bool SvpSalGraphics::getNativeControlRegion(ControlType eType, ControlPart ePart
return false;
}
+void SvpSalGraphics::updateSettings(AllSettings& rSettings)
+{
+ if (hasWidgetDraw())
+ {
+ m_pWidgetDraw->updateSettings(rSettings);
+ }
+}
namespace
{
diff --git a/vcl/inc/WidgetDrawInterface.hxx b/vcl/inc/WidgetDrawInterface.hxx
index ce6c5d43babe..4d1ecce7a3fe 100644
--- a/vcl/inc/WidgetDrawInterface.hxx
+++ b/vcl/inc/WidgetDrawInterface.hxx
@@ -12,6 +12,8 @@
#define INCLUDED_VCL_INC_WIDGETDRAWINTERFACE_HXX
#include <vcl/dllapi.h>
+#include <vcl/salnativewidgets.hxx>
+#include <vcl/settings.hxx>
namespace vcl
{
@@ -91,6 +93,8 @@ public:
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion)
= 0;
+
+ virtual bool updateSettings(AllSettings& rSettings) = 0;
};
}
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 7d38112130c8..59692de60012 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -14,9 +14,27 @@
#include <cairo.h>
#include <vcl/dllapi.h>
#include <vcl/salnativewidgets.hxx>
+#include <tools/color.hxx>
namespace vcl
{
+struct WidgetDrawStyle
+{
+ Color maFaceColor;
+ Color maLightColor;
+ Color maLightBorderColor;
+ Color maShadowColor;
+ Color maDarkShadowColor;
+ Color maHighlightColor;
+ Color maHighlightTextColor;
+ Color maActiveTabColor;
+ Color maInactiveTabColor;
+ Color maWindowColor;
+ Color maWindowTextColor;
+ Color maDialogColor;
+ Color maDialogTextColor;
+};
+
struct ControlDrawParameters
{
ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState)
@@ -76,6 +94,8 @@ public:
virtual bool drawListNet(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawListHeader(ControlDrawParameters const& rParameters, long nWidth,
long nHeight);
+
+ virtual bool updateSettings(WidgetDrawStyle& rSettings);
};
extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary();
diff --git a/vcl/inc/headless/CustomWidgetDraw.hxx b/vcl/inc/headless/CustomWidgetDraw.hxx
index ce749ac15b63..89082803abc3 100644
--- a/vcl/inc/headless/CustomWidgetDraw.hxx
+++ b/vcl/inc/headless/CustomWidgetDraw.hxx
@@ -16,6 +16,7 @@
#include <WidgetDrawInterface.hxx>
#include <WidgetThemeLibrary.hxx>
#include <headless/svpgdi.hxx>
+#include <vcl/settings.hxx>
#include <memory>
namespace vcl
@@ -45,6 +46,8 @@ public:
const ImplControlValue& aValue, const OUString& aCaption,
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion) override;
+
+ bool updateSettings(AllSettings& rSettings) override;
};
} // end vcl namespace
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 1cf6f1556d4e..0c834a0a158a 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -248,6 +248,8 @@ public:
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion) override;
+ virtual void updateSettings(AllSettings& rSettings);
+
#if ENABLE_CAIRO_CANVAS
virtual bool SupportsCairo() const override;
virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index fc896db7f913..99d656ee1eec 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -115,6 +115,9 @@ public:
const OUString& rCaption,
tools::Rectangle &rNativeBoundingRegion,
tools::Rectangle &rNativeContentRegion ) override;
+
+ virtual void updateSettings(AllSettings& rSettings) override;
+
#if ENABLE_CAIRO_CANVAS
virtual bool SupportsCairo() const override;
@@ -125,7 +128,6 @@ public:
void WidgetQueueDraw() const;
- void updateSettings( AllSettings& rSettings );
static void refreshFontconfig( GtkSettings *pSettings );
static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 9259ee36c63b..95c9cf73df15 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2873,8 +2873,14 @@ static vcl::Font getFont(GtkStyleContext* pStyle, const css::lang::Locale& rLoca
return aFont;
}
-void GtkSalGraphics::updateSettings( AllSettings& rSettings )
+void GtkSalGraphics::updateSettings(AllSettings& rSettings)
{
+ if (m_pWidgetDraw)
+ {
+ m_pWidgetDraw->updateSettings(rSettings);
+ return;
+ }
+
GtkStyleContext* pStyle = gtk_widget_get_style_context( mpWindow );
GtkSettings* pSettings = gtk_widget_get_settings( mpWindow );
StyleSettings aStyleSet = rSettings.GetStyleSettings();
commit 24e772ebe8dbc2cb1a25fade6a02270e96e2663f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Sep 11 22:35:12 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:36 2018 +0100
custom widgets: draw fixed line widget
Change-Id: Icb8cfbe09caf5cbfcf1d3f461c297c052056250d
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index aa4732c1bd05..5cf2ccf83f55 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -236,7 +236,10 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
}
break;
case ControlType::Fixedline:
- break;
+ {
+ bOK = s_pWidgetImplementation->drawFixedline(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::Toolbar:
{
bOK = s_pWidgetImplementation->drawToolbar(aParameters, nWidth, nHeight);
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 19249d498034..7d38112130c8 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -65,6 +65,7 @@ public:
virtual bool drawTabHeader(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawTabBody(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawSlider(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawFixedline(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawToolbar(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawProgress(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawWindowsBackground(ControlDrawParameters const& rParameters, long nWidth,
commit 5182b8aa2d4531afb7e9229ddab5e0b45b31a3f0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Sep 11 17:35:08 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:36 2018 +0100
custom widgets: differentiate stock and non-stock buttons
Change-Id: I05f01058d7886dacec3b00dcf31313aea3939164
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 37088f6aa968..aa4732c1bd05 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -96,6 +96,9 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
break;
case ControlType::Pushbutton:
{
+ const PushButtonValue* pPushButtonValue = static_cast<const PushButtonValue*>(&rValue);
+ if (pPushButtonValue)
+ aParameters.bIsStock = pPushButtonValue->mbIsStock;
bOK = s_pWidgetImplementation->drawPushButton(aParameters, nWidth, nHeight);
}
break;
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 53d5e5769ffa..19249d498034 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -24,6 +24,7 @@ struct ControlDrawParameters
, ePart(i_ePart)
, eState(i_eState)
, eButtonValue(ButtonValue::DontKnow)
+ , bIsStock(false)
, nValue(0)
{
}
@@ -32,6 +33,7 @@ struct ControlDrawParameters
ControlPart ePart;
ControlState eState;
ButtonValue eButtonValue;
+ bool bIsStock;
sal_Int64 nValue;
};
commit 9c8eee81496485f040eede8a76d43613dc5b4d14
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Sep 11 17:29:20 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:35 2018 +0100
vcl: mark stock buttons and transfer this to NWF on drawing
Stock buttons like OK/Cancel/Help need sometimes to be drawn
differently than just another button. For this we need to mark
such push buttons as "stock" when building them from a glade file
and transfer this information down to the NWF backend when drawing
the widget.
Change-Id: I131657f026a731208db47f4c8220622c8aabb464
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index 3a4159d35392..b2e8a6223db9 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -163,6 +163,16 @@ public:
virtual bool set_property(const OString &rKey, const OUString &rValue) override;
virtual void ShowFocus(const tools::Rectangle& rRect) override;
+ void setStock(bool bIsStock)
+ {
+ mbIsStock = bIsStock;
+ }
+
+ bool isStock()
+ {
+ return mbIsStock;
+ }
+
protected:
PushButtonDropdownStyle mnDDStyle;
bool mbIsActive;
@@ -198,6 +208,7 @@ private:
SymbolType meSymbol;
TriState meState;
bool mbPressed;
+ bool mbIsStock;
};
inline void PushButton::Check( bool bCheck )
diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 46ffc48f799b..0caa4b880fdf 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -455,13 +455,18 @@ class VCL_DLLPUBLIC PushButtonValue : public ImplControlValue
{
public:
PushButtonValue()
- : ImplControlValue( ControlType::Pushbutton, 0 )
- , mbBevelButton( false ), mbSingleLine( true ) {}
+ : ImplControlValue( ControlType::Pushbutton, 0 )
+ , mbBevelButton(false)
+ , mbSingleLine(true)
+ , mbIsStock(false)
+ {}
+
virtual ~PushButtonValue() override;
virtual PushButtonValue* clone() const override;
- bool mbBevelButton:1; // only used on OSX
- bool mbSingleLine:1; // only used on OSX
+ bool mbBevelButton:1; // only used on OSX
+ bool mbSingleLine:1; // only used on OSX
+ bool mbIsStock:1;
};
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index a4948e6c833a..c67569c6dfb3 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -627,6 +627,7 @@ void PushButton::ImplInitPushButtonData()
mnDDStyle = PushButtonDropdownStyle::NONE;
mbIsActive = false;
mbPressed = false;
+ mbIsStock = false;
}
namespace
@@ -1027,6 +1028,8 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
if (bNativeOK)
{
PushButtonValue aControlValue;
+ aControlValue.mbIsStock = isStock();
+
tools::Rectangle aCtrlRegion(aInRect);
ControlState nState = ControlState::NONE;
@@ -1672,7 +1675,8 @@ void PushButton::ShowFocus(const tools::Rectangle& rRect)
{
if (IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Focus))
{
- ImplControlValue aControlValue;
+ PushButtonValue aControlValue;
+ aControlValue.mbIsStock = isStock();
tools::Rectangle aInRect(Point(), GetOutputSizePixel());
GetOutDev()->DrawNativeControl(ControlType::Pushbutton, ControlPart::Focus, aInRect,
ControlState::FOCUSED, aControlValue, OUString());
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index c5cd39b18f8f..8af60681afb1 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -804,6 +804,9 @@ namespace
xWindow = VclPtr<PushButton>::Create(pParent, nBits);
xWindow->SetText(getStockText(sType));
}
+ PushButton* pPushButton = dynamic_cast<PushButton*>(xWindow.get());
+ if (pPushButton)
+ pPushButton->setStock(true);
}
if (!xWindow)
commit 9825276cbc20e89cc0e715aed6c6f642a0296754
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Sep 10 12:01:06 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:35 2018 +0100
custom widgets: editbox - draw focus rectangle
Change-Id: I5d038d165d5ff08a07d24906f6a7cc2d6176f1ac
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 22d2678b57a1..37088f6aa968 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -16,6 +16,7 @@
#include <tools/svlibrary.h>
#include <osl/module.hxx>
#include <cairo.h>
+#include <svdata.hxx>
namespace vcl
{
@@ -37,6 +38,14 @@ CustomWidgetDraw::CustomWidgetDraw(SvpSalGraphics& rGraphics)
if (fCreateWidgetThemeLibraryFunction)
s_pWidgetImplementation = (*fCreateWidgetThemeLibraryFunction)();
+
+ // Init
+ if (s_pWidgetImplementation)
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maNWFData.mbNoFocusRects = true;
+ pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
+ }
}
}
commit 220dfb3ad11db0ca85ddbbc1c4800f9e65a85721
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Sep 3 15:15:43 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:35 2018 +0100
custom widgets: return early when the widget lib is not available
Change-Id: I1d740b4a3840f73015f34bd2143663a919db2956
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index ef1a0a053033..22d2678b57a1 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -44,6 +44,8 @@ CustomWidgetDraw::~CustomWidgetDraw() {}
bool CustomWidgetDraw::isNativeControlSupported(ControlType eType, ControlPart ePart)
{
+ if (!s_pWidgetImplementation)
+ return false;
return s_pWidgetImplementation->isNativeControlSupported(eType, ePart);
}
@@ -59,7 +61,7 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
ControlState eState, const ImplControlValue& rValue,
const OUString& /*aCaptions*/)
{
- if (s_pWidgetImplementation == nullptr)
+ if (!s_pWidgetImplementation)
return false;
bool bOldAA = m_rGraphics.getAntiAliasB2DDraw();
@@ -285,7 +287,7 @@ bool CustomWidgetDraw::getNativeControlRegion(
ControlState eState, const ImplControlValue& /*aValue*/, const OUString& /*aCaption*/,
tools::Rectangle& rNativeBoundingRegion, tools::Rectangle& rNativeContentRegion)
{
- if (s_pWidgetImplementation == nullptr)
+ if (!s_pWidgetImplementation)
return false;
return s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
commit 4fe5abbe2a5a71885b343c1399cca0fdd875e7ac
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Jul 19 11:51:14 2018 +0300
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:34 2018 +0100
Avoid gcc: "specified bound depends on the length of the source argument"
Just use memcpy().
Change-Id: Icb705acb6c12baf28684c763a77da7abc514ea6d
Reviewed-on: https://gerrit.libreoffice.org/57714
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml at collabora.com>
(cherry picked from commit efe42fca7c386340575088ecf94952f3ba0447de)
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 91c30729c7cc..5c600b5022bf 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -201,7 +201,7 @@ static void *lok_dlopen( const char *install_path, char ** _imp_lib )
return NULL;
}
- strncpy(imp_lib, install_path, imp_lib_size);
+ memcpy(imp_lib, install_path, partial_length);
extendUnoPath(install_path);
commit 0275e44d62ec53ceb6e6640977d1a730ae9163b6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Aug 31 10:09:27 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:34 2018 +0100
custom widgets: enable anti-aliasing when drawing widgets
Change-Id: I050d8534cacdee63109158dbc150d9d13b43fe5e
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index ab4dec19b44e..ef1a0a053033 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -62,7 +62,10 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
if (s_pWidgetImplementation == nullptr)
return false;
- cairo_t* pCairoContext = m_rGraphics.getCairoContext(true);
+ bool bOldAA = m_rGraphics.getAntiAliasB2DDraw();
+ m_rGraphics.setAntiAliasB2DDraw(true);
+
+ cairo_t* pCairoContext = m_rGraphics.getCairoContext(false);
m_rGraphics.clipRegion(pCairoContext);
cairo_translate(pCairoContext, rControlRegion.Left(), rControlRegion.Top());
@@ -272,6 +275,8 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
m_rGraphics.releaseCairoContext(pCairoContext, true, aExtents);
+ m_rGraphics.setAntiAliasB2DDraw(bOldAA);
+
return bOK;
}
commit a2a49146cded46fb89f1a2a28e4c2aa838c2e48d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Aug 30 23:34:09 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:34 2018 +0100
custom widgets: get the region from the lib. + custom tab width
This implements getting the region rectangle from the widget
library so it is possible to redefine the size of the widgets if
needed.
Additionally increase a tab width which are too small by default.
Change-Id: If662c44e02631715efd137ecbfc4a5770fa9f6ab
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index a512a62bb178..ab4dec19b44e 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -275,15 +275,16 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
return bOK;
}
-bool CustomWidgetDraw::getNativeControlRegion(ControlType /*eType*/, ControlPart /*ePart*/,
- const tools::Rectangle& /*rBoundingControlRegion*/,
- ControlState /*eState*/,
- const ImplControlValue& /*aValue*/,
- const OUString& /*aCaption*/,
- tools::Rectangle& /*rNativeBoundingRegion*/,
- tools::Rectangle& /*rNativeContentRegion*/)
+bool CustomWidgetDraw::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;
+ if (s_pWidgetImplementation == nullptr)
+ return false;
+
+ return s_pWidgetImplementation->getRegion(eType, ePart, eState, rBoundingControlRegion,
+ rNativeBoundingRegion, rNativeContentRegion);
}
} // end vcl namespace
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 6d4ab9dde196..53d5e5769ffa 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -42,6 +42,10 @@ public:
virtual ~WidgetThemeLibrary();
virtual bool isNativeControlSupported(ControlType eType, ControlPart ePart);
+ virtual bool getRegion(ControlType eType, ControlPart ePart, ControlState eState,
+ const tools::Rectangle& rBoundingControlRegion,
+ tools::Rectangle& rNativeBoundingRegion,
+ tools::Rectangle& rNativeContentRegion);
virtual bool drawPushButton(ControlDrawParameters const& rParameters, long nWidth,
long nHeight);
commit 26a620c8508cfdb5577b7a737b4ea0577555f4af
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 13:33:01 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:33 2018 +0100
custom widgets: add Toolbar widget
Change-Id: Ia4efe711c07213f2edf472602c5b2acc81876906
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 81a51b074e10..a512a62bb178 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -221,7 +221,10 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
case ControlType::Fixedline:
break;
case ControlType::Toolbar:
- break;
+ {
+ bOK = s_pWidgetImplementation->drawToolbar(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::Menubar:
break;
case ControlType::MenuPopup:
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index 1db8d62a68f1..6d4ab9dde196 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -59,6 +59,7 @@ public:
virtual bool drawTabHeader(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawTabBody(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawSlider(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawToolbar(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawProgress(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawWindowsBackground(ControlDrawParameters const& rParameters, long nWidth,
long nHeight);
commit f45a8947a68de259f5e67492b6e1bebbab295373
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 11:58:01 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:33 2018 +0100
custom widgets: add List widget - ListNode, ListWidget
also added ListNet as noop
Change-Id: I033f908a8fc9ce9ec4b3d202e1299f7c0a9cad6c
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 7c2a0c225be9..81a51b074e10 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -247,11 +247,21 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
}
break;
case ControlType::ListNode:
- break;
+ {
+ aParameters.eButtonValue = rValue.getTristateVal();
+ bOK = s_pWidgetImplementation->drawListNode(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::ListNet:
- break;
+ {
+ bOK = s_pWidgetImplementation->drawListNet(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::ListHeader:
- break;
+ {
+ bOK = s_pWidgetImplementation->drawListHeader(aParameters, nWidth, nHeight);
+ }
+ break;
}
basegfx::B2DRange aExtents(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.Right(),
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index ee3c86fc45ac..1db8d62a68f1 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -64,6 +64,10 @@ public:
long nHeight);
virtual bool drawListbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawFrame(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawListNode(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawListNet(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawListHeader(ControlDrawParameters const& rParameters, long nWidth,
+ long nHeight);
};
extern "C" vcl::WidgetThemeLibrary* CreateWidgetThemeLibrary();
commit 4a82ae05c5fe9543055fa2ec54405a907de17725
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 11:07:48 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:32 2018 +0100
custom widgets: add Progress widget
Change-Id: I573a6c28f5ddb538ca3b0abf15197695fc113802
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index eaf1c3cae53a..7c2a0c225be9 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -227,7 +227,11 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
case ControlType::MenuPopup:
break;
case ControlType::Progress:
- break;
+ {
+ aParameters.nValue = rValue.getNumericVal();
+ bOK = s_pWidgetImplementation->drawProgress(aParameters, nWidth, nHeight);
+ }
+ break;
case ControlType::IntroProgress:
break;
case ControlType::Tooltip:
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index c99b2799b02f..ee3c86fc45ac 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -59,6 +59,7 @@ public:
virtual bool drawTabHeader(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawTabBody(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawSlider(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
+ virtual bool drawProgress(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
virtual bool drawWindowsBackground(ControlDrawParameters const& rParameters, long nWidth,
long nHeight);
virtual bool drawListbox(ControlDrawParameters const& rParameters, long nWidth, long nHeight);
commit 2a1561c2fc62ac620ac4e727be858fd096f49900
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 10:54:31 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:32 2018 +0100
vcl: simplify ControlDrawParameters construction, add nValue
Don't require eButtonValue as a constructor parameter as it mostly
isn't necessary and required.
In addition add nValue instance variable.
Change-Id: I927714f715fce1549d87cec633330a0dc313f569
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index e403d429bbb0..eaf1c3cae53a 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -72,7 +72,7 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
bool bOK = false;
- ControlDrawParameters aParameters{ pCairoContext, ePart, eState, ButtonValue::DontKnow };
+ ControlDrawParameters aParameters{ pCairoContext, ePart, eState };
switch (eType)
{
@@ -134,8 +134,7 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
ControlPart downBtnPart = pSpinVal->mnLowerPart;
ControlState downBtnState = pSpinVal->mnLowerState;
{
- ControlDrawParameters aParametersUp{ pCairoContext, upBtnPart, upBtnState,
- ButtonValue::DontKnow };
+ ControlDrawParameters aParametersUp{ pCairoContext, upBtnPart, upBtnState };
cairo_save(pCairoContext);
cairo_translate(pCairoContext,
pSpinVal->maUpperRect.Left() - rControlRegion.Left(),
@@ -148,8 +147,8 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
if (bOK)
{
- ControlDrawParameters aParametersDown{ pCairoContext, downBtnPart, downBtnState,
- ButtonValue::DontKnow };
+ ControlDrawParameters aParametersDown{ pCairoContext, downBtnPart,
+ downBtnState };
cairo_save(pCairoContext);
cairo_translate(pCairoContext,
pSpinVal->maLowerRect.Left() - rControlRegion.Left(),
@@ -207,8 +206,7 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
const SliderValue* pSliderValue = static_cast<const SliderValue*>(&rValue);
ControlDrawParameters aParametersButton{ pCairoContext, ControlPart::Button,
- eState | pSliderValue->mnThumbState,
- ButtonValue::DontKnow };
+ eState | pSliderValue->mnThumbState };
cairo_save(pCairoContext);
cairo_translate(pCairoContext,
pSliderValue->maThumbRect.Left() - rControlRegion.Left(),
diff --git a/vcl/inc/WidgetThemeLibrary.hxx b/vcl/inc/WidgetThemeLibrary.hxx
index b4e78c7e515d..c99b2799b02f 100644
--- a/vcl/inc/WidgetThemeLibrary.hxx
+++ b/vcl/inc/WidgetThemeLibrary.hxx
@@ -19,12 +19,12 @@ namespace vcl
{
struct ControlDrawParameters
{
- ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState,
- ButtonValue i_eButtonValue)
+ ControlDrawParameters(cairo_t* i_pCairo, ControlPart i_ePart, ControlState i_eState)
: pCairo(i_pCairo)
, ePart(i_ePart)
, eState(i_eState)
- , eButtonValue(i_eButtonValue)
+ , eButtonValue(ButtonValue::DontKnow)
+ , nValue(0)
{
}
@@ -32,6 +32,7 @@ struct ControlDrawParameters
ControlPart ePart;
ControlState eState;
ButtonValue eButtonValue;
+ sal_Int64 nValue;
};
class SAL_DLLPUBLIC_RTTI WidgetThemeLibrary
commit 58a1002d725a26191a1eb0bddf577c261b944506
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Aug 27 00:14:34 2018 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Nov 8 09:14:31 2018 +0100
custom widgets: add Slider widget
Change-Id: Ie2192edfcfc49a1953059c5947b8ea7bb03a3c7d
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index 4838d174f30c..e403d429bbb0 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -197,7 +197,29 @@ bool CustomWidgetDraw::drawNativeControl(ControlType eType, ControlPart ePart,
}
break;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list