You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2012/06/25 13:47:21 UTC

svn commit: r1353476 - /incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx

Author: alg
Date: Mon Jun 25 11:47:20 2012
New Revision: 1353476

URL: http://svn.apache.org/viewvc?rev=1353476&view=rev
Log:
#119516# 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

Modified:
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx?rev=1353476&r1=1353475&r2=1353476&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx Mon Jun 25 11:47:20 2012
@@ -2762,30 +2762,52 @@ bool SwWW8ImplReader::ReadChar(long nPos
             graphic preview of an associated ole2 object (or a simple
             graphic of course)
             */
-            if (!IsInlineEscherHack())
-            {
-                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 = ' ';
-                    ASSERT(!bObj && !bEmbeddObj && !nObjLocFc,
-                        "WW8: Please report this document, it may have a "
-                        "missing graphic");
-                }
-                else
-                {
-                    // reset the flags.
-                    bObj = bEmbeddObj = false;
-                    nObjLocFc = 0;
-                }
-            }
-            break;
+			//normally in the canvas field, the code is 0x8 0x1.
+			//in a special case, the code is 0x1 0x1, which yields a simple picture
+			{
+				bool bReadObj = IsInlineEscherHack();
+				if( bReadObj )
+				{
+					long nCurPos = pStrm->Tell();
+					sal_uInt8   nByteCode;
+					sal_uInt16 nWordCode;
+
+					if( bIsUnicode )
+						*pStrm >> nWordCode;
+					else
+					{
+						*pStrm >> nByteCode;
+						nWordCode = nByteCode;
+					}
+					if( nWordCode == 0x1 )
+						bReadObj = false;
+					pStrm->Seek( nCurPos );	
+				}
+				if( !bReadObj )
+				{
+					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 = ' ';
+						ASSERT(!bObj && !bEmbeddObj && !nObjLocFc,
+							"WW8: Please report this document, it may have a "
+							"missing graphic");
+					}
+					else
+					{
+						// reset the flags.
+						bObj = bEmbeddObj = false;
+						nObjLocFc = 0;
+					}
+				}
+			}
+			break;
         case 0x8:
             if( !bObj )
                 Read_GrafLayer( nPosCp );