summaryrefslogtreecommitdiff
path: root/include/editeng
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 /include/editeng
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 'include/editeng')
-rw-r--r--include/editeng/eeitem.hxx25
-rw-r--r--include/editeng/hyphenzoneitem.hxx3
-rw-r--r--include/editeng/memberids.h1
-rw-r--r--include/editeng/unotext.hxx1
4 files changed, 18 insertions, 12 deletions
diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx
index 28e5d8a0dd80..f862244865c1 100644
--- a/include/editeng/eeitem.hxx
+++ b/include/editeng/eeitem.hxx
@@ -80,18 +80,19 @@ constexpr TypedWhichId<SvxScriptSpaceItem> EE_PARA_ASIANCJKSPACING (EE
constexpr TypedWhichId<SvxNumBulletItem> EE_PARA_NUMBULLET (EE_PARA_START+5);
constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE (EE_PARA_START+6);
constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE_NO_CAPS (EE_PARA_START+7);
-constexpr TypedWhichId<SfxBoolItem> EE_PARA_BULLETSTATE (EE_PARA_START+8);
-constexpr TypedWhichId<SvxLRSpaceItem> EE_PARA_OUTLLRSPACE (EE_PARA_START+9);
-constexpr TypedWhichId<SfxInt16Item> EE_PARA_OUTLLEVEL (EE_PARA_START+10);
-constexpr TypedWhichId<SvxBulletItem> EE_PARA_BULLET (EE_PARA_START+11);
-constexpr TypedWhichId<SvxLRSpaceItem> EE_PARA_LRSPACE (EE_PARA_START+12);
-constexpr TypedWhichId<SvxULSpaceItem> EE_PARA_ULSPACE (EE_PARA_START+13);
-constexpr TypedWhichId<SvxLineSpacingItem> EE_PARA_SBL (EE_PARA_START+14);
-constexpr TypedWhichId<SvxAdjustItem> EE_PARA_JUST (EE_PARA_START+15);
-constexpr TypedWhichId<SvxTabStopItem> EE_PARA_TABS (EE_PARA_START+16);
-constexpr TypedWhichId<SvxJustifyMethodItem> EE_PARA_JUST_METHOD (EE_PARA_START+17);
-constexpr TypedWhichId<SvxVerJustifyItem> EE_PARA_VER_JUST (EE_PARA_START+18);
-constexpr sal_uInt16 EE_PARA_END (EE_PARA_START + 18);
+constexpr TypedWhichId<SfxBoolItem> EE_PARA_HYPHENATE_NO_LAST_WORD (EE_PARA_START+8);
+constexpr TypedWhichId<SfxBoolItem> EE_PARA_BULLETSTATE (EE_PARA_START+9);
+constexpr TypedWhichId<SvxLRSpaceItem> EE_PARA_OUTLLRSPACE (EE_PARA_START+10);
+constexpr TypedWhichId<SfxInt16Item> EE_PARA_OUTLLEVEL (EE_PARA_START+11);
+constexpr TypedWhichId<SvxBulletItem> EE_PARA_BULLET (EE_PARA_START+12);
+constexpr TypedWhichId<SvxLRSpaceItem> EE_PARA_LRSPACE (EE_PARA_START+13);
+constexpr TypedWhichId<SvxULSpaceItem> EE_PARA_ULSPACE (EE_PARA_START+14);
+constexpr TypedWhichId<SvxLineSpacingItem> EE_PARA_SBL (EE_PARA_START+15);
+constexpr TypedWhichId<SvxAdjustItem> EE_PARA_JUST (EE_PARA_START+16);
+constexpr TypedWhichId<SvxTabStopItem> EE_PARA_TABS (EE_PARA_START+17);
+constexpr TypedWhichId<SvxJustifyMethodItem> EE_PARA_JUST_METHOD (EE_PARA_START+18);
+constexpr TypedWhichId<SvxVerJustifyItem> EE_PARA_VER_JUST (EE_PARA_START+19);
+constexpr sal_uInt16 EE_PARA_END (EE_PARA_START + 19);
// Character attributes:
constexpr sal_uInt16 EE_CHAR_START (EE_PARA_END + 1);
diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx
index 9b3abd338839..26dd9a1b31f0 100644
--- a/include/editeng/hyphenzoneitem.hxx
+++ b/include/editeng/hyphenzoneitem.hxx
@@ -35,6 +35,7 @@ class EDITENG_DLLPUBLIC SvxHyphenZoneItem final : public SfxPoolItem
bool bHyphen : 1;
bool bPageEnd : 1;
bool bNoCapsHyphenation : 1;
+ bool bNoLastWordHyphenation : 1;
sal_uInt8 nMinLead;
sal_uInt8 nMinTrail;
sal_uInt8 nMaxHyphens;
@@ -65,6 +66,8 @@ public:
void SetNoCapsHyphenation( const bool bNew ) { bNoCapsHyphenation = bNew; }
bool IsNoCapsHyphenation() const { return bNoCapsHyphenation; }
+ void SetNoLastWordHyphenation( const bool bNew ) { bNoLastWordHyphenation = bNew; }
+ bool IsNoLastWordHyphenation() const { return bNoLastWordHyphenation; }
sal_uInt8 &GetMinLead() { return nMinLead; }
sal_uInt8 GetMinLead() const { return nMinLead; }
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index 1b50ab467229..a40d24cd6211 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -47,6 +47,7 @@
#define MID_HYPHEN_MIN_TRAIL 2
#define MID_HYPHEN_MAX_HYPHENS 3
#define MID_HYPHEN_NO_CAPS 4
+#define MID_HYPHEN_NO_LAST_WORD 5
// SvxBoxInfoItem
#define MID_HORIZONTAL 1
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index 87dc02a37c09..3c8f95368473 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -140,6 +140,7 @@ struct SfxItemPropertyMapEntry;
{ UNO_NAME_EDIT_PARA_BMARGIN, EE_PARA_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_LO_MARGIN, PropertyMoreFlags::METRIC_ITEM }, \
{ UNO_NAME_EDIT_PARA_IS_HYPHEN, EE_PARA_HYPHENATE, ::cppu::UnoType<bool>::get(), 0, 0 }, \
{u"ParaHyphenationNoCaps", EE_PARA_HYPHENATE_NO_CAPS, ::cppu::UnoType<bool>::get(), 0, 0 }, \
+ {u"ParaHyphenationNoLastWord", EE_PARA_HYPHENATE_NO_LAST_WORD, ::cppu::UnoType<bool>::get(), 0, 0 }, \
{ UNO_NAME_EDIT_PARA_LASTLINEADJ, EE_PARA_JUST, ::cppu::UnoType<sal_Int16>::get(), 0, MID_LAST_LINE_ADJUST }, \
{ UNO_NAME_EDIT_PARA_LMARGIN, EE_PARA_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_TXT_LMARGIN, PropertyMoreFlags::METRIC_ITEM }, \
{ UNO_NAME_EDIT_PARA_LINESPACING, EE_PARA_SBL, cppu::UnoType<css::style::LineSpacing>::get(), 0, CONVERT_TWIPS}, \