summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorCaolán McNamara <cmc@openoffice.org>2002-05-16 12:01:57 +0000
committerCaolán McNamara <cmc@openoffice.org>2002-05-16 12:01:57 +0000
commit104d1199b438c67c40dcc80c3897c6522089630d (patch)
tree3e214b7087d5cd7315e9a7a1a11b37086ab2b6d1 /sw/source
parent6eec92169c6cdcb7a7bce7e29865eb4465bdb924 (diff)
#i3942# #i4702# Make filter robust once and for all against unknown sprms
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx5
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx6
-rw-r--r--sw/source/filter/ww8/ww8graf2.cxx7
-rw-r--r--sw/source/filter/ww8/ww8par.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx9
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx6
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx85
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx6
9 files changed, 87 insertions, 51 deletions
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index b0a355de746b..3d7abe347417 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtw8nds.cxx,v $
*
- * $Revision: 1.23 $
+ * $Revision: 1.24 $
*
- * last change: $Author: cmc $ $Date: 2002-05-14 13:40:38 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1662,7 +1662,6 @@ Writer& OutWW8_SwTblNode( Writer& rWrt, SwTableNode & rNode )
if( nBox && pBoxArr[ nBox-1 ] == pBoxArr[ nBox ] )
continue;
- USHORT nValue;
SwWriteTableCell* pCell = pBoxArr[ nBox ];
if( SFX_ITEM_ON == pCell->GetBox()->GetFrmFmt()->
GetAttrSet().GetItemState( RES_BACKGROUND, FALSE, &pI )
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index d7ee7c382a96..23677f6ccf72 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8graf.cxx,v $
*
- * $Revision: 1.59 $
+ * $Revision: 1.60 $
*
- * last change: $Author: cmc $ $Date: 2002-05-15 13:17:03 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -720,7 +720,7 @@ void SwWW8ImplReader::InsertTxbxAttrs( long nStartCp, long nEndCp,
{
Read_PicLoc( aRes.nSprmId,
aRes.pMemPos + 1 + (8 > pWwFib->nVersion ? 0 : 1)
- + WW8SprmDataOfs( aRes.nSprmId ), 4 );
+ + WW8SprmDataOfs( pWwFib->nVersion, aRes.nSprmId ), 4 );
// Ok, that's it. Now let's get out of here!
break;
}
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index 8cd231d6947d..55397cda7fd1 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8graf2.cxx,v $
*
- * $Revision: 1.29 $
+ * $Revision: 1.30 $
*
- * last change: $Author: cmc $ $Date: 2002-05-11 14:06:35 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -638,7 +638,8 @@ BOOL SwWW8ImplReader::ImportURL(String &sURL,String &sMark,WW8_CP nStart)
if ( (68 == aRes.nSprmId) || (0x6A03 == aRes.nSprmId) )
{
Read_PicLoc( aRes.nSprmId, aRes.pMemPos+ 1+
- (8 > pWwFib->nVersion ? 0 : 1) + WW8SprmDataOfs(aRes.nSprmId),
+ (8 > pWwFib->nVersion ? 0 : 1) +
+ WW8SprmDataOfs(pWwFib->nVersion,aRes.nSprmId),
4);
break;
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index f0a333f3a820..a7288711e2fe 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par.cxx,v $
*
- * $Revision: 1.59 $
+ * $Revision: 1.60 $
*
- * last change: $Author: cmc $ $Date: 2002-05-15 10:00:24 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -3210,8 +3210,8 @@ BOOL SwMSDffManager::GetOLEStorageName( long nOLEId, String& rStorageName,
if( 0x6A03 == nId && 0 < nLen )
{
- nPictureId = SVBT32ToLong( pSprm + 1 +
- nDelta + WW8SprmDataOfs( nId ) );
+ nPictureId = SVBT32ToLong( pSprm + 1 + nDelta +
+ WW8SprmDataOfs(rReader.pWwFib->nVersion,nId) );
bRet = TRUE;
}
pSprm += nSL;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index eb1f1d09935f..e4a41bedfd70 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par2.cxx,v $
*
- * $Revision: 1.44 $
+ * $Revision: 1.45 $
*
- * last change: $Author: cmc $ $Date: 2002-05-14 13:40:39 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2910,7 +2910,7 @@ const BYTE* WW8RStyle::HasParaSprm( USHORT nId ) const
USHORT nAktId = WW8GetSprmId( rFib.nVersion, pSprms, &nDelta );
// Sprm found ?
if( nAktId == nId )
- return pSprms + 1 + nDelta + WW8SprmDataOfs( nId );
+ return pSprms + 1 + nDelta + WW8SprmDataOfs(rFib.nVersion, nId );
x = WW8GetSprmSize( rFib.nVersion, pSprms, &nAktId );
i += x;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 9c514e6eca37..67aec4251dde 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par3.cxx,v $
*
- * $Revision: 1.23 $
+ * $Revision: 1.24 $
*
- * last change: $Author: cmc $ $Date: 2002-05-11 14:06:35 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -480,7 +480,7 @@ sal_uInt8* WW8ListManager::GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms,
sal_uInt8 nDelta;
sal_uInt16 nAktId = WW8GetSprmId(rFib.nVersion, pSprms, &nDelta );
if( nAktId == nId ) // Sprm found
- return pSprms + 1 + nDelta + WW8SprmDataOfs( nId );
+ return pSprms + 1 + nDelta + WW8SprmDataOfs(rFib.nVersion, nId );
// gib Zeiger auf Daten
USHORT x = WW8GetSprmSize(rFib.nVersion, pSprms, &nAktId );
i += x;
@@ -1764,7 +1764,8 @@ BOOL SwWW8ImplReader::ImportFormulaControl(WW8FormulaControl &aFormula,
if ( (68 == aRes.nSprmId) || (0x6A03 == aRes.nSprmId) )
{
Read_PicLoc( aRes.nSprmId, aRes.pMemPos+ 1+
- (8 > pWwFib->nVersion ? 0 : 1) + WW8SprmDataOfs(aRes.nSprmId),
+ (8 > pWwFib->nVersion ? 0 : 1) + WW8SprmDataOfs(
+ pWwFib->nVersion, aRes.nSprmId),
4);
break;
}
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 47937475d420..8c8e1ec6cc7f 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8par6.cxx,v $
*
- * $Revision: 1.78 $
+ * $Revision: 1.79 $
*
- * last change: $Author: cmc $ $Date: 2002-05-16 11:55:17 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -5539,7 +5539,7 @@ short SwWW8ImplReader::ImportSprm(const BYTE* pPos,USHORT nId)
SprmReadInfo& rSprm = WW8GetSprmReadInfo( nId );
- USHORT nFixedLen = 1 + nDelta + WW8SprmDataOfs( nId );
+ USHORT nFixedLen = 1 + nDelta + WW8SprmDataOfs(nV, nId );
USHORT nL = WW8GetSprmSize( nV, pPos, &nId );
if( rSprm.pReadFnc )
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 0b943df8bba9..23e35d258fad 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8scan.cxx,v $
*
- * $Revision: 1.45 $
+ * $Revision: 1.46 $
*
- * last change: $Author: cmc $ $Date: 2002-05-16 11:55:18 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,7 +147,7 @@ void WW8SprmIter::UpdateMyMembers()
if (pSprms && nRemLen > 0)
{
nAktId = WW8GetSprmId( nVersion, pSprms );
- pAktParams = pSprms + 1 + nDelta + WW8SprmDataOfs( nAktId );
+ pAktParams = pSprms + 1 + nDelta + WW8SprmDataOfs(nVersion, nAktId );
nAktSize = WW8GetSprmSize( nVersion, pSprms, &nAktId );
}
else
@@ -2624,13 +2624,13 @@ BOOL WW8PLCFx_SEPX::Find4Sprms(USHORT nId1,USHORT nId2,USHORT nId3,USHORT nId4,
USHORT nAktId = WW8GetSprmId( GetVersion(), pSp );
BOOL bOk = TRUE;
if( nAktId == nId1 )
- p1 = pSp + 1 + nDelta + WW8SprmDataOfs( nId1 );
+ p1 = pSp + 1 + nDelta + WW8SprmDataOfs(GetVersion(), nId1 );
else if( nAktId == nId2 )
- p2 = pSp + 1 + nDelta + WW8SprmDataOfs( nId2 );
+ p2 = pSp + 1 + nDelta + WW8SprmDataOfs(GetVersion(), nId2 );
else if( nAktId == nId3 )
- p3 = pSp + 1 + nDelta + WW8SprmDataOfs( nId3 );
+ p3 = pSp + 1 + nDelta + WW8SprmDataOfs(GetVersion(), nId3 );
else if( nAktId == nId4 )
- p4 = pSp + 1 + nDelta + WW8SprmDataOfs( nId4 );
+ p4 = pSp + 1 + nDelta + WW8SprmDataOfs(GetVersion(), nId4 );
else
bOk = FALSE;
bFound |= bOk;
@@ -2656,7 +2656,7 @@ const BYTE* WW8PLCFx_SEPX::HasSprm( USHORT nId, BYTE n2nd ) const
// Sprm gefunden?
USHORT nAktId = WW8GetSprmId( GetVersion(), pSp );
if ( (nAktId == nId) && (pSp[ 1 + nDelta ] == n2nd) )
- return pSp + 1 + nDelta + WW8SprmDataOfs( nId );
+ return pSp + 1 + nDelta + WW8SprmDataOfs(GetVersion(), nId );
// erhoehe Zeiger, so dass er auf naechsten Sprm zeigt
USHORT x = WW8GetSprmSize( GetVersion(), pSp, &nAktId );
i += x;
@@ -6237,7 +6237,7 @@ extern "C"
}
-SprmInfo& WW8GetSprmInfo( USHORT nId )
+SprmInfo WW8GetSprmInfo(BYTE nVersion, USHORT nId)
{
// if necessary sort tab
static BOOL bInit = FALSE;
@@ -6260,8 +6260,41 @@ SprmInfo& WW8GetSprmInfo( USHORT nId )
ASSERT( pFound,
"Unknown undocumented sprm, report to complete word import");
#endif
- // as a fallback use the null element
- pFound = (void*)aWwSprmTab;
+ if (nVersion != 8)
+ {
+ // as a fallback use the null element
+ pFound = (void*)aWwSprmTab;
+ }
+ else
+ {
+ aSrch.nVari = L_FIX;
+ switch (nId >> 13)
+ {
+ case 0:
+ case 1:
+ aSrch.nLen = 1;
+ break;
+ case 2:
+ aSrch.nLen = 2;
+ break;
+ case 3:
+ aSrch.nLen = 4;
+ break;
+ case 4:
+ case 5:
+ aSrch.nLen = 2;
+ break;
+ case 6:
+ aSrch.nLen = 0;
+ aSrch.nVari = L_VAR;
+ break;
+ case 7:
+ default:
+ aSrch.nLen = 3;
+ break;
+ }
+ pFound = (void*)&aSrch;
+ }
}
return *(SprmInfo*) pFound;
}
@@ -6269,9 +6302,10 @@ SprmInfo& WW8GetSprmInfo( USHORT nId )
//-----------------------------------------
// Sprms
//-----------------------------------------
-static USHORT WW8GetSprmSize0( USHORT nId, const BYTE* pSprm, BYTE nDelta)
+static USHORT WW8GetSprmSize0(BYTE nVersion, USHORT nId, const BYTE* pSprm,
+ BYTE nDelta)
{
- SprmInfo& rSprm = WW8GetSprmInfo( nId );
+ SprmInfo aSprm = WW8GetSprmInfo(nVersion, nId);
USHORT nL = 0; // number of Bytes to read
//sprmPChgTabs
@@ -6280,7 +6314,7 @@ static USHORT WW8GetSprmSize0( USHORT nId, const BYTE* pSprm, BYTE nDelta)
case 23:
case 0xC615:
if( pSprm[1 + nDelta] != 255 )
- nL = pSprm[1 + nDelta] + rSprm.nLen;
+ nL = pSprm[1 + nDelta] + aSprm.nLen;
else
{
BYTE nDel = pSprm[2 + nDelta];
@@ -6293,20 +6327,20 @@ static USHORT WW8GetSprmSize0( USHORT nId, const BYTE* pSprm, BYTE nDelta)
nL = SVBT16ToShort( &pSprm[1 + nDelta] );
break;
default:
- switch ( rSprm.nVari )
+ switch (aSprm.nVari)
{
case L_FIX:
- nL = rSprm.nLen; // Excl. Token
+ nL = aSprm.nLen; // Excl. Token
break;
case L_VAR:
// Variable 1-Byte Length?
// Excl. Token + Var-Lengthbyte
- nL = pSprm[1 + nDelta] + rSprm.nLen;
+ nL = pSprm[1 + nDelta] + aSprm.nLen;
break;
case L_VAR2:
// Variable 2-Byte Length?
// Excl. Token + Var-Lengthbyte
- nL = SVBT16ToShort( &pSprm[1 + nDelta] ) + rSprm.nLen - 1;
+ nL = SVBT16ToShort( &pSprm[1 + nDelta] ) + aSprm.nLen - 1;
break;
default:
ASSERT(0,"Unknown sprm varient");
@@ -6370,7 +6404,8 @@ BOOL WW8PLCFx_SEPX::CompareSprms(const BYTE* pOtherSprms, long nOtherSprmSiz,
bRes = FALSE;
else
{
- const BYTE *pTst = pSp + 1 + nDelta + WW8SprmDataOfs(nSpId);
+ const BYTE *pTst = pSp + 1 + nDelta + WW8SprmDataOfs(
+ GetVersion(), nSpId);
//Allow a one twip fuzziness for the margins, word is
//doing something very small but intriguing with its
//rounding of these margins
@@ -6383,8 +6418,8 @@ BOOL WW8PLCFx_SEPX::CompareSprms(const BYTE* pOtherSprms, long nOtherSprmSiz,
if (abs(nOne-nTwo) > 1) //(perhaps ww8par2#nToleranz)
bRes = FALSE;
}
- else if (memcmp(pTst,pOtherSp,WW8GetSprmSize0(nSpId,pSp,
- nDelta)))
+ else if (memcmp(pTst,pOtherSp,WW8GetSprmSize0(GetVersion(),
+ nSpId,pSp, nDelta)))
{
bRes = FALSE;
}
@@ -6437,11 +6472,11 @@ USHORT WW8GetSprmSize( BYTE nVersion, const BYTE* pSprm, USHORT* pId )
{
BYTE nDelta = ( 8 > nVersion ) ? 0 : 1;
USHORT nId = pId ? *pId : WW8GetSprmId( nVersion, pSprm );
- return WW8GetSprmSize0( nId, pSprm, nDelta ) + 1 + nDelta +
- WW8GetSprmInfo( nId ).nVari;
+ return WW8GetSprmSize0(nVersion, nId, pSprm, nDelta) + 1 + nDelta +
+ WW8SprmDataOfs(nVersion, nId);
}
-BYTE WW8SprmDataOfs( USHORT nId )
+BYTE WW8SprmDataOfs(BYTE nVersion, USHORT nId)
{
- return WW8GetSprmInfo( nId ).nVari;
+ return WW8GetSprmInfo(nVersion, nId).nVari;
}
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 840d98d02e94..9ae49bd04971 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ww8scan.hxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: cmc $ $Date: 2002-04-29 09:50:28 $
+ * last change: $Author: cmc $ $Date: 2002-05-16 13:01:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -134,7 +134,7 @@ void WW8ReadSTTBF( BOOL bVer8, SvStream& rStrm, UINT32 nStart, INT32 nLen,
USHORT WW8GetSprmId( BYTE nVersion, const BYTE* pSp, BYTE* pDelta = 0 );
USHORT WW8GetSprmSize( BYTE nVersion, const BYTE* pSprm, USHORT* pId );
-BYTE WW8SprmDataOfs( USHORT nId );
+BYTE WW8SprmDataOfs(BYTE nVersion, USHORT nId );
struct WW8FieldDesc
{