diff --git a/sw/qa/extras/layout/data/tdf85610.fodt b/sw/qa/extras/layout/data/tdf85610.fodt new file mode 100644 index 000000000000..17c51096db12 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf85610.fodt @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + C + 2022-04-27T11:06:53 + + + + + + + C + 2022-04-27T11:07:06 + + + + + + + C + 2022-04-27T11:06:51 + + + + + + + + + + + Lorem.1 + Ipsum. + Dolor sit.2 + Amet. + + + diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 6c059f0f57c4..02b40c21b5ef 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -302,6 +302,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInNumbering) assertXPath(pXmlDoc, "/metafile/push/push/push/font[4][@color='#000000']", 0); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInFootnote) +{ + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf85610.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); + + // changed color of numbers of footnote 1 (deleted footnote) and footnote 2 (inserted footnote) + // decreased the black elements by 2: + // This was 7 + assertXPath(pXmlDoc, "/metafile/push/push/push/font[@color='#000000']", 5); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineMoving) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf42748.fodt"); diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index ce7756c23a45..64d0f0418286 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -53,6 +53,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -990,6 +997,36 @@ SwNumberPortion *SwTextFormatter::NewFootnoteNumPortion( SwTextFormatInfo const pNumFnt->SetDiffFnt(&rSet, pIDSA ); pNumFnt->SetVertical( pNumFnt->GetOrientation(), m_pFrame->IsVertical() ); + // tdf#85610 apply redline coloring to the footnote numbering in the footnote area + SwUnoInternalPaM aPam(*pDoc); + if ( ::sw::XTextRangeToSwPaM(aPam, xAnchor) ) + { + SwRedlineTable::size_type nRedlinePos = 0; + const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRangeRedline* pRedline = rTable.FindAtPosition( *aPam.Start(), nRedlinePos ); + if (pRedline) + { + SwAttrPool& rPool = pDoc->GetAttrPool(); + SfxItemSetFixed aSet(rPool); + + std::size_t aAuthor = (1 < pRedline->GetStackCount()) + ? pRedline->GetAuthor( 1 ) + : pRedline->GetAuthor(); + + if ( RedlineType::Delete == pRedline->GetType() ) + SW_MOD()->GetDeletedAuthorAttr(aAuthor, aSet); + else + SW_MOD()->GetInsertAuthorAttr(aAuthor, aSet); + + if (const SvxColorItem* pItem = aSet.GetItemIfSet(RES_CHRATR_COLOR)) + pNumFnt->SetColor(pItem->GetValue()); + if (const SvxUnderlineItem* pItem = aSet.GetItemIfSet(RES_CHRATR_UNDERLINE)) + pNumFnt->SetUnderline(pItem->GetLineStyle()); + if (const SvxCrossedOutItem* pItem = aSet.GetItemIfSet(RES_CHRATR_CROSSEDOUT)) + pNumFnt->SetStrikeout( pItem->GetStrikeout() ); + } + } + SwFootnoteNumPortion* pNewPor = new SwFootnoteNumPortion( aFootnoteText, std::move(pNumFnt) ); pNewPor->SetLeft( !m_pFrame->IsRightToLeft() ); return pNewPor; diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index f6e2a0bda869..26e1afd7a6c4 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -823,7 +823,15 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r } rWriter.startElement("text"); - rWriter.content(pMetaTextArrayAction->GetText()); + + const OUString& rStr = pMetaTextArrayAction->GetText(); + // fix bad XML dump by removing forbidden 0x01 + // FIXME: expand footnote anchor point 0x01 instead of this + if ( rStr.indexOf(0x01) > -1 ) + rWriter.content(rStr.replaceAll("\001", "")); + else + rWriter.content(rStr); + rWriter.endElement(); rWriter.endElement();