summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTushar Bende <tushar.bende@synerzip.com>2014-06-10 15:52:23 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-11 09:30:45 +0000
commite1d80c0d70562e1f24f150a81a34ee4e3edc90f3 (patch)
tree54cb7a9371386327e7c3b7dd49900f7eb9923707
parent63d1aa4dc8aa70256edb19638bcab3a6d5b1f3b6 (diff)
fdo#79668 :File getting corrupt after RT
Problem Description : For some documents containing redLine data there was already processing done for paragraph properties pPr but when it comes to DocxAttributeOutput::EndParagraphProperties() instead of writing these pPr, LO was calling Redline( pRedlineData ) which has it's pPr inside w:pPrChange. This was the reason when LO calls WriteCollectedParagraphProperties() after calling Redline() it was writing both paragraph properties inside single w:shd element.Hence the RT document was getting Corrupt. Added condition in DocxAttributeOutput::EndParagraphProperties() which is checking for RedlineData and if it's there call WriteCollectedParagraphProperties() before calling Redline(). Added Export Test case. Change-Id: I7000c27fe6ee372cac81d6f22e0d3ca9219a24d7 Reviewed-on: https://gerrit.libreoffice.org/9712 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo79668.docxbin0 -> 27444 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx13
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx5
3 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo79668.docx b/sw/qa/extras/ooxmlexport/data/fdo79668.docx
new file mode 100644
index 000000000000..793fd2adffe4
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo79668.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5310ce21d11f..250f52d023f8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3540,6 +3540,19 @@ DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14");
}
+DECLARE_OOXMLEXPORT_TEST(testfdo79668,"fdo79668.docx")
+{
+ // fdo#79668: Document was Crashing on DebugUtil build while Saving
+ // because of repeated attribute value in same element.
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ // w:pPr's w:shd attributes were getting added to w:pPrChange/w:pPr's w:shd hence checking
+ // w:fill for both shd elements
+ assertXPath ( pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:shd", "fill", "FFFFFF" );
+ assertXPath ( pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:pPrChange/w:pPr/w:shd", "fill", "FFFFFF" );
+}
+
DECLARE_OOXMLEXPORT_TEST(testfdo78907,"fdo78907.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index ff6986e1b38b..62d1e05f469e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -649,6 +649,11 @@ void DocxAttributeOutput::EndParagraphProperties( const SfxItemSet* pParagraphMa
{
// Call the 'Redline' function. This will add redline (change-tracking) information that regards to paragraph properties.
// This includes changes like 'Bold', 'Underline', 'Strikethrough' etc.
+
+ // If there is RedlineData present, call WriteCollectedParagraphProperties() for writting pPr before calling Redline().
+ // As there will be another pPr for redline and LO might mix both.
+ if(pRedlineData)
+ WriteCollectedParagraphProperties();
Redline( pRedlineData );
WriteCollectedParagraphProperties();