summaryrefslogtreecommitdiff
path: root/cui/source/tabpages
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2022-07-25 18:03:49 +0200
committerBalazs Varga <balazs.varga.extern@allotropia.de>2022-07-29 08:53:49 +0200
commitfe2d59a0730e60c0196baa46af12440afd343878 (patch)
treee627745273cc638e5f855b650067f485dcaddef7 /cui/source/tabpages
parent4f61276dae10fdaf2ed33ab23d98adbe311cb7ee (diff)
tdf#150100 sc import and UI: fix double cell border dialog
Hide "Hairline (0.05pt)", "Very thin (0.5pt)" and "Thin (0.75pt)" predefined border types for Double cell borders, because it has a minimum thickness 1.1pt, which means, we cannot allow to select them. Also setting the Medium (1.5pt) predefined thickness to the border width for Double borders as the thinnest possible predefined value. TODO: tdf#146466: Inconsistent choices of borders between toolbar and sidebar Change-Id: I46ccb206835a34a6dfaa39e63e614bb01bc6b02e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137441 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'cui/source/tabpages')
-rw-r--r--cui/source/tabpages/border.cxx55
1 files changed, 50 insertions, 5 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 683dd7713c37..38099a4599c8 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -1242,8 +1242,12 @@ IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void)
IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthLBHdl_Impl, weld::ComboBox&, void)
{
sal_Int32 nPos = m_xLineWidthLB->get_active();
+ sal_Int32 nRemovedType = 0;
+ if (m_xLineWidthLB->get_values_changed_from_saved()) {
+ nRemovedType = m_aLineWidths.size() - m_xLineWidthLB->get_count();
+ }
- SetLineWidth(m_aLineWidths[nPos]);
+ SetLineWidth(m_aLineWidths[nPos + nRemovedType], nRemovedType);
// Call the spinner handler to trigger all related modifications
ModifyWidthMFHdl_Impl(*m_xLineWidthMF);
@@ -1252,6 +1256,13 @@ IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthLBHdl_Impl, weld::ComboBox&, void)
IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthMFHdl_Impl, weld::MetricSpinButton&, void)
{
sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE);
+
+ // for DOUBLE_THIN line style we cannot allow thinner line width then 1.10pt
+ if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::DOUBLE_THIN)
+ m_xLineWidthMF->set_min(110, FieldUnit::NONE);
+ else
+ m_xLineWidthMF->set_min(5, FieldUnit::NONE);
+
nVal = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
nVal,
m_xLineWidthMF->get_digits(),
@@ -1265,6 +1276,13 @@ IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthMFHdl_Impl, weld::MetricSpinButton&
IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
{
sal_Int64 nOldWidth = m_xLineWidthMF->get_value(FieldUnit::NONE);
+
+ // for DOUBLE_THIN line style we cannot allow thinner line width then 1.10pt
+ if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::DOUBLE_THIN)
+ m_xLineWidthMF->set_min(110, FieldUnit::NONE);
+ else
+ m_xLineWidthMF->set_min(5, FieldUnit::NONE);
+
nOldWidth = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
nOldWidth,
m_xLineWidthMF->get_digits(),
@@ -1276,7 +1294,14 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
// auto change line-width if it doesn't correspond to minimal value
// let's change only in case when user has not changed the line-width into some custom value
- const sal_Int64 nNewWidth = (nOldMinWidth == nOldWidth)? nNewMinWidth : nOldWidth;
+ sal_Int64 nNewWidth = (nOldMinWidth == nOldWidth) ? nNewMinWidth : nOldWidth;
+
+ // if we had selected a predefined border width under SvxBorderLineWidth::Medium set the Medium as default
+ // otherwise if we had a cusom border width under 1.10pt then set the spinner to the maximum allowed value for double border styles
+ bool bNewDoubleHairline = m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::DOUBLE_THIN && !m_xLineWidthMF->get_visible() &&
+ (nOldWidth == SvxBorderLineWidth::Hairline || nOldWidth == SvxBorderLineWidth::VeryThin || nOldWidth == SvxBorderLineWidth::Thin);
+ if (bNewDoubleHairline && nNewWidth < SvxBorderLineWidth::Medium)
+ nNewWidth = SvxBorderLineWidth::Medium;
// set value inside edit box
if (nOldWidth != nNewWidth)
@@ -1289,6 +1314,26 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void)
SetLineWidth(nNewWidthPt);
}
+ if (m_xLbLineStyle->GetSelectEntryStyle() == SvxBorderLineStyle::DOUBLE_THIN)
+ {
+ for (size_t i = 0; i < 3; i++)
+ {
+ m_xLineWidthLB->save_values_by_id(OUString::number(i));
+ m_xLineWidthLB->remove_id(OUString::number(i));
+ }
+ if (m_xLineWidthLB->get_active_id().isEmpty())
+ m_xLineWidthLB->set_active_id("3");
+ }
+ else
+ {
+ if (m_xLineWidthLB->get_values_changed_from_saved())
+ {
+ for (size_t i = 0; i < 3; i++)
+ m_xLineWidthLB->append(i, OUString::number(i), m_xLineWidthLB->get_saved_values(i));
+ m_xLineWidthLB->removeSavedValues();
+ }
+ }
+
// set value inside style box
m_aFrameSel.SetStyleToSelection( nNewWidth,
m_xLbLineStyle->GetSelectEntryStyle() );
@@ -1413,7 +1458,7 @@ void SvxBorderTabPage::FillValueSets()
FillShadowVS();
}
-void SvxBorderTabPage::SetLineWidth( sal_Int64 nWidth )
+void SvxBorderTabPage::SetLineWidth( sal_Int64 nWidth, sal_Int32 nRemovedType )
{
if ( nWidth >= 0 )
m_xLineWidthMF->set_value( nWidth, FieldUnit::POINT );
@@ -1425,12 +1470,12 @@ void SvxBorderTabPage::SetLineWidth( sal_Int64 nWidth )
{
// Select predefined value in combobox
m_xLineWidthMF->hide();
- m_xLineWidthLB->set_active(std::distance(m_aLineWidths.begin(), it));
+ m_xLineWidthLB->set_active(std::distance(m_aLineWidths.begin(), it) - nRemovedType);
}
else
{
// This is not one of predefined values. Show spinner
- m_xLineWidthLB->set_active(m_aLineWidths.size()-1);
+ m_xLineWidthLB->set_active(m_aLineWidths.size() - nRemovedType -1);
m_xLineWidthMF->show();
}
}