summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-01-14 18:12:26 +0100
committerKurt Zenker <kz@openoffice.org>2010-01-14 18:12:26 +0100
commitfaa1ff31284aeecbd4acedcdfa1eaf401b892c33 (patch)
treefa54b05edff35711b90890c8df68f4792e98ea8c
parent0329cf725b6af7f4df33e1ee9a5845e45a9be673 (diff)
parentf3c6bdfbb0f4b245897880265fde514cf0a722e4 (diff)
CWS-TOOLING: integrate CWS sw32bf10_DEV300
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par.cxx15
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx31
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx55
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx2
5 files changed, 73 insertions, 35 deletions
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 0553267d12..e1c5b25092 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -506,14 +506,15 @@ ESelection SwWW8ImplReader::GetESelection( long nCpStart, long nCpEnd )
// ItemSet gestopft.
void SwWW8ImplReader::InsertTxbxStyAttrs( SfxItemSet& rS, USHORT nColl )
{
- if( nColl < nColls && pCollA[nColl].pFmt && pCollA[nColl].bColl )
+ SwWW8StyInf * pStyInf = GetStyle(nColl);
+ if( pStyInf != NULL && pStyInf->pFmt && pStyInf->bColl )
{
const SfxPoolItem* pItem;
for( USHORT i = POOLATTR_BEGIN; i < POOLATTR_END; i++ )
{
//If we are set in the source and not set in the destination
//then add it in.
- if ( SFX_ITEM_SET == pCollA[nColl].pFmt->GetItemState(
+ if ( SFX_ITEM_SET == pStyInf->pFmt->GetItemState(
i, true, &pItem ) )
{
SfxItemPool *pEditPool = rS.GetPool();
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 2ae8a362ea..ebd7d2a770 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -989,7 +989,7 @@ const SfxPoolItem* SwWW8FltControlStack::GetFmtAttr(const SwPosition& rPos,
SfxItemState eState = SFX_ITEM_DEFAULT;
if (const SfxItemSet *pSet = pNd->GetpSwAttrSet())
eState = pSet->GetItemState(RES_LR_SPACE, false);
- if (eState != SFX_ITEM_SET)
+ if (eState != SFX_ITEM_SET && rReader.pCollA != NULL)
pItem = &(rReader.pCollA[rReader.nAktColl].maWordLR);
}
@@ -2163,7 +2163,7 @@ CharSet SwWW8ImplReader::GetCurrentCharSet()
eSrcCharSet = maFontSrcCharSets.top();
if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
eSrcCharSet = pCollA[nCharFmt].GetCharSet();
- if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && StyleExists(nAktColl))
eSrcCharSet = pCollA[nAktColl].GetCharSet();
if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
{ // patch from cmc for #i52786#
@@ -2221,10 +2221,13 @@ CharSet SwWW8ImplReader::GetCurrentCJKCharSet()
{
if (!maFontSrcCJKCharSets.empty())
eSrcCharSet = maFontSrcCJKCharSets.top();
- if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
- eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet();
- if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
- eSrcCharSet = pCollA[nAktColl].GetCJKCharSet();
+ if (pCollA != NULL)
+ {
+ if ((eSrcCharSet == RTL_TEXTENCODING_DONTKNOW) && (nCharFmt != -1))
+ eSrcCharSet = pCollA[nCharFmt].GetCJKCharSet();
+ if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
+ eSrcCharSet = pCollA[nAktColl].GetCJKCharSet();
+ }
if (eSrcCharSet == RTL_TEXTENCODING_DONTKNOW)
{ // patch from cmc for #i52786#
/*
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 65912eb6b6..04e75b06a1 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -827,7 +827,8 @@ void SwWW8ImplReader::Read_ANLevelNo( USHORT, const BYTE* pData, short nLen )
{
// nur fuer SwTxtFmtColl, nicht CharFmt
// WW: 0 = no Numbering
- if (pCollA[nAktColl].bColl && *pData)
+ SwWW8StyInf * pColl = GetStyle(nAktColl);
+ if (pColl != NULL && pColl->bColl && *pData)
{
// Bereich WW:1..9 -> SW:0..8 keine Aufzaehlung / Nummerierung
@@ -861,12 +862,16 @@ void SwWW8ImplReader::Read_ANLevelNo( USHORT, const BYTE* pData, short nLen )
void SwWW8ImplReader::Read_ANLevelDesc( USHORT, const BYTE* pData, short nLen ) // Sprm 12
{
- if( !pAktColl || nLen <= 0 // nur bei Styledef
- || !pCollA[nAktColl].bColl // CharFmt -> ignorieren
- || ( nIniFlags & WW8FL_NO_OUTLINE ) ){
- nSwNumLevel = 0xff;
- return;
+ {
+ SwWW8StyInf * pStyInf = GetStyle(nAktColl);
+ if( !pAktColl || nLen <= 0 // nur bei Styledef
+ || (pStyInf && !pStyInf->bColl) // CharFmt -> ignorieren
+ || ( nIniFlags & WW8FL_NO_OUTLINE ) ){
+ nSwNumLevel = 0xff;
+ return;
+ }
}
+
if( nSwNumLevel <= MAXLEVEL // Bereich WW:1..9 -> SW:0..8
&& nSwNumLevel <= 9 ){ // keine Aufzaehlung / Nummerierung
@@ -892,7 +897,10 @@ void SwWW8ImplReader::Read_ANLevelDesc( USHORT, const BYTE* pData, short nLen )
SwNumRule* pNR = GetStyRule();
SetAnld(pNR, (WW8_ANLD*)pData, 0, false);
pAktColl->SetFmtAttr( SwNumRuleItem( pNR->GetName() ) );
- pCollA[nAktColl].bHasStyNumRule = true;
+
+ SwWW8StyInf * pStyInf = GetStyle(nAktColl);
+ if (pStyInf != NULL)
+ pStyInf->bHasStyNumRule = true;
}
}
@@ -1007,9 +1015,10 @@ void SwWW8ImplReader::StartAnl(const BYTE* pSprm13)
}
}
- if (!sNumRule.Len() && pCollA[nAktColl].bHasStyNumRule)
+ SwWW8StyInf * pStyInf = GetStyle(nAktColl);
+ if (!sNumRule.Len() && pStyInf->bHasStyNumRule)
{
- sNumRule = pCollA[nAktColl].pFmt->GetNumRule().GetValue();
+ sNumRule = pStyInf->pFmt->GetNumRule().GetValue();
pNumRule = rDoc.FindNumRulePtr(sNumRule);
if (!pNumRule)
sNumRule.Erase();
@@ -3918,8 +3927,8 @@ WW8RStyle::WW8RStyle(WW8Fib& _rFib, SwWW8ImplReader* pI)
: WW8Style(*pI->pTableStream, _rFib), maSprmParser(_rFib.GetFIBVersion()),
pIo(pI), pStStrm(pI->pTableStream), pStyRule(0), nWwNumLevel(0)
{
- pIo->pCollA = new SwWW8StyInf[ cstd ]; // Style-UEbersetzung WW->SW
pIo->nColls = cstd;
+ pIo->pCollA = cstd ? new SwWW8StyInf[ cstd ] : NULL; // Style-UEbersetzung WW->SW
}
void WW8RStyle::Set1StyleDefaults()
@@ -4691,7 +4700,7 @@ void WW8RStyle::Import()
//
// fuer z.B. Tabellen wird ein immer gueltiger Std-Style gebraucht
- if( pIo->pCollA[0].pFmt && pIo->pCollA[0].bColl && pIo->pCollA[0].bValid )
+ if( pIo->StyleExists(0) && pIo->pCollA[0].pFmt && pIo->pCollA[0].bColl && pIo->pCollA[0].bValid )
pIo->pDfltTxtFmtColl = (SwTxtFmtColl*)pIo->pCollA[0].pFmt;
else
pIo->pDfltTxtFmtColl = pIo->rDoc.GetDfltTxtFmtColl();
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index d559608d86..5c8cc8ffd3 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2281,22 +2281,48 @@ WW8PLCF::WW8PLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF, int nStruct,
void WW8PLCF::ReadPLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF )
{
+ bool failure = false;
+
// Pointer auf Pos-Array
pPLCF_PosArray = new WW8_CP[ ( nPLCF + 3 ) / 4 ];
sal_Size nOldPos = pSt->Tell();
pSt->Seek( nFilePos );
- pSt->Read( pPLCF_PosArray, nPLCF );
+ failure = pSt->GetError();
+
+ if (!failure)
+ {
+ pSt->Read( pPLCF_PosArray, nPLCF );
+ failure = pSt->GetError();
+ }
+
+ if (!failure)
+ {
#ifdef OSL_BIGENDIAN
- for( nIdx = 0; nIdx <= nIMax; nIdx++ )
- pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] );
- nIdx = 0;
+ for( nIdx = 0; nIdx <= nIMax; nIdx++ )
+ pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] );
+ nIdx = 0;
#endif // OSL_BIGENDIAN
- // Pointer auf Inhalts-Array
- pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1];
+ // Pointer auf Inhalts-Array
+ pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1];
+ }
pSt->Seek( nOldPos );
+
+ ASSERT( !failure, "Document has corrupt PLCF, ignoring it" );
+
+ if (failure)
+ MakeFailedPLCF();
+}
+
+void WW8PLCF::MakeFailedPLCF()
+{
+ nIMax = 0;
+ delete[] pPLCF_PosArray;
+ pPLCF_PosArray = new INT32[2];
+ pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX;
+ pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1];
}
void WW8PLCF::GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN )
@@ -2359,13 +2385,7 @@ void WW8PLCF::GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN )
ASSERT( !failure, "Document has corrupt PLCF, ignoring it" );
if (failure)
- {
- nIMax = 0;
- delete[] pPLCF_PosArray;
- pPLCF_PosArray = new INT32[2];
- pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX;
- pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1];
- }
+ MakeFailedPLCF();
}
bool WW8PLCF::SeekPos(WW8_CP nPos)
@@ -6240,8 +6260,11 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
rSt.Seek( rFib.fcSttbfffn );
+ INT32 nFFn = rFib.lcbSttbfffn - 2;
+
// allocate Font Array
- BYTE* pA = new BYTE[ rFib.lcbSttbfffn - 2 ];
+ BYTE* pA = new BYTE[ nFFn ];
+ memset(pA, 0, nFFn);
WW8_FFN* p = (WW8_FFN*)pA;
ww::WordVersion eVersion = rFib.GetFIBVersion();
@@ -6258,13 +6281,13 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
rSt.SeekRel( 2 );
// read all font information
- rSt.Read( pA, rFib.lcbSttbfffn - 2 );
+ nFFn = rSt.Read( pA, nFFn );
if( eVersion < ww::eWW8 )
{
// try to figure out how many fonts are defined here
nMax = 0;
- long nLeft = rFib.lcbSttbfffn - 2;
+ long nLeft = nFFn;
for(;;)
{
short nNextSiz;
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 9d3d0af1f6..107bde4aa4 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -295,6 +295,8 @@ private:
machen wir uns hiermit einen PLC:
*/
void GeneratePLCF( SvStream* pSt, INT32 nPN, INT32 ncpN );
+
+ void MakeFailedPLCF();
public:
WW8PLCF( SvStream* pSt, WW8_FC nFilePos, INT32 nPLCF, int nStruct,
WW8_CP nStartPos = -1 );