summaryrefslogtreecommitdiff
path: root/editeng/source/items/paraitem.cxx
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-05-26 09:09:38 +0200
committerLászló Németh <nemeth@numbertext.org>2022-05-26 16:37:02 +0200
commit8c018910ae4d8701b1ce2a95727b9baed4016da3 (patch)
treee0155b8a29d3b60cd78dd98c8bcf57df612d477a /editeng/source/items/paraitem.cxx
parentec694a32ea6c9f0287e8c12f4de62047abfcde72 (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 'editeng/source/items/paraitem.cxx')
-rw-r--r--editeng/source/items/paraitem.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 6f5e5f9acd80..56d9628276b3 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -555,6 +555,7 @@ SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph, const sal_uInt16 nId ) :
bHyphen(bHyph),
bPageEnd(true),
bNoCapsHyphenation(false),
+ bNoLastWordHyphenation(false),
nMinLead(0),
nMinTrail(0),
nMaxHyphens(255)
@@ -582,6 +583,9 @@ bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con
case MID_HYPHEN_NO_CAPS:
rVal <<= bNoCapsHyphenation;
break;
+ case MID_HYPHEN_NO_LAST_WORD:
+ rVal <<= bNoLastWordHyphenation;
+ break;
}
return true;
}
@@ -591,9 +595,12 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
nMemberId &= ~CONVERT_TWIPS;
sal_Int16 nNewVal = 0;
- if( nMemberId != MID_IS_HYPHEN && nMemberId != MID_HYPHEN_NO_CAPS )
+ if( nMemberId != MID_IS_HYPHEN && nMemberId != MID_HYPHEN_NO_CAPS &&
+ nMemberId != MID_HYPHEN_NO_LAST_WORD )
+ {
if(!(rVal >>= nNewVal))
return false;
+ }
switch(nMemberId)
{
@@ -612,6 +619,9 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
case MID_HYPHEN_NO_CAPS:
bNoCapsHyphenation = Any2Bool(rVal);
break;
+ case MID_HYPHEN_NO_LAST_WORD:
+ bNoLastWordHyphenation = Any2Bool(rVal);
+ break;
}
return true;
}
@@ -624,6 +634,7 @@ bool SvxHyphenZoneItem::operator==( const SfxPoolItem& rAttr ) const
const SvxHyphenZoneItem& rItem = static_cast<const SvxHyphenZoneItem&>(rAttr);
return ( rItem.bHyphen == bHyphen
&& rItem.bNoCapsHyphenation == bNoCapsHyphenation
+ && rItem.bNoLastWordHyphenation == bNoLastWordHyphenation
&& rItem.bPageEnd == bPageEnd
&& rItem.nMinLead == nMinLead
&& rItem.nMinTrail == nMinTrail