Kaydet (Commit) 515b5c76 authored tarafından umeshkadam's avatar umeshkadam Kaydeden (comit) Miklos Vajna

fdo#74110 : Issue with <a:prstGeom prst="rect"> tag in document.xml

Issue:
 - While exporting the system used to write adjustment values for preset shape type "rect" in document.xml
   with the shape guide name(adjustment name) being empty.
 - This is not accepted by MS Office. Hence the file was resulting as corrupt.

Implementation:
 - The preset shapes are being picked up from GetOOXMLPresetGeometry(), which refers pCustomShapeTypeTranslationTable[] array
   for the mapping.
 - Most of the shape types have been commented in the pCustomShapeTypeTranslationTable[] array therefore the GetOOXMLPresetGeometry()
   defaults the shapetype as rect, whereas the adjustment values are being picked up for the actual shape type(s).
 - Uncommenting the commented shape type translations( for instance textInflateTop) in pCustomShapeTypeTranslationTable will
   eventually write prst="textInflateTop" under the tag prstGeom which is invalid.
 - It should probably go under prstTxWrap.
 - In order to avoid the corruption, thought of adding a check before writing the adjustment values. If the shape type is "rect"( which is defaulted
   and does not have adjustment values defined in presetShapeDefinitions.xml) then avoid writing the adjustment values under this tag.

Conflicts:
	oox/source/export/drawingml.cxx
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
	https://gerrit.libreoffice.org/7765

Change-Id: I6511e9a3ee0c01962d6e82997705a484161086ef
üst f87e78a7
......@@ -1723,6 +1723,7 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bo
if ( ( rProp.Value >>= aAdjustmentSeq )
&& eShapeType != mso_sptActionButtonForwardNext // we have adjustments values for these type of shape, but MSO doesn't like them
&& eShapeType != mso_sptActionButtonBackPrevious // so they are now disabled
&& OString(pShape) != "rect" //some shape types are commented out in pCustomShapeTypeTranslationTable[] & are being defaulted to rect & rect does not have adjustment values/name.
) {
DBG(fprintf(stderr, "adj seq len: %d\n", int( aAdjustmentSeq.getLength() )));
if ( bPredefinedHandlesUsed )
......
......@@ -3011,6 +3011,22 @@ DECLARE_OOXMLEXPORT_TEST(testFDO74215, "FDO74215.docx")
assertXPath(pXmlDoc, "/w:numbering/w:numPicBullet[2]/w:pict/v:shape", "style", "width:6.4pt;height:6.4pt");
}
DECLARE_OOXMLEXPORT_TEST(testFdo74110,"fdo74110.docx")
{
/*
The File contains word art which is being exported as shape and the mapping is defaulted to
shape type rect since the actual shape type(s) is/are commented out for some reason.
The actual shape type(s) has/have adjustment value(s) where as rect does not have adjustment value.
Hence the following test case.
*/
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]",
"prst", "rect");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]/a:avLst[1]/a:gd[1]",0);
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment