diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-01-26 19:48:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-01-27 09:53:20 +0100 |
commit | 37f5f9896449c6e2cb9aa481f004cd887672d2ed (patch) | |
tree | 08d64e511b9d642b5c7711fba9c1ae6cf6d34090 | |
parent | 960bc8553328c6bfb8818094195e0f737eb013a9 (diff) |
tdf#130197 give paragraph and table panels column widths of 5 toolbutton widths
Change-Id: Iae4f10eef6b293731d22eec8dcbb85a07d3e6c11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87462
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svx/dlgctrl.hxx | 2 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 20 | ||||
-rw-r--r-- | svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 7 | ||||
-rw-r--r-- | svx/uiconfig/ui/measurewidthbar.ui | 79 | ||||
-rw-r--r-- | svx/uiconfig/ui/sidebarparagraph.ui | 11 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/TableEditPanel.cxx | 6 |
7 files changed, 115 insertions, 11 deletions
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index eaa31a5d0e3f..6625b0651496 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -417,6 +417,8 @@ class RelativeField; SVX_DLLPUBLIC void limitWidthForSidebar(weld::SpinButton& rSpinButton); SVX_DLLPUBLIC void limitWidthForSidebar(RelativeField& rMetricSpinButton); +//tdf#130197 Give this toolbar a width as if it had 5 standard toolbutton entries +SVX_DLLPUBLIC void padWidthForSidebar(weld::Toolbar& rToolbar, const css::uno::Reference<css::frame::XFrame>& rFrame); #endif // INCLUDED_SVX_DLGCTRL_HXX diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 3d52a8369b3f..56192ca71601 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -69,6 +69,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/interimdockparent \ svx/uiconfig/ui/interimparent \ svx/uiconfig/ui/linkwarndialog \ + svx/uiconfig/ui/measurewidthbar \ svx/uiconfig/ui/mediaplayback \ svx/uiconfig/ui/namespacedialog \ svx/uiconfig/ui/numberingwindow \ diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index b23970a82b61..c9cb58ca1594 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -22,6 +22,7 @@ #include <vcl/virdev.hxx> #include <vcl/event.hxx> #include <sfx2/dialoghelper.hxx> +#include <sfx2/weldutils.hxx> #include <svx/relfld.hxx> #include <svx/xlineit0.hxx> #include <svx/xtable.hxx> @@ -1465,4 +1466,23 @@ void limitWidthForSidebar(RelativeField& rMetricSpinButton) limitWidthForSidebar(rSpinButton); } +void padWidthForSidebar(weld::Toolbar& rToolbar, const css::uno::Reference<css::frame::XFrame>& rFrame) +{ + static int nColumnWidth = -1; + static vcl::ImageType eSize; + if (nColumnWidth != -1 && eSize != rToolbar.get_icon_size()) + nColumnWidth = -1; + if (nColumnWidth == -1) + { + // use the, filled-in by dispatcher, width of measurewidth as the width + // of a "standard" column in a two column panel + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(&rToolbar, "svx/ui/measurewidthbar.ui")); + std::unique_ptr<weld::Toolbar> xToolbar(xBuilder->weld_toolbar("measurewidth")); + std::unique_ptr<ToolbarUnoDispatcher> xDispatcher(new ToolbarUnoDispatcher(*xToolbar, rFrame)); + nColumnWidth = xToolbar->get_preferred_size().Width(); + eSize = rToolbar.get_icon_size(); + } + rToolbar.set_size_request(nColumnWidth, -1); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 0a01b42a8654..01dd63823e9e 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -445,6 +445,13 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent, mpBindings(pBindings), mxSidebar(rxSidebar) { + // tdf#130197 We want to give this toolbar a width as if it had 5 entries + // (the parent grid has homogeneous width set so both columns will have the + // same width). This ParaPropertyPanel is a default panel in writer, so + // subsequent panels, e.g. the TableEditPanel panel can have up to 5 + // entries in each of its column and remain in alignment with this panel + padWidthForSidebar(*mxTBxIndent, rxFrame); + initial(); m_aMetricCtl.RequestUpdate(); } diff --git a/svx/uiconfig/ui/measurewidthbar.ui b/svx/uiconfig/ui/measurewidthbar.ui new file mode 100644 index 000000000000..ad96cc7b2339 --- /dev/null +++ b/svx/uiconfig/ui/measurewidthbar.ui @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkToolbar" id="measurewidth"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <property name="icon_size">2</property> + <child> + <object class="GtkToolButton" id=".uno:MergeCells"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id=".uno:SplitCell"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id=".uno:SplitTable"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id=".uno:DeleteColumns"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id=".uno:DeleteTable"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> +</interface> diff --git a/svx/uiconfig/ui/sidebarparagraph.ui b/svx/uiconfig/ui/sidebarparagraph.ui index 2d3fb0903e04..4e0a7df6836f 100644 --- a/svx/uiconfig/ui/sidebarparagraph.ui +++ b/svx/uiconfig/ui/sidebarparagraph.ui @@ -260,8 +260,6 @@ <object class="GtkBox" id="box11"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">4</property> - <property name="margin_right">6</property> <property name="spacing">6</property> <child> <object class="GtkImage" id="image6"> @@ -308,8 +306,6 @@ <object class="GtkBox" id="box12"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">4</property> - <property name="margin_right">6</property> <property name="spacing">6</property> <child> <object class="GtkImage" id="image7"> @@ -356,7 +352,6 @@ <object class="GtkToolbar" id="linespacing"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="margin_left">1</property> <property name="toolbar_style">icons</property> <property name="show_arrow">False</property> <property name="icon_size">2</property> @@ -462,8 +457,6 @@ <object class="GtkBox" id="box14"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">4</property> - <property name="margin_right">6</property> <property name="spacing">6</property> <child> <object class="GtkImage" id="image8"> @@ -510,8 +503,6 @@ <object class="GtkBox" id="box15"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">4</property> - <property name="margin_right">6</property> <property name="spacing">6</property> <child> <object class="GtkImage" id="image9"> @@ -558,8 +549,6 @@ <object class="GtkBox" id="box16"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="margin_left">4</property> - <property name="margin_right">6</property> <property name="spacing">6</property> <child> <object class="GtkImage" id="image10"> diff --git a/sw/source/uibase/sidebar/TableEditPanel.cxx b/sw/source/uibase/sidebar/TableEditPanel.cxx index dcca792db112..8f64722499a4 100644 --- a/sw/source/uibase/sidebar/TableEditPanel.cxx +++ b/sw/source/uibase/sidebar/TableEditPanel.cxx @@ -131,6 +131,12 @@ TableEditPanel::TableEditPanel(vcl::Window* pParent, , m_aDistributeColumnsController(FN_TABLE_BALANCE_CELLS, *pBindings, *this) , m_aMergeCellsController(FN_TABLE_MERGE_CELLS, *pBindings, *this) { + // tdf#130197 Give this toolbar a width as if it had 5 entries (the parent + // grid has homogeneous width set so both columns will have the same + // width). This will align this TableEditPanel's columns with + // ParaPropertyPanel's columns + padWidthForSidebar(*m_xSplitMerge, rxFrame); + InitRowHeightToolitem(); InitColumnWidthToolitem(); } |