[Libreoffice-commits] .: svtools/source tools/inc tools/source
Thorsten Behrens
thorsten at kemper.freedesktop.org
Mon Dec 19 12:57:34 PST 2011
svtools/source/filter/filter.cxx | 1
tools/inc/tools/stream.hxx | 1
tools/source/generic/color.cxx | 146 +-------------
tools/source/generic/gen.cxx | 396 ---------------------------------------
tools/source/generic/poly.cxx | 98 ---------
5 files changed, 15 insertions(+), 627 deletions(-)
New commits:
commit 864bc59e66e92eabeef26222301607a7a5745bea
Author: Matteo Casalin <matteo.casalin at poste.it>
Date: Sat Dec 17 11:18:58 2011 +0100
Removed COMPRESSMODE_FULL support from SvStream
diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx
index f61990b..8047b7b 100644
--- a/svtools/source/filter/filter.cxx
+++ b/svtools/source/filter/filter.cxx
@@ -2034,7 +2034,6 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String&
SvMemoryStream aMemStm( 65535, 65535 );
- aMemStm.SetCompressMode( COMPRESSMODE_FULL );
( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( aMemStm );
xActiveDataSource->setOutputStream( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >(
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index 1554776..66312b7 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -90,7 +90,6 @@ typedef sal_uInt16 StreamMode;
#define NUMBERFORMAT_INT_BIGENDIAN (sal_uInt16)0x0000
#define NUMBERFORMAT_INT_LITTLEENDIAN (sal_uInt16)0xFFFF
-#define COMPRESSMODE_FULL (sal_uInt16)0xFFFF
#define COMPRESSMODE_NONE (sal_uInt16)0x0000
#define COMPRESSMODE_ZBITMAP (sal_uInt16)0x0001
#define COMPRESSMODE_NATIVE (sal_uInt16)0x0010
diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx
index 6ee5b0d..f06d3d1 100644
--- a/tools/source/generic/color.cxx
+++ b/tools/source/generic/color.cxx
@@ -296,88 +296,18 @@ SvStream& operator>>( SvStream& rIStream, Color& rColor )
DBG_ASSERTWARNING( rIStream.GetVersion(), "Color::>> - Solar-Version not set on rIStream" );
sal_uInt16 nColorName;
- sal_uInt16 nRed;
- sal_uInt16 nGreen;
- sal_uInt16 nBlue;
rIStream >> nColorName;
if ( nColorName & COL_NAME_USER )
{
- if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
- {
- unsigned char cAry[6];
- sal_uInt16 i = 0;
-
- nRed = 0;
- nGreen = 0;
- nBlue = 0;
-
- if ( nColorName & COL_RED_2B )
- i += 2;
- else if ( nColorName & COL_RED_1B )
- i++;
- if ( nColorName & COL_GREEN_2B )
- i += 2;
- else if ( nColorName & COL_GREEN_1B )
- i++;
- if ( nColorName & COL_BLUE_2B )
- i += 2;
- else if ( nColorName & COL_BLUE_1B )
- i++;
-
- rIStream.Read( cAry, i );
- i = 0;
-
- if ( nColorName & COL_RED_2B )
- {
- nRed = cAry[i];
- nRed <<= 8;
- i++;
- nRed |= cAry[i];
- i++;
- }
- else if ( nColorName & COL_RED_1B )
- {
- nRed = cAry[i];
- nRed <<= 8;
- i++;
- }
- if ( nColorName & COL_GREEN_2B )
- {
- nGreen = cAry[i];
- nGreen <<= 8;
- i++;
- nGreen |= cAry[i];
- i++;
- }
- else if ( nColorName & COL_GREEN_1B )
- {
- nGreen = cAry[i];
- nGreen <<= 8;
- i++;
- }
- if ( nColorName & COL_BLUE_2B )
- {
- nBlue = cAry[i];
- nBlue <<= 8;
- i++;
- nBlue |= cAry[i];
- i++;
- }
- else if ( nColorName & COL_BLUE_1B )
- {
- nBlue = cAry[i];
- nBlue <<= 8;
- i++;
- }
- }
- else
- {
- rIStream >> nRed;
- rIStream >> nGreen;
- rIStream >> nBlue;
- }
+ sal_uInt16 nRed;
+ sal_uInt16 nGreen;
+ sal_uInt16 nBlue;
+
+ rIStream >> nRed;
+ rIStream >> nGreen;
+ rIStream >> nBlue;
rColor.mnColor = RGB_COLORDATA( nRed>>8, nGreen>>8, nBlue>>8 );
}
@@ -441,64 +371,10 @@ SvStream& operator<<( SvStream& rOStream, const Color& rColor )
nGreen = (nGreen<<8) + nGreen;
nBlue = (nBlue<<8) + nBlue;
- if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
- {
- unsigned char cAry[6];
- sal_uInt16 i = 0;
-
- if ( nRed & 0x00FF )
- {
- nColorName |= COL_RED_2B;
- cAry[i] = (unsigned char)(nRed & 0xFF);
- i++;
- cAry[i] = (unsigned char)((nRed >> 8) & 0xFF);
- i++;
- }
- else if ( nRed & 0xFF00 )
- {
- nColorName |= COL_RED_1B;
- cAry[i] = (unsigned char)((nRed >> 8) & 0xFF);
- i++;
- }
- if ( nGreen & 0x00FF )
- {
- nColorName |= COL_GREEN_2B;
- cAry[i] = (unsigned char)(nGreen & 0xFF);
- i++;
- cAry[i] = (unsigned char)((nGreen >> 8) & 0xFF);
- i++;
- }
- else if ( nGreen & 0xFF00 )
- {
- nColorName |= COL_GREEN_1B;
- cAry[i] = (unsigned char)((nGreen >> 8) & 0xFF);
- i++;
- }
- if ( nBlue & 0x00FF )
- {
- nColorName |= COL_BLUE_2B;
- cAry[i] = (unsigned char)(nBlue & 0xFF);
- i++;
- cAry[i] = (unsigned char)((nBlue >> 8) & 0xFF);
- i++;
- }
- else if ( nBlue & 0xFF00 )
- {
- nColorName |= COL_BLUE_1B;
- cAry[i] = (unsigned char)((nBlue >> 8) & 0xFF);
- i++;
- }
-
- rOStream << nColorName;
- rOStream.Write( cAry, i );
- }
- else
- {
- rOStream << nColorName;
- rOStream << nRed;
- rOStream << nGreen;
- rOStream << nBlue;
- }
+ rOStream << nColorName;
+ rOStream << nRed;
+ rOStream << nGreen;
+ rOStream << nBlue;
return rOStream;
}
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 563014a..be16230 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -36,48 +36,7 @@ SvStream& operator>>( SvStream& rIStream, Pair& rPair )
{
DBG_ASSERTWARNING( rIStream.GetVersion(), "Pair::>> - Solar-Version not set on rIStream" );
- if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
- {
- unsigned char cId;
- unsigned char cAry[8];
- int i;
- int i1;
- int i2;
- sal_uInt32 nNum;
-
- rIStream >> cId;
- i1 = (cId & 0x70) >> 4;
- i2 = cId & 0x07;
- rIStream.Read( cAry, i1+i2 );
-
- nNum = 0;
- i = i1;
- while ( i )
- {
- i--;
- nNum <<= 8;
- nNum |= cAry[i];
- }
- if ( cId & 0x80 )
- nNum ^= 0xFFFFFFFF;
- rPair.nA = (sal_Int32)nNum;
-
- nNum = 0;
- i = i1+i2;
- while ( i > i1 )
- {
- i--;
- nNum <<= 8;
- nNum |= cAry[i];
- }
- if ( cId & 0x08 )
- nNum ^= 0xFFFFFFFF;
- rPair.nB = (sal_Int32)nNum;
- }
- else
- {
- rIStream >> rPair.nA >> rPair.nB;
- }
+ rIStream >> rPair.nA >> rPair.nB;
return rIStream;
}
@@ -88,102 +47,7 @@ SvStream& operator<<( SvStream& rOStream, const Pair& rPair )
{
DBG_ASSERTWARNING( rOStream.GetVersion(), "Pair::<< - Solar-Version not set on rOStream" );
- if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
- {
- unsigned char cAry[9];
- int i = 1;
- sal_uInt32 nNum;
-
- cAry[0] = 0;
-
- nNum = (sal_uInt32)(sal_Int32)rPair.nA;
- if ( rPair.nA < 0 )
- {
- cAry[0] |= 0x80;
- nNum ^= 0xFFFFFFFF;
- }
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
- cAry[0] |= 0x40;
- }
- else
- cAry[0] |= 0x30;
- }
- else
- cAry[0] |= 0x20;
- }
- else
- cAry[0] |= 0x10;
- }
-
- nNum = (sal_uInt32)(sal_Int32)rPair.nB;
- if ( rPair.nB < 0 )
- {
- cAry[0] |= 0x08;
- nNum ^= 0xFFFFFFFF;
- }
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
- cAry[0] |= 0x04;
- }
- else
- cAry[0] |= 0x03;
- }
- else
- cAry[0] |= 0x02;
- }
- else
- cAry[0] |= 0x01;
- }
-
- rOStream.Write( cAry, i );
- }
- else
- {
- rOStream << rPair.nA << rPair.nB;
- }
+ rOStream << rPair.nA << rPair.nB;
return rOStream;
}
@@ -363,81 +227,7 @@ SvStream& operator>>( SvStream& rIStream, Rectangle& rRect )
{
DBG_ASSERTWARNING( rIStream.GetVersion(), "Rectangle::>> - Solar-Version not set on rIStream" );
- if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
- {
- unsigned char cIdAry[2];
- unsigned char cAry[16];
- int i;
- int iLast;
- int i1;
- int i2;
- int i3;
- int i4;
- sal_uInt32 nNum;
-
- rIStream.Read( cIdAry, 2 );
- i1 = (cIdAry[0] & 0x70) >> 4;
- i2 = cIdAry[0] & 0x07;
- i3 = (cIdAry[1] & 0x70) >> 4;
- i4 = cIdAry[1] & 0x07;
- rIStream.Read( cAry, i1+i2+i3+i4 );
-
- nNum = 0;
- i = i1;
- iLast = i;
- while ( i )
- {
- i--;
- nNum <<= 8;
- nNum |= cAry[i];
- }
- iLast = i1;
- if ( cIdAry[0] & 0x80 )
- nNum ^= 0xFFFFFFFF;
- rRect.nLeft = (sal_Int32)nNum;
-
- nNum = 0;
- i = iLast+i2;
- while ( i > iLast )
- {
- i--;
- nNum <<= 8;
- nNum |= cAry[i];
- }
- iLast += i2;
- if ( cIdAry[0] & 0x08 )
- nNum ^= 0xFFFFFFFF;
- rRect.nTop = (sal_Int32)nNum;
-
- nNum = 0;
- i = iLast+i3;
- while ( i > iLast )
- {
- i--;
- nNum <<= 8;
- nNum |= cAry[i];
- }
- iLast += i3;
- if ( cIdAry[1] & 0x80 )
- nNum ^= 0xFFFFFFFF;
- rRect.nRight = (sal_Int32)nNum;
-
- nNum = 0;
- i = iLast+i4;
- while ( i > iLast )
- {
- i--;
- nNum <<= 8;
- nNum |= cAry[i];
- }
- if ( cIdAry[1] & 0x08 )
- nNum ^= 0xFFFFFFFF;
- rRect.nBottom = (sal_Int32)nNum;
- }
- else
- {
- rIStream >> rRect.nLeft >> rRect.nTop >> rRect.nRight >> rRect.nBottom;
- }
+ rIStream >> rRect.nLeft >> rRect.nTop >> rRect.nRight >> rRect.nBottom;
return rIStream;
}
@@ -448,185 +238,7 @@ SvStream& operator<<( SvStream& rOStream, const Rectangle& rRect )
{
DBG_ASSERTWARNING( rOStream.GetVersion(), "Rectangle::<< - Solar-Version not set on rOStream" );
- if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
- {
- unsigned char cAry[18];
- int i = 2;
- sal_uInt32 nNum;
-
- cAry[0] = 0;
- cAry[1] = 0;
-
- nNum = (sal_uInt32)(sal_Int32)rRect.nLeft;
- if ( rRect.nLeft < 0 )
- {
- cAry[0] |= 0x80;
- nNum ^= 0xFFFFFFFF;
- }
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
- cAry[0] |= 0x40;
- }
- else
- cAry[0] |= 0x30;
- }
- else
- cAry[0] |= 0x20;
- }
- else
- cAry[0] |= 0x10;
- }
-
- nNum = (sal_uInt32)(sal_Int32)rRect.nTop;
- if ( rRect.nTop < 0 )
- {
- cAry[0] |= 0x08;
- nNum ^= 0xFFFFFFFF;
- }
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
- cAry[0] |= 0x04;
- }
- else
- cAry[0] |= 0x03;
- }
- else
- cAry[0] |= 0x02;
- }
- else
- cAry[0] |= 0x01;
- }
-
- nNum = (sal_uInt32)(sal_Int32)rRect.nRight;
- if ( rRect.nRight < 0 )
- {
- cAry[1] |= 0x80;
- nNum ^= 0xFFFFFFFF;
- }
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
- cAry[1] |= 0x40;
- }
- else
- cAry[1] |= 0x30;
- }
- else
- cAry[1] |= 0x20;
- }
- else
- cAry[1] |= 0x10;
- }
-
- nNum = (sal_uInt32)(sal_Int32)rRect.nBottom;
- if ( rRect.nBottom < 0 )
- {
- cAry[1] |= 0x08;
- nNum ^= 0xFFFFFFFF;
- }
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
-
- if ( nNum )
- {
- cAry[i] = (unsigned char)(nNum & 0xFF);
- nNum >>= 8;
- i++;
- cAry[1] |= 0x04;
- }
- else
- cAry[1] |= 0x03;
- }
- else
- cAry[1] |= 0x02;
- }
- else
- cAry[1] |= 0x01;
- }
-
- rOStream.Write( cAry, i );
- }
- else
- {
- rOStream << rRect.nLeft << rRect.nTop << rRect.nRight << rRect.nBottom;
- }
+ rOStream << rRect.nLeft << rRect.nTop << rRect.nRight << rRect.nBottom;
return rOStream;
}
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 9d81db3..fa2d1f5 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1671,8 +1671,6 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly )
DBG_ASSERTWARNING( rIStream.GetVersion(), "Polygon::>> - Solar-Version not set on rIStream" );
sal_uInt16 i;
- sal_uInt16 nStart;
- sal_uInt16 nCurPoints;
sal_uInt16 nPoints;
// Anzahl der Punkte einlesen und Array erzeugen
@@ -1686,40 +1684,6 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly )
else
rPoly.mpImplPolygon->ImplSetSize( nPoints, sal_False );
- // Je nach CompressMode das Polygon einlesen
- if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
- {
- i = 0;
- unsigned char bShort;
- while ( i < nPoints )
- {
- rIStream >> bShort >> nCurPoints;
-
- if ( bShort )
- {
- short nShortX;
- short nShortY;
- for ( nStart = i; i < nStart+nCurPoints; i++ )
- {
- rIStream >> nShortX >> nShortY;
- rPoly.mpImplPolygon->mpPointAry[i].X() = nShortX;
- rPoly.mpImplPolygon->mpPointAry[i].Y() = nShortY;
- }
- }
- else
- {
- long nLongX;
- long nLongY;
- for ( nStart = i; i < nStart+nCurPoints; i++ )
- {
- rIStream >> nLongX >> nLongY;
- rPoly.mpImplPolygon->mpPointAry[i].X() = nLongX;
- rPoly.mpImplPolygon->mpPointAry[i].Y() = nLongY;
- }
- }
- }
- }
- else
{
// Feststellen, ob ueber die Operatoren geschrieben werden muss
#if (SAL_TYPES_SIZEOFLONG) != 4
@@ -1752,74 +1716,12 @@ SvStream& operator<<( SvStream& rOStream, const Polygon& rPoly )
DBG_CHKOBJ( &rPoly, Polygon, NULL );
DBG_ASSERTWARNING( rOStream.GetVersion(), "Polygon::<< - Solar-Version not set on rOStream" );
- sal_uInt16 nStart;
sal_uInt16 i;
sal_uInt16 nPoints = rPoly.GetSize();
// Anzahl der Punkte rausschreiben
rOStream << nPoints;
- // Je nach CompressMode das Polygon rausschreiben
- if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
- {
- i = 0;
- unsigned char bShort;
- while ( i < nPoints )
- {
- nStart = i;
-
- // Feststellen, welcher Typ geschrieben werden soll
- if ( ((rPoly.mpImplPolygon->mpPointAry[nStart].X() >= SHRT_MIN) &&
- (rPoly.mpImplPolygon->mpPointAry[nStart].X() <= SHRT_MAX)) &&
- ((rPoly.mpImplPolygon->mpPointAry[nStart].Y() >= SHRT_MIN) &&
- (rPoly.mpImplPolygon->mpPointAry[nStart].Y() <= SHRT_MAX)) )
- bShort = sal_True;
- else
- bShort = sal_False;
- unsigned char bCurShort;
- while ( i < nPoints )
- {
- // Feststellen, welcher Typ geschrieben werden soll
- if ( ((rPoly.mpImplPolygon->mpPointAry[nStart].X() >= SHRT_MIN) &&
- (rPoly.mpImplPolygon->mpPointAry[nStart].X() <= SHRT_MAX)) &&
- ((rPoly.mpImplPolygon->mpPointAry[nStart].Y() >= SHRT_MIN) &&
- (rPoly.mpImplPolygon->mpPointAry[nStart].Y() <= SHRT_MAX)) )
- bCurShort = sal_True;
- else
- bCurShort = sal_False;
-
- // Wenn sich die Werte in einen anderen Bereich begeben,
- // muessen wir neu rausschreiben
- if ( bCurShort != bShort )
- {
- bShort = bCurShort;
- break;
- }
-
- i++;
- }
-
- rOStream << bShort << (sal_uInt16)(i-nStart);
-
- if ( bShort )
- {
- for( ; nStart < i; nStart++ )
- {
- rOStream << (short)rPoly.mpImplPolygon->mpPointAry[nStart].X()
- << (short)rPoly.mpImplPolygon->mpPointAry[nStart].Y();
- }
- }
- else
- {
- for( ; nStart < i; nStart++ )
- {
- rOStream << rPoly.mpImplPolygon->mpPointAry[nStart].X()
- << rPoly.mpImplPolygon->mpPointAry[nStart].Y();
- }
- }
- }
- }
- else
{
// Feststellen, ob ueber die Operatoren geschrieben werden muss
#if (SAL_TYPES_SIZEOFLONG) != 4
More information about the Libreoffice-commits
mailing list