diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-06-15 10:06:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-06-15 15:27:56 +0200 |
commit | bbd6def8df823fcc2f5c6aef4dce775d87eef59f (patch) | |
tree | e4ed42aa15dae0edb3403726aa85ef650e751fa5 | |
parent | a870f90800041d108078642ece84bacebd1dc794 (diff) |
gtk4: support image at top in button with vert orientation of child box
Change-Id: I87b7c2752120d272eb176307465d658f4a980170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117244
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk4/convert3to4.cxx | 31 |
2 files changed, 30 insertions, 3 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 028ff623ecd9..261744a70351 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -22352,6 +22352,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "modules/scalc/ui/movecopysheet.ui" && rUIFile != "modules/scalc/ui/optimalcolwidthdialog.ui" && rUIFile != "modules/scalc/ui/optimalrowheightdialog.ui" && + rUIFile != "modules/scalc/ui/pastespecial.ui" && rUIFile != "modules/scalc/ui/pivottablelayoutdialog.ui" && rUIFile != "modules/scalc/ui/printareasdialog.ui" && rUIFile != "modules/scalc/ui/protectsheetdlg.ui" && @@ -22361,6 +22362,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIFile != "modules/scalc/ui/sharedocumentdlg.ui" && rUIFile != "modules/scalc/ui/selectrange.ui" && rUIFile != "modules/scalc/ui/selectsource.ui" && + rUIFile != "modules/scalc/ui/showsheetdialog.ui" && rUIFile != "modules/scalc/ui/solverdlg.ui" && rUIFile != "modules/scalc/ui/solveroptionsdialog.ui" && rUIFile != "modules/scalc/ui/sortcriteriapage.ui" && diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx index 9572f7fb07ec..d1d56926acd9 100644 --- a/vcl/unx/gtk4/convert3to4.cxx +++ b/vcl/unx/gtk4/convert3to4.cxx @@ -310,17 +310,20 @@ struct ConvertResult bool m_bHasVisible; bool m_bHasSymbolicIconName; bool m_bAlwaysShowImage; + bool m_bImageAtTop; bool m_bUseUnderline; bool m_bVertOrientation; css::uno::Reference<css::xml::dom::XNode> m_xPropertyLabel; ConvertResult(bool bChildCanFocus, bool bHasVisible, bool bHasSymbolicIconName, - bool bAlwaysShowImage, bool bUseUnderline, bool bVertOrientation, + bool bAlwaysShowImage, bool bImageAtTop, bool bUseUnderline, + bool bVertOrientation, const css::uno::Reference<css::xml::dom::XNode>& rPropertyLabel) : m_bChildCanFocus(bChildCanFocus) , m_bHasVisible(bHasVisible) , m_bHasSymbolicIconName(bHasSymbolicIconName) , m_bAlwaysShowImage(bAlwaysShowImage) + , m_bImageAtTop(bImageAtTop) , m_bUseUnderline(bUseUnderline) , m_bVertOrientation(bVertOrientation) , m_xPropertyLabel(rPropertyLabel) @@ -338,7 +341,7 @@ 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, nullptr); + return ConvertResult(false, false, false, false, false, false, false, nullptr); std::vector<css::uno::Reference<css::xml::dom::XNode>> xRemoveList; @@ -347,6 +350,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode bool bHasVisible = false; bool bHasSymbolicIconName = false; bool bAlwaysShowImage = false; + bool bImageAtTop = false; bool bUseUnderline = false; bool bVertOrientation = false; css::uno::Reference<css::xml::dom::XNode> xPropertyLabel; @@ -547,6 +551,19 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode } } + if (sName == "image-position") + { + if (GetParentObjectType(xChild) == "GtkButton") + { + // we will turn always-show-image into a GtkBox child for + // GtkButton and a GtkLabel child for the GtkBox and move + // the label property into it. + assert(xChild->getFirstChild()->getNodeValue() == "top"); + bImageAtTop = xChild->getFirstChild()->getNodeValue() == "top"; + xRemoveList.push_back(xChild); + } + } + if (sName == "use-underline") bUseUnderline = toBool(xChild->getFirstChild()->getNodeValue()); @@ -906,6 +923,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode bool bChildHasSymbolicIconName = false; bool bChildHasVisible = false; bool bChildAlwaysShowImage = false; + bool bChildImageAtTop = false; bool bChildUseUnderline = false; bool bChildVertOrientation = false; css::uno::Reference<css::xml::dom::XNode> xChildPropertyLabel; @@ -923,6 +941,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode bChildHasVisible = aChildRes.m_bHasVisible; bChildHasSymbolicIconName = aChildRes.m_bHasSymbolicIconName; bChildAlwaysShowImage = aChildRes.m_bAlwaysShowImage; + bChildImageAtTop = aChildRes.m_bImageAtTop; bChildUseUnderline = aChildRes.m_bUseUnderline; bChildVertOrientation = aChildRes.m_bVertOrientation; xChildPropertyLabel = aChildRes.m_xPropertyLabel; @@ -1198,6 +1217,12 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode xBoxClassName->setValue("GtkBox"); xNewObjectNode->setAttributeNode(xBoxClassName); + if (bChildImageAtTop) + { + auto xOrientation = CreateProperty(xDoc, "orientation", "vertical"); + xNewObjectNode->appendChild(xOrientation); + } + auto xSpacing = CreateProperty(xDoc, "spacing", "6"); xNewObjectNode->appendChild(xSpacing); @@ -1246,7 +1271,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode xNode->removeChild(xRemove); return ConvertResult(bChildCanFocus, bHasVisible, bHasSymbolicIconName, bAlwaysShowImage, - bUseUnderline, bVertOrientation, xPropertyLabel); + bImageAtTop, bUseUnderline, bVertOrientation, xPropertyLabel); } } |