summaryrefslogtreecommitdiff
path: root/xmloff
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 /xmloff
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 'xmloff')
-rw-r--r--xmloff/inc/xmlprop.hxx1
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/text/txtprhdl.cxx13
-rw-r--r--xmloff/source/text/txtprmap.cxx1
-rw-r--r--xmloff/source/token/tokens.txt2
5 files changed, 14 insertions, 5 deletions
diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx
index 9b9226ffc716..72ffd69323f4 100644
--- a/xmloff/inc/xmlprop.hxx
+++ b/xmloff/inc/xmlprop.hxx
@@ -498,6 +498,7 @@ inline constexpr OUString PROP_ParaHyphenationNoCaps = u"ParaHyphenationNoCaps"_
inline constexpr OUString PROP_ParaHyphenationNoLastWord = u"ParaHyphenationNoLastWord"_ustr;
inline constexpr OUString PROP_ParaHyphenationZone = u"ParaHyphenationZone"_ustr;
inline constexpr OUString PROP_ParaHyphenationKeep = u"ParaHyphenationKeep"_ustr;
+inline constexpr OUString PROP_ParaHyphenationKeepType = u"ParaHyphenationKeepType"_ustr;
inline constexpr OUString PROP_ParaIsAutoFirstLineIndent = u"ParaIsAutoFirstLineIndent"_ustr;
inline constexpr OUString PROP_ParaIsCharacterDistance = u"ParaIsCharacterDistance"_ustr;
inline constexpr OUString PROP_ParaIsConnectBorder = u"ParaIsConnectBorder"_ustr;
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index dab286974ed4..39ba7cc1b499 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1069,6 +1069,7 @@ namespace xmloff::token {
TOKEN( "hyperlink-behaviour", XML_HYPERLINK_BEHAVIOUR ),
TOKEN( "hyphenate", XML_HYPHENATE ),
TOKEN( "hyphenation-keep", XML_HYPHENATION_KEEP ),
+ TOKEN( "hyphenation-keep-type", XML_HYPHENATION_KEEP_TYPE ),
TOKEN( "hyphenation-ladder-count", XML_HYPHENATION_LADDER_COUNT ),
TOKEN( "hyphenation-push-char-count", XML_HYPHENATION_PUSH_CHAR_COUNT ),
TOKEN( "hyphenation-remain-char-count", XML_HYPHENATION_REMAIN_CHAR_COUNT ),
@@ -1855,6 +1856,7 @@ namespace xmloff::token {
TOKEN( "split-column", XML_SPLIT_COLUMN ),
TOKEN( "split-position", XML_SPLIT_POSITION ),
TOKEN( "split-row", XML_SPLIT_ROW ),
+ TOKEN( "spread", XML_SPREAD ),
TOKEN( "spreadsheet", XML_SPREADSHEET ),
TOKEN( "spreadMethod", XML_SPREADMETHOD ),
TOKEN( "sql-statement", XML_SQL_STATEMENT ),
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index f140d2341475..e4d552f5a5ba 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -231,11 +231,12 @@ SvXMLEnumMapEntry<sal_uInt16> const pXML_ParaVerticalAlign_Enum[] =
{ XML_TOKEN_INVALID, 0 }
};
-SvXMLEnumMapEntry<sal_uInt16> const pXML_ParaHyphenationKeep_Enum[] =
+SvXMLEnumMapEntry<sal_uInt16> const pXML_ParaHyphenationKeepType_Enum[] =
{
{ XML_AUTO, ParagraphHyphenationKeepType::AUTO },
- // keep page and column for interoperability
- { XML_PAGE, ParagraphHyphenationKeepType::COLUMN },
+ { XML_COLUMN, ParagraphHyphenationKeepType::COLUMN },
+ { XML_PAGE, ParagraphHyphenationKeepType::PAGE },
+ { XML_SPREAD, ParagraphHyphenationKeepType::SPREAD },
{ XML_TOKEN_INVALID, 0 }
};
@@ -1424,9 +1425,11 @@ static const XMLPropertyHandler *GetPropertyHandler
pHdl = new XMLComplexColorHandler;
break;
case XML_TYPE_HYPHENATION_KEEP:
- pHdl = new XMLConstantsPropertyHandler( pXML_ParaHyphenationKeep_Enum, XML_TOKEN_INVALID );
+ pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_PAGE, ::xmloff::token::XML_AUTO );
+ break;
+ case XML_TYPE_HYPHENATION_KEEP_TYPE:
+ pHdl = new XMLConstantsPropertyHandler( pXML_ParaHyphenationKeepType_Enum, XML_TOKEN_INVALID );
break;
-
default:
{
OSL_ENSURE(false, "XMLPropertyHandler missing (!)");
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index f0762610e61f..f5ff3aa4de6e 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -346,6 +346,7 @@ XMLPropertyMapEntry constexpr aXMLParaPropMap[] =
MAP_EXT( PROP_ParaHyphenationZone, XML_NAMESPACE_LO_EXT, XML_HYPHENATION_ZONE, XML_TYPE_NUMBER16_NONE|XML_TYPE_PROP_TEXT, 0 ),
MAP_EXT( PROP_ParaHyphenationCompoundMinLeadingChars, XML_NAMESPACE_LO_EXT, XML_HYPHENATION_COMPOUND_REMAIN_CHAR_COUNT, XML_TYPE_NUMBER16_NO_ZERO|XML_TYPE_PROP_TEXT, 0 ),
MP_E( PROP_ParaHyphenationKeep, XML_NAMESPACE_FO, XML_HYPHENATION_KEEP, XML_TYPE_HYPHENATION_KEEP, 0 ),
+ MAP_EXT( PROP_ParaHyphenationKeepType, XML_NAMESPACE_LO_EXT, XML_HYPHENATION_KEEP_TYPE, XML_TYPE_HYPHENATION_KEEP_TYPE|XML_TYPE_PROP_TEXT, 0 ),
// RES_PARATR_DROP
MP_E( PROP_DropCapWholeWord, XML_NAMESPACE_STYLE, XML_LENGTH, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BOOL, CTF_DROPCAPWHOLEWORD ),
MP_E( PROP_DropCapCharStyleName, XML_NAMESPACE_STYLE, XML_STYLE_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_DROPCAPCHARSTYLE ),
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index ad716a02d13f..29aa2c055658 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -969,6 +969,7 @@ hyperlink
hyperlink-behaviour
hyphenate
hyphenation-keep
+hyphenation-keep-type
hyphenation-ladder-count
hyphenation-push-char-count
hyphenation-remain-char-count
@@ -1755,6 +1756,7 @@ split
split-column
split-position
split-row
+spread
spreadsheet
spreadMethod
sql-statement