[Libreoffice-commits] core.git: include/svx svx/source svx/uiconfig svx/UIConfig_svx.mk sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 27 08:53:51 UTC 2020


 include/svx/dlgctrl.hxx                            |    2 
 svx/UIConfig_svx.mk                                |    1 
 svx/source/dialog/dlgctrl.cxx                      |   20 +++++
 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |    7 +
 svx/uiconfig/ui/measurewidthbar.ui                 |   79 +++++++++++++++++++++
 svx/uiconfig/ui/sidebarparagraph.ui                |   11 --
 sw/source/uibase/sidebar/TableEditPanel.cxx        |    6 +
 7 files changed, 115 insertions(+), 11 deletions(-)

New commits:
commit 37f5f9896449c6e2cb9aa481f004cd887672d2ed
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jan 26 19:48:54 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jan 27 09:53:20 2020 +0100

    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 at redhat.com>

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();
 }


More information about the Libreoffice-commits mailing list