summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/svm/svmtest.cxx3
-rw-r--r--vcl/source/filter/graphicfilter.cxx7
-rw-r--r--vcl/source/filter/svm/SvmWriter.cxx6
-rw-r--r--vcl/source/gdi/TypeSerializer.cxx9
-rw-r--r--vcl/source/gdi/impgraph.cxx7
-rw-r--r--vcl/source/gdi/metaact.cxx7
-rw-r--r--vcl/source/treelist/transfer.cxx4
7 files changed, 32 insertions, 11 deletions
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 2ffb8ff14c9b..05a3a8ce78a3 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -309,7 +309,8 @@ static void writeMetaFile(GDIMetaFile& rInputMetafile, const OUString& rUrl)
{
SvFileStream aFileStream(rUrl, StreamMode::WRITE);
aFileStream.Seek(STREAM_SEEK_TO_BEGIN);
- rInputMetafile.Write(aFileStream);
+ SvmWriter aWriter(aFileStream);
+ aWriter.Write(rInputMetafile);
aFileStream.Close();
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index b0ee96a0e54c..d7848b83a8bb 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -31,6 +31,7 @@
#include <fltcall.hxx>
#include <vcl/salctype.hxx>
#include <vcl/filter/PngImageReader.hxx>
+#include <vcl/filter/SvmWriter.hxx>
#include <vcl/pngwrite.hxx>
#include <vcl/vectorgraphicdata.hxx>
#include <vcl/virdev.hxx>
@@ -1623,7 +1624,8 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
// #i119735# just use GetGDIMetaFile, it will create a buffered version of contained bitmap now automatically
GDIMetaFile aMTF(aGraphic.GetGDIMetaFile());
- aMTF.Write( rOStm );
+ SvmWriter aWriter( rOStm );
+ aWriter.Write( aMTF );
if( rOStm.GetError() )
nStatus = ERRCODE_GRFILTER_IOERROR;
@@ -1821,7 +1823,8 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
SvMemoryStream aMemStm( 65535, 65535 );
// #i119735# just use GetGDIMetaFile, it will create a buffered version of contained bitmap now automatically
- const_cast<GDIMetaFile&>( aGraphic.GetGDIMetaFile() ).Write( aMemStm );
+ SvmWriter aWriter( aMemStm );
+ aWriter.Write( aGraphic.GetGDIMetaFile() );
xActiveDataSource->setOutputStream( css::uno::Reference< css::io::XOutputStream >(
xStmIf, css::uno::UNO_QUERY ) );
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx
index bb1901f19dc2..189f6a8e69ac 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -35,7 +35,7 @@ void SvmWriter::WriteColor(::Color aColor)
mrStream.WriteUInt32(static_cast<sal_uInt32>(aColor));
}
-SvStream& SvmWriter::Write(GDIMetaFile& rMetaFile)
+SvStream& SvmWriter::Write(const GDIMetaFile& rMetaFile)
{
const SvStreamCompressFlags nStmCompressMode = mrStream.GetCompressMode();
SvStreamEndian nOldFormat = mrStream.GetEndian();
@@ -57,11 +57,11 @@ SvStream& SvmWriter::Write(GDIMetaFile& rMetaFile)
aWriteData.meActualCharSet = mrStream.GetStreamCharSet();
- MetaAction* pAct = rMetaFile.FirstAction();
+ MetaAction* pAct = const_cast<GDIMetaFile&>(rMetaFile).FirstAction();
while (pAct)
{
MetaActionHandler(pAct, &aWriteData);
- pAct = rMetaFile.NextAction();
+ pAct = const_cast<GDIMetaFile&>(rMetaFile).NextAction();
}
mrStream.SetEndian(nOldFormat);
diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx
index 6f88b1954e25..403ec5e56428 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -23,6 +23,7 @@
#include <sal/log.hxx>
#include <comphelper/fileformat.h>
#include <vcl/filter/SvmReader.hxx>
+#include <vcl/filter/SvmWriter.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/dibtools.hxx>
@@ -410,7 +411,13 @@ void TypeSerializer::writeGraphic(const Graphic& rGraphic)
default:
{
if (aGraphic.IsSupportedGraphic())
- WriteGDIMetaFile(mrStream, rGraphic.GetGDIMetaFile());
+ {
+ if (!mrStream.GetError())
+ {
+ SvmWriter aWriter(mrStream);
+ aWriter.Write(rGraphic.GetGDIMetaFile());
+ }
+ }
}
break;
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 242e1d22e49e..6e4416935100 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -32,6 +32,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/tempfile.hxx>
#include <vcl/filter/SvmReader.hxx>
+#include <vcl/filter/SvmWriter.hxx>
#include <vcl/outdev.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/virdev.hxx>
@@ -1188,7 +1189,11 @@ bool ImpGraphic::swapOutGraphic(SvStream& rStream)
{
case GraphicType::GdiMetafile:
{
- WriteGDIMetaFile(rStream, maMetaFile);
+ if(!rStream.GetError())
+ {
+ SvmWriter aWriter(rStream);
+ aWriter.Write(maMetaFile);
+ }
}
break;
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 0685f939683f..5ec7e2055fa8 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -26,6 +26,7 @@
#include <tools/helpers.hxx>
#include <vcl/dibtools.hxx>
#include <vcl/filter/SvmReader.hxx>
+#include <vcl/filter/SvmWriter.hxx>
#include <vcl/outdev.hxx>
#include <vcl/metaact.hxx>
#include <vcl/graphictools.hxx>
@@ -3023,7 +3024,8 @@ void MetaFloatTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pDat
MetaAction::Write(rOStm, pData);
VersionCompatWrite aCompat(rOStm, 1);
- maMtf.Write( rOStm );
+ SvmWriter aWriter( rOStm );
+ aWriter.Write( maMtf );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPoint);
aSerializer.writeSize(maSize);
@@ -3089,7 +3091,8 @@ void MetaEPSAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
aSerializer.writeGfxLink(maGfxLink);
aSerializer.writePoint(maPoint);
aSerializer.writeSize(maSize);
- maSubst.Write( rOStm );
+ SvmWriter aWriter( rOStm );
+ aWriter.Write( maSubst );
}
void MetaEPSAction::Read( SvStream& rIStm, ImplMetaReadData* )
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 99f76a0ce78e..c8dfe375b6c9 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -32,6 +32,7 @@
#include <sot/storage.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/filter/SvmReader.hxx>
+#include <vcl/filter/SvmWriter.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/graph.hxx>
#include <vcl/cvtgrf.hxx>
@@ -723,7 +724,8 @@ bool TransferableHelper::SetGDIMetaFile( const GDIMetaFile& rMtf )
{
SvMemoryStream aMemStm( 65535, 65535 );
- const_cast<GDIMetaFile&>(rMtf).Write( aMemStm );
+ SvmWriter aWriter( aMemStm );
+ aWriter.Write( rMtf );
maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.TellEnd() );
}