summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2012-06-22 09:01:55 +0000
committerOliver-Rainer Wittmann <orw@apache.org>2012-06-22 09:01:55 +0000
commit48538700cdafaa4becfe74a1d3d93179aed9d764 (patch)
tree0043a8dda232f0692bb56660585b6d412c849da1
parent9c1aca0089556fc2feac53147a61a9c941b2750a (diff)
#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>
Notes
-rw-r--r--sw/source/core/edit/edtab.cxx42
1 files changed, 41 insertions, 1 deletions
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index a6c5fd3075e6..4e73db63c612 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -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();