diff options
author | Pallavi Jadhav <pallavi.jadhav@synerzip.com> | 2014-06-05 19:04:36 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-06-11 08:21:47 +0000 |
commit | 69ba8e94e33c142072920fe455899c04b4e035d1 (patch) | |
tree | fa9182dd61e27f18e88a19b8cd648d36fc7a7601 | |
parent | d2725abf5d8f1e33dfd061f899101afc970292fb (diff) |
fdo#79540 : DOCX: Lo exports Drawing inside Drawing
Issue :
- In file there is a WordArt inside Table.
- In RT, LO exports <w:drawing> inside <w:drawing>.
- The xml sequence was :
<mc:AltrnateContent>
<mc:Choice>
<w:drawing> // first start of drawing
<w:txbxContent>
<w:tbl>
<w:drawing> // second start of drawing. MSO does not allow.
Implementation :
- In DocxAttributeOutput::OutputFlyFrame_Impl() under "case sw::Frame::eDrawing",
if drawing is already open then Postpone the Inner Drawing.
- Added Export Unit Test case to check two separate drawings are
now written in document.xml of RT.
Change-Id: I01d06621576d60d26cd51489ee9718dd79eb9c72
Reviewed-on: https://gerrit.libreoffice.org/9653
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo79540.docx | bin | 0 -> 26279 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 8 |
3 files changed, 24 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo79540.docx b/sw/qa/extras/ooxmlexport/data/fdo79540.docx Binary files differnew file mode 100644 index 000000000000..ce843d6616a1 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo79540.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 4b5de65f3c5d..30f748033d48 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3510,6 +3510,23 @@ DECLARE_OOXMLEXPORT_TEST(testfdo76934, "fdo76934.docx") assertXPath ( pXmlDoc, "/w:styles[1]/w:style[36]/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" ); } +DECLARE_OOXMLEXPORT_TEST(testfdo79540, "fdo79540.docx") +{ + /* Issue was, <w:drawing> was getting written inside <w:drawing>. + * So Postone the writing of Inner Drawing tag. + * MS Office does not allow Nestimg of drawing tags. + */ + + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + + if (!pXmlDoc) + return; + + // Ensure that two separate w:drawing tags are written after the code changes. + assertXPath ( pXmlDoc, "/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing",1); + assertXPath ( pXmlDoc, "/w:document/w:body/w:p/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing",1); +} + DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx") { xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml"); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 645688f74713..7e7c4a01fca9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4390,7 +4390,13 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po if ( m_postponedDMLDrawing == NULL ) { if ( IsAlternateContentChoiceOpen() ) - m_rExport.SdrExporter().writeDMLDrawing( pSdrObj, &rFrame.GetFrmFmt(), m_anchorId++); + { + // Do not write w:drawing inside w:drawing. Instead Postpone the Inner Drawing. + if( m_rExport.SdrExporter().IsDrawingOpen() ) + m_postponedCustomShape->push_back(PostponedDrawing(pSdrObj, &(rFrame.GetFrmFmt()), &rNdTopLeft)); + else + m_rExport.SdrExporter().writeDMLDrawing( pSdrObj, &rFrame.GetFrmFmt(), m_anchorId++); + } else m_rExport.SdrExporter().writeDMLAndVMLDrawing( pSdrObj, rFrame.GetFrmFmt(), rNdTopLeft, m_anchorId++); |