From 79b9d3875fd454722d723f6c68be390f7eca60df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Thu, 7 Mar 2019 14:00:16 +0100 Subject: [PATCH] widget theme - update scrollbars, draw from svg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7e7cd05ce516ab24d380bb8b6a264fd45e1d553c Reviewed-on: https://gerrit.libreoffice.org/68864 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/Package_theme_definitions.mk | 2 ++ vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 31 +++++++++++++++++-- vcl/uiconfig/theme_definitions/definition.xml | 14 ++++----- .../scrollbar-horizontal.svgx | 4 +++ .../theme_definitions/scrollbar-vertical.svgx | 4 +++ 5 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 vcl/uiconfig/theme_definitions/scrollbar-horizontal.svgx create mode 100644 vcl/uiconfig/theme_definitions/scrollbar-vertical.svgx diff --git a/vcl/Package_theme_definitions.mk b/vcl/Package_theme_definitions.mk index 4dc31caf9b5a..b51f60555165 100644 --- a/vcl/Package_theme_definitions.mk +++ b/vcl/Package_theme_definitions.mk @@ -40,6 +40,8 @@ $(eval $(call gb_Package_add_files,vcl_theme_definitions,$(LIBO_SHARE_FOLDER)/th tabitem-first-selected.svgx \ tabitem-middle-selected.svgx \ tabitem-last-selected.svgx \ + scrollbar-horizontal.svgx \ + scrollbar-vertical.svgx \ )) # vim: set noet sw=4 ts=4: diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index 33d139e1fc21..0067fed75954 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -203,9 +203,16 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, SalGraphics& rGraphics aPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix( -aPolyPolygonRange.getMinX(), -aPolyPolygonRange.getMinY())); - aPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix( - aFinalRectangle.getWidth() / aPolyPolygonRange.getWidth(), - aFinalRectangle.getHeight() / aPolyPolygonRange.getHeight())); + + double fScaleX = 1.0; + double fScaleY = 1.0; + if (aPolyPolygonRange.getWidth() > 0.0) + fScaleX = aFinalRectangle.getWidth() / aPolyPolygonRange.getWidth(); + if (aPolyPolygonRange.getHeight() > 0.0) + fScaleY = aFinalRectangle.getHeight() / aPolyPolygonRange.getHeight(); + + aPolyPolygon.transform(basegfx::utils::createScaleB2DHomMatrix(fScaleX, fScaleY)); + aPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix( aFinalRectangle.getMinX() - 0.5, aFinalRectangle.getMinY() - 0.5)); @@ -698,6 +705,24 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion( rNativeContentRegion = rBoundingControlRegion; return true; } + break; + case ControlType::Scrollbar: + { + if (ePart == ControlPart::ButtonUp || ePart == ControlPart::ButtonDown + || ePart == ControlPart::ButtonLeft || ePart == ControlPart::ButtonRight) + { + rNativeContentRegion = tools::Rectangle(aLocation, Size(0, 0)); + rNativeBoundingRegion = rNativeContentRegion; + return true; + } + else + { + rNativeBoundingRegion = rBoundingControlRegion; + rNativeContentRegion = rNativeBoundingRegion; + return true; + } + } + break; default: break; diff --git a/vcl/uiconfig/theme_definitions/definition.xml b/vcl/uiconfig/theme_definitions/definition.xml index 90ffbc32ca06..99df7524b8d2 100644 --- a/vcl/uiconfig/theme_definitions/definition.xml +++ b/vcl/uiconfig/theme_definitions/definition.xml @@ -227,14 +227,12 @@ - - + - - + @@ -247,22 +245,22 @@ - + - + - + - + diff --git a/vcl/uiconfig/theme_definitions/scrollbar-horizontal.svgx b/vcl/uiconfig/theme_definitions/scrollbar-horizontal.svgx new file mode 100644 index 000000000000..4bdcd409dc20 --- /dev/null +++ b/vcl/uiconfig/theme_definitions/scrollbar-horizontal.svgx @@ -0,0 +1,4 @@ + + + + diff --git a/vcl/uiconfig/theme_definitions/scrollbar-vertical.svgx b/vcl/uiconfig/theme_definitions/scrollbar-vertical.svgx new file mode 100644 index 000000000000..b4a885d9138d --- /dev/null +++ b/vcl/uiconfig/theme_definitions/scrollbar-vertical.svgx @@ -0,0 +1,4 @@ + + + +