diff options
author | László Németh <nemeth@numbertext.org> | 2024-05-06 17:17:43 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2024-05-07 13:58:28 +0200 |
commit | c8a99cb8dce54de506ba66d1cc0818b9b5f7858b (patch) | |
tree | 51291edc4f5413fcf300d694fa4c7f6f20f5deb1 /cui/source | |
parent | 0ca20dca3349daa303b89251443f550491968a39 (diff) |
tdf#132599 sw schema xmloff: add hyphenation-keep-type='always'
Add new hyphenation option to limit hyphenation
of the last full line of the hyphenated paragraph.
Move also loext:hyphenation-keep-type to paragraph-properties,
following the associated hyphenation-keep.
Note: value "always" is defined by CSS 4 hyphenate-limit-last,
see https://www.w3.org/TR/css-text-4/#hyphenate-line-limits.
Follow-up to commit 6e8819f29b6051a0e551d77512830539913ec277
"tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type".
Change-Id: I2121269205fc89fb5367dccdca00195aac68f3e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167232
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/inc/paragrph.hxx | 3 | ||||
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 38 |
2 files changed, 39 insertions, 2 deletions
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index b35111f43b33..e219aa622e07 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -221,6 +221,7 @@ private: weld::TriStateEnabled aKeepParaState; weld::TriStateEnabled aOrphanState; weld::TriStateEnabled aWidowState; + weld::TriStateEnabled aAcrossParagraphState; weld::TriStateEnabled aAcrossColumnState; weld::TriStateEnabled aAcrossPageState; weld::TriStateEnabled aAcrossSpreadState; @@ -272,6 +273,7 @@ private: // avoid hyphenation across std::unique_ptr<weld::Label> m_xAcrossText; + std::unique_ptr<weld::CheckButton> m_xAcrossParagraphBox; std::unique_ptr<weld::CheckButton> m_xAcrossColumnBox; std::unique_ptr<weld::CheckButton> m_xAcrossPageBox; std::unique_ptr<weld::CheckButton> m_xAcrossSpreadBox; @@ -294,6 +296,7 @@ private: DECL_LINK(PageBreakTypeHdl_Impl, weld::ComboBox&, void); DECL_LINK(PageNumBoxClickHdl_Impl, weld::Toggleable&, void); DECL_LINK(KeepParaBoxClickHdl_Impl, weld::Toggleable&, void); + DECL_LINK(AcrossParagraphHdl_Impl, weld::Toggleable&, void); DECL_LINK(AcrossColumnHdl_Impl, weld::Toggleable&, void); DECL_LINK(AcrossPageHdl_Impl, weld::Toggleable&, void); DECL_LINK(AcrossSpreadHdl_Impl, weld::Toggleable&, void); diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 034983ea73ce..56b697a046a6 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -1618,6 +1618,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) m_xMaxHyphenEdit->get_value_changed_from_saved() || m_xMinWordLength->get_value_changed_from_saved() || m_aHyphenZone.get_value_changed_from_saved() || + m_xAcrossParagraphBox->get_state_changed_from_saved() || m_xAcrossColumnBox->get_state_changed_from_saved() || m_xAcrossPageBox->get_state_changed_from_saved() || m_xAcrossSpreadBox->get_state_changed_from_saved() ) @@ -1643,6 +1644,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) aHyphen.GetTextHyphenZone() = static_cast<sal_uInt16>(m_aHyphenZone.GetCoreValue(eUnit)); aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE ); aHyphen.SetNoLastWordHyphenation(m_xHyphenNoLastWordBox->get_state() != TRISTATE_TRUE); + const TriState eAcrossParagraphState = m_xAcrossParagraphBox->get_state(); const TriState eAcrossColumnState = m_xAcrossColumnBox->get_state(); const TriState eAcrossPageState = m_xAcrossPageBox->get_state(); const TriState eAcrossSpreadState = m_xAcrossSpreadBox->get_state(); @@ -1666,12 +1668,19 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) aHyphen.GetKeepType() = static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::PAGE); } - else + else if ( eAcrossParagraphState == TRISTATE_TRUE ) { - // don't hyphenate across column, page and spread -> 3 (COLUMN) + // hyphenate across last full paragraph line, but not page and spread -> 2 (PAGE) aHyphen.GetKeepType() = static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::COLUMN); } + else + { + // don't hyphenate across last full paragraph line, + // also column, page and spread -> 4 (COLUMN) + aHyphen.GetKeepType() = + static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::ALWAYS); + } if ( !pOld || *static_cast<const SvxHyphenZoneItem*>(pOld) != aHyphen || @@ -1886,9 +1895,11 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) m_xMinWordLength->set_value(rHyphen.GetMinWordLength()); m_aHyphenZone.SetFieldUnit(eFUnit); m_aHyphenZone.SetMetricValue(rHyphen.GetTextHyphenZone(), MapUnit::MapTwip); + m_xAcrossParagraphBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 4 ? TRISTATE_TRUE : TRISTATE_FALSE); m_xAcrossColumnBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 3 ? TRISTATE_TRUE : TRISTATE_FALSE); m_xAcrossPageBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 2 ? TRISTATE_TRUE : TRISTATE_FALSE); m_xAcrossSpreadBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() == 0 ? TRISTATE_TRUE : TRISTATE_FALSE); + aAcrossParagraphState.bTriStateEnabled = false; aAcrossColumnState.bTriStateEnabled = false; aAcrossPageState.bTriStateEnabled = false; aAcrossSpreadState.bTriStateEnabled = false; @@ -1915,6 +1926,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) m_xHyphenZoneLabel->set_sensitive(bEnable); m_aHyphenZone.set_sensitive(bEnable); m_xAcrossText->set_sensitive(bEnable); + m_xAcrossParagraphBox->set_sensitive(bEnable); m_xAcrossColumnBox->set_sensitive(bEnable); m_xAcrossPageBox->set_sensitive(bEnable); m_xAcrossSpreadBox->set_sensitive(bEnable); @@ -2180,6 +2192,7 @@ void SvxExtParagraphTabPage::ChangesApplied() m_xMaxHyphenEdit->save_value(); m_xMinWordLength->save_value(); m_aHyphenZone.save_value(); + m_xAcrossParagraphBox->save_state(); m_xAcrossColumnBox->save_state(); m_xAcrossPageBox->save_state(); m_xAcrossSpreadBox->save_state(); @@ -2260,6 +2273,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia , m_xWidowRowLabel(m_xBuilder->weld_label(u"labelWidow"_ustr)) // Avoid hyphenation across , m_xAcrossText(m_xBuilder->weld_label(u"labelHyphenAcross"_ustr)) + , m_xAcrossParagraphBox(m_xBuilder->weld_check_button(u"checkAcrossParagraph"_ustr)) , m_xAcrossColumnBox(m_xBuilder->weld_check_button(u"checkAcrossColumn"_ustr)) , m_xAcrossPageBox(m_xBuilder->weld_check_button(u"checkAcrossPage"_ustr)) , m_xAcrossSpreadBox(m_xBuilder->weld_check_button(u"checkAcrossSpread"_ustr)) @@ -2277,6 +2291,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia m_xBreakPositionLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl)); m_xPageNumBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl)); m_xKeepParaBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl)); + m_xAcrossParagraphBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossParagraphHdl_Impl)); m_xAcrossColumnBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossColumnHdl_Impl)); m_xAcrossPageBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossPageHdl_Impl)); m_xAcrossSpreadBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossSpreadHdl_Impl)); @@ -2323,6 +2338,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia m_xPageNumBox->set_sensitive(false); m_xPagenumEdit->set_sensitive(false); m_xAcrossText->set_sensitive(false); + m_xAcrossParagraphBox->set_sensitive(false); m_xAcrossColumnBox->set_sensitive(false); m_xAcrossPageBox->set_sensitive(false); m_xAcrossSpreadBox->set_sensitive(false); @@ -2464,6 +2480,7 @@ void SvxExtParagraphTabPage::HyphenClickHdl() m_xHyphenZoneLabel->set_sensitive(bEnable); m_aHyphenZone.set_sensitive(bEnable); m_xAcrossText->set_sensitive(bEnable); + m_xAcrossParagraphBox->set_sensitive(bEnable); m_xAcrossColumnBox->set_sensitive(bEnable); m_xAcrossPageBox->set_sensitive(bEnable); m_xAcrossSpreadBox->set_sensitive(bEnable); @@ -2568,6 +2585,17 @@ void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet& aSet) DisablePageBreak(); } +IMPL_LINK(SvxExtParagraphTabPage, AcrossParagraphHdl_Impl, weld::Toggleable&, rToggle, void) +{ + aAcrossParagraphState.ButtonToggled(rToggle); + if (m_xAcrossParagraphBox->get_state() != TRISTATE_TRUE ) + { + m_xAcrossColumnBox->set_state( TRISTATE_FALSE ); + m_xAcrossPageBox->set_state( TRISTATE_FALSE ); + m_xAcrossSpreadBox->set_state( TRISTATE_FALSE ); + } +} + IMPL_LINK(SvxExtParagraphTabPage, AcrossColumnHdl_Impl, weld::Toggleable&, rToggle, void) { aAcrossColumnState.ButtonToggled(rToggle); @@ -2576,13 +2604,18 @@ IMPL_LINK(SvxExtParagraphTabPage, AcrossColumnHdl_Impl, weld::Toggleable&, rTogg m_xAcrossPageBox->set_state( TRISTATE_FALSE ); m_xAcrossSpreadBox->set_state( TRISTATE_FALSE ); } + else + m_xAcrossParagraphBox->set_state( TRISTATE_TRUE ); } IMPL_LINK(SvxExtParagraphTabPage, AcrossPageHdl_Impl, weld::Toggleable&, rToggle, void) { aAcrossPageState.ButtonToggled(rToggle); if (m_xAcrossPageBox->get_state() == TRISTATE_TRUE ) + { + m_xAcrossParagraphBox->set_state( TRISTATE_TRUE ); m_xAcrossColumnBox->set_state( TRISTATE_TRUE ); + } else m_xAcrossSpreadBox->set_state( TRISTATE_FALSE ); } @@ -2592,6 +2625,7 @@ IMPL_LINK(SvxExtParagraphTabPage, AcrossSpreadHdl_Impl, weld::Toggleable&, rTogg aAcrossSpreadState.ButtonToggled(rToggle); if (m_xAcrossSpreadBox->get_state() == TRISTATE_TRUE ) { + m_xAcrossParagraphBox->set_state( TRISTATE_TRUE ); m_xAcrossColumnBox->set_state( TRISTATE_TRUE ); m_xAcrossPageBox->set_state( TRISTATE_TRUE ); } |