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

Armin Le Grand alg at apache.org
Thu May 2 04:47:14 PDT 2013


 sw/source/filter/ww8/ww8par.cxx |   56 +++++++++++++++++++++++++++-------------
 1 file changed, 39 insertions(+), 17 deletions(-)

New commits:
commit f38604fa73702ff94f715208d9375b5aa4685c30
Author: Armin Le Grand <alg at apache.org>
Date:   Mon Jun 25 10:47:20 2012 +0000

    Resolves: #i119516# allow 0x1 0x1 as well as 0x8 0x1 detection for canvases
    
    Be prepared to allow not only 0x8 0x1 detection for canvases, but also 0x1 0x1.
    
    Patch by: Lei Debin
    Detected by: louqle
    Review by: alg(cherry picked from commit 0711fae8c3f99c53bc1cb091eb218f10f3d8b15f)
    
    Conflicts:
    	sw/source/filter/ww8/ww8par.cxx
    
    Change-Id: Ib1d8d892470261639fa46ae9955079759c0aebaa

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 9a42e20..a987c10 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3186,27 +3186,49 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs)
             graphic preview of an associated ole2 object (or a simple
             graphic of course)
             */
-            if (!IsInlineEscherHack())
+            //normally in the canvas field, the code is 0x8 0x1.
+            //in a special case, the code is 0x1 0x1, which yields a simple picture
             {
-                SwFrmFmt *pResult = 0;
-                if (bObj)
-                    pResult = ImportOle();
-                else if (bSpec)
-                    pResult = ImportGraf();
-
-                // If we have a bad 0x1 insert a space instead.
-                if (!pResult)
+                bool bReadObj = IsInlineEscherHack();
+                if( bReadObj )
                 {
-                    cInsert = ' ';
-                    OSL_ENSURE(!bObj && !bEmbeddObj && !nObjLocFc,
-                        "WW8: Please report this document, it may have a "
-                        "missing graphic");
+                    long nCurPos = pStrm->Tell();
+                    sal_uInt16 nWordCode(0);
+
+                    if( bIsUnicode )
+                        *pStrm >> nWordCode;
+                    else
+                    {
+                        sal_uInt8 nByteCode(0);
+                        *pStrm >> nByteCode;
+                        nWordCode = nByteCode;
+                    }
+                    if( nWordCode == 0x1 )
+                        bReadObj = false;
+                    pStrm->Seek( nCurPos );
                 }
-                else
+                if( !bReadObj )
                 {
-                    // reset the flags.
-                    bObj = bEmbeddObj = false;
-                    nObjLocFc = 0;
+                    SwFrmFmt *pResult = 0;
+                    if (bObj)
+                        pResult = ImportOle();
+                    else if (bSpec)
+                        pResult = ImportGraf();
+
+                    //#102160# If we have a bad 0x1 insert a space instead.
+                    if (!pResult)
+                    {
+                        cInsert = ' ';
+                        OSL_ENSURE(!bObj && !bEmbeddObj && !nObjLocFc,
+                            "WW8: Please report this document, it may have a "
+                            "missing graphic");
+                    }
+                    else
+                    {
+                        // reset the flags.
+                        bObj = bEmbeddObj = false;
+                        nObjLocFc = 0;
+                    }
                 }
             }
             break;


More information about the Libreoffice-commits mailing list