Commits

Anonymous committed d2be041

CWS-TOOLING: integrate CWS sw32bf01
2009-04-22 09:52:28 +0200 od r271075 : CWS-TOOLING: rebase CWS sw32bf01 to trunk@270723 (milestone: DEV300:m46)
2009-04-06 10:46:37 +0200 od r270529 : #i100782# method <SwFlowFrm::PasteTree(..)>
- patch: correct paste into layout frame containing more than one lower
2009-03-24 15:15:04 +0100 od r269956 : #i90311# method <SwpHints::BuildPortions(..)>
- Do not remove existing character format hint during XML import,
when applying another character format hint.
2009-03-24 08:59:36 +0100 od r269910 : #i94285# method <SwDoc::CopyFmtArr(..)>
- copy existing <SwFmtPageDesc> instance, before copying attributes
2009-03-19 14:50:29 +0100 od r269747 : #i95726# ODF import/export of table:
- include some fault tolerance regarding corrupted tables
2009-03-17 11:50:27 +0100 od r269585 : #i95711# method <SwRedline::MoveFromSection()>
- Before deleting the change tracking node section assure that the internal member
still points to this node section.

  • Participants
  • Parent commits c4c94fd

Comments (0)

Files changed (6)

File sw/source/core/doc/docfmt.cxx

   //                                              RES_PARATR_NUMRULE };
 		//for( USHORT n = 0; n < 3; ++n )
         USHORT __READONLY_DATA aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK,	//->add by zhaojianwei
-                                                RES_PARATR_NUMRULE, 
+                                                RES_PARATR_NUMRULE,
 												RES_PARATR_OUTLINELEVEL };
 		for( USHORT n = 0; n < 4; ++n )										//<-end,zhaojianwei
         {
 					{
 						bSave = pPara && pPara->bKeepOutlineLevelAttr;
 					}
-					break;										//<-end,zhaojianwei	
+					break;										//<-end,zhaojianwei
 				}
 				if( bSave )
 				{
         SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl);
 		if ( pPara->bReset )
         {
-	
+
 			if( pFmt->GetAttrOutlineLevel() == 0 && pPara )
 				pPara->bKeepOutlineLevelAttr = true;
 
 			lcl_RstAttr( pCNd, pPara );
-			
+
             // --> OD 2007-11-06 #i62675#
             // --> OD 2008-04-15 #refactorlists#
             // check, if paragraph style has changed
 	pNewColl->CopyAttrs( rColl, TRUE );
 
 	// setze noch den Outline-Level
-    //if( NO_NUMBERING != rColl.GetOutlineLevel() )	//#outline level,zhaojianwei 
+    //if( NO_NUMBERING != rColl.GetOutlineLevel() )	//#outline level,zhaojianwei
 	//	pNewColl->SetOutlineLevel( rColl.GetOutlineLevel() );
     if(rColl.IsAssignedToListLevelOfOutlineStyle())
 		pNewColl->AssignToListLevelOfOutlineStyle(rColl.GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
 //		pDest->CopyAttrs( *pSrc, TRUE );			// kopiere Attribute
 //JP 19.02.96: ist so wohl optimaler - loest ggfs. kein Modify aus!
 		pDest->DelDiffs( *pSrc );
-        pDest->SetFmtAttr( pSrc->GetAttrSet() );      // kopiere Attribute
-
-		//JP 18.08.98: Bug 55115 - PageDescAttribute in diesem Fall doch
-		//				kopieren
-		const SfxPoolItem* pItem;
-		if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() &&
-			SFX_ITEM_SET == pSrc->GetAttrSet().GetItemState(
-			RES_PAGEDESC, FALSE, &pItem ) &&
-			((SwFmtPageDesc*)pItem)->GetPageDesc() )
-		{
-			SwFmtPageDesc aDesc( *(SwFmtPageDesc*)pItem );
-			const String& rNm = aDesc.GetPageDesc()->GetName();
-			SwPageDesc* pDesc = ::lcl_FindPageDesc( aPageDescs, rNm );
-			if( !pDesc )
-				pDesc = aPageDescs[ MakePageDesc( rNm ) ];
-			pDesc->Add( &aDesc );
-            pDest->SetFmtAttr( aDesc );
-		}
+        // --> OD 2009-03-23 #i94285#
+        // copy existing <SwFmtPageDesc> instance, before copying attributes
+//        pDest->SetFmtAttr( pSrc->GetAttrSet() );      // kopiere Attribute
+        //JP 18.08.98: Bug 55115 - copy PageDescAttribute in this case
+        const SfxPoolItem* pItem;
+        if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() &&
+            SFX_ITEM_SET == pSrc->GetAttrSet().GetItemState(
+            RES_PAGEDESC, FALSE, &pItem ) &&
+            ((SwFmtPageDesc*)pItem)->GetPageDesc() )
+        {
+            SwFmtPageDesc aPageDesc( *(SwFmtPageDesc*)pItem );
+            const String& rNm = aPageDesc.GetPageDesc()->GetName();
+            SwPageDesc* pPageDesc = ::lcl_FindPageDesc( aPageDescs, rNm );
+            if( !pPageDesc )
+            {
+                pPageDesc = aPageDescs[ MakePageDesc( rNm ) ];
+            }
+            pPageDesc->Add( &aPageDesc );
+//            pDest->SetFmtAttr( aPageDesc );
+            SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() );
+            aTmpAttrSet.Put( aPageDesc );
+            pDest->SetFmtAttr( aTmpAttrSet );
+        }
+        else
+        {
+            pDest->SetFmtAttr( pSrc->GetAttrSet() );
+        }
+        // <--
 
 		pDest->SetPoolFmtId( pSrc->GetPoolFmtId() );
 		pDest->SetPoolHelpId( pSrc->GetPoolHelpId() );
 					rDestArr, pSrcColl->GetNextTxtFmtColl().GetName() ) );
 
 			// setze noch den Outline-Level
-			//if( NO_NUMBERING != pSrcColl->GetOutlineLevel() )	//#outline level,zhaojianwei 
+			//if( NO_NUMBERING != pSrcColl->GetOutlineLevel() )	//#outline level,zhaojianwei
 			//	pDstColl->SetOutlineLevel( pSrcColl->GetOutlineLevel() );
 			if(pSrcColl->IsAssignedToListLevelOfOutlineStyle())
 				pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei

File sw/source/core/doc/docredln.cxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
 			}
 		}
 
+        // --> OD 2009-03-17 #i95711#
+        const SwNode* pKeptCntntSectNode( &pCntntSect->GetNode() );
+        // <--
 		{
 			SwPaM aPam( pCntntSect->GetNode(),
 						*pCntntSect->GetNode().EndOfSectionNode(), 1,
 			if( pColl && pCNd )
 				pCNd->ChgFmtColl( pColl );
 		}
-		pDoc->DeleteSection( &pCntntSect->GetNode() );
+        // --> OD 2009-03-17 #i95771#
+        // Under certain conditions the previous <SwDoc::Move(..)> has already
+        // remove the change tracking section of this <SwRedline> instance from
+        // the change tracking nodes area.
+        // Thus, check, if <pCntntSect> still points to the change tracking section
+        // by comparing it with the "indexed" <SwNode> instance copied before
+        // perform the intrinsic move.
+        // Note: Such condition is e.g. a "delete" change tracking only containing a table.
+        if ( &pCntntSect->GetNode() == pKeptCntntSectNode )
+        {
+            pDoc->DeleteSection( &pCntntSect->GetNode() );
+        }
+        // <--
 		delete pCntntSect, pCntntSect = 0;
 
         // #100611# adjustment of redline table positions must take start and

File sw/source/core/layout/flowfrm.cxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
 	}
 
 	if ( pLay->IsFtnFrm() )
-    {   if ( !pLay->Lower() && !pLay->IsColLocked() &&
+    {
+        if ( !pLay->Lower() && !pLay->IsColLocked() &&
              !((SwFtnFrm*)pLay)->IsBackMoveLocked() )
-		{	pLay->Cut();
+        {
+            pLay->Cut();
 			delete pLay;
 		}
-		else
-        {   BOOL bUnlock = !((SwFtnFrm*)pLay)->IsBackMoveLocked();
+        else
+        {
+            BOOL bUnlock = !((SwFtnFrm*)pLay)->IsBackMoveLocked();
             ((SwFtnFrm*)pLay)->LockBackMove();
-			pLay->InvalidateSize();
-			pLay->Calc();
-			SwCntntFrm *pCnt = pLay->ContainsCntnt();
-			while ( pCnt && pLay->IsAnLower( pCnt ) )
-			{
-				//Kann sein, dass der CntFrm gelockt ist, wir wollen hier nicht
-				//in eine endlose Seitenwanderung hineinlaufen und rufen das
-				//Calc garnicht erst!
-				ASSERT( pCnt->IsTxtFrm(), "Die Graphic ist gelandet." );
-				if ( ((SwTxtFrm*)pCnt)->IsLocked() ||
-					 ((SwTxtFrm*)pCnt)->GetFollow() == pStart )
-					break;
-				pCnt->Calc();
-				pCnt = pCnt->GetNextCntntFrm();
-			}
+            pLay->InvalidateSize();
+            pLay->Calc();
+            SwCntntFrm *pCnt = pLay->ContainsCntnt();
+            while ( pCnt && pLay->IsAnLower( pCnt ) )
+            {
+                //Kann sein, dass der CntFrm gelockt ist, wir wollen hier nicht
+                //in eine endlose Seitenwanderung hineinlaufen und rufen das
+                //Calc garnicht erst!
+                ASSERT( pCnt->IsTxtFrm(), "Die Graphic ist gelandet." );
+                if ( ((SwTxtFrm*)pCnt)->IsLocked() ||
+                     ((SwTxtFrm*)pCnt)->GetFollow() == pStart )
+                    break;
+                pCnt->Calc();
+                pCnt = pCnt->GetNextCntntFrm();
+            }
             if( bUnlock )
                 ((SwFtnFrm*)pLay)->UnlockBackMove();
-		}
+        }
 		pLay = 0;
 	}
 	return pLay;
 	}
 	else
 	{
-		if ( 0 == (pStart->pPrev = pParent->Lower()) )
-			pParent->pLower = pStart;
-		else
-			pParent->Lower()->pNext = pStart;
+        if ( 0 == (pStart->pPrev = pParent->Lower()) )
+            pParent->pLower = pStart;
+        else
+        //Modified for #i100782#,04/03/2009
+        //If the pParent has more than 1 child nodes, former design will 
+        //ignore them directly without any collection work. It will make some 
+        //dangling pointers. This lead the crash...
+        //The new design will find the last child of pParent in loop way, and 
+        //add the pStart after the last child.
+        //  pParent->Lower()->pNext = pStart;
+        {
+            SwFrm* pTemp = pParent->pLower;
+            while (pTemp)
+            {
+                if (pTemp->pNext)
+                    pTemp = pTemp->pNext;
+                else
+                {
+                    pStart->pPrev = pTemp;
+                    pTemp->pNext = pStart;
+                    break;
+                }
+            }
+        }
+        //End modification for #i100782#,04/03/2009
 
         // #i27145#
         if ( pParent->IsSctFrm() )

File sw/source/core/txtnode/thints.cxx

                     const bool bSameCharFmt = rOtherCharFmt.GetCharFmt() == rThisCharFmt.GetCharFmt();
                     // <--
 
-                    if ( !( nsSetAttrMode::SETATTR_DONTREPLACE & nMode ) || bNoLengthAttribute || bSameCharFmt )
+                    // --> OD 2009-03-24 #i90311#
+                    // Do not remove existing character format hint during XML import
+                    if ( !rNode.GetDoc()->IsInXMLImport() &&
+                         ( !( nsSetAttrMode::SETATTR_DONTREPLACE & nMode ) ||
+                           bNoLengthAttribute ||
+                           bSameCharFmt ) )
+                    // <--
                     {
                         // Remove old hint
                         Delete( *aIter );

File sw/source/filter/xml/xmltble.cxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
 				nCPos = (sal_uInt16)rLines.GetWidth();
 
 			// Und ihren Index
-			sal_uInt16 nOldCol = nCol;
-			SwXMLTableColumn_Impl aCol( nCPos );
+            const sal_uInt16 nOldCol = nCol;
+            {
+                SwXMLTableColumn_Impl aCol( nCPos );
 #ifndef PRODUCT
-			sal_Bool bFound =
+                const sal_Bool bFound =
 #endif
-				rLines.GetColumns().Seek_Entry( &aCol, &nCol );
-			ASSERT( bFound, "couldn't find column" );
+                    rLines.GetColumns().Seek_Entry( &aCol, &nCol );
+                ASSERT( bFound, "couldn't find column" );
+            }
+
+            // --> OD 2009-03-19 #i95726#
+            // Some fault tolerance, if table is somehow corrupted.
+            if ( nCol < nOldCol )
+            {
+                ASSERT( false, "table and/or table information seems to be corrupted." );
+                if ( nBox == nBoxes - 1 )
+                {
+                    nCol = rLines.GetColumns().Count() - 1;
+                }
+                else
+                {
+                    nCol = nOldCol;
+                }
+            }
+            // <--
 
 			sal_uInt16 nColSpan = nCol - nOldCol + 1U;
 

File sw/source/filter/xml/xmltbli.cxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
         mbCovered( sal_False )
 		{}
 
-	inline void Set( const OUString& rStyleName,
+    inline void Set( const OUString& rStyleName,
 					  sal_uInt32 nRSpan, sal_uInt32 nCSpan,
 					 const SwStartNode *pStNd, SwXMLTableContext *pTable,
 					 sal_Bool bProtect = sal_False,
     sal_Bool HasTextValue() const { return mbTextValue; }
 
 	const SwStartNode *GetStartNode() const { return pStartNode; }
-	inline void SetStartNode( const SwStartNode *pSttNd );
+    inline void SetStartNode( const SwStartNode *pSttNd );
 
 	inline SwXMLTableContext *GetSubTable() const;
 
 {
 	ASSERT( nCol < USHRT_MAX,
 			"SwXMLTableRow_Impl::GetCell: column number is to big" );
-	return aCells[(sal_uInt16)nCol];
+    // --> OD 2009-03-19 #i95726# - some fault tolerance
+//    return aCells[(sal_uInt16)nCol];
+    ASSERT( nCol < aCells.Count(),
+            "SwXMLTableRow_Impl::GetCell: column number is out of bound" );
+    return nCol < aCells.Count() ? aCells[(sal_uInt16)nCol] : 0;
+    // <--
 }
 
 void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, sal_Bool bOneCell )
 	{
 		if( pPrevCell->GetStartNode() )
 			pSttNd = pPrevCell->GetStartNode();
-		else
+        // --> OD 2009-03-19 #i95726# - Some fault tolerance
+//        else
+        else if ( pPrevCell->GetSubTable() )
+        // <--
 			pSttNd = pPrevCell->GetSubTable()->GetLastStartNode();
+
+        ASSERT( pSttNd != 0,
+                "table corrupt" );
 	}
 
 	return pSttNd;
                 // No subtabels: We use the new table model.
                 SwXMLTableCell_Impl *pCell = GetCell(nTopRow,nCol);
 
+                // --> OD 2009-03-19 #i95726# - some fault tolerance
+                if ( pCell == 0 )
+                {
+                    ASSERT( false, "table seems to be corrupt." );
+                    break;
+                }
+                // <--
+
                 // Could the table fragment be splitted vertically behind the
                 // current column (uptp the current line?
                 bSplit = 1UL == pCell->GetColSpan();
 			{
 				SwTableBox* pBox = 0;
 				SwXMLTableCell_Impl *pCell = GetCell( nTopRow, nStartCol );
+                // --> OD 2009-03-19 #i95726# - some fault tolerance
                 if( ( !bHasSubTables || ( pCell->GetRowSpan() == (nBottomRow-nTopRow) ) ) &&
-                    pCell->GetColSpan() == (nCol+1UL-nStartCol) )
+                    pCell->GetColSpan() == (nCol+1UL-nStartCol) &&
+                    ( pCell->GetStartNode() || pCell->GetSubTable() ) )
+                // <--
 				{
                     // insert new empty cell for covered cells:
                     long nBoxRowSpan = 1;