Index: main/sw/source/core/edit/edtab.cxx =================================================================== --- main/sw/source/core/edit/edtab.cxx (revision 1343549) +++ main/sw/source/core/edit/edtab.cxx (working copy) @@ -61,6 +61,42 @@ extern void ClearFEShellTabCols(); +//Added for bug 119954:Application crashed if undo/redo covert nest table to text +sal_Bool ConvertTableToText( const SwTableNode *pTableNode, sal_Unicode cCh ); + +void ConvertNestedTablesToText( const SwTableLines &rTableLines, sal_Unicode cCh ) +{ + for( sal_uInt16 n = 0; n < rTableLines.Count(); ++n ) + { + SwTableLine* pTableLine = rTableLines[ n ]; + for( sal_uInt16 i = 0; i < pTableLine->GetTabBoxes().Count(); ++i ) + { + SwTableBox* pTableBox = pTableLine->GetTabBoxes()[ i ]; + if ( !pTableBox->GetTabLines().Count() ) + { + SwNodeIndex nodeIndex( *pTableBox->GetSttNd(), 1 ); + SwNodeIndex endNodeIndex( *pTableBox->GetSttNd()->EndOfSectionNode() ); + for( ; nodeIndex < endNodeIndex ; nodeIndex++ ) + { + if ( SwTableNode* pTableNode = nodeIndex.GetNode().GetTableNode() ) + ConvertTableToText( pTableNode, cCh ); + } + } + else + { + ConvertNestedTablesToText( pTableBox->GetTabLines(), cCh ); + } + } + } +} + +sal_Bool ConvertTableToText( const SwTableNode *pConstTableNode, sal_Unicode cCh ) +{ + SwTableNode *pTableNode = const_cast< SwTableNode* >( pConstTableNode ); + ConvertNestedTablesToText( pTableNode->GetTable().GetTabLines(), cCh ); + return pTableNode->GetDoc()->TableToText( pTableNode, cCh ); +} +//End for bug 119954 const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTblOpts, sal_uInt16 nRows, sal_uInt16 nCols, sal_Int16 eAdj, @@ -138,7 +174,11 @@ pCrsr->SetMark(); pCrsr->DeleteMark(); - bRet = GetDoc()->TableToText( pTblNd, cCh ); + //Modified for bug 119954:Application crashed if undo/redo covert nest table to text + StartUndo();//UNDO_START + bRet = ConvertTableToText( pTblNd, cCh ); + EndUndo();//UNDO_END + //End for bug 119954 pCrsr->GetPoint()->nNode = aTabIdx; SwCntntNode* pCNd = pCrsr->GetCntntNode();