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

Jacobo Aragunde Pérez jaragunde at igalia.com
Mon Feb 10 07:32:20 PST 2014


 sw/source/filter/ww8/docxattributeoutput.cxx |   10 +++++++---
 sw/source/filter/ww8/docxattributeoutput.hxx |    6 +++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit eddcfe55f1fc995f88756c2fdc99321ef48c5188
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Thu Feb 6 18:40:54 2014 +0100

    sw: fix fallback for OLE object output.
    
    OLE objects could be written as graphics as a fallback for
    unsupported formats, but it happened in a wrong position of the
    document (inside w:rPr).
    
    Added two extra fields to the PostponedGraphic structure to be able
    to postpone the writing of OLE graphics.
    
    Change-Id: If36a0aed11bcac2115ef0322cc83efccd6ef1204

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 46d862e..3733c7c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1231,7 +1231,7 @@ void DocxAttributeOutput::WritePostponedGraphic()
     for( std::list< PostponedGraphic >::const_iterator it = m_postponedGraphic->begin();
          it != m_postponedGraphic->end();
          ++it )
-        FlyFrameGraphic( it->grfNode, it->size, 0, 0, it->pSdrObj );
+        FlyFrameGraphic( it->grfNode, it->size, it->mOLEFrmFmt, it->mOLENode, it->pSdrObj );
     delete m_postponedGraphic;
     m_postponedGraphic = NULL;
 }
@@ -3091,7 +3091,11 @@ void DocxAttributeOutput::WriteOLE2Obj( const SdrObject* pSdrObj, SwOLENode& rOL
     if( WriteOLEMath( pSdrObj, rOLENode, rSize ))
         return;
     // Then we fall back to just export the object as a graphic.
-    FlyFrameGraphic( 0, rSize, pFlyFrmFmt, &rOLENode );
+    if( m_postponedGraphic == NULL )
+        FlyFrameGraphic( 0, rSize, pFlyFrmFmt, &rOLENode );
+    else
+        // w:drawing should not be inside w:rPr, so write it out later
+        m_postponedGraphic->push_back( PostponedGraphic( 0, rSize, pFlyFrmFmt, &rOLENode, 0 ) );
 }
 
 bool DocxAttributeOutput::WriteOLEChart( const SdrObject* pSdrObj, const Size& rSize )
@@ -3272,7 +3276,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
                         FlyFrameGraphic( pGrfNode, rFrame.GetLayoutSize(), 0, 0, pSdrObj);
                     else // we are writing out attributes, but w:drawing should not be inside w:rPr,
                     {    // so write it out later
-                        m_postponedGraphic->push_back( PostponedGraphic( pGrfNode, rFrame.GetLayoutSize(), pSdrObj));
+                        m_postponedGraphic->push_back( PostponedGraphic( pGrfNode, rFrame.GetLayoutSize(), 0, 0, pSdrObj));
                     }
                 }
             }
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 5c628c6..926db22 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -752,9 +752,13 @@ private:
 
     struct PostponedGraphic
     {
-        PostponedGraphic( const SwGrfNode* n, Size s,  const SdrObject* sObj ) : grfNode( n ), size( s ),  pSdrObj(sObj) {};
+        PostponedGraphic( const SwGrfNode* n, Size s, const SwFlyFrmFmt* pOLEFrmFmt, SwOLENode* pOLENode, const SdrObject* sObj )
+            : grfNode( n ), size( s ), mOLEFrmFmt( pOLEFrmFmt ), mOLENode( pOLENode ), pSdrObj(sObj) {};
+
         const SwGrfNode* grfNode;
         Size size;
+        const SwFlyFrmFmt* mOLEFrmFmt;
+        SwOLENode* mOLENode;
         const SdrObject* pSdrObj;
     };
     std::list< PostponedGraphic >* m_postponedGraphic;


More information about the Libreoffice-commits mailing list