[Libreoffice-commits] core.git: include/svx svx/source sw/source sw/uiconfig
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 17 21:06:56 UTC 2020
include/svx/dlgctrl.hxx | 5 +++
svx/source/dialog/dlgctrl.cxx | 14 +++++++++
svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 31 ++++-----------------
sw/source/uibase/sidebar/TableEditPanel.cxx | 5 +++
sw/uiconfig/swriter/ui/sidebartableedit.ui | 2 -
5 files changed, 30 insertions(+), 27 deletions(-)
New commits:
commit 16bbfcd1902e63823f6f1a491442b82024def2bc
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jan 17 13:44:19 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jan 17 22:06:22 2020 +0100
limit table spinbuttons width for sidebar
to the same width as the paragraph sidebar spinbuttons
Change-Id: I980545b4186b25cb5ada473095ece8c77f99420a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86992
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 eb7f19c79f91..eaa31a5d0e3f 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -413,6 +413,11 @@ public:
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
};
+class RelativeField;
+
+SVX_DLLPUBLIC void limitWidthForSidebar(weld::SpinButton& rSpinButton);
+SVX_DLLPUBLIC void limitWidthForSidebar(RelativeField& rMetricSpinButton);
+
#endif // INCLUDED_SVX_DLGCTRL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index d69a3cceb2f4..b23970a82b61 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 <svx/relfld.hxx>
#include <svx/xlineit0.hxx>
#include <svx/xtable.hxx>
#include <svx/strings.hrc>
@@ -1451,4 +1452,17 @@ void SvxXRectPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
rRenderContext.Pop();
}
+void limitWidthForSidebar(weld::SpinButton& rSpinButton)
+{
+ // space is limited in the sidebar, so limit MetricSpinButtons to a width of 4 digits
+ const int nMaxDigits = 4;
+ rSpinButton.set_width_chars(std::min(rSpinButton.get_width_chars(), nMaxDigits));
+}
+
+void limitWidthForSidebar(RelativeField& rMetricSpinButton)
+{
+ weld::SpinButton& rSpinButton = rMetricSpinButton.get_widget();
+ limitWidthForSidebar(rSpinButton);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index e22cd4bbda27..0a01b42a8654 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -26,6 +26,7 @@
#include <editeng/ulspitem.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
+#include <svx/dlgctrl.hxx>
#include <svx/svxids.hrc>
#include <svl/intitem.hxx>
#include <sfx2/objsh.hxx>
@@ -401,18 +402,6 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI
return eUnit;
}
-namespace
-{
- void limitWidth(RelativeField& rMetricSpinButton)
- {
- // space is limited in the sidebar, so limit MetricSpinButtons to a width of 4 digits
- const int nMaxDigits = 4;
-
- weld::SpinButton& rSpinButton = rMetricSpinButton.get_widget();
- rSpinButton.set_width_chars(std::min(rSpinButton.get_width_chars(), nMaxDigits));
- }
-}
-
ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -456,25 +445,17 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
mpBindings(pBindings),
mxSidebar(rxSidebar)
{
-#if 0
- mxTopDist->set_size_request(mxTopDist->get_preferred_size().Width(), -1);
- mxBottomDist->set_size_request(mxBottomDist->get_preferred_size().Width(), -1);
- mxLeftIndent->set_size_request(mxLeftIndent->get_preferred_size().Width(), -1);
- mxRightIndent->set_size_request(mxRightIndent->get_preferred_size().Width(), -1);
- mxFLineIndent->set_size_request(mxFLineIndent->get_preferred_size().Width(), -1);
-#endif
-
initial();
m_aMetricCtl.RequestUpdate();
}
void ParaPropertyPanel::limitMetricWidths()
{
- limitWidth(*mxTopDist);
- limitWidth(*mxBottomDist);
- limitWidth(*mxLeftIndent);
- limitWidth(*mxRightIndent);
- limitWidth(*mxFLineIndent);
+ limitWidthForSidebar(*mxTopDist);
+ limitWidthForSidebar(*mxBottomDist);
+ limitWidthForSidebar(*mxLeftIndent);
+ limitWidthForSidebar(*mxRightIndent);
+ limitWidthForSidebar(*mxFLineIndent);
}
ParaPropertyPanel::~ParaPropertyPanel()
diff --git a/sw/source/uibase/sidebar/TableEditPanel.cxx b/sw/source/uibase/sidebar/TableEditPanel.cxx
index 4d09aa4c0794..dcca792db112 100644
--- a/sw/source/uibase/sidebar/TableEditPanel.cxx
+++ b/sw/source/uibase/sidebar/TableEditPanel.cxx
@@ -16,6 +16,7 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <svtools/unitconv.hxx>
+#include <svx/dlgctrl.hxx>
#include <swmodule.hxx>
#include <usrpref.hxx>
@@ -146,6 +147,8 @@ void TableEditPanel::InitRowHeightToolitem()
m_xRowHeightEdit->set_min(MINLAY, FieldUnit::TWIP);
m_xRowHeightEdit->set_max(SAL_MAX_INT32, FieldUnit::TWIP);
+
+ limitWidthForSidebar(*m_xRowHeightEdit);
}
void TableEditPanel::InitColumnWidthToolitem()
@@ -158,6 +161,8 @@ void TableEditPanel::InitColumnWidthToolitem()
m_xColumnWidthEdit->set_min(MINLAY, FieldUnit::TWIP);
m_xColumnWidthEdit->set_max(SAL_MAX_INT32, FieldUnit::TWIP);
+
+ limitWidthForSidebar(*m_xColumnWidthEdit);
}
void TableEditPanel::dispose()
diff --git a/sw/uiconfig/swriter/ui/sidebartableedit.ui b/sw/uiconfig/swriter/ui/sidebartableedit.ui
index 2a67ff4acf9d..e0d369f7021a 100644
--- a/sw/uiconfig/swriter/ui/sidebartableedit.ui
+++ b/sw/uiconfig/swriter/ui/sidebartableedit.ui
@@ -29,7 +29,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes" context="sidebatableedit|rowheight|tooltip_text">Row Height</property>
- <property name="halign">start</property>
<property name="hexpand">True</property>
<property name="text">0</property>
<property name="adjustment">adjustment1</property>
@@ -197,7 +196,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes" context="sidebatableedit|columnwidth|tooltip_text">Column Width</property>
- <property name="halign">start</property>
<property name="hexpand">True</property>
<property name="text">0</property>
<property name="adjustment">adjustment2</property>
More information about the Libreoffice-commits
mailing list