summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2024-04-10 12:27:38 +0200
committerLászló Németh <nemeth@numbertext.org>2024-04-11 10:20:41 +0200
commit6e8819f29b6051a0e551d77512830539913ec277 (patch)
tree0b1db7dca582745986374695fade6a7a8ba42b49 /include
parentd890c27b670aa2fcd06a40021ddf6a5b44714a49 (diff)
tdf#132599 cui offapi sw xmloff: add hyphenation-keep-type
Support XSL attribute "column" and CSS 4 attribute "spread", stored in loext:hyphenation-keep-type, to give better control over hyphenation-keep. E.g. spread: both parts of a hyphenated word shall lie within a single spread, i.e. when the next page is not visible at the same time (e.g. the next page is not a right page of a book). – css::style::ParaHyphenationKeep is a boolean property now, importing hyphenation-keep = "page" as true. – type of ParaHyphenationKeep, including the new non-ODF types is stored in the new ParagraphProperties::ParaHyphenationKeepType. – default value of ParaHyphenationKeepType is COLUMN for interoperability. – Add checkboxes to Text Flow -> Hyphenation Across in paragraph dialog: * Column (previously: Hyphenate across column and page) * Page * Spread – enabling/disabling them follows XSL/CSS 4/loext, i.e. possible combinations: * No Hyphenation across (hyphenation-keep = "page" and loext:hyphenation-keep-type = "column") * Hyphenation across [x] Column (hyphenation-keep = "page" and loext:hyphenation-keep-type = "page") * Hyphenation across [x] Column [x] Page (hyphenation-keep = "page" and loext:hyphenation-keep-type = "spread") * Hyphenation across [x] Column [x] Page [x] Spread (hyphenation-keep = "auto") – Add ODF import/export – Update DOCX import – Add ODF unit tests Note: recent implementation depends on widow settings: disabling widow handling allows hyphenation across columns and pages not only in table cells. Note: RTF import-only, but not used bPageEnd has been renamed to bKeep. Depending on the RTF test results, likely it will need to disable the layout change, e.g. GetKeepType()=ParagraphHyphenationKeepType::AUTO, if PageEnd uses obsolete hyphenation rule, i.e. shifting only the hyphenated word to the next page, not the full line. More information: – 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). Follow-up to commit 9574a62add8e4901405e12117e75c86c2d2c2f21 "tdf#132599 cui offapi sw xmloff: implement hyphenate-keep" and commit c8ee0e8f581b8a6e41b1a6b8aa4d40b442c1d463 "tdf160518 DOCX: import hyphenation-keep to fix layout". Change-Id: I3ac6d9e86d0ed1646f105de8607c0e8ebc534eaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165954 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.hrc8
-rw-r--r--include/editeng/hyphenzoneitem.hxx12
-rw-r--r--include/editeng/memberids.h3
-rw-r--r--include/sfx2/msg.hxx1
-rw-r--r--include/unotools/linguprops.hxx4
-rw-r--r--include/xmloff/xmltoken.hxx2
-rw-r--r--include/xmloff/xmltypes.hxx1
7 files changed, 19 insertions, 12 deletions
diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc
index 0f1a198dffc8..270b02707758 100644
--- a/include/editeng/editrids.hrc
+++ b/include/editeng/editrids.hrc
@@ -199,8 +199,8 @@
#define RID_SVXITEMS_TRANSPARENT_FALSE NC_("RID_SVXITEMS_TRANSPARENT_FALSE", "Not Transparent")
#define RID_SVXITEMS_HYPHEN_TRUE NC_("RID_SVXITEMS_HYPHEN_TRUE", "Hyphenation")
#define RID_SVXITEMS_HYPHEN_FALSE NC_("RID_SVXITEMS_HYPHEN_FALSE", "No hyphenation")
-#define RID_SVXITEMS_PAGE_END_TRUE NC_("RID_SVXITEMS_PAGE_END_TRUE", "Page End")
-#define RID_SVXITEMS_PAGE_END_FALSE NC_("RID_SVXITEMS_PAGE_END_FALSE", "No Page End")
+#define RID_SVXITEMS_HYPHEN_KEEP_TRUE NC_("RID_SVXITEMS_HYPHEN_KEEP_TRUE", "No hyphenation across")
+#define RID_SVXITEMS_HYPHEN_KEEP_FALSE NC_("RID_SVXITEMS_HYPHEN_KEEP_FALSE", "Hyphenation across page")
#define RID_SVXITEMS_SIZE_WIDTH NC_("RID_SVXITEMS_SIZE_WIDTH", "Width: ")
#define RID_SVXITEMS_SIZE_HEIGHT NC_("RID_SVXITEMS_SIZE_HEIGHT", "Height: ")
#define RID_SVXITEMS_LRSPACE_LEFT NC_("RID_SVXITEMS_LRSPACE_LEFT", "Indent left ")
@@ -236,8 +236,8 @@
#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_AUTO NC_("RID_SVXITEMS_HYPHEN_KEEP_AUTO", "Hyphenation across page")
+#define RID_SVXITEMS_HYPHEN_KEEP_SPREAD NC_("RID_SVXITEMS_HYPHEN_KEEP_SPREAD", "Avoid hyphenation across page when the next page is 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")
diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx
index 0c7fe7fb6fed..d7aa7ea61862 100644
--- a/include/editeng/hyphenzoneitem.hxx
+++ b/include/editeng/hyphenzoneitem.hxx
@@ -33,7 +33,7 @@
class EDITENG_DLLPUBLIC SvxHyphenZoneItem final : public SfxPoolItem
{
bool bHyphen : 1;
- bool bPageEnd : 1;
+ bool bKeep : 1; // avoid hyphenation across page etc., see ParagraphHyphenationKeep
bool bNoCapsHyphenation : 1;
bool bNoLastWordHyphenation : 1;
sal_uInt8 nMinLead;
@@ -41,7 +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
+ sal_uInt8 nKeepType; // avoid hyphenation across page etc., see ParagraphHyphenationKeep
sal_uInt8 nCompoundMinLead; // min. characters between compound word boundary and hyphenation
public:
@@ -65,8 +65,8 @@ public:
void SetHyphen( const bool bNew ) { bHyphen = bNew; }
bool IsHyphen() const { return bHyphen; }
- void SetPageEnd( const bool bNew ) { bPageEnd = bNew; }
- bool IsPageEnd() const { return bPageEnd; }
+ void SetKeep( const bool bNew ) { bKeep = bNew; }
+ bool IsKeep() const { return bKeep; }
void SetNoCapsHyphenation( const bool bNew ) { bNoCapsHyphenation = bNew; }
bool IsNoCapsHyphenation() const { return bNoCapsHyphenation; }
@@ -91,8 +91,8 @@ public:
sal_uInt16 &GetTextHyphenZone() { return nTextHyphenZone; }
sal_uInt16 GetTextHyphenZone() const { return nTextHyphenZone; }
- sal_uInt8 &GetKeep() { return nKeep; }
- sal_uInt8 GetKeep() const { return nKeep; }
+ sal_uInt8 &GetKeepType() { return nKeepType; }
+ sal_uInt8 GetKeepType() const { return nKeepType; }
};
#endif
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index f913921a6ee8..57250a9872e8 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -52,7 +52,8 @@
#define MID_HYPHEN_MIN_WORD_LENGTH 6
#define MID_HYPHEN_ZONE 7
#define MID_HYPHEN_KEEP 8
-#define MID_HYPHEN_COMPOUND_MIN_LEAD 9
+#define MID_HYPHEN_KEEP_TYPE 9
+#define MID_HYPHEN_COMPOUND_MIN_LEAD 10
// SvxBoxInfoItem
#define MID_HORIZONTAL 1
diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx
index 4d6f1a060e50..86ecfd423644 100644
--- a/include/sfx2/msg.hxx
+++ b/include/sfx2/msg.hxx
@@ -135,6 +135,7 @@ SFX_DECL_TYPE(5);
SFX_DECL_TYPE(6);
SFX_DECL_TYPE(7);
SFX_DECL_TYPE(8);
+SFX_DECL_TYPE(9); // for SvxHyphenZoneItem
SFX_DECL_TYPE(10); // for SfxDocInfoItem
SFX_DECL_TYPE(11);
diff --git a/include/unotools/linguprops.hxx b/include/unotools/linguprops.hxx
index f6f0ffc1aa40..92767f657620 100644
--- a/include/unotools/linguprops.hxx
+++ b/include/unotools/linguprops.hxx
@@ -43,6 +43,7 @@ inline constexpr OUString UPN_HYPH_NO_CAPS = u"HyphNoCaps"_us
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;
+inline constexpr OUString UPN_HYPH_KEEP_TYPE = u"HyphKeepType"_ustr;
// UNO property names for Lingu
// (those not covered by the SpellChecker and Hyphenator
@@ -110,7 +111,8 @@ inline constexpr OUString UPN_IS_GRAMMAR_INTERACTIVE = u"IsInteractiveG
#define UPH_HYPH_NO_LAST_WORD 32
#define UPH_HYPH_ZONE 33
#define UPH_HYPH_KEEP 34
-#define UPH_HYPH_COMPOUND_MIN_LEADING 35
+#define UPH_HYPH_KEEP_TYPE 35
+#define UPH_HYPH_COMPOUND_MIN_LEADING 36
#ifdef __GNUC__
#pragma GCC diagnostic pop
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index e5c34c8cafbc..f410ce69344a 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1056,6 +1056,7 @@ namespace xmloff::token {
XML_HYPERLINK_BEHAVIOUR,
XML_HYPHENATE,
XML_HYPHENATION_KEEP,
+ XML_HYPHENATION_KEEP_TYPE,
XML_HYPHENATION_LADDER_COUNT,
XML_HYPHENATION_PUSH_CHAR_COUNT,
XML_HYPHENATION_REMAIN_CHAR_COUNT,
@@ -1842,6 +1843,7 @@ namespace xmloff::token {
XML_SPLIT_COLUMN,
XML_SPLIT_POSITION,
XML_SPLIT_ROW,
+ XML_SPREAD,
XML_SPREADSHEET,
XML_SPREADMETHOD,
XML_SQL_STATEMENT,
diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx
index 313591c730d0..7c7cabb43df1 100644
--- a/include/xmloff/xmltypes.hxx
+++ b/include/xmloff/xmltypes.hxx
@@ -297,6 +297,7 @@
#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)
+#define XML_TYPE_HYPHENATION_KEEP_TYPE (XML_TEXT_TYPES_START + 132)
#endif // INCLUDED_XMLOFF_XMLTYPES_HXX