diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-06-15 20:58:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-06-16 09:54:32 +0200 |
commit | 01e4acd1dc3bfedb9c37b4b9bb93be1201b475a5 (patch) | |
tree | 654412f858ce350a9037a1d5f4a6bed3cb115303 /vcl | |
parent | ecdb4b2ca8a55b8b2d077cabd930964a41624736 (diff) |
gtk4: use xalign to position replacement box
insert, section the "pick button" in color subtab of background as an
example of a horizontally centered case
and
format, watermark, color dropdown "custom color" as a left aligned
example.
Change-Id: Id318b5acec44ceccaed5875e4f747968225bdd78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117278
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk4/convert3to4.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx index 2ef37b99c72b..ce9af84251d5 100644 --- a/vcl/unx/gtk4/convert3to4.cxx +++ b/vcl/unx/gtk4/convert3to4.cxx @@ -312,12 +312,14 @@ struct ConvertResult bool m_bAlwaysShowImage; bool m_bUseUnderline; bool m_bVertOrientation; + bool m_bXAlign; GtkPositionType m_eImagePos; css::uno::Reference<css::xml::dom::XNode> m_xPropertyLabel; css::uno::Reference<css::xml::dom::XNode> m_xPropertyIconName; ConvertResult(bool bChildCanFocus, bool bHasVisible, bool bHasIconSize, bool bAlwaysShowImage, - bool bUseUnderline, bool bVertOrientation, GtkPositionType eImagePos, + bool bUseUnderline, bool bVertOrientation, bool bXAlign, + GtkPositionType eImagePos, const css::uno::Reference<css::xml::dom::XNode>& rPropertyLabel, const css::uno::Reference<css::xml::dom::XNode>& rPropertyIconName) : m_bChildCanFocus(bChildCanFocus) @@ -326,6 +328,7 @@ struct ConvertResult , m_bAlwaysShowImage(bAlwaysShowImage) , m_bUseUnderline(bUseUnderline) , m_bVertOrientation(bVertOrientation) + , m_bXAlign(bXAlign) , m_eImagePos(eImagePos) , m_xPropertyLabel(rPropertyLabel) , m_xPropertyIconName(rPropertyIconName) @@ -343,8 +346,10 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode { css::uno::Reference<css::xml::dom::XNodeList> xNodeList = xNode->getChildNodes(); if (!xNodeList.is()) - return ConvertResult(false, false, false, false, false, false, GTK_POS_LEFT, nullptr, + { + return ConvertResult(false, false, false, false, false, false, false, GTK_POS_LEFT, nullptr, nullptr); + } std::vector<css::uno::Reference<css::xml::dom::XNode>> xRemoveList; @@ -356,6 +361,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode GtkPositionType eImagePos = GTK_POS_LEFT; bool bUseUnderline = false; bool bVertOrientation = false; + bool bXAlign = false; css::uno::Reference<css::xml::dom::XNode> xPropertyLabel; css::uno::Reference<css::xml::dom::XNode> xPropertyIconName; css::uno::Reference<css::xml::dom::XNode> xCantFocus; @@ -598,6 +604,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode { // TODO expand into a GtkLabel child with alignment on that instead assert(xChild->getFirstChild()->getNodeValue() == "0"); + bXAlign = true; xRemoveList.push_back(xChild); } } @@ -930,6 +937,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode GtkPositionType eChildImagePos = GTK_POS_LEFT; bool bChildUseUnderline = false; bool bChildVertOrientation = false; + bool bChildXAlign = false; css::uno::Reference<css::xml::dom::XNode> xChildPropertyLabel; css::uno::Reference<css::xml::dom::XNode> xChildPropertyIconName; if (xChild->hasChildNodes() && xChild != xGeneratedImageChild) @@ -949,6 +957,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode eChildImagePos = aChildRes.m_eImagePos; bChildUseUnderline = aChildRes.m_bUseUnderline; bChildVertOrientation = aChildRes.m_bVertOrientation; + bChildXAlign = aChildRes.m_bXAlign; xChildPropertyLabel = aChildRes.m_xPropertyLabel; xChildPropertyIconName = aChildRes.m_xPropertyIconName; } @@ -1274,8 +1283,9 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode xNewObjectNode->appendChild(xOrientation); } - auto xSpacing = CreateProperty(xDoc, "spacing", "6"); - xNewObjectNode->appendChild(xSpacing); + xNewObjectNode->appendChild(CreateProperty(xDoc, "spacing", "6")); + if (!bChildXAlign) + xNewObjectNode->appendChild(CreateProperty(xDoc, "halign", "center")); xNewChildNode->appendChild(xNewObjectNode); @@ -1341,7 +1351,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode } return ConvertResult(bChildCanFocus, bHasVisible, bHasIconSize, bAlwaysShowImage, bUseUnderline, - bVertOrientation, eImagePos, xPropertyLabel, xPropertyIconName); + bVertOrientation, bXAlign, eImagePos, xPropertyLabel, xPropertyIconName); } } |