summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-07-01 11:55:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-07-01 13:50:09 +0100
commit3ea17073114cae99d7c323f051a4a2ba074f043c (patch)
treec66f42b01904beeb785b75231b7e1ab13d1177a9 /filter
parent38baed1ececf311410c7f9c3ccdd435e3690cc09 (diff)
Resolves: #i125187# more precision where the BLIP graphic is located
(cherry picked from commit 2be700effa5568859a0c6ba5f596e35ffc600320) Conflicts: filter/source/msfilter/msdffimp.cxx Change-Id: I3926d5f47469049662a292063f9810826c575154
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/msdffimp.cxx37
1 files changed, 29 insertions, 8 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index e397e3b4a24c..350d4d593e0a 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5821,25 +5821,46 @@ void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uLong nLe
nLenFBSE = nLength;
// is FBSE big enough for our data
bool bOk = ( nSkipBLIPLen + 4 + nSkipBLIPPos + 4 <= nLenFBSE );
+ bool bBLIPIsDirectlyEmbedded(false);
- if( bOk )
+ if(bOk)
{
- rSt.SeekRel( nSkipBLIPLen );
+ rSt.SeekRel(nSkipBLIPLen);
rSt.ReadUInt32( nBLIPLen );
- rSt.SeekRel( nSkipBLIPPos );
+
+ // #i125187# do not simply skip these four bytes, but read them. This value
+ // is zero when the BLIP is embedded to the FBSE directly following in the
+ // stream, else 1. Use this as hint to be more reliable (see below)
+ rSt.ReadUInt32( nBLIPPos );
+
+ if (0 == nBLIPPos)
+ {
+ bBLIPIsDirectlyEmbedded = true;
+ }
+
rSt.ReadUInt32( nBLIPPos );
bOk = rSt.GetError() == 0;
- nLength -= nSkipBLIPLen+ 4 + nSkipBLIPPos + 4;
+ nLength -= nSkipBLIPLen + 4 + nSkipBLIPPos + 4;
}
if( bOk )
{
- // specialty:
- // If nBLIPLen is less than nLenFBSE AND nBLIPPos is NULL,
- // then we assume, that the image is in FBSE!
- if( (!nBLIPPos) && (nBLIPLen < nLenFBSE) )
+ // #i125187# the original check to test if the BLIP is following embeded in the FBSE was
+ // was (!nBLIPPos && nBLIPLen < nLenFBSE), but there are ppt documents
+ // where this is not sufficient (what means that for BLIPs in the picture
+ // stream the same conditions can be true sometimes). I experimented with various
+ // ppt files and detected that the four bytes before reading the nBLIPPos
+ // contain a flag which describes that embedding more reliable, thus I will
+ // use it here now in the form of the bBLIPIsDirectlyEmbedded variable (see above).
+ // This modification works with all ppt files I found which use directly embedded
+ // BLIPs and with the file which showed the error. More work may be needed when
+ // exceptions to this more strict schema may show up, though.
+ if (0 == nBLIPPos && nBLIPLen < nLenFBSE && bBLIPIsDirectlyEmbedded)
+ {
+ // get BLIP file position as directly following embedded
nBLIPPos = rSt.Tell() + 4;
+ }
// That worked great!
// We store, that we do have one FBSE more in the pointer array.