[Libreoffice-commits] core.git: sw/source
Oliver-Rainer Wittmann
orw at apache.org
Sat May 11 12:44:13 PDT 2013
sw/source/core/edit/edtab.cxx | 42 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
New commits:
commit a0bd65d2e0e6813f47221ae52092cdb4e748c0e6
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Jun 22 09:01:55 2012 +0000
Resolves: #i119954# fix nest tables to text conversion crash
- 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>
(cherry picked from commit 48538700cdafaa4becfe74a1d3d93179aed9d764)
Change-Id: Iaefbf6f75d526ef8c0c4302d8b39096becc183e8
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index 13dc561..c10e243 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -52,6 +52,42 @@ using namespace ::com::sun::star::uno;
extern void ClearFEShellTabCols();
+//Added for bug #i119954# 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 (size_t n = 0; n < rTableLines.size(); ++n)
+ {
+ SwTableLine* pTableLine = rTableLines[ n ];
+ for (size_t i = 0; i < pTableLine->GetTabBoxes().size(); ++i)
+ {
+ SwTableBox* pTableBox = pTableLine->GetTabBoxes()[ i ];
+ if (pTableBox->GetTabLines().empty())
+ {
+ 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 #i119954#
const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTblOpts,
sal_uInt16 nRows, sal_uInt16 nCols,
sal_Int16 eAdj,
@@ -129,7 +165,11 @@ sal_Bool SwEditShell::TableToText( sal_Unicode cCh )
pCrsr->SetMark();
pCrsr->DeleteMark();
- bRet = GetDoc()->TableToText( pTblNd, cCh );
+ //Modified for bug #i119954# Application crashed if undo/redo covert nest table to text
+ StartUndo();
+ bRet = ConvertTableToText( pTblNd, cCh );
+ EndUndo();
+ //End for bug #i119954#
pCrsr->GetPoint()->nNode = aTabIdx;
SwCntntNode* pCNd = pCrsr->GetCntntNode();
More information about the Libreoffice-commits
mailing list