Kaydet (Commit) 48538700 authored tarafından Oliver-Rainer Wittmann's avatar Oliver-Rainer Wittmann

#119954# - method <SwEditShell::TableToText(..)>

- assure that conversion of nested tables are performed correctly.

Found by: Yang Ji <yanji.yj at gmail dot com>
Patch by: kang jian <jane73_kang at hotmail dot com>
Review by: Oliver <orw at apache dot org>
üst 9c1aca00
......@@ -61,6 +61,42 @@ using namespace ::com::sun::star::uno;
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 @@ sal_Bool SwEditShell::TableToText( sal_Unicode cCh )
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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment