View | Details | Raw Unified | Return to issue 119954
Collapse All | Expand All

(-)main/sw/source/core/edit/edtab.cxx (-1 / +41 lines)
Lines 61-66 Link Here
61
61
62
extern void ClearFEShellTabCols();
62
extern void ClearFEShellTabCols();
63
63
64
//Added for bug 119954:Application crashed if undo/redo covert nest table to text
65
sal_Bool ConvertTableToText( const SwTableNode *pTableNode, sal_Unicode cCh );
66
67
void	ConvertNestedTablesToText( const SwTableLines &rTableLines, sal_Unicode cCh )
68
{
69
	for( sal_uInt16 n = 0; n < rTableLines.Count(); ++n )
70
	{
71
		SwTableLine* pTableLine = rTableLines[ n ];
72
		for( sal_uInt16 i = 0; i < pTableLine->GetTabBoxes().Count(); ++i )
73
		{
74
			SwTableBox* pTableBox = pTableLine->GetTabBoxes()[ i ];
75
			if ( !pTableBox->GetTabLines().Count() )
76
			{			
77
				SwNodeIndex nodeIndex( *pTableBox->GetSttNd(), 1 );
78
				SwNodeIndex endNodeIndex( *pTableBox->GetSttNd()->EndOfSectionNode() );
79
				for( ; nodeIndex < endNodeIndex ; nodeIndex++ )
80
				{				
81
					if ( SwTableNode* pTableNode = nodeIndex.GetNode().GetTableNode() )
82
						ConvertTableToText( pTableNode, cCh );
83
				}
84
			}
85
			else
86
			{
87
				ConvertNestedTablesToText( pTableBox->GetTabLines(), cCh );
88
			}
89
		}
90
	}
91
}
92
93
sal_Bool ConvertTableToText( const SwTableNode *pConstTableNode, sal_Unicode cCh )
94
{
95
	SwTableNode *pTableNode = const_cast< SwTableNode* >( pConstTableNode );
96
	ConvertNestedTablesToText( pTableNode->GetTable().GetTabLines(), cCh );
97
	return pTableNode->GetDoc()->TableToText( pTableNode, cCh );
98
}
99
//End for bug 119954
64
const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTblOpts,
100
const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTblOpts,
65
                                         sal_uInt16 nRows, sal_uInt16 nCols,
101
                                         sal_uInt16 nRows, sal_uInt16 nCols,
66
                                         sal_Int16 eAdj,
102
                                         sal_Int16 eAdj,
Lines 138-144 Link Here
138
	pCrsr->SetMark();
174
	pCrsr->SetMark();
139
	pCrsr->DeleteMark();
175
	pCrsr->DeleteMark();
140
176
141
	bRet = GetDoc()->TableToText( pTblNd, cCh );
177
	//Modified for bug 119954:Application crashed if undo/redo covert nest table to text
178
	StartUndo();//UNDO_START
179
	bRet = ConvertTableToText( pTblNd, cCh ); 
180
	EndUndo();//UNDO_END
181
	//End  for bug 119954
142
	pCrsr->GetPoint()->nNode = aTabIdx;
182
	pCrsr->GetPoint()->nNode = aTabIdx;
143
183
144
	SwCntntNode* pCNd = pCrsr->GetCntntNode();
184
	SwCntntNode* pCNd = pCrsr->GetCntntNode();

Return to issue 119954