editeng/inc/editattr.hxx                |    1 
 editeng/source/editeng/impedit3.cxx     |    4 ++
 sw/qa/extras/layout/data/tdf129357.fodt |   48 ++++++++++++++++++++++++++++++++
 sw/qa/extras/layout/layout2.cxx         |   17 +++++++++++
 4 files changed, 70 insertions(+)

New commits:
commit 326660093c903427285cfebaef12ecab1236b2db
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Fri Dec 8 08:13:42 2023 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Fri Dec 8 15:21:33 2023 +0100

    tdf#129357 editeng: show soft hyphen in text boxes and shapes
    
    Shapes and text boxes didn't show the optional hyphen
    at line break.
    
    Change-Id: I5cc842964fc91571e5c55995981de697da966b14
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160453
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx
index bb609ac1e996..3a619a5e85b8 100644
--- a/editeng/inc/editattr.hxx
+++ b/editeng/inc/editattr.hxx
@@ -54,6 +54,7 @@ class SfxGrabBagItem;
 
 #define CH_FEATURE_OLD  (sal_uInt8)         0xFF
 #define CH_FEATURE      u'\x0001'
+#define CH_SOFTHYPHEN   u'\x00AD'
 
 // DEF_METRIC: For my pool, the DefMetric should always appear when
 // GetMetric (nWhich)!
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 7402487120e1..b24cc004011c 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1975,6 +1975,10 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* 
pParaPortion, EditLine* pLine, Te
                 i18n::LineBreakResults aLBR = _xBI->getLineBreak(
                     pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, 
aHyphOptions, aUserOptions );
                 nBreakPos = aLBR.breakIndex;
+
+                // show soft hyphen
+                if ( nBreakPos && CH_SOFTHYPHEN == pNode->GetString()[ 
sal_Int32(nBreakPos) - 1 ] )
+                    bHyphenated = true;
             }
             else
             {
diff --git a/sw/qa/extras/layout/data/tdf129357.fodt 
b/sw/qa/extras/layout/data/tdf129357.fodt
new file mode 100644
index 000000000000..9cf563d71710
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf129357.fodt
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:officeooo="http://openoffice.org/2009/office"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2023-12-07T18:38:07.301280012</meta:creation-date><dc:date>2023-12-07T18:42:50.197688001</dc:date><meta:editing-duration>PT4M44S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic
 meta:table-count="0" meta:image-count="0" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="0" meta:word-count="0" 
meta:character-count="0" 
meta:non-whitespace-character-count="0"/><meta:generator>LibreOfficeDev/24.2.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/47e8abdafa26e64647e32d8577cb27e54cd843d1</meta:generator></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Arial" svg:font-family="Arial" 
style:font-family-generic="swiss"/>
+  <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu 
Sans&apos;" style:font-family-generic="swiss"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="8.5pt" 
draw:shadow-offset-y="8.5pt" draw:start-line-spacing-horizontal="8.02pt" 
draw:start-line-spacing-vertical="8.02pt" 
draw:end-line-spacing-horizontal="8.02pt" 
draw:end-line-spacing-vertical="8.02pt" style:writing-mode="lr-tb" 
style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" loext:tab-stop-distance="0pt" 
style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="DejaVu Sans" fo:font-size="12pt" 
fo:language="hu" fo:country="HU" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Lohit Devanagari1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" 
style:punctuation-wrap="hanging" style:line-break="strict" 
style:tab-stop-distance="35.46pt" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="DejaVu Sans" fo:font-size="12pt" 
fo:language="hu" fo:country="HU" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Lohit Devanagari1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" 
loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Text_20_body" style:display-name="Text body" 
style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+   <style:paragraph-properties fo:margin-top="0pt" fo:margin-bottom="7pt" 
style:contextual-spacing="false" fo:line-height="115%"/>
+  </style:style>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph">
+   <loext:graphic-properties draw:fill="solid" draw:fill-color="#f7d1d5" 
draw:gradient-step-count="0"/>
+  </style:style>
+  <style:style style:name="gr1" style:family="graphic">
+   <style:graphic-properties draw:stroke="none" svg:stroke-color="#000000" 
draw:fill="solid" draw:fill-color="#f7d1d5" draw:gradient-step-count="0" 
fo:min-height="53.86pt" loext:decorative="false" style:run-through="foreground" 
style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" 
style:vertical-pos="from-top" style:vertical-rel="paragraph" 
style:horizontal-pos="from-left" style:horizontal-rel="paragraph" 
draw:wrap-influence-on-position="once-concurrent" loext:allow-overlap="true" 
style:flow-with-text="false"/>
+   <style:paragraph-properties style:writing-mode="lr-tb"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:body>
+  <office:text>
+   <text:p text:style-name="Standard"><draw:frame text:anchor-type="paragraph" 
draw:z-index="0" draw:name="Text Frame 1" draw:style-name="gr1" 
draw:text-style-name="P1" svg:width="68.49pt" svg:height="53.86pt" 
svg:x="3.6pt" svg:y="3.34pt">
+     <draw:text-box>
+      <text:p>hyphena­tion</text:p>
+     </draw:text-box>
+    </draw:frame></text:p>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 12dba9a65ce6..800e5749fe2c 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -642,6 +642,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150790)
                 "colors"_ostr, "#Bookmark 2 Bookmark End#Bookmark 3 Bookmark 
Start");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf129357)
+{
+    createSwDoc("tdf129357.fodt");
+    SwDoc* pDoc = getSwDoc();
+    SwDocShell* pShell = pDoc->GetDocShell();
+
+    // Dump the rendering of the first page as an XML file.
+    std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+
+    xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    // visible soft hyphen
+    assertXPathContent(pXmlDoc, 
"/metafile/push/push/push/push/push/textarray[2]/text"_ostr, "-");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering)
 {
     createSwDoc("tdf42748.fodt");

Reply via email to