diff options
author | umeshkadam <umesh.kadam@synerzip.com> | 2014-01-31 15:09:09 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-13 14:19:08 +0100 |
commit | 515b5c7688631679fe1d39932478a835dc0a35a2 (patch) | |
tree | 6b56af3fc30ce3f7ecfad650403a12c6b9bd53e0 | |
parent | f87e78a777c975451b839d9dae6b723db7d040cd (diff) |
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
-rw-r--r-- | oox/source/export/drawingml.cxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo74110.docx | bin | 0 -> 22916 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 |
3 files changed, 17 insertions, 0 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index a96ecdd9b7eb..3e869854adcf 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -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 ) diff --git a/sw/qa/extras/ooxmlexport/data/fdo74110.docx b/sw/qa/extras/ooxmlexport/data/fdo74110.docx Binary files differnew file mode 100644 index 000000000000..6b7ab0e415c2 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo74110.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 5f55f19287f0..021c8d270770 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -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(); |