sw/qa/extras/layout/data/tdf130218.fodt | 86 ++++++++++++++++++++++++++++++++ sw/qa/extras/layout/layout.cxx | 16 +++++ sw/source/core/text/itrcrsr.cxx | 10 +++ 3 files changed, 112 insertions(+)
New commits: commit d593fef07be33cf7999b191e0f4aa87e79e2845c Author: László Németh <nem...@numbertext.org> AuthorDate: Mon Jun 22 15:59:05 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Jun 24 14:55:51 2020 +0200 tdf#130218 sw: show hanging indent in narrow cells Instead of hiding it, show hanging first paragraph line in narrow table cells, like MSO does. Change-Id: Ibfa7242644db36c1be4d2fe93af75cb295d443b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96865 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 2eecf2b007a44c4e2ce2877af2c841875a70c282) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97001 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins diff --git a/sw/qa/extras/layout/data/tdf130218.fodt b/sw/qa/extras/layout/data/tdf130218.fodt new file mode 100644 index 000000000000..d9031871bfd5 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf130218.fodt @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1. 0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ooo="http://openoffice.org/2004/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d: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:rpt="http://op enoffice.org/2005/report" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:creation-date>2018-08-13T16:49:19.884459566</meta:creation-date><dc:date>2018-08-13T16:56:24.066877759</dc:date><meta:editing-duration>PT7M6S</meta:editing-duration><meta:editing-cycles>2</meta:editing-cycles><meta:generator>LibreOfficeDev/6.4.0.0.alpha0$Linux_X86_64 LibreOffice_project/628fbb66869ea82a1f38132ff2ba39e9666083eb</meta:generator><meta:document-statistic meta:table-count="1" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="5" meta:word-count="24" meta:character-count="118"/></office:meta> + <office:styles> + <text:list-style style:name="Numbering_20_123" style:display-name="Numbering 123"> + <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.7cm" fo:text-indent="-0.7cm" fo:margin-left="1.33cm"/> + </style:list-level-properties> + </text:list-level-style-number> + </text:list-style> + <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:style style:name="Table1" style:family="table"> + <style:table-properties style:width="10.8cm" style:rel-width="100%" fo:margin-left="0cm" table:align="left"/> + </style:style> + <style:style style:name="Table1.A" style:family="table-column"> + <style:table-column-properties style:column-width="1.905cm" style:rel-column-width="1080*"/> + </style:style> + <style:style style:name="Table1.B" style:family="table-column"> + <style:table-column-properties style:column-width="8.895cm" style:rel-column-width="5043*"/> + </style:style> + <style:style style:name="Table1.A1" style:family="table-cell"> + <style:table-cell-properties fo:background-color="transparent" fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" fo:border-right="none" fo:border-top="0.5pt solid #000000" fo:border-bottom="0.5pt solid #000000" style:writing-mode="page"> + <style:background-image/> + </style:table-cell-properties> + </style:style> + <style:style style:name="Table1.B1" style:family="table-cell"> + <style:table-cell-properties fo:background-color="transparent" fo:padding="0.097cm" fo:border="0.5pt solid #000000" style:writing-mode="page"> + <style:background-image/> + </style:table-cell-properties> + </style:style> + <style:style style:name="Table1.A2" style:family="table-cell"> + <style:table-cell-properties fo:background-color="transparent" fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.5pt solid #000000" style:writing-mode="page"> + <style:background-image/> + </style:table-cell-properties> + </style:style> + <style:style style:name="Table1.B2" style:family="table-cell"> + <style:table-cell-properties fo:background-color="transparent" fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" fo:border-right="0.5pt solid #000000" fo:border-top="none" fo:border-bottom="0.5pt solid #000000" style:writing-mode="page"> + <style:background-image/> + </style:table-cell-properties> + </style:style> + <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Standard"> + <loext:graphic-properties draw:fill="none"/> + <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="-3cm" style:auto-text-indent="false" fo:background-color="transparent" text:number-lines="false" text:line-number="0"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties fo:color="#000000" loext:opacity="100%" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" fo:font-size="12pt" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" officeooo:rsid="001e4698" officeooo:paragraph-rsid="001e4698" style:font-size-asian="12pt" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-size-complex="12pt" style:font-style-complex="normal" style:font-weight-complex="normal" style:text-overline-style="none" style:text-overline-color="font-color"/> + </style:style> + <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Standard"> + <loext:graphic-properties draw:fill="none"/> + <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" fo:background-color="transparent" text:number-lines="false" text:line-number="0"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties fo:color="#000000" loext:opacity="100%" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" fo:font-size="12pt" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" officeooo:rsid="001e4698" officeooo:paragraph-rsid="001e4698" style:font-size-asian="12pt" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-size-complex="12pt" style:font-style-complex="normal" style:font-weight-complex="normal" style:text-overline-style="none" style:text-overline-color="font-color"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <office:forms form:automatic-focus="false" form:apply-design-mode="false"/> + <table:table table:name="Table1" table:style-name="Table1"> + <table:table-column table:style-name="Table1.A"/> + <table:table-column table:style-name="Table1.B"/> + <table:table-row> + <table:table-cell table:style-name="Table1.A1" office:value-type="string"> + <text:p text:style-name="P5">Text</text:p> + </table:table-cell> + <table:table-cell table:style-name="Table1.B1" office:value-type="string"> + <text:p text:style-name="Standard"><text:span text:style-name="T2">First column should have </text:span><text:span text:style-name="T3">visible content</text:span></text:p> + </table:table-cell> + </table:table-row> + <table:table-row> + <table:table-cell table:style-name="Table1.A2" office:value-type="string"> + <text:p text:style-name="P6">Text</text:p> + </table:table-cell> + <table:table-cell table:style-name="Table1.B2" office:value-type="string"> + <text:p text:style-name="Standard">With hanging indent, too.</text:p> + </table:table-cell> + </table:table-row> + </table:table> + <text:p text:style-name="P5"/> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index cbf995ec1acf..efd361609eaa 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3515,6 +3515,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf113014) assertXPathContent(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/textarray[5]/text", "3."); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf130218) +{ + SwDoc* pDoc = createDoc("tdf130218.fodt"); + 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); + + // This failed, if hanging first line was hidden + assertXPathContent(pXmlDoc, "/metafile/push[1]/push[1]/push[1]/textarray[1]/text", "Text"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127235) { SwDoc* pDoc = createDoc("tdf127235.odt"); diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index acf24d67c597..cb830f327412 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -305,6 +305,16 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame *pNewFrame, SwTextSizeInfo *p bListLevelIndentsApplicableAndLabelAlignmentActive || !pNode->getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) { + if ( nFirstLineOfs < 0 && m_pFrame->IsInTab() && + nLeft == m_pFrame->getFramePrintArea().Left() + m_pFrame->getFrameArea().Left() && + !m_pFrame->IsRightToLeft() && + !bListLevelIndentsApplicableAndLabelAlignmentActive ) + { + // tdf#130218 always show hanging indent in narrow table cells + // to avoid hiding the text content of the first line + nLeft -= nFirstLineOfs; + } + nFirst = nLeft + nFirstLineOfs; } else _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits