include/vcl/weld.hxx | 10 ---- sw/source/ui/table/tabledlg.cxx | 5 +- sw/source/uibase/table/tablepg.hxx | 1 sw/uiconfig/swriter/ui/tablecolumnpage.ui | 2 vcl/inc/qt5/QtInstanceWidget.hxx | 10 ---- vcl/inc/salvtables.hxx | 10 ---- vcl/qt5/QtInstanceWidget.cxx | 18 ------- vcl/source/app/salvtables.cxx | 16 ------ vcl/unx/gtk3/gtkinst.cxx | 69 ------------------------------ 9 files changed, 5 insertions(+), 136 deletions(-)
New commits: commit 3b6bea954e9cdc297c70e5d11cfe62600d9b3d86 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Dec 16 23:35:23 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Dec 17 22:56:25 2024 +0100 weld: Drop now unused weld::Widget::{g,s}et_grid_* These methods were superseded by corresponding methods in the weld::Grid class in Change-Id: I67f5ea16b5108e8359820850f0815e34db439ef1 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Dec 16 11:02:00 2024 +0100 weld: Add weld::Grid to handle grid child positions Now that all existing code has been ported to the new API, drop the unused old methods. Change-Id: I94ffa6a9de5e052e8248276b60f6fe4f10dff697 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178638 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 32fd70fd575b..2251f2e4056d 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -195,16 +195,6 @@ public: virtual OUString get_help_id() const = 0; virtual void set_help_id(const OUString& rName) = 0; - // NOTE: The following 5 methods for handling grid positions - // and column span are deprecated and should not be used in new code. - // Call the corresponding weld::Grid methods on the parent grid instead. - // (These deprecated methods will be dropped once existing code has been ported.) - virtual void set_grid_left_attach(int nAttach) = 0; - virtual int get_grid_left_attach() const = 0; - virtual void set_grid_width(int nCols) = 0; - virtual void set_grid_top_attach(int nAttach) = 0; - virtual int get_grid_top_attach() const = 0; - virtual void set_hexpand(bool bExpand) = 0; virtual bool get_hexpand() const = 0; virtual void set_vexpand(bool bExpand) = 0; diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx index 891e49d4f6f0..e60e78abbecb 100644 --- a/vcl/inc/qt5/QtInstanceWidget.hxx +++ b/vcl/inc/qt5/QtInstanceWidget.hxx @@ -74,16 +74,6 @@ public: virtual OUString get_help_id() const override; - virtual void set_grid_left_attach(int) override; - - virtual int get_grid_left_attach() const override; - - virtual void set_grid_width(int) override; - - virtual void set_grid_top_attach(int) override; - - virtual int get_grid_top_attach() const override; - virtual void set_hexpand(bool) override; virtual bool get_hexpand() const override; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index c51f2c12a999..464fc72afb4f 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -275,16 +275,6 @@ public: virtual OUString get_help_id() const override; - virtual void set_grid_left_attach(int nAttach) override; - - virtual int get_grid_left_attach() const override; - - virtual void set_grid_width(int nCols) override; - - virtual void set_grid_top_attach(int nAttach) override; - - virtual int get_grid_top_attach() const override; - virtual void set_hexpand(bool bExpand) override; virtual bool get_hexpand() const override; diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index d5aeb2b80754..f2656b1df54e 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -277,24 +277,6 @@ OUString QtInstanceWidget::get_help_id() const return toOUString(aHelpIdVariant.toString()); } -void QtInstanceWidget::set_grid_left_attach(int) { assert(false && "Not implemented yet"); } - -int QtInstanceWidget::get_grid_left_attach() const -{ - assert(false && "Not implemented yet"); - return -1; -} - -void QtInstanceWidget::set_grid_width(int) { assert(false && "Not implemented yet"); } - -void QtInstanceWidget::set_grid_top_attach(int) { assert(false && "Not implemented yet"); } - -int QtInstanceWidget::get_grid_top_attach() const -{ - assert(false && "Not implemented yet"); - return -1; -} - void QtInstanceWidget::set_hexpand(bool) { assert(false && "Not implemented yet"); } bool QtInstanceWidget::get_hexpand() const diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index c8edbc05da2f..3913fc84fbef 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -437,22 +437,6 @@ void SalInstanceWidget::set_help_id(const OUString& rId) { return m_xWidget->Set OUString SalInstanceWidget::get_help_id() const { return m_xWidget->GetHelpId(); } -void SalInstanceWidget::set_grid_left_attach(int nAttach) -{ - m_xWidget->set_grid_left_attach(nAttach); -} - -int SalInstanceWidget::get_grid_left_attach() const { return m_xWidget->get_grid_left_attach(); } - -void SalInstanceWidget::set_grid_width(int nCols) { m_xWidget->set_grid_width(nCols); } - -void SalInstanceWidget::set_grid_top_attach(int nAttach) -{ - m_xWidget->set_grid_top_attach(nAttach); -} - -int SalInstanceWidget::get_grid_top_attach() const { return m_xWidget->get_grid_top_attach(); } - void SalInstanceWidget::set_hexpand(bool bExpand) { m_xWidget->set_hexpand(bExpand); } bool SalInstanceWidget::get_hexpand() const { return m_xWidget->get_hexpand(); } diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index c3042eab5b77..e79147651d10 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -3682,75 +3682,6 @@ public: return ::get_font(m_pWidget); } - virtual void set_grid_left_attach(int nAttach) override - { - GtkWidget* pParent = gtk_widget_get_parent(m_pWidget); -#if GTK_CHECK_VERSION(4, 0, 0) - int row, width, height; - gtk_grid_query_child(GTK_GRID(pParent), m_pWidget, nullptr, &row, &width, &height); - g_object_ref(m_pWidget); - gtk_grid_remove(GTK_GRID(pParent), m_pWidget); - gtk_grid_attach(GTK_GRID(pParent), m_pWidget, nAttach, row, width, height); - g_object_unref(m_pWidget); -#else - gtk_container_child_set(GTK_CONTAINER(pParent), m_pWidget, "left-attach", nAttach, nullptr); -#endif - } - - virtual int get_grid_left_attach() const override - { - gint nAttach(0); - GtkWidget* pParent = gtk_widget_get_parent(m_pWidget); -#if GTK_CHECK_VERSION(4, 0, 0) - gtk_grid_query_child(GTK_GRID(pParent), m_pWidget, &nAttach, nullptr, nullptr, nullptr); -#else - gtk_container_child_get(GTK_CONTAINER(pParent), m_pWidget, "left-attach", &nAttach, nullptr); -#endif - return nAttach; - } - - virtual void set_grid_width(int nCols) override - { - GtkWidget* pParent = gtk_widget_get_parent(m_pWidget); -#if GTK_CHECK_VERSION(4, 0, 0) - int col, row, height; - gtk_grid_query_child(GTK_GRID(pParent), m_pWidget, &col, &row, nullptr, &height); - g_object_ref(m_pWidget); - gtk_grid_remove(GTK_GRID(pParent), m_pWidget); - gtk_grid_attach(GTK_GRID(pParent), m_pWidget, col, row, nCols, height); - g_object_unref(m_pWidget); -#else - gtk_container_child_set(GTK_CONTAINER(pParent), m_pWidget, "width", nCols, nullptr); -#endif - } - - virtual void set_grid_top_attach(int nAttach) override - { - GtkWidget* pParent = gtk_widget_get_parent(m_pWidget); -#if GTK_CHECK_VERSION(4, 0, 0) - int col, width, height; - gtk_grid_query_child(GTK_GRID(pParent), m_pWidget, &col, nullptr, &width, &height); - g_object_ref(m_pWidget); - gtk_grid_remove(GTK_GRID(pParent), m_pWidget); - gtk_grid_attach(GTK_GRID(pParent), m_pWidget, col, nAttach, width, height); - g_object_unref(m_pWidget); -#else - gtk_container_child_set(GTK_CONTAINER(pParent), m_pWidget, "top-attach", nAttach, nullptr); -#endif - } - - virtual int get_grid_top_attach() const override - { - gint nAttach(0); - GtkWidget* pParent = gtk_widget_get_parent(m_pWidget); -#if GTK_CHECK_VERSION(4, 0, 0) - gtk_grid_query_child(GTK_GRID(pParent), m_pWidget, nullptr, &nAttach, nullptr, nullptr); -#else - gtk_container_child_get(GTK_CONTAINER(pParent), m_pWidget, "top-attach", &nAttach, nullptr); -#endif - return nAttach; - } - virtual void set_hexpand(bool bExpand) override { gtk_widget_set_hexpand(m_pWidget, bExpand); commit a62bc3edcf9b023268a59830e2e88e449fc8f1fa Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Dec 16 23:18:06 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Dec 17 22:56:17 2024 +0100 Port SwTableColumnPage to new weld::Grid API See previous commit Change-Id: I67f5ea16b5108e8359820850f0815e34db439ef1 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Dec 16 11:02:00 2024 +0100 weld: Add weld::Grid to handle grid child positions for more background. Change-Id: I75184bd5522c9ae53981a7260ee5de110b7565f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178637 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 577d178e92ac..eb680387143c 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -747,6 +747,7 @@ SwTableColumnPage::SwTableColumnPage(weld::Container* pPage, weld::DialogControl m_xBuilder->weld_label(u"3"_ustr), m_xBuilder->weld_label(u"4"_ustr), m_xBuilder->weld_label(u"5"_ustr)} + , m_xColumnWidthsGrid(m_xBuilder->weld_grid(u"columnwidthsgrid"_ustr)) , m_xModifyTableCB(m_xBuilder->weld_check_button(u"adaptwidth"_ustr)) , m_xProportionalCB(m_xBuilder->weld_check_button(u"adaptcolumns"_ustr)) , m_xSpaceFT(m_xBuilder->weld_label(u"spaceft"_ustr)) @@ -782,8 +783,8 @@ IMPL_LINK_NOARG(SwTableColumnPage, SizeHdl, void*, void) if (pTopLevel->get_preferred_size().Width() > aOrigSize.Width()) { m_nMetFields = i + 1; - m_aTextArr[i]->set_grid_width(1); - m_xUpBtn->set_grid_left_attach(m_nMetFields * 2 - 1); + m_xColumnWidthsGrid->set_child_column_span(*m_aTextArr[i], 1); + m_xColumnWidthsGrid->set_child_left_attach(*m_xUpBtn, m_nMetFields * 2 - 1); break; } } diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index 80a680817caf..227f3942b2fe 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -111,6 +111,7 @@ class SwTableColumnPage : public SfxTabPage SwPercentField m_aFieldArr[MET_FIELDS]; std::unique_ptr<weld::Label> m_aTextArr[MET_FIELDS]; + std::unique_ptr<weld::Grid> m_xColumnWidthsGrid; std::unique_ptr<weld::CheckButton> m_xModifyTableCB; std::unique_ptr<weld::CheckButton> m_xProportionalCB; std::unique_ptr<weld::Label> m_xSpaceFT; diff --git a/sw/uiconfig/swriter/ui/tablecolumnpage.ui b/sw/uiconfig/swriter/ui/tablecolumnpage.ui index 3122ad2cdb37..73954ce2b8e7 100644 --- a/sw/uiconfig/swriter/ui/tablecolumnpage.ui +++ b/sw/uiconfig/swriter/ui/tablecolumnpage.ui @@ -168,7 +168,7 @@ <property name="shadow-type">none</property> <child> <!-- n-columns=12 n-rows=2 --> - <object class="GtkGrid" id="grid17"> + <object class="GtkGrid" id="columnwidthsgrid"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="margin-start">12</property>