diff options
Diffstat (limited to 'cui/source/tabpages/border.cxx')
-rw-r--r-- | cui/source/tabpages/border.cxx | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 0bdb47fe4ed4..e3c12e0eae7a 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -1219,7 +1219,11 @@ IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthLBHdl_Impl, weld::ComboBox&, void) { sal_Int32 nPos = m_xLineWidthLB->get_active(); - SetLineWidth(m_aLineWidths[nPos]); + sal_Int32 nRemovedType = 0; + if (m_xLineWidthLB->get_values_changed_from_saved()) { + nRemovedType = m_aLineWidths.size() - m_xLineWidthLB->get_count(); + } + SetLineWidth(m_aLineWidths[nPos + nRemovedType], nRemovedType); // Call the spinner handler to trigger all related modifications ModifyWidthMFHdl_Impl(*m_xLineWidthMF); @@ -1228,6 +1232,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>(MetricField::ConvertDoubleValue( nVal, m_xLineWidthMF->get_digits(), @@ -1241,6 +1252,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>(MetricField::ConvertDoubleValue( nOldWidth, m_xLineWidthMF->get_digits(), @@ -1252,7 +1270,13 @@ 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) @@ -1265,6 +1289,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() ); @@ -1389,7 +1433,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 ); @@ -1401,12 +1445,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(); } } |