diff options
author | László Németh <nemeth@numbertext.org> | 2022-05-26 09:09:38 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-05-26 16:37:02 +0200 |
commit | 8c018910ae4d8701b1ce2a95727b9baed4016da3 (patch) | |
tree | e0155b8a29d3b60cd78dd98c8bcf57df612d477a /cui/source | |
parent | ec694a32ea6c9f0287e8c12f4de62047abfcde72 (diff) |
tdf#149248 sw offapi xmloff: add option to not hyphenate last word
Add option to disable automatic hyphenation of the last word of
paragraphs for better typography.
Note: the same option used e.g. in Adobe InDesign, and a
similar one in CSS Text Module Level 4 (hyphenate-limit-last).
* Add checkbox to Text Flow in paragraph dialog
* Store property in paragraph model (com::sun::star::style::ParagraphProperties::ParaHyphenationNoLastWord)
* Add ODF import/export
* Add ODF unit test
* Add layout test
Follow-up to commit 72bd0df107ee47c4d54fa88b4960d32ea03e9f69
"tdf#121658 Add option to not hyphenate words in CAPS".
Change-Id: Ida29c65b5a7cbfd7c399c342781531a6fb86f639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134985
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 | 1 | ||||
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index 73cc5faf32cd..0967c32a060e 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -225,6 +225,7 @@ private: // hyphenation std::unique_ptr<weld::CheckButton> m_xHyphenBox; std::unique_ptr<weld::CheckButton> m_xHyphenNoCapsBox; + std::unique_ptr<weld::CheckButton> m_xHyphenNoLastWordBox; std::unique_ptr<weld::Label> m_xBeforeText; std::unique_ptr<weld::SpinButton> m_xExtHyphenBeforeBox; std::unique_ptr<weld::Label> m_xAfterText; diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 14a43480caa5..29bc2fc76b43 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -1352,6 +1352,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) if ( m_xHyphenBox->get_state_changed_from_saved() || m_xHyphenNoCapsBox->get_state_changed_from_saved() || + m_xHyphenNoLastWordBox->get_state_changed_from_saved() || m_xExtHyphenBeforeBox->get_value_changed_from_saved() || m_xExtHyphenAfterBox->get_value_changed_from_saved() || m_xMaxHyphenEdit->get_value_changed_from_saved() ) @@ -1360,6 +1361,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet ) static_cast<const SvxHyphenZoneItem&>(GetItemSet().Get( _nWhich )) ); aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE ); aHyphen.SetNoCapsHyphenation(m_xHyphenNoCapsBox->get_state() == TRISTATE_TRUE); + aHyphen.SetNoLastWordHyphenation(m_xHyphenNoLastWordBox->get_state() == TRISTATE_TRUE); if ( eHyphenState == TRISTATE_TRUE ) { @@ -1570,6 +1572,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) bIsHyphen = rHyphen.IsHyphen(); m_xHyphenBox->set_state(bIsHyphen ? TRISTATE_TRUE : TRISTATE_FALSE); m_xHyphenNoCapsBox->set_state(rHyphen.IsNoCapsHyphenation() ? TRISTATE_TRUE : TRISTATE_FALSE); + m_xHyphenNoLastWordBox->set_state(rHyphen.IsNoLastWordHyphenation() ? TRISTATE_TRUE : TRISTATE_FALSE); m_xExtHyphenBeforeBox->set_value(rHyphen.GetMinLead()); m_xExtHyphenAfterBox->set_value(rHyphen.GetMinTrail()); @@ -1579,9 +1582,11 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet ) { m_xHyphenBox->set_state(TRISTATE_INDET); m_xHyphenNoCapsBox->set_state(TRISTATE_INDET); + m_xHyphenNoLastWordBox->set_state(TRISTATE_INDET); } bool bEnable = bItemAvailable && bIsHyphen; m_xHyphenNoCapsBox->set_sensitive(bEnable); + m_xHyphenNoLastWordBox->set_sensitive(bEnable); m_xExtHyphenBeforeBox->set_sensitive(bEnable); m_xExtHyphenAfterBox->set_sensitive(bEnable); m_xBeforeText->set_sensitive(bEnable); @@ -1843,6 +1848,7 @@ void SvxExtParagraphTabPage::ChangesApplied() { m_xHyphenBox->save_state(); m_xHyphenNoCapsBox->save_state(); + m_xHyphenNoLastWordBox->save_state(); m_xExtHyphenBeforeBox->set_value(m_xExtHyphenBeforeBox->get_value()); m_xExtHyphenAfterBox->set_value(m_xExtHyphenAfterBox->get_value()); m_xMaxHyphenEdit->set_value(m_xMaxHyphenEdit->get_value()); @@ -1889,6 +1895,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia // Hyphenation , m_xHyphenBox(m_xBuilder->weld_check_button("checkAuto")) , m_xHyphenNoCapsBox(m_xBuilder->weld_check_button("checkNoCaps")) + , m_xHyphenNoLastWordBox(m_xBuilder->weld_check_button("checkNoLastWord")) , m_xBeforeText(m_xBuilder->weld_label("labelLineBegin")) , m_xExtHyphenBeforeBox(m_xBuilder->weld_spin_button("spinLineEnd")) , m_xAfterText(m_xBuilder->weld_label("labelLineEnd")) @@ -1956,6 +1963,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia bHtmlMode = true; m_xHyphenBox->set_sensitive(false); m_xHyphenNoCapsBox->set_sensitive(false); + m_xHyphenNoLastWordBox->set_sensitive(false); m_xBeforeText->set_sensitive(false); m_xExtHyphenBeforeBox->set_sensitive(false); m_xAfterText->set_sensitive(false); @@ -2088,6 +2096,7 @@ void SvxExtParagraphTabPage::HyphenClickHdl() { bool bEnable = m_xHyphenBox->get_state() == TRISTATE_TRUE; m_xHyphenNoCapsBox->set_sensitive(bEnable); + m_xHyphenNoLastWordBox->set_sensitive(bEnable); m_xBeforeText->set_sensitive(bEnable); m_xExtHyphenBeforeBox->set_sensitive(bEnable); m_xAfterText->set_sensitive(bEnable); |