[Libreoffice-commits] core.git: oox/source sw/qa sw/source

sushil_shinde sushil.shinde at synerzip.com
Tue Nov 12 00:54:34 PST 2013


 oox/source/export/vmlexport.cxx               |    9 +++++++--
 sw/qa/extras/ooxmlexport/data/image_data.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx      |    8 ++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx  |    4 ++--
 4 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 965d29d00eb14250a994393f5d6b437e49760830
Author: sushil_shinde <sushil.shinde at synerzip.com>
Date:   Mon Oct 21 21:34:55 2013 +0530

     #65836- Fix for exporting image inside vml data was corrupting file.
    
        - Handled exporting of image for all type of format in vmlexport.
        - fixed issue - .rels file was not getting exported for vmlexport.
        - Not handled for .wmf image (will work on it)
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    Reviewed on:
    	https://gerrit.libreoffice.org/6369
    
    Change-Id: I9ccf7a36ae316a658f06d1074caa4e4b2f5d271f

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 6274e19..8eeb9dc 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -555,6 +555,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
                     if ( rProps.GetOpt( ESCHER_Prop_fillBackColor, nValue ) )
                         impl_AddColor( pAttrList, XML_color2, nValue );
 
+                    bool imageData = false;
                     EscherPropSortStruct aStruct;
                     if ( rProps.GetOpt( ESCHER_Prop_fillBlip, aStruct ) && m_pTextExport)
                     {
@@ -563,9 +564,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
                         aStream.Write(aStruct.pBuf + nHeaderSize, aStruct.nPropSize - nHeaderSize);
                         aStream.Seek(0);
                         Graphic aGraphic;
-                        GraphicConverter::Import(aStream, aGraphic, CVT_PNG);
+                        GraphicConverter::Import(aStream, aGraphic);
                         OUString aImageId = m_pTextExport->GetDrawingML().WriteImage( aGraphic );
                         pAttrList->add(FSNS(XML_r, XML_id), OUStringToOString(aImageId, RTL_TEXTENCODING_UTF8));
+                        imageData = true;
                     }
 
                     if ( rProps.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) )
@@ -575,7 +577,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
                         // Partly undo the transformation at the end of EscherPropertyContainer::CreateFillProperties(): VML opacity is 0..1.
                         pAttrList->add(XML_opacity, OString::number(double((nValue * 100) >> 16) / 100));
 
-                    m_pSerializer->singleElementNS( XML_v, XML_fill, XFastAttributeListRef( pAttrList ) );
+                    if (imageData)
+                        m_pSerializer->singleElementNS( XML_v, XML_imagedata, XFastAttributeListRef( pAttrList ) );
+                    else
+                        m_pSerializer->singleElementNS( XML_v, XML_fill, XFastAttributeListRef( pAttrList ) );
                 }
                 bAlreadyWritten[ ESCHER_Prop_fillType ] = true;
                 bAlreadyWritten[ ESCHER_Prop_fillColor ] = true;
diff --git a/sw/qa/extras/ooxmlexport/data/image_data.docx b/sw/qa/extras/ooxmlexport/data/image_data.docx
new file mode 100644
index 0000000..a2f89b1
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/image_data.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index c19a70a..94b48a0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1588,6 +1588,14 @@ DECLARE_OOXML_TEST(testVMLData, "TestVMLData.docx")
     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/w:pict/v:shape", "stroked").match("f"));
 }
 
+DECLARE_OOXML_TEST(testImageData, "image_data.docx")
+{
+    // The problem was exporter was exporting v:imagedata data for shape in w:pict as v:fill w element.
+
+    xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
+    CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/w:pict/v:shape/v:imagedata", "detectmouseclick").match("t"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 19f80e7..2712f75 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1158,7 +1158,7 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData )
     //We need to write w:drawing tag after the w:rPr.
     WritePostponedChart();
 
-    //We need to write w:drawing tag after the w:rPr.
+    //We need to write w:pict tag after the w:rPr.
     WritePostponedVMLDrawing();
 
     // merge the properties _before_ the run text (strictly speaking, just
@@ -3260,7 +3260,7 @@ void DocxAttributeOutput::WriteVMLDrawing( const SdrObject* sdrObj, const SwFrmF
    }
 
    m_pSerializer->startElementNS( XML_w, XML_pict, FSEND );
-
+   m_rDrawingML.SetFS(m_pSerializer);
    // See WinwordAnchoring::SetAnchoring(), these are not part of the SdrObject, have to be passed around manually.
 
    SwFmtHoriOrient rHoriOri = (rFrmFmt).GetHoriOrient();


More information about the Libreoffice-commits mailing list