summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2024-02-29 14:07:34 +0100
committerLászló Németh <nemeth@numbertext.org>2024-03-04 23:39:51 +0100
commit9574a62add8e4901405e12117e75c86c2d2c2f21 (patch)
tree519ec81796776b97d2ea72f3a0f08c344c1779c2 /include
parent2eba8bb8d43d39eb229a81947907e70f50859a76 (diff)
tdf#132599 cui offapi sw xmloff: implement hyphenate-keep
Both parts of a hyphenated word shall lie within a single page with ODF paragraph setting fo:hyphenation-keep="page". The implementation follows the default page layout of MSO 2016 and newer by shifting the bottom hyphenated line to the next page (and to the next column, see last note). Note: this is a MSO DOCX interoperability feature, used also in DTP software, XSL and CSS. * Add checkbox/combobox to Text Flow in paragraph dialog * Store property in paragraph model (com::sun::star::style::ParagraphProperties::ParaHyphenationKeep) * Add ODF import/export * Add ODF unit tests New constants of com::sun::star::text::ParagraphHyphenationKeepType, containing ODF AUTO and PAGE (borrowed from XSL), and for the planned extension ParaHyphenationKeepType of ParagraphProperties: – COLUMN (standard XSL value, defined in https://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#hyphenation-keep) – SPREAD and ALWAYS (CSS 4 values of hyphenate-limit-last, equivalent of hyphenation-keep, defined in https://www.w3.org/TR/css-text-4/#hyphenate-line-limits). Note: the implementation truncates only a single hyphenated line, like MSO does: the pages can end in hyphenated lines (i.e. in the case of consecutive hyphenated lines), but less often, than before. Clean-up hyphenation dialog by collecting "Don't hyphenate" options at the end of the hyphenation settings, and negating them (similar to MSO and DTP), adding also the new option "Hyphenate across column and page": [x] Hyphenate words in CAPS [x] Hyphenate last word [x] Hyphenate across column and page Note: ODF fo:hyphenation-keep has got only "auto" and "page" attributes, while XSL defines also "column". Because of the interoperability with MSO and DTP, fo:hyphenation-keep="page" is interpreted as XSL "column", avoiding hyphenation at the end of column, not only at the end of page. Change-Id: I5c6b7adc0671a5a790568e7bf1d33256e607f85f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164158 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'include')
-rw-r--r--include/editeng/editrids.hrc5
-rw-r--r--include/editeng/hyphenzoneitem.hxx4
-rw-r--r--include/editeng/memberids.h1
-rw-r--r--include/unotools/linguprops.hxx2
-rw-r--r--include/xmloff/xmltypes.hxx1
5 files changed, 13 insertions, 0 deletions
diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc
index 8d45a7c8a9da..2fd74999c980 100644
--- a/include/editeng/editrids.hrc
+++ b/include/editeng/editrids.hrc
@@ -235,6 +235,11 @@
#define RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE NC_("RID_SVXITEMS_HYPHEN_NO_CAPS_FALSE", "Not hyphenated last word")
#define RID_SVXITEMS_HYPHEN_MINWORDLEN NC_("RID_SVXITEMS_HYPHEN_MINWORDLEN", "%1 characters in words")
#define RID_SVXITEMS_HYPHEN_ZONE NC_("RID_SVXITEMS_HYPHEN_ZONE", "Hyphenation zone ")
+#define RID_SVXITEMS_HYPHEN_KEEP_AUTO NC_("RID_SVXITEMS_HYPHEN_KEEP_AUTO", "Automatic hyphenation across page")
+#define RID_SVXITEMS_HYPHEN_KEEP_SPREAD NC_("RID_SVXITEMS_HYPHEN_KEEP_SPREAD", "Avoid hyphenation between pages which are not visible to the reader at the same time")
+#define RID_SVXITEMS_HYPHEN_KEEP_PAGE NC_("RID_SVXITEMS_HYPHEN_KEEP_PAGE", "Avoid hyphenation across page")
+#define RID_SVXITEMS_HYPHEN_KEEP_COLUMN NC_("RID_SVXITEMS_HYPHEN_KEEP_COLUMN", "Avoid hyphenation across column and page")
+#define RID_SVXITEMS_HYPHEN_KEEP_ALWAYS NC_("RID_SVXITEMS_HYPHEN_KEEP_ALWAYS", "Avoid hyphenation across last full paragraph line, column and page")
#define RID_SVXITEMS_PAGEMODEL_COMPLETE NC_("RID_SVXITEMS_PAGEMODEL_COMPLETE", "Page Style: ")
#define RID_SVXITEMS_KERNING_COMPLETE NC_("RID_SVXITEMS_KERNING_COMPLETE", "Kerning ")
#define RID_SVXITEMS_KERNING_EXPANDED NC_("RID_SVXITEMS_KERNING_EXPANDED", "locked ")
diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx
index 7104d2d7db58..cbe4a503a0a6 100644
--- a/include/editeng/hyphenzoneitem.hxx
+++ b/include/editeng/hyphenzoneitem.hxx
@@ -41,6 +41,7 @@ class EDITENG_DLLPUBLIC SvxHyphenZoneItem final : public SfxPoolItem
sal_uInt8 nMaxHyphens; // max. consecutive lines with hyphenation
sal_uInt8 nMinWordLength; // hyphenate only words with at least nMinWordLength characters
sal_uInt16 nTextHyphenZone; // don't force hyphenation at line end, allow this extra white space
+ sal_uInt8 nKeep; // avoid hyphenation across page etc., see ParagraphHyphenationKeep
public:
static SfxPoolItem* CreateDefault();
@@ -85,6 +86,9 @@ public:
sal_uInt16 &GetTextHyphenZone() { return nTextHyphenZone; }
sal_uInt16 GetTextHyphenZone() const { return nTextHyphenZone; }
+
+ sal_uInt8 &GetKeep() { return nKeep; }
+ sal_uInt8 GetKeep() const { return nKeep; }
};
#endif
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index b44a1486ac16..d1245172eee5 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -51,6 +51,7 @@
#define MID_HYPHEN_NO_LAST_WORD 5
#define MID_HYPHEN_MIN_WORD_LENGTH 6
#define MID_HYPHEN_ZONE 7
+#define MID_HYPHEN_KEEP 8
// SvxBoxInfoItem
#define MID_HORIZONTAL 1
diff --git a/include/unotools/linguprops.hxx b/include/unotools/linguprops.hxx
index 1f182cd3d487..81d2748eef3b 100644
--- a/include/unotools/linguprops.hxx
+++ b/include/unotools/linguprops.hxx
@@ -42,6 +42,7 @@ inline constexpr OUString UPN_HYPH_MIN_WORD_LENGTH = u"HyphMinWordLen
inline constexpr OUString UPN_HYPH_NO_CAPS = u"HyphNoCaps"_ustr;
inline constexpr OUString UPN_HYPH_NO_LAST_WORD = u"HyphNoLastWord"_ustr;
inline constexpr OUString UPN_HYPH_ZONE = u"HyphZone"_ustr;
+inline constexpr OUString UPN_HYPH_KEEP = u"HyphKeep"_ustr;
// UNO property names for Lingu
// (those not covered by the SpellChecker and Hyphenator
@@ -109,6 +110,7 @@ inline constexpr OUString UPN_IS_GRAMMAR_INTERACTIVE = u"IsInteractiveG
#define UPH_HYPH_NO_CAPS 32
#define UPH_HYPH_NO_LAST_WORD 33
#define UPH_HYPH_ZONE 34
+#define UPH_HYPH_KEEP 35
#ifdef __GNUC__
#pragma GCC diagnostic pop
diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx
index 8c9b001b061d..313591c730d0 100644
--- a/include/xmloff/xmltypes.hxx
+++ b/include/xmloff/xmltypes.hxx
@@ -296,6 +296,7 @@
#define XML_SW_TYPE_PRESPAGE_BACKSIZE (XML_TEXT_TYPES_START + 128)
#define XML_SW_TYPE_RTLGUTTER (XML_TEXT_TYPES_START + 129)
#define XML_TYPE_COMPLEX_COLOR (XML_TEXT_TYPES_START + 130)
+#define XML_TYPE_HYPHENATION_KEEP (XML_TEXT_TYPES_START + 131)
#endif // INCLUDED_XMLOFF_XMLTYPES_HXX