i18npool/source/breakiterator/breakiterator_unicode.cxx | 5 + sw/qa/extras/layout/data/no-line-break-at-slash.fodt | 50 ++++++++++++++++ sw/qa/extras/layout/layout.cxx | 40 ++++++++++++ sw/qa/extras/rtfimport/data/picture-in-textframe.rtf | 29 +++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 16 +++++ sw/source/core/doc/DocumentContentOperationsManager.cxx | 6 - writerfilter/source/rtftok/rtfsdrimport.cxx | 5 + 7 files changed, 147 insertions(+), 4 deletions(-)
New commits: commit df20753e3bc9f65994f53fee57ee64ed091ae706 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Mon Jul 20 20:22:55 2020 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Jul 23 10:24:36 2020 +0200 i18npool: don't break line at slash '/' If sw text formatting gets the result of the special-case code added to the "word boundary break" condition, it may call again the next time with the preceding index, and fall into the "Line boundary break" condition, which hence also needs to special case '/'. (regression from ICU 60, 9206a08ada00e8762c4a634f242bd566028964bb) Change-Id: I2aaefbc7b25af157e0a6ef15fabaa71bff1e8d9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99104 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit a916e2253df2bf1415c25fb7f974e0d16b615d03) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99132 Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index e1675ec6a41d..61a8b6473982 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -495,7 +495,10 @@ LineBreakResults SAL_CALL BreakIterator_Unicode::getLineBreak( icu::BreakIterator* pLineBI = line.mpValue->mpBreakIterator.get(); bool GlueSpace=true; while (GlueSpace) { - if (pLineBI->preceding(nStartPos + 1) == nStartPos) { //Line boundary break + // don't break with Slash U+002F SOLIDUS at end of line; see "else" below! + if (pLineBI->preceding(nStartPos + 1) == nStartPos + && (nStartPos == 0 || Text[nStartPos - 1] != '/')) + { //Line boundary break lbr.breakIndex = nStartPos; lbr.breakType = BreakType::WORDBOUNDARY; } else if (hOptions.rHyphenator.is()) { //Hyphenation break diff --git a/sw/qa/extras/layout/data/no-line-break-at-slash.fodt b/sw/qa/extras/layout/data/no-line-break-at-slash.fodt new file mode 100644 index 000000000000..e900594fa0c8 --- /dev/null +++ b/sw/qa/extras/layout/data/no-line-break-at-slash.fodt @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:dc="http://purl.org/dc/eleme nts/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0 " xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:font-face-decls> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/> + </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="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" 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="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" 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"/> + </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="Standard" style:family="paragraph" style:class="text"/> + <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> + <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/> + <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> + </office:styles> + <office:automatic-styles> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="10.5cm" fo:page-height="14.801cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </office:master-styles> + <office:body> + <office:text> + <office:forms form:automatic-focus="false" form:apply-design-mode="false"/> + <text:p text:style-name="Standard">Blah blah bla bla bla Foostrasse 13/c/2, etc.</text:p> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 5436f04253ff..22451046cb3d 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1139,6 +1139,46 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testNoLineBreakAtSlash) +{ + load(DATA_DIRECTORY, "no-line-break-at-slash.fodt"); + xmlDocPtr pLayout = parseLayoutDump(); + + // the line break was between "Foostrasse 13/c/" and "2" + xmlXPathObjectPtr pXmlObj = getXPathNode(pLayout, "/root/page[1]/body/txt[1]/child::*[2]"); + CPPUNIT_ASSERT_EQUAL(std::string("Text"), std::string(reinterpret_cast<char const*>( + pXmlObj->nodesetval->nodeTab[0]->name))); + xmlXPathFreeObject(pXmlObj); + pXmlObj = getXPathNode(pLayout, "/root/page[1]/body/txt[1]/child::*[3]"); + CPPUNIT_ASSERT_EQUAL(std::string("LineBreak"), std::string(reinterpret_cast<char const*>( + pXmlObj->nodesetval->nodeTab[0]->name))); + xmlXPathFreeObject(pXmlObj); + pXmlObj = getXPathNode(pLayout, "/root/page[1]/body/txt[1]/child::*[4]"); + CPPUNIT_ASSERT_EQUAL(std::string("Text"), std::string(reinterpret_cast<char const*>( + pXmlObj->nodesetval->nodeTab[0]->name))); + xmlXPathFreeObject(pXmlObj); + pXmlObj = getXPathNode(pLayout, "/root/page[1]/body/txt[1]/child::*[5]"); + CPPUNIT_ASSERT_EQUAL(std::string("Special"), std::string(reinterpret_cast<char const*>( + pXmlObj->nodesetval->nodeTab[0]->name))); + xmlXPathFreeObject(pXmlObj); + pXmlObj = getXPathNode(pLayout, "/root/page[1]/body/txt[1]/child::*[6]"); + CPPUNIT_ASSERT_EQUAL(std::string("Text"), std::string(reinterpret_cast<char const*>( + pXmlObj->nodesetval->nodeTab[0]->name))); + xmlXPathFreeObject(pXmlObj); + pXmlObj = getXPathNode(pLayout, "/root/page[1]/body/txt[1]/child::*[7]"); + CPPUNIT_ASSERT_EQUAL(std::string("LineBreak"), std::string(reinterpret_cast<char const*>( + pXmlObj->nodesetval->nodeTab[0]->name))); + xmlXPathFreeObject(pXmlObj); + pXmlObj = getXPathNode(pLayout, "/root/page[1]/body/txt[1]/child::*[8]"); + CPPUNIT_ASSERT_EQUAL(std::string("Finish"), std::string(reinterpret_cast<char const*>( + pXmlObj->nodesetval->nodeTab[0]->name))); + xmlXPathFreeObject(pXmlObj); + + assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[1]", "Portion", "Blah blah bla bla bla "); + assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[2]", "Portion", "Foostrasse"); + assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[3]", "Portion", "13/c/2, etc."); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) { loadURL("private:factory/swriter", nullptr); commit fd36cfcbc73188c2ad98870d59847ba45bd95820 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Jul 21 17:30:55 2020 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Jul 23 10:24:30 2020 +0200 tdf#132911 sw_redlinehide: fix assert in CopyImplImpl() With Ctrl+A, Ctrl+X, Ctrl+V we get the bAfterTable = true case; line 4722 does pCopyPam->GetPoint()->nNode-- and then line 5085 does pCopyPam->GetPoint()->nNode++ but the problem is that nContent still points to the same node as initially while the node after the table end node is now a different one, i.e. nNode and nContent point to different nodes and something in redlining asserts becuase of that with "Assertion `m_pIndexReg == rIndex.m_pIndexReg' failed."; we don't get to step 4 anyway. (reportedly something changed with commit 4532845e22c10f252840887e55002307227b2390 but it's a mystery what that would be) Change-Id: I23744fad543e1e7bfcc11c4b488d4469ba9e509c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99166 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit 14bdbc36f0cf3913f6de10c746044b6aadf37095) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99194 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 33b7e5fe8f27..f834b8817492 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -5078,10 +5078,10 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo pCopyPam->Move( fnMoveForward, bCanMoveBack ? GoInContent : GoInNode ); else { - // Reset the offset to 0 as it was before the insertion - pCopyPam->GetPoint()->nContent = 0; - pCopyPam->GetPoint()->nNode++; + + // Reset the offset to 0 as it was before the insertion + pCopyPam->GetPoint()->nContent.Assign(pCopyPam->GetPoint()->nNode.GetNode().GetContentNode(), 0); // If the next node is a start node, then step back: the start node // has been copied and needs to be in the selection for the undo if (pCopyPam->GetPoint()->nNode.GetNode().IsStartNode()) commit 4a88779af7619a37c4c04bf513994f119fc8f354 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Jul 20 21:22:14 2020 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Jul 23 10:24:25 2020 +0200 tdf#134400 RTF import: fix unexpected inner properties for picture-in-textframe Regression from commit 4ab658b56f5c6ff0082d38d8ace1924d11e30e96 (RTF import: implement support for tables inside text frames, 2013-06-16), the problem was that both the outer "textbox" and the inner "picture frame" object had a shapeType property, and the properties were stored in a vector. So by the time RTFSdrImport::initShape() looked up the shape type for the inner shape, it thought it's not a picture frame, leading to data loss. (cherry picked from commit 5a083be34456e91427d0f2e2fea172f49f4502db) Change-Id: I4a536789371619d1d54afa8c8d41c7d273b0d21b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99118 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99167 Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf b/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf new file mode 100644 index 000000000000..ec0a07690bdf --- /dev/null +++ b/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf @@ -0,0 +1,29 @@ +{\rtf1 +\paperw10080\paperh12960\margl1066\margr1066\margt1642\margb1066 +\pard\plain +{\shp +{\*\shpinst\shpleft31\shptop105\shpright4108\shpbottom3887\shpfhdr0\shpwr2\shpwrk3\shpfblwtxt0 +{\sp +{\sn shapeType} +{\sv 202} +} +{\shptxt \pard\plain +before +{\*\shppict +{\pict +{\*\picprop\shplid1025 +{\sp +{\sn shapeType} +{\sv 75} +} +} +\picscalex23\picscaley24\piccropl0\piccropr0\piccropt0\piccropb0\picw30372\pich22437\picwgoal17219\pichgoal12720\pngblip +47494638396110001000d5ff00000000ffffffc0c0c0555f00ffffaafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a8888888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b18181810101009090906060603030300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021f90401000002002c0000000010001000000684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a00001e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b +} +} +after\par +} +} +} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index d2c2d4d24c8f..42c0108c020f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -933,6 +933,22 @@ CPPUNIT_TEST_FIXTURE(Test, testOleInline) getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType")); } +CPPUNIT_TEST_FIXTURE(Test, testPictureInTextframe) +{ + load(mpTestDocumentPath, "picture-in-textframe.rtf"); + uno::Reference<drawing::XDrawPageSupplier> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage = xTextDocument->getDrawPage(); + uno::Reference<beans::XPropertySet> xInnerShape(xDrawPage->getByIndex(1), uno::UNO_QUERY); + text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_PARAGRAPH; + xInnerShape->getPropertyValue("AnchorType") >>= eAnchorType; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 4 + // i.e. the properties of the inner shape (including its anchor type and bitmap fill) were lost + // on import. + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, eAnchorType); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf128611) { load(mpTestDocumentPath, "tdf128611.rtf"); diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 85f61129b1f3..ddd2337a9945 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -1129,6 +1129,11 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap m_rImport.Mapper().endShape(); } } + + // If the shape has an inner shape, the inner object's properties should not be influenced by + // the outer one. + rShape.getProperties().clear(); + m_xShape = xShape; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits