From d125024874da5d22abf0d60b8a13c355effff495 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 6 Jun 2021 16:18:22 +0100 Subject: gtk4: set same use-underline on inserted GtkLabel as parent GtkButton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6618433faf2379bfadf7a257e394785360d07526 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116760 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/unx/gtk4/convert3to4.cxx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx index da0ef100a6ef..88d3de723d39 100644 --- a/vcl/unx/gtk4/convert3to4.cxx +++ b/vcl/unx/gtk4/convert3to4.cxx @@ -257,15 +257,17 @@ struct ConvertResult bool m_bHasVisible; bool m_bHasSymbolicIconName; bool m_bAlwaysShowImage; + bool m_bUseUnderline; css::uno::Reference m_xPropertyLabel; ConvertResult(bool bChildCanFocus, bool bHasVisible, bool bHasSymbolicIconName, - bool bAlwaysShowImage, + bool bAlwaysShowImage, bool bUseUnderline, const css::uno::Reference& rPropertyLabel) : m_bChildCanFocus(bChildCanFocus) , m_bHasVisible(bHasVisible) , m_bHasSymbolicIconName(bHasSymbolicIconName) , m_bAlwaysShowImage(bAlwaysShowImage) + , m_bUseUnderline(bUseUnderline) , m_xPropertyLabel(rPropertyLabel) { } @@ -281,7 +283,7 @@ ConvertResult Convert3To4(const css::uno::Reference& xNode { css::uno::Reference xNodeList = xNode->getChildNodes(); if (!xNodeList.is()) - return ConvertResult(false, false, false, false, nullptr); + return ConvertResult(false, false, false, false, false, nullptr); std::vector> xRemoveList; @@ -290,6 +292,7 @@ ConvertResult Convert3To4(const css::uno::Reference& xNode bool bHasVisible = false; bool bHasSymbolicIconName = false; bool bAlwaysShowImage = false; + bool bUseUnderline = false; css::uno::Reference xPropertyLabel; css::uno::Reference xCantFocus; @@ -487,6 +490,9 @@ ConvertResult Convert3To4(const css::uno::Reference& xNode } } + if (sName == "use-underline") + bUseUnderline = toBool(xChild->getFirstChild()->getNodeValue()); + if (sName == "relief") { if (GetParentObjectType(xChild) == "GtkToggleButton" @@ -759,6 +765,7 @@ ConvertResult Convert3To4(const css::uno::Reference& xNode bool bChildHasSymbolicIconName = false; bool bChildHasVisible = false; bool bChildAlwaysShowImage = false; + bool bChildUseUnderline = false; css::uno::Reference xChildPropertyLabel; if (xChild->hasChildNodes()) { @@ -774,6 +781,7 @@ ConvertResult Convert3To4(const css::uno::Reference& xNode bChildHasVisible = aChildRes.m_bHasVisible; bChildHasSymbolicIconName = aChildRes.m_bHasSymbolicIconName; bChildAlwaysShowImage = aChildRes.m_bAlwaysShowImage; + bChildUseUnderline = aChildRes.m_bUseUnderline; xChildPropertyLabel = aChildRes.m_xPropertyLabel; } } @@ -1030,6 +1038,11 @@ ConvertResult Convert3To4(const css::uno::Reference& xNode if (xChildPropertyLabel) xNewChildObjectNode->appendChild( xChildPropertyLabel->getParentNode()->removeChild(xChildPropertyLabel)); + if (bChildUseUnderline) + { + auto xUseUnderline = CreateProperty(xDoc, "use-underline", "True"); + xNewChildObjectNode->appendChild(xUseUnderline); + } xNewLabelChildNode->appendChild(xNewChildObjectNode); if (xImageCandidateNode) @@ -1048,7 +1061,7 @@ ConvertResult Convert3To4(const css::uno::Reference& xNode xNode->removeChild(xRemove); return ConvertResult(bChildCanFocus, bHasVisible, bHasSymbolicIconName, bAlwaysShowImage, - xPropertyLabel); + bUseUnderline, xPropertyLabel); } } -- cgit