From 2eecf2b007a44c4e2ce2877af2c841875a70c282 Mon Sep 17 00:00:00 2001 From: László Németh Date: Mon, 22 Jun 2020 15:59:05 +0200 Subject: tdf#130218 sw: show hanging indent in narrow cells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: László Németh --- 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(+) create mode 100644 sw/qa/extras/layout/data/tdf130218.fodt (limited to 'sw') 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 @@ + + + + 2018-08-13T16:49:19.8844595662018-08-13T16:56:24.066877759PT7M6S2LibreOfficeDev/6.4.0.0.alpha0$Linux_X86_64 LibreOffice_project/628fbb66869ea82a1f38132ff2ba39e9666083eb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Text + + + First column should have visible content + + + + + Text + + + With hanging indent, too. + + + + + + + diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index eb772aa54611..139252721b52 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3513,6 +3513,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 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 -- cgit v1.2.3