diff options
author | Armin Le Grand <alg@apache.org> | 2012-06-25 10:47:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-02 12:46:52 +0100 |
commit | f38604fa73702ff94f715208d9375b5aa4685c30 (patch) | |
tree | 0e451aa338652f32a87bcff302a8820cc7db6649 /sw | |
parent | af37523b69b9e445fdf860e98e896daabf386e41 (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 9a42e208e40a..a987c10eb8bc 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; |