summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-06-15 16:58:32 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-06-16 09:53:52 +0200
commitecdb4b2ca8a55b8b2d077cabd930964a41624736 (patch)
treeb751b176341973f3d7648fcb6605c708d7ad72a1
parent72e0b04d23857f873855073605314c912f449801 (diff)
gtk4: use image-position to position elements within replacement box
enable insert, section with pick button in color subtab of background tabpage as example usage Change-Id: Ie972e2de9181888b59159a7a12651e6f7f7dec26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117275 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx9
-rw-r--r--vcl/unx/gtk4/convert3to4.cxx51
2 files changed, 42 insertions, 18 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 2f04556c88f1..b8ece3292b5d 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -22242,8 +22242,11 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString&
rUIFile != "cui/ui/acorreplacepage.ui" &&
rUIFile != "cui/ui/applyautofmtpage.ui" &&
rUIFile != "cui/ui/applylocalizedpage.ui" &&
+ rUIFile != "cui/ui/areatabpage.ui" &&
rUIFile != "cui/ui/autocorrectdialog.ui" &&
+ rUIFile != "cui/ui/bitmaptabpage.ui" &&
rUIFile != "cui/ui/breaknumberoption.ui" &&
+ rUIFile != "cui/ui/colorpage.ui" &&
rUIFile != "cui/ui/colorpickerdialog.ui" &&
rUIFile != "cui/ui/editdictionarydialog.ui" &&
rUIFile != "cui/ui/eventassigndialog.ui" &&
@@ -22264,6 +22267,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString&
rUIFile != "cui/ui/macroassigndialog.ui" &&
rUIFile != "cui/ui/macroassignpage.ui" &&
rUIFile != "cui/ui/macroselectordialog.ui" &&
+ rUIFile != "cui/ui/namedialog.ui" &&
rUIFile != "cui/ui/objectnamedialog.ui" &&
rUIFile != "cui/ui/objecttitledescdialog.ui" &&
rUIFile != "cui/ui/optjsearchpage.ui" &&
@@ -22336,6 +22340,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString&
rUIFile != "modules/BasicIDE/ui/newlibdialog.ui" &&
rUIFile != "modules/BasicIDE/ui/organizedialog.ui" &&
rUIFile != "modules/scalc/ui/advancedfilterdialog.ui" &&
+ rUIFile != "modules/scalc/ui/checkwarningdialog.ui" &&
rUIFile != "modules/scalc/ui/colwidthdialog.ui" &&
rUIFile != "modules/scalc/ui/consolidatedialog.ui" &&
rUIFile != "modules/scalc/ui/dataform.ui" &&
@@ -22401,11 +22406,14 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString&
rUIFile != "modules/swriter/ui/exchangedatabases.ui" &&
rUIFile != "modules/swriter/ui/footendnotedialog.ui" &&
rUIFile != "modules/swriter/ui/footnotepage.ui" &&
+ rUIFile != "modules/swriter/ui/footnotesendnotestabpage.ui" &&
rUIFile != "modules/swriter/ui/gotopagedialog.ui" &&
+ rUIFile != "modules/swriter/ui/indentpage.ui" &&
rUIFile != "modules/swriter/ui/indexentry.ui" &&
rUIFile != "modules/swriter/ui/insertbookmark.ui" &&
rUIFile != "modules/swriter/ui/insertbreak.ui" &&
rUIFile != "modules/swriter/ui/insertfootnote.ui" &&
+ rUIFile != "modules/swriter/ui/insertsectiondialog.ui" &&
rUIFile != "modules/swriter/ui/inserttable.ui" &&
rUIFile != "modules/swriter/ui/linenumbering.ui" &&
rUIFile != "modules/swriter/ui/newuserindexdialog.ui" &&
@@ -22417,6 +22425,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString&
rUIFile != "modules/swriter/ui/printoptionspage.ui" &&
rUIFile != "modules/swriter/ui/renameautotextdialog.ui" &&
rUIFile != "modules/swriter/ui/renameobjectdialog.ui" &&
+ rUIFile != "modules/swriter/ui/sectionpage.ui" &&
rUIFile != "modules/swriter/ui/statisticsinfopage.ui" &&
rUIFile != "modules/swriter/ui/titlepage.ui" &&
rUIFile != "modules/swriter/ui/watermarkdialog.ui" &&
diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx
index 24b67f01e576..2ef37b99c72b 100644
--- a/vcl/unx/gtk4/convert3to4.cxx
+++ b/vcl/unx/gtk4/convert3to4.cxx
@@ -310,23 +310,23 @@ struct ConvertResult
bool m_bHasVisible;
bool m_bHasIconSize;
bool m_bAlwaysShowImage;
- bool m_bImageAtTop;
bool m_bUseUnderline;
bool m_bVertOrientation;
+ 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 bImageAtTop, bool bUseUnderline, bool bVertOrientation,
+ bool bUseUnderline, bool bVertOrientation, GtkPositionType eImagePos,
const css::uno::Reference<css::xml::dom::XNode>& rPropertyLabel,
const css::uno::Reference<css::xml::dom::XNode>& rPropertyIconName)
: m_bChildCanFocus(bChildCanFocus)
, m_bHasVisible(bHasVisible)
, m_bHasIconSize(bHasIconSize)
, m_bAlwaysShowImage(bAlwaysShowImage)
- , m_bImageAtTop(bImageAtTop)
, m_bUseUnderline(bUseUnderline)
, m_bVertOrientation(bVertOrientation)
+ , m_eImagePos(eImagePos)
, m_xPropertyLabel(rPropertyLabel)
, m_xPropertyIconName(rPropertyIconName)
{
@@ -343,7 +343,8 @@ 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, false, nullptr, nullptr);
+ return ConvertResult(false, false, false, false, false, false, GTK_POS_LEFT, nullptr,
+ nullptr);
std::vector<css::uno::Reference<css::xml::dom::XNode>> xRemoveList;
@@ -352,7 +353,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
bool bHasVisible = false;
bool bHasIconSize = false;
bool bAlwaysShowImage = false;
- bool bImageAtTop = false;
+ GtkPositionType eImagePos = GTK_POS_LEFT;
bool bUseUnderline = false;
bool bVertOrientation = false;
css::uno::Reference<css::xml::dom::XNode> xPropertyLabel;
@@ -501,9 +502,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
auto xIconSize = CreateProperty(xDoc, "icon-size", "2");
xChild->getParentNode()->insertBefore(xIconSize, xChild);
}
- else
- SAL_WARN("vcl.gtk", "what should we do with an icon-size of: "
- << xChild->getFirstChild()->getNodeValue());
+
xRemoveList.push_back(xChild);
}
}
@@ -557,8 +556,15 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
// 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";
+ OUString sImagePos = xChild->getFirstChild()->getNodeValue();
+ if (sImagePos == "top")
+ eImagePos = GTK_POS_TOP;
+ else if (sImagePos == "bottom")
+ eImagePos = GTK_POS_BOTTOM;
+ else if (sImagePos == "right")
+ eImagePos = GTK_POS_RIGHT;
+ else
+ assert(sImagePos == "left");
xRemoveList.push_back(xChild);
}
}
@@ -921,7 +927,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
bool bChildHasIconSize = false;
bool bChildHasVisible = false;
bool bChildAlwaysShowImage = false;
- bool bChildImageAtTop = false;
+ GtkPositionType eChildImagePos = GTK_POS_LEFT;
bool bChildUseUnderline = false;
bool bChildVertOrientation = false;
css::uno::Reference<css::xml::dom::XNode> xChildPropertyLabel;
@@ -940,7 +946,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
bChildHasVisible = aChildRes.m_bHasVisible;
bChildHasIconSize = aChildRes.m_bHasIconSize;
bChildAlwaysShowImage = aChildRes.m_bAlwaysShowImage;
- bChildImageAtTop = aChildRes.m_bImageAtTop;
+ eChildImagePos = aChildRes.m_eImagePos;
bChildUseUnderline = aChildRes.m_bUseUnderline;
bChildVertOrientation = aChildRes.m_bVertOrientation;
xChildPropertyLabel = aChildRes.m_xPropertyLabel;
@@ -1262,7 +1268,7 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
xBoxClassName->setValue("GtkBox");
xNewObjectNode->setAttributeNode(xBoxClassName);
- if (bChildImageAtTop)
+ if (eChildImagePos == GTK_POS_TOP || eChildImagePos == GTK_POS_BOTTOM)
{
auto xOrientation = CreateProperty(xDoc, "orientation", "vertical");
xNewObjectNode->appendChild(xOrientation);
@@ -1300,9 +1306,18 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
}
xNewLabelChildNode->appendChild(xNewChildObjectNode);
- if (xImageCandidateNode)
- xNewObjectNode->appendChild(xImageCandidateNode);
- xNewObjectNode->appendChild(xNewLabelChildNode);
+ if (eChildImagePos == GTK_POS_LEFT || eChildImagePos == GTK_POS_TOP)
+ {
+ if (xImageCandidateNode)
+ xNewObjectNode->appendChild(xImageCandidateNode);
+ xNewObjectNode->appendChild(xNewLabelChildNode);
+ }
+ else
+ {
+ xNewObjectNode->appendChild(xNewLabelChildNode);
+ if (xImageCandidateNode)
+ xNewObjectNode->appendChild(xImageCandidateNode);
+ }
}
}
@@ -1325,8 +1340,8 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode
g_free(pText);
}
- return ConvertResult(bChildCanFocus, bHasVisible, bHasIconSize, bAlwaysShowImage, bImageAtTop,
- bUseUnderline, bVertOrientation, xPropertyLabel, xPropertyIconName);
+ return ConvertResult(bChildCanFocus, bHasVisible, bHasIconSize, bAlwaysShowImage, bUseUnderline,
+ bVertOrientation, eImagePos, xPropertyLabel, xPropertyIconName);
}
}