Move Rectangle,Point,Size serialization to GenericTypeSerializer

Change-Id: Iae489fc31b13b836e1df5327ba2fa07e0325907a
Reviewed-on: https://gerrit.libreoffice.org/79793
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
Tomaž Vajngerl 2019-09-26 16:22:09 +02:00 committed by Tomaž Vajngerl
parent 43d3f3a2d1
commit 66eedce71f
18 changed files with 457 additions and 219 deletions

View File

@ -233,9 +233,9 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
ReadFont( rStream, *pBulletFont );
}
else pBulletFont = nullptr;
ReadPair( rStream, aGraphicSize );
tools::GenericTypeSerializer aSerializer(rStream);
aSerializer.readSize(aGraphicSize);
aSerializer.readColor(nBulletColor);
rStream.ReadUInt16( nBulletRelSize );
@ -261,6 +261,8 @@ void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverte
pBulletFont->SetFamilyName(sFontName);
}
tools::GenericTypeSerializer aSerializer(rStream);
rStream.WriteUInt16( NUMITEM_VERSION_04 );
rStream.WriteUInt16( GetNumberingType() );
@ -307,13 +309,13 @@ void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverte
}
else
rStream.WriteUInt16( 0 );
WritePair( rStream, aGraphicSize );
aSerializer.writeSize(aGraphicSize);
Color nTempColor = nBulletColor;
if(COL_AUTO == nBulletColor)
nTempColor = COL_BLACK;
tools::GenericTypeSerializer aSerializer(rStream);
aSerializer.writeColor(nTempColor);
rStream.WriteUInt16( nBulletRelSize );
rStream.WriteUInt16( sal_uInt16(IsShowSymbol()) );

View File

@ -21,6 +21,7 @@
#include <tools/toolsdllapi.h>
#include <tools/color.hxx>
#include <tools/gen.hxx>
#include <tools/stream.hxx>
namespace tools
@ -37,6 +38,15 @@ public:
void readColor(Color& rColor);
void writeColor(const Color& rColor);
void readPoint(Point& rPoint);
void writePoint(const Point& rPoint);
void readSize(Size& rSize);
void writeSize(const Size& rSize);
void readRectangle(Rectangle& rRectangle);
void writeRectangle(const Rectangle& rRectangle);
};
} // end namespace tools

View File

@ -48,8 +48,6 @@ public:
long& B() { return nB; }
TOOLS_DLLPUBLIC rtl::OString toString() const;
TOOLS_DLLPUBLIC friend SvStream& ReadPair( SvStream& rIStream, Pair& rPair );
TOOLS_DLLPUBLIC friend SvStream& WritePair( SvStream& rOStream, const Pair& rPair );
protected:
long nA;
@ -448,9 +446,6 @@ public:
friend inline tools::Rectangle operator + ( const tools::Rectangle& rRect, const Point& rPt );
friend inline tools::Rectangle operator - ( const tools::Rectangle& rRect, const Point& rPt );
TOOLS_DLLPUBLIC friend SvStream& ReadRectangle( SvStream& rIStream, tools::Rectangle& rRect );
TOOLS_DLLPUBLIC friend SvStream& WriteRectangle( SvStream& rOStream, const tools::Rectangle& rRect );
// ONE
long getX() const { return nLeft; }
long getY() const { return nTop; }
@ -733,11 +728,6 @@ inline std::basic_ostream<charT, traits> & operator <<(
<< "@(" << rectangle.getX() << ',' << rectangle.getY() << ")";
}
inline SvStream& ReadPair( SvStream& rIStream, Point& v ) { return ReadPair(rIStream, v.toPair()); }
inline SvStream& WritePair( SvStream& rOStream, const Point& v ) { return WritePair(rOStream, v.toPair()); }
inline SvStream& ReadPair( SvStream& rIStream, Size& v ) { return ReadPair(rIStream, v.toPair()); }
inline SvStream& WritePair( SvStream& rOStream, const Size& v ) { return WritePair(rOStream, v.toPair()); }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -29,6 +29,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
tools/qa/cppunit/test_100mm2twips \
tools/qa/cppunit/test_fround \
tools/qa/cppunit/test_xmlwalker \
tools/qa/cppunit/test_GenericTypeSerializer \
))
$(eval $(call gb_CppunitTest_add_cxxobjects,tools_test,\

View File

@ -0,0 +1,101 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sal/types.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <tools/GenericTypeSerializer.hxx>
#include <tools/stream.hxx>
#include <tools/gen.hxx>
namespace tools
{
class GenericTypeSerializerTest : public CppUnit::TestFixture
{
public:
void testRoundtripPoint()
{
Point aPoint(20, 50);
SvMemoryStream aStream;
GenericTypeSerializer aSerializer(aStream);
aSerializer.writePoint(aPoint);
aStream.Seek(STREAM_SEEK_TO_BEGIN);
Point aReadPoint;
aSerializer.readPoint(aReadPoint);
CPPUNIT_ASSERT_EQUAL(aPoint, aReadPoint);
}
void testRoundtripSize()
{
Size aSize(40, 80);
SvMemoryStream aStream;
GenericTypeSerializer aSerializer(aStream);
aSerializer.writeSize(aSize);
aStream.Seek(STREAM_SEEK_TO_BEGIN);
Size aReadSize;
aSerializer.readSize(aReadSize);
CPPUNIT_ASSERT_EQUAL(aSize, aReadSize);
}
void testRoundtripRectangle()
{
{
Rectangle aRectangle;
CPPUNIT_ASSERT(aRectangle.IsEmpty());
SvMemoryStream aStream;
aStream.Seek(STREAM_SEEK_TO_BEGIN);
GenericTypeSerializer aSerializer(aStream);
aSerializer.writeRectangle(aRectangle);
aStream.Seek(STREAM_SEEK_TO_BEGIN);
// Need to set the rectangle to non-empty, so it will be set to empty later
Rectangle aReadRectangle(Point(20, 50), Size(10, 30));
aSerializer.readRectangle(aReadRectangle);
CPPUNIT_ASSERT(aRectangle.IsEmpty());
}
{
Rectangle aRectangle(Point(20, 50), Size(10, 30));
SvMemoryStream aStream;
aStream.Seek(STREAM_SEEK_TO_BEGIN);
GenericTypeSerializer aSerializer(aStream);
aSerializer.writeRectangle(aRectangle);
aStream.Seek(STREAM_SEEK_TO_BEGIN);
Rectangle aReadRectangle;
aSerializer.readRectangle(aReadRectangle);
CPPUNIT_ASSERT_EQUAL(aRectangle.Top(), aReadRectangle.Top());
CPPUNIT_ASSERT_EQUAL(aRectangle.Left(), aReadRectangle.Left());
CPPUNIT_ASSERT_EQUAL(aRectangle.Right(), aReadRectangle.Right());
CPPUNIT_ASSERT_EQUAL(aRectangle.Bottom(), aReadRectangle.Bottom());
}
}
CPPUNIT_TEST_SUITE(GenericTypeSerializerTest);
CPPUNIT_TEST(testRoundtripPoint);
CPPUNIT_TEST(testRoundtripSize);
CPPUNIT_TEST(testRoundtripRectangle);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(GenericTypeSerializerTest);
} // namespace tools
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -27,23 +27,6 @@
#include <tools/gen.hxx>
#include <tools/stream.hxx>
SvStream& ReadPair( SvStream& rIStream, Pair& rPair )
{
sal_Int32 nTmpA(0), nTmpB(0);
rIStream.ReadInt32( nTmpA ).ReadInt32( nTmpB );
rPair.nA = nTmpA;
rPair.nB = nTmpB;
return rIStream;
}
SvStream& WritePair( SvStream& rOStream, const Pair& rPair )
{
rOStream.WriteInt32( rPair.nA ).WriteInt32( rPair.nB );
return rOStream;
}
OString Pair::toString() const
{
std::stringstream ss;
@ -200,33 +183,6 @@ bool tools::Rectangle::IsOver( const tools::Rectangle& rRect ) const
return !GetIntersection( rRect ).IsEmpty();
}
namespace tools
{
SvStream& ReadRectangle( SvStream& rIStream, tools::Rectangle& rRect )
{
sal_Int32 nTmpL(0), nTmpT(0), nTmpR(0), nTmpB(0);
rIStream.ReadInt32( nTmpL ).ReadInt32( nTmpT ).ReadInt32( nTmpR ).ReadInt32( nTmpB );
rRect.nLeft = nTmpL;
rRect.nTop = nTmpT;
rRect.nRight = nTmpR;
rRect.nBottom = nTmpB;
return rIStream;
}
SvStream& WriteRectangle( SvStream& rOStream, const tools::Rectangle& rRect )
{
rOStream.WriteInt32( rRect.nLeft )
.WriteInt32( rRect.nTop )
.WriteInt32( rRect.nRight )
.WriteInt32( rRect.nBottom );
return rOStream;
}
}
OString tools::Rectangle::toString() const
{
std::stringstream ss;

View File

@ -26,6 +26,8 @@ namespace tools
{
constexpr sal_uInt16 COL_NAME_USER = 0x8000;
constexpr sal_Int32 RECT_EMPTY_VALUE_RIGHT_BOTTOM = -32767;
void GenericTypeSerializer::readColor(Color& rColor)
{
sal_uInt16 nColorNameID(0);
@ -100,6 +102,85 @@ void GenericTypeSerializer::writeColor(const Color& rColor)
mrStream.WriteUInt16((nB << 8) + nB);
}
void GenericTypeSerializer::readPoint(Point& rPoint)
{
sal_Int32 nX(0);
sal_Int32 nY(0);
mrStream.ReadInt32(nX);
mrStream.ReadInt32(nY);
rPoint.setX(nX);
rPoint.setY(nY);
}
void GenericTypeSerializer::writePoint(const Point& rPoint)
{
mrStream.WriteInt32(rPoint.getX());
mrStream.WriteInt32(rPoint.getY());
}
void GenericTypeSerializer::readSize(Size& rSize)
{
sal_Int32 nWidth(0);
sal_Int32 nHeight(0);
mrStream.ReadInt32(nWidth);
mrStream.ReadInt32(nHeight);
rSize.setWidth(nWidth);
rSize.setHeight(nHeight);
}
void GenericTypeSerializer::writeSize(const Size& rSize)
{
mrStream.WriteInt32(rSize.getWidth());
mrStream.WriteInt32(rSize.getHeight());
}
void GenericTypeSerializer::readRectangle(Rectangle& rRectangle)
{
sal_Int32 nLeft(0);
sal_Int32 nTop(0);
sal_Int32 nRight(0);
sal_Int32 nBottom(0);
mrStream.ReadInt32(nLeft);
mrStream.ReadInt32(nTop);
mrStream.ReadInt32(nRight);
mrStream.ReadInt32(nBottom);
if (nRight == RECT_EMPTY_VALUE_RIGHT_BOTTOM || nBottom == RECT_EMPTY_VALUE_RIGHT_BOTTOM)
{
rRectangle.SetEmpty();
}
else
{
rRectangle.SetLeft(nLeft);
rRectangle.SetTop(nTop);
rRectangle.SetRight(nRight);
rRectangle.SetBottom(nBottom);
}
}
void GenericTypeSerializer::writeRectangle(const Rectangle& rRectangle)
{
if (rRectangle.IsEmpty())
{
mrStream.WriteInt32(0);
mrStream.WriteInt32(0);
mrStream.WriteInt32(RECT_EMPTY_VALUE_RIGHT_BOTTOM);
mrStream.WriteInt32(RECT_EMPTY_VALUE_RIGHT_BOTTOM);
}
else
{
mrStream.WriteInt32(rRectangle.Left());
mrStream.WriteInt32(rRectangle.Top());
mrStream.WriteInt32(rRectangle.Right());
mrStream.WriteInt32(rRectangle.Bottom());
}
}
} // end namespace tools
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -21,6 +21,7 @@
#include <sal/config.h>
#include <tools/stream.hxx>
#include <tools/GenericTypeSerializer.hxx>
#include <sal/log.hxx>
#include <vcl/animate/Animation.hxx>
@ -591,9 +592,10 @@ SvStream& WriteAnimation(SvStream& rOStm, const Animation& rAnimation)
// Write AnimationBitmap
WriteDIBBitmapEx(rAnimationBitmap.maBitmapEx, rOStm);
WritePair(rOStm, rAnimationBitmap.maPositionPixel);
WritePair(rOStm, rAnimationBitmap.maSizePixel);
WritePair(rOStm, rAnimation.maGlobalSize);
tools::GenericTypeSerializer aSerializer(rOStm);
aSerializer.writePoint(rAnimationBitmap.maPositionPixel);
aSerializer.writeSize(rAnimationBitmap.maSizePixel);
aSerializer.writeSize(rAnimation.maGlobalSize);
rOStm.WriteUInt16((ANIMATION_TIMEOUT_ON_CLICK == rAnimationBitmap.mnWait)
? 65535
: rAnimationBitmap.mnWait);
@ -653,9 +655,10 @@ SvStream& ReadAnimation(SvStream& rIStm, Animation& rAnimation)
do
{
ReadDIBBitmapEx(aAnimationBitmap.maBitmapEx, rIStm);
ReadPair(rIStm, aAnimationBitmap.maPositionPixel);
ReadPair(rIStm, aAnimationBitmap.maSizePixel);
ReadPair(rIStm, rAnimation.maGlobalSize);
tools::GenericTypeSerializer aSerializer(rIStm);
aSerializer.readPoint(aAnimationBitmap.maPositionPixel);
aSerializer.readSize(aAnimationBitmap.maSizePixel);
aSerializer.readSize(rAnimation.maGlobalSize);
rIStm.ReadUInt16(nTmp16);
aAnimationBitmap.mnWait = ((65535 == nTmp16) ? ANIMATION_TIMEOUT_ON_CLICK : nTmp16);
rIStm.ReadUInt16(nTmp16);

View File

@ -21,6 +21,7 @@
#include <tools/stream.hxx>
#include <tools/fract.hxx>
#include <tools/urlobj.hxx>
#include <TypeSerializer.hxx>
#include <vcl/outdev.hxx>
#include <vcl/graphicfilter.hxx>
#include <unotools/ucbstreamhelper.hxx>
@ -1025,7 +1026,8 @@ bool GraphicDescriptor::ImpDetectSVM( SvStream& rStm, bool bExtendedInfo )
rStm.SeekRel( 0x06 );
ReadMapMode( rStm, aMapMode );
ReadPair( rStm, aLogSize );
TypeSerializer aSerializer(rStm);
aSerializer.readSize(aLogSize);
aLogSize = OutputDevice::LogicToLogic( aLogSize, aMapMode, MapMode( MapUnit::Map100thMM ) );
}
}

View File

@ -32,6 +32,7 @@
#include <algorithm>
#include <rtl/instance.hxx>
#include <TypeSerializer.hxx>
using namespace vcl;
@ -365,7 +366,8 @@ SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont )
rImplFont.SetFamilyName( rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet()) );
rImplFont.maStyleName = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
ReadPair( rIStm, rImplFont.maAverageFontSize );
TypeSerializer aSerializer(rIStm);
aSerializer.readSize(rImplFont.maAverageFontSize);
rIStm.ReadUInt16( nTmp16 ); rImplFont.SetCharSet( static_cast<rtl_TextEncoding>(nTmp16) );
rIStm.ReadUInt16( nTmp16 ); rImplFont.SetFamilyType( static_cast<FontFamily>(nTmp16) );
@ -406,9 +408,10 @@ SvStream& ReadImplFont( SvStream& rIStm, ImplFont& rImplFont )
SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& rImplFont )
{
VersionCompat aCompat( rOStm, StreamMode::WRITE, 3 );
TypeSerializer aSerializer(rOStm);
rOStm.WriteUniOrByteString( rImplFont.GetFamilyName(), rOStm.GetStreamCharSet() );
rOStm.WriteUniOrByteString( rImplFont.GetStyleName(), rOStm.GetStreamCharSet() );
WritePair( rOStm, rImplFont.maAverageFontSize );
aSerializer.writeSize(rImplFont.maAverageFontSize);
rOStm.WriteUInt16( GetStoreCharSet( rImplFont.GetCharSet() ) );
rOStm.WriteUInt16( rImplFont.GetFamilyTypeNoAsk() );

View File

@ -39,6 +39,7 @@
#include <vcl/mtfxmldump.hxx>
#include <svmconverter.hxx>
#include <TypeSerializer.hxx>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/rendering/MtfRenderer.hpp>
@ -2646,7 +2647,8 @@ SvStream& ReadGDIMetaFile(SvStream& rIStm, GDIMetaFile& rGDIMetaFile, ImplMetaRe
rIStm.ReadUInt32( nStmCompressMode );
ReadMapMode( rIStm, rGDIMetaFile.m_aPrefMapMode );
ReadPair( rIStm, rGDIMetaFile.m_aPrefSize );
TypeSerializer aSerializer(rIStm);
aSerializer.readSize(rGDIMetaFile.m_aPrefSize);
rIStm.ReadUInt32( nCount );
pCompat.reset(); // destructor writes stuff into the header
@ -2730,7 +2732,8 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm )
rOStm.WriteUInt32( static_cast<sal_uInt32>(nStmCompressMode) );
WriteMapMode( rOStm, m_aPrefMapMode );
WritePair( rOStm, m_aPrefSize );
TypeSerializer aSerializer(rOStm);
aSerializer.writeSize(m_aPrefSize);
rOStm.WriteUInt32( GetActionSize() );
delete pCompat;

View File

@ -24,6 +24,8 @@
#include <vcl/gfxlink.hxx>
#include <vcl/graphicfilter.hxx>
#include <memory>
#include <TypeSerializer.hxx>
GfxLink::GfxLink()
: meType(GfxLinkType::NONE)
@ -148,12 +150,13 @@ bool GfxLink::ExportNative( SvStream& rOStream ) const
SvStream& WriteGfxLink( SvStream& rOStream, const GfxLink& rGfxLink )
{
std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rOStream, StreamMode::WRITE, 2 ));
TypeSerializer aSerializer(rOStream);
// Version 1
rOStream.WriteUInt16( static_cast<sal_uInt16>(rGfxLink.GetType()) ).WriteUInt32( rGfxLink.GetDataSize() ).WriteUInt32( rGfxLink.GetUserId() );
// Version 2
WritePair( rOStream, rGfxLink.GetPrefSize() );
aSerializer.writeSize(rGfxLink.GetPrefSize());
WriteMapMode( rOStream, rGfxLink.GetPrefMapMode() );
pCompat.reset(); // destructor writes stuff into the header
@ -175,6 +178,8 @@ SvStream& ReadGfxLink( SvStream& rIStream, GfxLink& rGfxLink)
bool bMapAndSizeValid( false );
std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rIStream, StreamMode::READ ));
TypeSerializer aSerializer(rIStream);
// Version 1
sal_uInt16 nType(0);
sal_uInt32 nSize(0), nUserId(0);
@ -182,7 +187,7 @@ SvStream& ReadGfxLink( SvStream& rIStream, GfxLink& rGfxLink)
if( pCompat->GetVersion() >= 2 )
{
ReadPair( rIStream, aSize );
aSerializer.readSize(aSize);
ReadMapMode( rIStream, aMapMode );
bMapAndSizeValid = true;
}

View File

@ -44,7 +44,7 @@
#include <map>
#include <memory>
#include <vcl/gdimetafiletools.hxx>
#include <TypeSerializer.hxx>
#include <vcl/pdfread.hxx>
#define GRAPHIC_MTFTOBMP_MAXEXT 2048
@ -1263,7 +1263,8 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
rIStm.ReadInt32( nType );
sal_Int32 nLen;
rIStm.ReadInt32( nLen );
ReadPair( rIStm, aSize );
TypeSerializer aSerializer(rIStm);
aSerializer.readSize(aSize);
ReadMapMode( rIStm, aMapMode );
}
else
@ -1403,7 +1404,9 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
nDataFieldPos = rOStm.Tell();
rOStm.WriteInt32( 0 );
WritePair( rOStm, aSize );
TypeSerializer aSerializer(rOStm);
aSerializer.writeSize(aSize);
WriteMapMode( rOStm, aMapMode );
}
else

View File

@ -24,6 +24,7 @@
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
#include <rtl/instance.hxx>
#include <TypeSerializer.hxx>
struct MapMode::ImplMapMode
{
@ -137,8 +138,10 @@ SvStream& ReadMapMode( SvStream& rIStm, MapMode& rMapMode )
VersionCompat aCompat( rIStm, StreamMode::READ );
sal_uInt16 nTmp16;
TypeSerializer aSerializer(rIStm);
rIStm.ReadUInt16( nTmp16 ); rMapMode.mpImplMapMode->meUnit = static_cast<MapUnit>(nTmp16);
ReadPair( rIStm, rMapMode.mpImplMapMode->maOrigin );
aSerializer.readPoint(rMapMode.mpImplMapMode->maOrigin);
ReadFraction( rIStm, rMapMode.mpImplMapMode->maScaleX );
ReadFraction( rIStm, rMapMode.mpImplMapMode->maScaleY );
rIStm.ReadCharAsBool( rMapMode.mpImplMapMode->mbSimple );
@ -150,8 +153,10 @@ SvStream& WriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
{
VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 );
TypeSerializer aSerializer(rOStm);
rOStm.WriteUInt16( static_cast<sal_uInt16>(rMapMode.mpImplMapMode->meUnit) );
WritePair( rOStm, rMapMode.mpImplMapMode->maOrigin );
aSerializer.writePoint(rMapMode.mpImplMapMode->maOrigin);
WriteFraction( rOStm, rMapMode.mpImplMapMode->maScaleX );
WriteFraction( rOStm, rMapMode.mpImplMapMode->maScaleY );
rOStm.WriteBool( rMapMode.mpImplMapMode->mbSimple );

View File

@ -308,14 +308,16 @@ void MetaPixelAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WritePair( rOStm, maPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
rOStm.WriteUInt32(maColor.mValue);
}
void MetaPixelAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadPair( rIStm, maPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
rIStm.ReadUInt32(maColor.mValue);
}
@ -355,13 +357,15 @@ void MetaPointAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WritePair( rOStm, maPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
}
void MetaPointAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadPair( rIStm, maPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
}
MetaLineAction::MetaLineAction() :
@ -416,9 +420,12 @@ void MetaLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 2);
WritePair( rOStm, maStartPt );
WritePair( rOStm, maEndPt ); // Version 1
WriteLineInfo( rOStm, maLineInfo ); // Version 2
// Version 1
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maStartPt);
aSerializer.writePoint(maEndPt);
// Version 2
WriteLineInfo( rOStm, maLineInfo );
}
void MetaLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
@ -426,8 +433,9 @@ void MetaLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
VersionCompat aCompat(rIStm, StreamMode::READ);
// Version 1
ReadPair( rIStm, maStartPt );
ReadPair( rIStm, maEndPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maStartPt);
aSerializer.readPoint(maEndPt);
// Version 2
if( aCompat.GetVersion() >= 2 )
@ -472,13 +480,15 @@ void MetaRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteRectangle( rOStm, maRect );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
}
void MetaRectAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
}
MetaRoundRectAction::MetaRoundRectAction() :
@ -524,14 +534,17 @@ void MetaRoundRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteRectangle( rOStm, maRect );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
rOStm.WriteUInt32( mnHorzRound ).WriteUInt32( mnVertRound );
}
void MetaRoundRectAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect ).ReadUInt32( mnHorzRound ).ReadUInt32( mnVertRound );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
rIStm.ReadUInt32( mnHorzRound ).ReadUInt32( mnVertRound );
}
MetaEllipseAction::MetaEllipseAction() :
@ -570,13 +583,15 @@ void MetaEllipseAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteRectangle( rOStm, maRect );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
}
void MetaEllipseAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
}
MetaArcAction::MetaArcAction() :
@ -622,17 +637,19 @@ void MetaArcAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteRectangle( rOStm, maRect );
WritePair( rOStm, maStartPt );
WritePair( rOStm, maEndPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
aSerializer.writePoint(maStartPt);
aSerializer.writePoint(maEndPt);
}
void MetaArcAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect );
ReadPair( rIStm, maStartPt );
ReadPair( rIStm, maEndPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
aSerializer.readPoint(maStartPt);
aSerializer.readPoint(maEndPt);
}
MetaPieAction::MetaPieAction() :
@ -678,17 +695,19 @@ void MetaPieAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteRectangle( rOStm, maRect );
WritePair( rOStm, maStartPt );
WritePair( rOStm, maEndPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
aSerializer.writePoint(maStartPt);
aSerializer.writePoint(maEndPt);
}
void MetaPieAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect );
ReadPair( rIStm, maStartPt );
ReadPair( rIStm, maEndPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
aSerializer.readPoint(maStartPt);
aSerializer.readPoint(maEndPt);
}
MetaChordAction::MetaChordAction() :
@ -734,17 +753,19 @@ void MetaChordAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteRectangle( rOStm, maRect );
WritePair( rOStm, maStartPt );
WritePair( rOStm, maEndPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
aSerializer.writePoint(maStartPt);
aSerializer.writePoint(maEndPt);
}
void MetaChordAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect );
ReadPair( rIStm, maStartPt );
ReadPair( rIStm, maEndPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
aSerializer.readPoint(maStartPt);
aSerializer.readPoint(maEndPt);
}
MetaPolyLineAction::MetaPolyLineAction() :
@ -1029,7 +1050,8 @@ void MetaTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 2);
WritePair( rOStm, maPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
rOStm.WriteUInt16(mnIndex);
rOStm.WriteUInt16(mnLen);
@ -1040,7 +1062,8 @@ void MetaTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
void MetaTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadPair( rIStm, maPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
sal_uInt16 nTmpIndex(0);
rIStm.ReadUInt16(nTmpIndex);
@ -1129,7 +1152,8 @@ void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 2);
WritePair( rOStm, maStartPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maStartPt);
rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
rOStm.WriteUInt16(mnIndex);
rOStm.WriteUInt16(mnLen);
@ -1146,7 +1170,8 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
mpDXAry.reset();
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadPair( rIStm, maStartPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maStartPt);
maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
sal_uInt16 nTmpIndex(0);
rIStm.ReadUInt16(nTmpIndex);
@ -1251,7 +1276,8 @@ void MetaStretchTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 2);
WritePair( rOStm, maPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
rOStm.WriteUInt32( mnWidth );
rOStm.WriteUInt16( mnIndex );
@ -1263,7 +1289,8 @@ void MetaStretchTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadPair( rIStm, maPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm.ReadUInt32( mnWidth );
sal_uInt16 nTmpIndex(0);
@ -1317,7 +1344,8 @@ void MetaTextRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 2);
WriteRectangle( rOStm, maRect );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
rOStm.WriteUniOrByteString( maStr, pData->meActualCharSet );
rOStm.WriteUInt16( static_cast<sal_uInt16>(mnStyle) );
@ -1327,7 +1355,8 @@ void MetaTextRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
void MetaTextRectAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
sal_uInt16 nTmp;
rIStm .ReadUInt16( nTmp );
@ -1386,7 +1415,9 @@ void MetaTextLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 2);
WritePair( rOStm, maPos );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPos);
rOStm.WriteInt32( mnWidth );
rOStm.WriteUInt32( meStrikeout );
rOStm.WriteUInt32( meUnderline );
@ -1399,7 +1430,8 @@ void MetaTextLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
VersionCompat aCompat(rIStm, StreamMode::READ);
sal_Int32 nTempWidth(0);
ReadPair( rIStm, maPos );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPos);
rIStm.ReadInt32(nTempWidth);
mnWidth = nTempWidth;
@ -1459,7 +1491,8 @@ void MetaBmpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIB(maBmp, rOStm, false, true);
WritePair( rOStm, maPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
}
}
@ -1467,7 +1500,8 @@ void MetaBmpAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIB(maBmp, rIStm, true);
ReadPair( rIStm, maPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
}
MetaBmpScaleAction::MetaBmpScaleAction() :
@ -1515,8 +1549,10 @@ void MetaBmpScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIB(maBmp, rOStm, false, true);
WritePair( rOStm, maPt );
WritePair( rOStm, maSz );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
aSerializer.writeSize(maSz);
}
}
@ -1524,8 +1560,9 @@ void MetaBmpScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIB(maBmp, rIStm, true);
ReadPair( rIStm, maPt );
ReadPair( rIStm, maSz );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
aSerializer.readSize(maSz);
}
MetaBmpScalePartAction::MetaBmpScalePartAction() :
@ -1576,10 +1613,12 @@ void MetaBmpScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIB(maBmp, rOStm, false, true);
WritePair( rOStm, maDstPt );
WritePair( rOStm, maDstSz );
WritePair( rOStm, maSrcPt );
WritePair( rOStm, maSrcSz );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maDstPt);
aSerializer.writeSize(maDstSz);
aSerializer.writePoint(maSrcPt);
aSerializer.writeSize(maSrcSz);
}
}
@ -1587,10 +1626,11 @@ void MetaBmpScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIB(maBmp, rIStm, true);
ReadPair( rIStm, maDstPt );
ReadPair( rIStm, maDstSz );
ReadPair( rIStm, maSrcPt );
ReadPair( rIStm, maSrcSz );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maDstPt);
aSerializer.readSize(maDstSz);
aSerializer.readPoint(maSrcPt);
aSerializer.readSize(maSrcSz);
}
MetaBmpExAction::MetaBmpExAction() :
@ -1633,7 +1673,8 @@ void MetaBmpExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIBBitmapEx(maBmpEx, rOStm);
WritePair( rOStm, maPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
}
}
@ -1641,7 +1682,8 @@ void MetaBmpExAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIBBitmapEx(maBmpEx, rIStm);
ReadPair( rIStm, maPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
}
MetaBmpExScaleAction::MetaBmpExScaleAction() :
@ -1689,8 +1731,9 @@ void MetaBmpExScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIBBitmapEx(maBmpEx, rOStm);
WritePair( rOStm, maPt );
WritePair( rOStm, maSz );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
aSerializer.writeSize(maSz);
}
}
@ -1698,8 +1741,9 @@ void MetaBmpExScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIBBitmapEx(maBmpEx, rIStm);
ReadPair( rIStm, maPt );
ReadPair( rIStm, maSz );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
aSerializer.readSize(maSz);
}
MetaBmpExScalePartAction::MetaBmpExScalePartAction() :
@ -1750,10 +1794,11 @@ void MetaBmpExScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIBBitmapEx(maBmpEx, rOStm);
WritePair( rOStm, maDstPt );
WritePair( rOStm, maDstSz );
WritePair( rOStm, maSrcPt );
WritePair( rOStm, maSrcSz );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maDstPt);
aSerializer.writeSize(maDstSz);
aSerializer.writePoint(maSrcPt);
aSerializer.writeSize(maSrcSz);
}
}
@ -1761,10 +1806,11 @@ void MetaBmpExScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIBBitmapEx(maBmpEx, rIStm);
ReadPair( rIStm, maDstPt );
ReadPair( rIStm, maDstSz );
ReadPair( rIStm, maSrcPt );
ReadPair( rIStm, maSrcSz );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maDstPt);
aSerializer.readSize(maDstSz);
aSerializer.readPoint(maSrcPt);
aSerializer.readSize(maSrcSz);
}
MetaMaskAction::MetaMaskAction() :
@ -1810,7 +1856,8 @@ void MetaMaskAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIB(maBmp, rOStm, false, true);
WritePair( rOStm, maPt );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
}
}
@ -1818,7 +1865,8 @@ void MetaMaskAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIB(maBmp, rIStm, true);
ReadPair( rIStm, maPt );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
}
MetaMaskScaleAction::MetaMaskScaleAction() :
@ -1868,8 +1916,9 @@ void MetaMaskScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIB(maBmp, rOStm, false, true);
WritePair( rOStm, maPt );
WritePair( rOStm, maSz );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPt);
aSerializer.writeSize(maSz);
}
}
@ -1877,8 +1926,9 @@ void MetaMaskScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIB(maBmp, rIStm, true);
ReadPair( rIStm, maPt );
ReadPair( rIStm, maSz );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPt);
aSerializer.readSize(maSz);
}
MetaMaskScalePartAction::MetaMaskScalePartAction() :
@ -1932,10 +1982,11 @@ void MetaMaskScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteDIB(maBmp, rOStm, false, true);
rOStm.WriteUInt32(maColor.mValue);
WritePair( rOStm, maDstPt );
WritePair( rOStm, maDstSz );
WritePair( rOStm, maSrcPt );
WritePair( rOStm, maSrcSz );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maDstPt);
aSerializer.writeSize(maDstSz);
aSerializer.writePoint(maSrcPt);
aSerializer.writeSize(maSrcSz);
}
}
@ -1944,10 +1995,11 @@ void MetaMaskScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadDIB(maBmp, rIStm, true);
rIStm.ReadUInt32(maColor.mValue);
ReadPair( rIStm, maDstPt );
ReadPair( rIStm, maDstSz );
ReadPair( rIStm, maSrcPt );
ReadPair( rIStm, maSrcSz );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maDstPt);
aSerializer.readSize(maDstSz);
aSerializer.readPoint(maSrcPt);
aSerializer.readSize(maSrcSz);
}
MetaGradientAction::MetaGradientAction() :
@ -1987,16 +2039,16 @@ void MetaGradientAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteRectangle( rOStm, maRect );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
aSerializer.writeGradient(maGradient);
}
void MetaGradientAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
aSerializer.readGradient(maGradient);
}
@ -2250,13 +2302,15 @@ void MetaISectRectClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* p
{
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteRectangle( rOStm, maRect );
TypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(maRect);
}
void MetaISectRectClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadRectangle( rIStm, maRect );
TypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(maRect);
}
MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction() :
@ -2950,10 +3004,9 @@ void MetaFloatTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pDat
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
maMtf.Write( rOStm );
WritePair( rOStm, maPoint );
WritePair( rOStm, maSize );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPoint);
aSerializer.writeSize(maSize);
aSerializer.writeGradient(maGradient);
}
@ -2961,9 +3014,9 @@ void MetaFloatTransparentAction::Read(SvStream& rIStm, ImplMetaReadData* pData)
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadGDIMetaFile(rIStm, maMtf, pData);
ReadPair( rIStm, maPoint );
ReadPair( rIStm, maSize );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPoint);
aSerializer.readSize(maSize);
aSerializer.readGradient(maGradient);
}
@ -3012,8 +3065,9 @@ void MetaEPSAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WriteGfxLink( rOStm, maGfxLink );
WritePair( rOStm, maPoint );
WritePair( rOStm, maSize );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maPoint);
aSerializer.writeSize(maSize);
maSubst.Write( rOStm );
}
@ -3021,8 +3075,9 @@ void MetaEPSAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadGfxLink( rIStm, maGfxLink );
ReadPair( rIStm, maPoint );
ReadPair( rIStm, maSize );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maPoint);
aSerializer.readSize(maSize);
ReadGDIMetaFile( rIStm, maSubst );
}
@ -3058,14 +3113,17 @@ void MetaRefPointAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
MetaAction::Write(rOStm, pData);
VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
WritePair( rOStm, maRefPoint );
TypeSerializer aSerializer(rOStm);
aSerializer.writePoint(maRefPoint);
rOStm.WriteBool( mbSet );
}
void MetaRefPointAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, StreamMode::READ);
ReadPair( rIStm, maRefPoint ).ReadCharAsBool( mbSet );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(maRefPoint);
rIStm.ReadCharAsBool( mbSet );
}
MetaCommentAction::MetaCommentAction() :

View File

@ -22,7 +22,6 @@
#include <osl/thread.h>
#include <tools/fract.hxx>
#include <tools/stream.hxx>
#include <tools/GenericTypeSerializer.hxx>
#include <vcl/dibtools.hxx>
#include <vcl/virdev.hxx>
#include <vcl/lineinfo.hxx>
@ -41,14 +40,17 @@ static void ImplReadRect( SvStream& rIStm, tools::Rectangle& rRect )
Point aTL;
Point aBR;
ReadPair( rIStm, aTL );
ReadPair( rIStm, aBR );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(aTL);
aSerializer.readPoint(aBR);
rRect = tools::Rectangle( aTL, aBR );
}
static bool ImplReadPoly(SvStream& rIStm, tools::Polygon& rPoly)
{
TypeSerializer aSerializer(rIStm);
sal_Int32 nSize32(0);
rIStm.ReadInt32(nSize32);
sal_uInt16 nSize = nSize32;
@ -63,8 +65,9 @@ static bool ImplReadPoly(SvStream& rIStm, tools::Polygon& rPoly)
rPoly = tools::Polygon(nSize);
for (sal_uInt16 i = 0; i < nSize && rIStm.good(); ++i)
ReadPair(rIStm, rPoly[i]);
{
aSerializer.readPoint(rPoly[i]);
}
return rIStm.good();
}
@ -105,7 +108,8 @@ static bool ImplReadMapMode(SvStream& rIStm, MapMode& rMapMode)
rIStm.ReadInt16(nUnit);
Point aOrg;
ReadPair(rIStm, aOrg);
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(aOrg);
sal_Int32 nXNum(0), nXDenom(0), nYNum(0), nYDenom(0);
rIStm.ReadInt32(nXNum).ReadInt32(nXDenom).ReadInt32(nYNum).ReadInt32(nYDenom);
@ -163,6 +167,8 @@ static void ImplSkipActions(SvStream& rIStm, sal_uLong nSkipCount)
static void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, tools::PolyPolygon& rPolyPoly)
{
TypeSerializer aSerializer(rIStm);
rPolyPoly.Clear();
sal_uInt16 nPolygonCount(0);
rIStm.ReadUInt16( nPolygonCount );
@ -199,7 +205,7 @@ static void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, tools::PolyPolygo
{
for(sal_uInt16 b(0); b < nPointCount; b++)
{
ReadPair( rIStm , aCandidate[b] );
aSerializer.readPoint(aCandidate[b]);
}
sal_uInt8 bHasFlags(int(false));
@ -332,6 +338,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
size_t nLastPolygonAction(0);
TypeSerializer aSerializer(rIStm);
for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
{
sal_Int16 nType(0);
@ -346,7 +354,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
{
case GDI_PIXEL_ACTION:
{
ReadPair( rIStm, aPt );
aSerializer.readPoint(aPt);
ImplReadColor( rIStm, aActionColor );
rMtf.AddAction( new MetaPixelAction( aPt, aActionColor ) );
}
@ -354,15 +362,15 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case GDI_POINT_ACTION:
{
ReadPair( rIStm, aPt );
aSerializer.readPoint(aPt);
rMtf.AddAction( new MetaPointAction( aPt ) );
}
break;
case GDI_LINE_ACTION:
{
ReadPair( rIStm, aPt );
ReadPair( rIStm, aPt1 );
aSerializer.readPoint(aPt);
aSerializer.readPoint(aPt1);
rMtf.AddAction( new MetaLineAction( aPt, aPt1, aLineInfo ) );
}
break;
@ -505,8 +513,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case GDI_ARC_ACTION:
{
ImplReadRect( rIStm, aRect );
ReadPair( rIStm, aPt );
ReadPair( rIStm, aPt1 );
aSerializer.readPoint(aPt);
aSerializer.readPoint(aPt1);
if( bFatLine )
{
@ -526,8 +534,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case GDI_PIE_ACTION:
{
ImplReadRect( rIStm, aRect );
ReadPair( rIStm, aPt );
ReadPair( rIStm, aPt1 );
aSerializer.readPoint(aPt);
aSerializer.readPoint(aPt1);
if( bFatLine )
{
@ -667,8 +675,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case GDI_TEXT_ACTION:
{
sal_Int32 nIndex(0), nLen(0), nTmp(0);
ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp );
aSerializer.readPoint(aPt);
rIStm.ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp );
if (nTmp > 0)
{
OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
@ -692,8 +700,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case GDI_TEXTARRAY_ACTION:
{
sal_Int32 nIndex(0), nLen(0), nAryLen(0), nTmp(0);
ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp ).ReadInt32( nAryLen );
aSerializer.readPoint(aPt);
rIStm.ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp ).ReadInt32( nAryLen );
if (nTmp > 0)
{
OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
@ -783,7 +791,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
{
sal_Int32 nIndex(0), nLen(0), nWidth(0), nTmp(0);
ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp ).ReadInt32( nWidth );
aSerializer.readPoint(aPt);
rIStm.ReadInt32( nIndex ).ReadInt32( nLen ).ReadInt32( nTmp ).ReadInt32( nWidth );
if (nTmp > 0)
{
OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
@ -808,7 +817,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
{
Bitmap aBmp;
ReadPair( rIStm, aPt );
aSerializer.readPoint(aPt);
ReadDIB(aBmp, rIStm, true);
rMtf.AddAction( new MetaBmpAction( aPt, aBmp ) );
}
@ -818,8 +827,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
{
Bitmap aBmp;
ReadPair( rIStm, aPt );
ReadPair( rIStm, aSz );
aSerializer.readPoint(aPt);
aSerializer.readSize(aSz);
ReadDIB(aBmp, rIStm, true);
rMtf.AddAction( new MetaBmpScaleAction( aPt, aSz, aBmp ) );
}
@ -830,10 +839,10 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
Bitmap aBmp;
Size aSz2;
ReadPair( rIStm, aPt );
ReadPair( rIStm, aSz );
ReadPair( rIStm, aPt1 );
ReadPair( rIStm, aSz2 );
aSerializer.readPoint(aPt);
aSerializer.readSize(aSz);
aSerializer.readPoint(aPt1);
aSerializer.readSize(aSz2);
ReadDIB(aBmp, rIStm, true);
rMtf.AddAction( new MetaBmpScalePartAction( aPt, aSz, aPt1, aSz2, aBmp ) );
}
@ -1079,9 +1088,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
sal_Int32 nFollowingActionCount(0);
ReadGDIMetaFile( rIStm, aMtf );
ReadPair( rIStm, aPos );
ReadPair( rIStm, aSize );
TypeSerializer aSerializer(rIStm);
aSerializer.readPoint(aPos);
aSerializer.readSize(aSize);
aSerializer.readGradient(aGradient);
rIStm.ReadInt32( nFollowingActionCount );
ImplSkipActions( rIStm, nFollowingActionCount );
@ -1113,7 +1121,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
bool bSet;
sal_Int32 nFollowingActionCount(0);
ReadPair( rIStm, aRefPoint );
aSerializer.readPoint(aRefPoint);
rIStm.ReadCharAsBool( bSet ).ReadInt32( nFollowingActionCount );
ImplSkipActions( rIStm, nFollowingActionCount );
rMtf.AddAction( new MetaRefPointAction( aRefPoint, bSet ) );
@ -1134,7 +1142,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
bool bSet;
sal_Int32 nFollowingActionCount(0);
tools::GenericTypeSerializer aSerializer(rIStm);
aSerializer.readColor(aColor);
rIStm.ReadCharAsBool( bSet ).ReadInt32( nFollowingActionCount );
ImplSkipActions( rIStm, nFollowingActionCount );
@ -1152,7 +1159,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
sal_uInt32 nUnderline(0);
sal_Int32 nFollowingActionCount(0);
ReadPair( rIStm, aStartPt );
aSerializer.readPoint(aStartPt);
rIStm.ReadInt32(nWidth ).ReadUInt32(nStrikeout).ReadUInt32(nUnderline).ReadInt32(nFollowingActionCount);
ImplSkipActions(rIStm, nFollowingActionCount);
rMtf.AddAction( new MetaTextLineAction( aStartPt, nWidth,
@ -1171,7 +1178,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
sal_Int32 nFollowingActionCount(0);
ReadPolyPolygon( rIStm, aPolyPoly );
TypeSerializer aSerializer(rIStm);
aSerializer.readGradient(aGradient);
rIStm.ReadInt32( nFollowingActionCount );
ImplSkipActions( rIStm, nFollowingActionCount );

View File

@ -80,7 +80,7 @@ SvStream& ReadImplWallpaper( SvStream& rIStm, ImplWallpaper& rImplWallpaper )
if( bRect )
{
rImplWallpaper.mpRect = tools::Rectangle();
ReadRectangle( rIStm, *rImplWallpaper.mpRect );
aSerializer.readRectangle(*rImplWallpaper.mpRect);
}
if( bGrad )
@ -123,7 +123,9 @@ SvStream& WriteImplWallpaper( SvStream& rOStm, const ImplWallpaper& rImplWallpap
rOStm.WriteBool( bRect ).WriteBool( bGrad ).WriteBool( bBmp ).WriteBool( bDummy ).WriteBool( bDummy ).WriteBool( bDummy );
if( bRect )
WriteRectangle( rOStm, *rImplWallpaper.mpRect );
{
aSerializer.writeRectangle(*rImplWallpaper.mpRect);
}
if (bGrad)
{

View File

@ -20,6 +20,7 @@
#include <tools/urlobj.hxx>
#include <tools/fract.hxx>
#include <tools/GenericTypeSerializer.hxx>
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
#include <vcl/mapmod.hxx>
@ -162,7 +163,8 @@ void IMapRectangleObject::ImpConstruct( const tools::Rectangle& rRect, bool bPix
void IMapRectangleObject::WriteIMapObject( SvStream& rOStm ) const
{
WriteRectangle( rOStm, aRect );
tools::GenericTypeSerializer aSerializer(rOStm);
aSerializer.writeRectangle(aRect);
}
@ -174,7 +176,8 @@ void IMapRectangleObject::WriteIMapObject( SvStream& rOStm ) const
void IMapRectangleObject::ReadIMapObject( SvStream& rIStm )
{
ReadRectangle( rIStm, aRect );
tools::GenericTypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(aRect);
}
@ -271,8 +274,8 @@ void IMapCircleObject::ImpConstruct( const Point& rCenter, sal_uLong nRad, bool
void IMapCircleObject::WriteIMapObject( SvStream& rOStm ) const
{
sal_uInt32 nTmp = nRadius;
WritePair( rOStm, aCenter );
tools::GenericTypeSerializer aSerializer(rOStm);
aSerializer.writePoint(aCenter);
rOStm.WriteUInt32( nTmp );
}
@ -287,7 +290,8 @@ void IMapCircleObject::ReadIMapObject( SvStream& rIStm )
{
sal_uInt32 nTmp;
ReadPair( rIStm, aCenter );
tools::GenericTypeSerializer aSerializer(rIStm);
aSerializer.readPoint(aCenter);
rIStm.ReadUInt32( nTmp );
nRadius = nTmp;
@ -406,9 +410,11 @@ void IMapPolygonObject::ImpConstruct( const tools::Polygon& rPoly, bool bPixel )
void IMapPolygonObject::WriteIMapObject( SvStream& rOStm ) const
{
tools::GenericTypeSerializer aSerializer(rOStm);
WritePolygon( rOStm, aPoly );
rOStm.WriteBool( bEllipse ); // >= Version 2
WriteRectangle( rOStm, aEllipse ); // >= Version 2
// Version 2
rOStm.WriteBool( bEllipse );
aSerializer.writeRectangle(aEllipse);
}
@ -426,7 +432,8 @@ void IMapPolygonObject::ReadIMapObject( SvStream& rIStm )
if ( nReadVersion >= 2 )
{
rIStm.ReadCharAsBool( bEllipse );
ReadRectangle( rIStm, aEllipse );
tools::GenericTypeSerializer aSerializer(rIStm);
aSerializer.readRectangle(aEllipse);
}
}