summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ivan <alexnivan@yahoo.com>2013-08-09 17:10:10 +0300
committerAlex Ivan <alexnivan@yahoo.com>2013-08-09 17:10:10 +0300
commit8d9905db69b2693cde5e80e53ccab521f4b8040f (patch)
tree22d03e548c2c55ab576d8f27565d2aebff56f2b8
parent085921a92a9255b1419687c2c0efb08145729cf3 (diff)
Fix undo for applying table style
Undo now works for applying a new table style. There is an issue where other undo commands i.e. resizing a cell will undo the table style, probably due to not setting the parents correctly. Change-Id: Ia7955e6303be57ec9ea10bd61a355a888818c420
-rw-r--r--sw/source/core/docnode/ndtbl.cxx2
-rw-r--r--sw/source/core/inc/UndoTable.hxx4
-rw-r--r--sw/source/core/undo/untbl.cxx11
3 files changed, 4 insertions, 13 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 4dd25c0c62a0..1a7ff43ae1ef 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -3556,7 +3556,7 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt&
bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
if (bUndo)
{
- pUndo = new SwUndoTblAutoFmt( *pTblNd, rNew );
+ pUndo = new SwUndoTblAutoFmt( *pTblNd );
GetIDocumentUndoRedo().AppendUndo(pUndo);
GetIDocumentUndoRedo().DoUndo(false);
}
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 37f5c41603d2..09bed01ae94c 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -153,9 +153,7 @@ class SwUndoTblAutoFmt : public SwUndo
void UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext);
public:
- SwUndoTblAutoFmt( const SwTableNode& rTblNd, const SwTableAutoFmt& );
-
- virtual ~SwUndoTblAutoFmt();
+ SwUndoTblAutoFmt( const SwTableNode& rTblNd );
virtual void UndoImpl( ::sw::UndoRedoContext & );
virtual void RedoImpl( ::sw::UndoRedoContext & );
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 8c30a5021ef0..5ddb001861ba 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1406,18 +1406,12 @@ void SwUndoAttrTbl::RedoImpl(::sw::UndoRedoContext & rContext)
}
// UndoObject for AutoFormat on Table
-SwUndoTblAutoFmt::SwUndoTblAutoFmt( const SwTableNode& rTblNd,
- const SwTableAutoFmt& rAFmt )
+SwUndoTblAutoFmt::SwUndoTblAutoFmt( const SwTableNode& rTblNd )
: SwUndo( UNDO_TABLE_AUTOFMT ),
nSttNode( rTblNd.GetIndex() ),
m_nRepeatHeading(rTblNd.GetTable().GetRowsToRepeat())
{
- pSaveFmt = new SwTableFmt( *rAFmt.GetTableStyle() );
-}
-
-SwUndoTblAutoFmt::~SwUndoTblAutoFmt()
-{
- delete pSaveFmt;
+ pSaveFmt = (SwTableFmt*)rTblNd.GetTable().GetTableFmt()->GetRegisteredIn();
}
void
@@ -1434,7 +1428,6 @@ SwUndoTblAutoFmt::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext)
table.SetRowsToRepeat( m_nRepeatHeading );
SwTableFmt::RestoreTableProperties( pSaveFmt, table );
- delete pSaveFmt;
pSaveFmt = pOrig;
}