diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-10-08 10:48:36 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-10-08 12:09:02 +0200 |
commit | cb9ba1c2d0202b1932b637d83a9458879a1f2e6a (patch) | |
tree | 58c9c5a39a2071299207d140ad7cb4ebd9f08ffb /sw/qa | |
parent | 98dd271c7228a4cf03a995d98eba8a1d64ad92f8 (diff) |
Related: tdf#120287 sw layout, TabOverMargin: fix left margin handling
The old code only worked when left and first margin was 0; feed the
relevant margin to SwTextFormatInfo, so SwTextFormatInfo::GetLineWidth()
can compare against the right rectangle.
This way TabOverMargin compat flag results in layout that matches the
Word behavior for all 3 bugdocs from the bugreport.
Change-Id: I6f81ad33b14e95ba4213c8956b3a9790ba6eee84
Reviewed-on: https://gerrit.libreoffice.org/61518
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/layout/data/tdf120287c.fodt | 46 | ||||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 11 |
2 files changed, 57 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/data/tdf120287c.fodt b/sw/qa/extras/layout/data/tdf120287c.fodt new file mode 100644 index 000000000000..f367336d79ec --- /dev/null +++ b/sw/qa/extras/layout/data/tdf120287c.fodt @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:settings> + <config:config-item-set config:name="ooo:configuration-settings"> + <config:config-item config:name="TabOverMargin" config:type="boolean">true</config:config-item> + <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item> + <config:config-item config:name="TabOverflow" config:type="boolean">false</config:config-item> + </config:config-item-set> + </office:settings> + <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"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="paragraph"> + <style:paragraph-properties 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="16pt" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-size-complex="12pt"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"> + <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.141cm" loext:contextual-spacing="false" fo:line-height="0.388cm"></style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="10pt"/> + </style:style> + <style:style style:name="Para" style:family="paragraph" style:parent-style-name="Standard"> + <style:paragraph-properties fo:margin-left="1.251cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.141cm" fo:line-height="0.388cm" fo:text-align="start" fo:text-indent="-1.251cm"> + <style:tab-stops> + <style:tab-stop style:position="9.751cm" style:type="right"/> + </style:tab-stops> + </style:paragraph-properties> + </style:style> + </office:styles> + <office:automatic-styles> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Para" style:master-page-name="Page"> + <style:paragraph-properties fo:margin-left="1.251cm" fo:margin-right="2.499cm" fo:text-align="start" fo:text-indent="-1.251cm" style:auto-text-indent="false"/> + </style:style> + <style:page-layout style:name="pm2" style:page-usage="mirrored"> + <style:page-layout-properties fo:page-width="14.801cm" fo:page-height="21.001cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="1.101cm" fo:margin-bottom="1cm" fo:margin-left="1.9cm" fo:margin-right="1.9cm"/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Page" style:page-layout-name="pm2"/> + </office:master-styles> + <office:body> + <office:text> + <text:p text:style-name="P1">b) x x x Lorem ipsum dolor sit amet, consetetur sadips test Lorem ipsum dolor sit amet, consetetur sadips<text:tab/>1 2 3 4 5 6 7 8 9 a b sed diam</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 fbef817cd8fd..083c2f16302b 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -59,6 +59,7 @@ public: void testTdf119875(); void testTdf120287(); void testTdf120287b(); + void testTdf120287c(); CPPUNIT_TEST_SUITE(SwLayoutWriter); CPPUNIT_TEST(testRedlineFootnotes); @@ -90,6 +91,7 @@ public: CPPUNIT_TEST(testTdf119875); CPPUNIT_TEST(testTdf120287); CPPUNIT_TEST(testTdf120287b); + CPPUNIT_TEST(testTdf120287c); CPPUNIT_TEST_SUITE_END(); private: @@ -2571,6 +2573,15 @@ void SwLayoutWriter::testTdf120287b() assertXPath(pXmlDoc, "/root/page/body/txt[1]/Text[@nType='POR_TABRIGHT']", "nWidth", "17"); } +void SwLayoutWriter::testTdf120287c() +{ + createDoc("tdf120287c.fodt"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + // This was 2, the second line was not broken into a 2nd and a 3rd one, + // rendering text outside the paragraph frame. + assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 3); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter); CPPUNIT_PLUGIN_IMPLEMENT(); |