summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2010-08-03 15:48:57 +0200
committerIvo Hinkelmann <ihi@openoffice.org>2010-08-03 15:48:57 +0200
commit39102116500fee3379a992293e8ea8125c1e8d86 (patch)
treec12043647fa69fda31d79182a13258f978dc3015
parentc4f87398a1fd4fbc1474a42f748f41e90d445f6c (diff)
parent4f41cb65cb10667b61d7a919fd4abd57711747a2 (diff)
CWS-TOOLING: integrate CWS impress196
-rw-r--r--svtools/source/filter.vcl/filter/filter2.cxx2
-rw-r--r--svtools/source/filter.vcl/wmf/winwmf.cxx69
2 files changed, 38 insertions, 33 deletions
diff --git a/svtools/source/filter.vcl/filter/filter2.cxx b/svtools/source/filter.vcl/filter/filter2.cxx
index de2bef64ba6e..6abab2626516 100644
--- a/svtools/source/filter.vcl/filter/filter2.cxx
+++ b/svtools/source/filter.vcl/filter/filter2.cxx
@@ -1201,7 +1201,7 @@ BOOL GraphicDescriptor::ImpDetectPCT( SvStream& rStm, BOOL )
nFormat = GFF_PCT;
else
{
- BYTE sBuf[4];
+ BYTE sBuf[3]={0};
rStm.Seek( nStmPos + 522 );
rStm.Read( sBuf, 3 );
diff --git a/svtools/source/filter.vcl/wmf/winwmf.cxx b/svtools/source/filter.vcl/wmf/winwmf.cxx
index f7c4f51ce1e2..cea1ab490b04 100644
--- a/svtools/source/filter.vcl/wmf/winwmf.cxx
+++ b/svtools/source/filter.vcl/wmf/winwmf.cxx
@@ -1081,6 +1081,8 @@ void WMFReader::ReadWMF()
nEMFRec = 0;
nEMFSize = 0;
+ sal_Bool bEMFAvailable = sal_False;
+
pOut->SetMapMode( MM_ANISOTROPIC );
pOut->SetWinOrg( Point() );
pOut->SetWinExt( Size( 1, 1 ) );
@@ -1117,50 +1119,53 @@ void WMFReader::ReadWMF()
break;
}
- if( aBmpSaveList.Count() &&
- ( nFunction != W_META_STRETCHDIB ) &&
- ( nFunction != W_META_DIBBITBLT ) &&
- ( nFunction != W_META_DIBSTRETCHBLT ) )
- {
- pOut->ResolveBitmapActions( aBmpSaveList );
- }
- if ( !nSkipActions )
- ReadRecordParams( nFunction );
- else
- nSkipActions--;
-
- if( pEMFStream && nEMFRecCount == nEMFRec )
+ if ( !bEMFAvailable )
{
- GDIMetaFile aMeta;
- pEMFStream->Seek( 0 );
- EnhWMFReader* pEMFReader = new EnhWMFReader ( *pEMFStream, aMeta );
- BOOL bRead = pEMFReader->ReadEnhWMF();
- delete pEMFReader; // destroy first!!!
-
- if( bRead )
+ if( aBmpSaveList.Count() &&
+ ( nFunction != W_META_STRETCHDIB ) &&
+ ( nFunction != W_META_DIBBITBLT ) &&
+ ( nFunction != W_META_DIBSTRETCHBLT ) )
{
- pOut->AddFromGDIMetaFile( aMeta );
- pOut->SetrclFrame( Rectangle(0, 0, aMeta.GetPrefSize().Width(), aMeta.GetPrefSize().Height() ));
- // we have successfully read the embedded EMF data
- // no need to process WMF data further
- break;
+ pOut->ResolveBitmapActions( aBmpSaveList );
}
+ if ( !nSkipActions )
+ ReadRecordParams( nFunction );
else
+ nSkipActions--;
+
+ if( pEMFStream && nEMFRecCount == nEMFRec )
{
- // something went wrong
- // continue with WMF, don't try this again
- delete pEMFStream;
- pEMFStream = NULL;
- }
+ GDIMetaFile aMeta;
+ pEMFStream->Seek( 0 );
+ EnhWMFReader* pEMFReader = new EnhWMFReader ( *pEMFStream, aMeta );
+ bEMFAvailable = pEMFReader->ReadEnhWMF();
+ delete pEMFReader; // destroy first!!!
+ if( bEMFAvailable )
+ {
+ pOut->AddFromGDIMetaFile( aMeta );
+ pOut->SetrclFrame( Rectangle(0, 0, aMeta.GetPrefSize().Width(), aMeta.GetPrefSize().Height() ));
+
+ // the stream needs to be set to the wmf end position,
+ // otherwise the GfxLink that is created will be incorrect
+ // (leading to graphic loss after swapout/swapin).
+ // so we will proceed normally, but are ignoring further wmf
+ // records
+ }
+ else
+ {
+ // something went wrong
+ // continue with WMF, don't try this again
+ delete pEMFStream;
+ pEMFStream = NULL;
+ }
+ }
}
-
nPos += nRecSize * 2;
if ( nPos <= nEndPos )
pWMF->Seek( nPos );
else
pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
-
}
}
else