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>
This commit is contained in:
Pallavi Jadhav 2014-06-05 19:04:36 +05:30 committed by Miklos Vajna
parent d2725abf5d
commit 69ba8e94e3
3 changed files with 24 additions and 1 deletions

Binary file not shown.

View File

@ -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");

View File

@ -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++);