summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-05-26 19:01:07 +0200
committerLászló Németh <nemeth@numbertext.org>2022-05-26 20:25:35 +0200
commit29359fc15c435cec17987fd6221ab6833d38746e (patch)
treec4bc33e84fee7414c0e0d5e9e6b9c77526e2aa68 /cui
parent3cde7345199b535763bb7d83a87096e9157b7317 (diff)
tdf#149324 sw offapi xmloff: add option to not hyphenate short words
Add paragraph property to disable automatic hyphenation of short words based on a minimum character count. Note: there is a (broken) global option for Minimum Word Length at hyphenation, see "Minimal number of characters for hyphenation" in Tools->Options->Language Settings->Writing Aids), but for better/comfortable paragraph-level adjustment of typesetting, add a paragraph property for it. The same option is available e.g. in Adobe InDesign and in CSS Text Module Level 4 (hyphenate-limit-chars). * Add checkbox to Text Flow in paragraph dialog * Store property in paragraph model (com::sun::star::style::ParagraphProperties::ParaHyphenationMinWordLength) * Add ODF import/export * Add ODF unit test * Add layout test Follow-up to commit 8c018910ae4d8701b1ce2a95727b9baed4016da3 "tdf#149248 sw offapi xmloff: add option to not hyphenate last word". Change-Id: I68715f47d17b5c022430bd0e74c88a97bc7f81f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135028 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/paragrph.hxx1
-rw-r--r--cui/source/tabpages/paragrph.cxx10
-rw-r--r--cui/uiconfig/ui/textflowpage.ui41
3 files changed, 51 insertions, 1 deletions
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 0967c32a060e..f0c56775fc2c 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -232,6 +232,7 @@ private:
std::unique_ptr<weld::SpinButton> m_xExtHyphenAfterBox;
std::unique_ptr<weld::Label> m_xMaxHyphenLabel;
std::unique_ptr<weld::SpinButton> m_xMaxHyphenEdit;
+ std::unique_ptr<weld::SpinButton> m_xMinWordLength;
// pagebreak
std::unique_ptr<weld::CheckButton> m_xPageBreakBox;
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 29bc2fc76b43..2d651fedae6a 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -1355,7 +1355,8 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
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() )
+ m_xMaxHyphenEdit->get_value_changed_from_saved() ||
+ m_xMinWordLength->get_value_changed_from_saved() )
{
SvxHyphenZoneItem aHyphen(
static_cast<const SvxHyphenZoneItem&>(GetItemSet().Get( _nWhich )) );
@@ -1367,6 +1368,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
{
aHyphen.GetMinLead() = static_cast<sal_uInt8>(m_xExtHyphenBeforeBox->get_value());
aHyphen.GetMinTrail() = static_cast<sal_uInt8>(m_xExtHyphenAfterBox->get_value());
+ aHyphen.GetMinWordLength() = static_cast<sal_uInt8>(m_xMinWordLength->get_value());
}
aHyphen.GetMaxHyphens() = static_cast<sal_uInt8>(m_xMaxHyphenEdit->get_value());
@@ -1577,6 +1579,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
m_xExtHyphenBeforeBox->set_value(rHyphen.GetMinLead());
m_xExtHyphenAfterBox->set_value(rHyphen.GetMinTrail());
m_xMaxHyphenEdit->set_value(rHyphen.GetMaxHyphens());
+ m_xMinWordLength->set_value(rHyphen.GetMinWordLength());
}
else
{
@@ -1593,6 +1596,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
m_xAfterText->set_sensitive(bEnable);
m_xMaxHyphenLabel->set_sensitive(bEnable);
m_xMaxHyphenEdit->set_sensitive(bEnable);
+ m_xMinWordLength->set_sensitive(bEnable);
switch (rSet->GetItemState(SID_ATTR_PARA_PAGENUM))
{
@@ -1852,6 +1856,7 @@ void SvxExtParagraphTabPage::ChangesApplied()
m_xExtHyphenBeforeBox->set_value(m_xExtHyphenBeforeBox->get_value());
m_xExtHyphenAfterBox->set_value(m_xExtHyphenAfterBox->get_value());
m_xMaxHyphenEdit->set_value(m_xMaxHyphenEdit->get_value());
+ m_xMinWordLength->set_value(m_xMinWordLength->get_value());
m_xPageBreakBox->save_state();
m_xBreakPositionLB->save_value();
m_xBreakTypeLB->save_value();
@@ -1902,6 +1907,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
, m_xExtHyphenAfterBox(m_xBuilder->weld_spin_button("spinLineBegin"))
, m_xMaxHyphenLabel(m_xBuilder->weld_label("labelMaxNum"))
, m_xMaxHyphenEdit(m_xBuilder->weld_spin_button("spinMaxNum"))
+ , m_xMinWordLength(m_xBuilder->weld_spin_button("spinMinLen"))
//Page break
, m_xPageBreakBox(m_xBuilder->weld_check_button("checkInsert"))
, m_xBreakTypeFT(m_xBuilder->weld_label("labelType"))
@@ -1970,6 +1976,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
m_xExtHyphenAfterBox->set_sensitive(false);
m_xMaxHyphenLabel->set_sensitive(false);
m_xMaxHyphenEdit->set_sensitive(false);
+ m_xMinWordLength->set_sensitive(false);
m_xPageNumBox->set_sensitive(false);
m_xPagenumEdit->set_sensitive(false);
// no column break in HTML
@@ -2103,6 +2110,7 @@ void SvxExtParagraphTabPage::HyphenClickHdl()
m_xExtHyphenAfterBox->set_sensitive(bEnable);
m_xMaxHyphenLabel->set_sensitive(bEnable);
m_xMaxHyphenEdit->set_sensitive(bEnable);
+ m_xMinWordLength->set_sensitive(bEnable);
m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
}
diff --git a/cui/uiconfig/ui/textflowpage.ui b/cui/uiconfig/ui/textflowpage.ui
index 9ff931ddc6b8..89ac8a3a22dd 100644
--- a/cui/uiconfig/ui/textflowpage.ui
+++ b/cui/uiconfig/ui/textflowpage.ui
@@ -41,6 +41,13 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkAdjustment" id="adjustment7">
+ <property name="lower">4</property>
+ <property name="upper">99</property>
+ <property name="value">4</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<!-- n-columns=1 n-rows=1 -->
<object class="GtkGrid" id="TextFlowPage">
<property name="visible">True</property>
@@ -86,6 +93,26 @@
</packing>
</child>
<child>
+ <object class="GtkSpinButton" id="spinMinLen">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
+ <property name="margin-start">25</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment7</property>
+ <property name="truncate-multiline">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="spinMinLen-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes" context="textflowpage|extended_tip|spinMinLen">Enter the minimum word length in characters that can be hyphenated.</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkSpinButton" id="spinMaxNum">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -188,6 +215,20 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="labelMinLen">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" context="textflowpage|labelMinLen">_Minimum word length in characters</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">spinMinLen</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="checkNoCaps">
<property name="label" translatable="yes" context="textflowpage|checkNoCaps">Don't hyphenate words in _CAPS</property>
<property name="visible">True</property>