summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8
diff options
context:
space:
mode:
authorjp <jp@openoffice.org>2001-11-28 10:50:45 +0000
committerjp <jp@openoffice.org>2001-11-28 10:50:45 +0000
commita43978c679f00dcedee481f33bae4a69c788b6b9 (patch)
treed24be359310ed3cef85536fd902d47b507602ab5 /sw/source/filter/ww8
parenteaf124a86e39ae7025730259549734e6f7f16246 (diff)
Bug #95205#: WrPlcl - use for data instead of a VarArray a simple c-array
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx33
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx8
2 files changed, 30 insertions, 11 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 2b21dd115fb6..76e36435e8c0 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtww8.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: cmc $ $Date: 2001-10-31 12:26:26 $
+ * last change: $Author: jp $ $Date: 2001-11-28 11:50:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -606,15 +606,30 @@ const SfxPoolItem& SwWW8Writer::GetItem( USHORT nWhich ) const
//------------------------------------------------------------------------------
WW8_WrPlc1::WW8_WrPlc1( USHORT nStructSz )
- : aPos( 16, 16 ), aDat( 16 * (int)nStructSz, 16 * (int)nStructSz ),
- nStructSiz( nStructSz )
+ : aPos( 16, 16 ), nStructSiz( nStructSz )
{
+ nDataLen = 16 * nStructSz;
+ pData = new BYTE[ nDataLen ];
}
-void WW8_WrPlc1::Append( WW8_CP nCp, const void* pData )
+WW8_WrPlc1::~WW8_WrPlc1()
{
+ delete [] pData;
+}
+
+void WW8_WrPlc1::Append( WW8_CP nCp, const void* pNewData )
+{
+ ULONG nInsPos = aPos.Count() * nStructSiz;
aPos.Insert( nCp, aPos.Count() );
- aDat.Insert( (BYTE*)pData, nStructSiz, aDat.Count() );
+ if( nDataLen < nInsPos + nStructSiz )
+ {
+ BYTE* pNew = new BYTE[ 2 * nDataLen ];
+ memmove( pNew, pData, nDataLen );
+ delete [] pData;
+ pData = pNew;
+ nDataLen *= 2;
+ }
+ memcpy( pData + nInsPos, pNewData, nStructSiz );
}
void WW8_WrPlc1::Finish( ULONG nLastCp, ULONG nSttCp )
@@ -631,9 +646,11 @@ void WW8_WrPlc1::Finish( ULONG nLastCp, ULONG nSttCp )
void WW8_WrPlc1::Write( SvStream& rStrm )
{
- for( USHORT i = 0; i < aPos.Count(); ++i )
+ USHORT i;
+ for( i = 0; i < aPos.Count(); ++i )
SwWW8Writer::WriteLong( rStrm, aPos[i] );
- rStrm.Write( aDat.GetData(), aDat.Count() ); // Anz Eintraege
+ if( i )
+ rStrm.Write( pData, (i-1) * nStructSiz );
}
//------------------------------------------------------------------------------
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 47a9d233e8f7..6f3d2bec04dd 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtww8.hxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: cmc $ $Date: 2001-11-02 09:59:45 $
+ * last change: $Author: jp $ $Date: 2001-11-28 11:50:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -650,7 +650,8 @@ public:
class WW8_WrPlc1
{
SvULongs aPos; // PTRARR von CPs
- WW8Bytes aDat; // Inhalte ( Strukturen )
+ BYTE* pData; // Inhalte ( Strukturen )
+ ULONG nDataLen;
USHORT nStructSiz;
protected:
USHORT Count() const { return aPos.Count(); }
@@ -658,6 +659,7 @@ protected:
public:
WW8_WrPlc1( USHORT nStructSz );
+ ~WW8_WrPlc1();
void Append( WW8_CP nCp, const void* pData );
void Finish( ULONG nLastCp, ULONG nStartCp );
};