[Libreoffice-commits] core.git: sw/qa sw/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 17 14:37:16 UTC 2021
sw/qa/extras/ooxmlexport/data/tdf126206.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 9 ++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 35 ++++++++++++++++++++++++++-
3 files changed, 43 insertions(+), 1 deletion(-)
New commits:
commit 15f340f35cd9dc635d0507ca7de9d11227ae9922
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Mon Aug 16 14:42:01 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Tue Aug 17 16:36:41 2021 +0200
tdf#143911 DOCX: export character formatting changes
of text portions (instead of losing them completely,
resulting missing rejection of tracked formatting changes
later).
Follow-up to commit 0115a77eb84afb0d820d8e23f45e49b30b82a8d3
"tdf#50447 sw: track changes of character formatting" and
commit 5322663f8234836a6a4aaaed025c158fd7e8b67a%5E%21
"tdf#126206 DOCX: add rejection of character formatting changes".
Change-Id: I7f00774875fe06d21865d9468fc1a63bd11d91ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120568
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf126206.docx b/sw/qa/extras/ooxmlexport/data/tdf126206.docx
new file mode 100644
index 000000000000..166125e7a738
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf126206.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 431d5d71753d..92a841b826f8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -1036,6 +1036,15 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf124491, "tdf124491.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/*/*/w:rPrChange", 0);
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf143911, "tdf126206.docx")
+{
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ // export format change of text portions
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:rPr/w:rPrChange");
+ // This was without tracked bold formatting
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:rPr/w:rPrChange/w:rPr/w:b");
+}
+
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf105485, "tdf105485.docx")
{
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5dd987b252a9..c447bf7a60c8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -180,7 +180,7 @@ const sal_Int32 Tag_EndRun_1 = 9;
const sal_Int32 Tag_EndRun_2 = 10;
const sal_Int32 Tag_StartRunProperties = 11;
const sal_Int32 Tag_InitCollectedRunProperties = 12;
-//static const sal_Int32 Tag_Redline_1 = 13;
+const sal_Int32 Tag_Redline_1 = 13;
const sal_Int32 Tag_Redline_2 = 14;
const sal_Int32 Tag_TableDefinition = 15;
const sal_Int32 Tag_OutputFlyFrame = 16;
@@ -2756,6 +2756,11 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData )
{
// Call the 'Redline' function. This will add redline (change-tracking) information that regards to run properties.
// This includes changes like 'Bold', 'Underline', 'Strikethrough' etc.
+
+ // If there is RedlineData present, call WriteCollectedRunProperties() for writing rPr before calling Redline().
+ // As there will be another rPr for redline and LO might mix both.
+ if(pRedlineData)
+ WriteCollectedRunProperties();
Redline( pRedlineData );
WriteCollectedRunProperties();
@@ -3172,6 +3177,34 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
: rAuthor,
FSNS( XML_w, XML_date ), aDate );
+ // Check if there is any extra data stored in the redline object
+ if (pRedlineData->GetExtraData())
+ {
+ const SwRedlineExtraData* pExtraData = pRedlineData->GetExtraData();
+ const SwRedlineExtraData_FormatColl* pFormattingChanges = dynamic_cast<const SwRedlineExtraData_FormatColl*>(pExtraData);
+
+ // Check if the extra data is of type 'formatting changes'
+ if (pFormattingChanges)
+ {
+ // Get the item set that holds all the changes properties
+ const SfxItemSet *pChangesSet = pFormattingChanges->GetItemSet();
+ if (pChangesSet)
+ {
+ m_pSerializer->mark(Tag_Redline_1);
+
+ m_pSerializer->startElementNS(XML_w, XML_rPr);
+
+ // Output the redline item set
+ if (pChangesSet)
+ m_rExport.OutputItemSet( *pChangesSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF );
+
+ m_pSerializer->endElementNS( XML_w, XML_rPr );
+
+ m_pSerializer->mergeTopMarks(Tag_Redline_1, sax_fastparser::MergeMarks::PREPEND);
+ }
+ }
+ }
+
m_pSerializer->endElementNS( XML_w, XML_rPrChange );
break;
More information about the Libreoffice-commits
mailing list