oox/source/export/drawingml.cxx             |    1 +
 sw/qa/extras/ooxmlexport/data/fdo74110.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx    |   16 ++++++++++++++++
 3 files changed, 17 insertions(+)

New commits:
commit 515b5c7688631679fe1d39932478a835dc0a35a2
Author: umeshkadam <umesh.ka...@synerzip.com>
Date:   Fri Jan 31 15:09:09 2014 +0530

    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

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a96ecdd..3e86985 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
new file mode 100644
index 0000000..6b7ab0e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo74110.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5f55f19..021c8d2 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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to