diff options
author | Oliver Bolte <obo@openoffice.org> | 2010-01-08 14:44:35 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2010-01-08 14:44:35 +0000 |
commit | 7650c7b49d3d76fa199a2e5def3e0dd74316f5c4 (patch) | |
tree | 7c36a7b880c6476932871072b14bdaf15b85fb66 /sw | |
parent | 039fa47b6ed780eb99bcd330aae8a548f45d6ebc (diff) |
CWS-TOOLING: integrate CWS sw32bf10
2009-12-14 13:25:38 +0100 hbrinkm r277804 : #161286# applied patch and solved crash
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 15 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 31 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 55 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.hxx | 2 |
5 files changed, 73 insertions, 35 deletions
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 4948ac5edd..40619b094e 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 9b5a785220..b69d219905 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 b737fc1102..ef564e6c5e 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 ); |