Kaydet (Commit) a2aceeb0 authored tarafından Caolán McNamara's avatar Caolán McNamara

return earlier, no logic change intended

Change-Id: Icd75c46eb57c059fb60fd9701e6bb1fb651d8f3f
üst b560dc89
......@@ -1520,86 +1520,87 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
{
if( !rOStm.GetError() )
if (rOStm.GetError())
return;
if (rImpGraphic.ImplIsSwapOut())
{
if( !rImpGraphic.ImplIsSwapOut() )
{
if( ( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 ) &&
( rOStm.GetCompressMode() & SvStreamCompressFlags::NATIVE ) &&
rImpGraphic.mpGfxLink && rImpGraphic.mpGfxLink->IsNative() &&
!rImpGraphic.maPdfData.hasElements())
{
// native format
rOStm.WriteUInt32( NATIVE_FORMAT_50 );
rOStm.SetError( SVSTREAM_GENERALERROR );
return;
}
// write compat info
std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rOStm, StreamMode::WRITE, 1 ));
pCompat.reset(); // destructor writes stuff into the header
if( ( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 ) &&
( rOStm.GetCompressMode() & SvStreamCompressFlags::NATIVE ) &&
rImpGraphic.mpGfxLink && rImpGraphic.mpGfxLink->IsNative() &&
!rImpGraphic.maPdfData.hasElements())
{
// native format
rOStm.WriteUInt32( NATIVE_FORMAT_50 );
rImpGraphic.mpGfxLink->SetPrefMapMode( rImpGraphic.ImplGetPrefMapMode() );
rImpGraphic.mpGfxLink->SetPrefSize( rImpGraphic.ImplGetPrefSize() );
WriteGfxLink( rOStm, *rImpGraphic.mpGfxLink );
}
else
{
// own format
const SvStreamEndian nOldFormat = rOStm.GetEndian();
rOStm.SetEndian( SvStreamEndian::LITTLE );
// write compat info
std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rOStm, StreamMode::WRITE, 1 ));
pCompat.reset(); // destructor writes stuff into the header
switch( rImpGraphic.ImplGetType() )
{
case GraphicType::NONE:
case GraphicType::Default:
break;
rImpGraphic.mpGfxLink->SetPrefMapMode( rImpGraphic.ImplGetPrefMapMode() );
rImpGraphic.mpGfxLink->SetPrefSize( rImpGraphic.ImplGetPrefSize() );
WriteGfxLink( rOStm, *rImpGraphic.mpGfxLink );
}
else
{
// own format
const SvStreamEndian nOldFormat = rOStm.GetEndian();
rOStm.SetEndian( SvStreamEndian::LITTLE );
case GraphicType::Bitmap:
{
if(rImpGraphic.getSvgData().get())
{
// stream out Svg defining data (length, byte array and evtl. path)
// this is used e.g. in swapping out graphic data and in transporting it over UNO API
// as sequence of bytes, but AFAIK not written anywhere to any kind of file, so it should be
// no problem to extend it; only used at runtime
const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
rOStm.WriteUInt32( nSvgMagic );
rOStm.WriteUInt32( rImpGraphic.getSvgData()->getSvgDataArrayLength() );
rOStm.WriteBytes(rImpGraphic.getSvgData()->getSvgDataArray().getConstArray(),
rImpGraphic.getSvgData()->getSvgDataArrayLength());
rOStm.WriteUniOrByteString(rImpGraphic.getSvgData()->getPath(),
rOStm.GetStreamCharSet());
}
else if( rImpGraphic.ImplIsAnimated())
{
WriteAnimation( rOStm, *rImpGraphic.mpAnimation );
}
else
{
WriteDIBBitmapEx(rImpGraphic.maEx, rOStm);
}
}
break;
switch( rImpGraphic.ImplGetType() )
{
case GraphicType::NONE:
case GraphicType::Default:
break;
default:
{
if (rImpGraphic.maPdfData.hasElements())
{
// Stream out PDF data.
rOStm.WriteUInt32(nPdfMagic);
rOStm.WriteUInt32(rImpGraphic.maPdfData.getLength());
rOStm.WriteBytes(rImpGraphic.maPdfData.getConstArray(), rImpGraphic.maPdfData.getLength());
}
if( rImpGraphic.ImplIsSupportedGraphic() )
WriteGDIMetaFile( rOStm, rImpGraphic.maMetaFile );
}
break;
case GraphicType::Bitmap:
{
if(rImpGraphic.getSvgData().get())
{
// stream out Svg defining data (length, byte array and evtl. path)
// this is used e.g. in swapping out graphic data and in transporting it over UNO API
// as sequence of bytes, but AFAIK not written anywhere to any kind of file, so it should be
// no problem to extend it; only used at runtime
const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
rOStm.WriteUInt32( nSvgMagic );
rOStm.WriteUInt32( rImpGraphic.getSvgData()->getSvgDataArrayLength() );
rOStm.WriteBytes(rImpGraphic.getSvgData()->getSvgDataArray().getConstArray(),
rImpGraphic.getSvgData()->getSvgDataArrayLength());
rOStm.WriteUniOrByteString(rImpGraphic.getSvgData()->getPath(),
rOStm.GetStreamCharSet());
}
else if( rImpGraphic.ImplIsAnimated())
{
WriteAnimation( rOStm, *rImpGraphic.mpAnimation );
}
else
{
WriteDIBBitmapEx(rImpGraphic.maEx, rOStm);
}
}
break;
rOStm.SetEndian( nOldFormat );
default:
{
if (rImpGraphic.maPdfData.hasElements())
{
// Stream out PDF data.
rOStm.WriteUInt32(nPdfMagic);
rOStm.WriteUInt32(rImpGraphic.maPdfData.getLength());
rOStm.WriteBytes(rImpGraphic.maPdfData.getConstArray(), rImpGraphic.maPdfData.getLength());
}
if( rImpGraphic.ImplIsSupportedGraphic() )
WriteGDIMetaFile( rOStm, rImpGraphic.maMetaFile );
}
break;
}
else
rOStm.SetError( SVSTREAM_GENERALERROR );
rOStm.SetEndian( nOldFormat );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment