summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ivan <alexnivan@yahoo.com>2013-07-18 18:45:14 +0300
committerAlex Ivan <alexnivan@yahoo.com>2013-07-18 18:45:14 +0300
commit248c76291562f2fe95c2f246be06cbd7338fcb3e (patch)
tree5a0dab605fe3824a73624d475da33037e82c6ed1
parent13d870054e1b9f9b52519eef5eaf769d5cf4337e (diff)
Modify undo mechanism for applying table format
Undo object no longer reconstructs table, but changes the table style back to the original. The actual modification _should_ become visible once the proper modifications to the rendering of the table are done. Change-Id: Ife10f52077c9b13d5cf4f44fa1194fe414661cd1
-rw-r--r--sw/source/core/inc/UndoTable.hxx7
-rw-r--r--sw/source/core/undo/untbl.cxx44
2 files changed, 11 insertions, 40 deletions
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index cd79f20e346f..37f5c41603d2 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -43,6 +43,7 @@ class SwTable;
class SwTableBox;
class SwStartNode;
class SwTableNode;
+class SwTableFmt;
class SwTableAutoFmt;
class SwTableSortBoxes;
@@ -146,9 +147,7 @@ class SwUndoTblNumFmt;
class SwUndoTblAutoFmt : public SwUndo
{
sal_uLong nSttNode;
- _SaveTable* pSaveTbl;
- ::std::vector< ::boost::shared_ptr<SwUndoTblNumFmt> > m_Undos;
- sal_Bool bSaveCntntAttr;
+ SwTableFmt* pSaveFmt;
sal_uInt16 m_nRepeatHeading;
void UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext);
@@ -160,8 +159,6 @@ public:
virtual void UndoImpl( ::sw::UndoRedoContext & );
virtual void RedoImpl( ::sw::UndoRedoContext & );
-
- void SaveBoxCntnt( const SwTableBox& rBox );
};
class SwUndoTblNdsChg : public SwUndo, private boost::noncopyable
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index a3793d26a3d5..4157e5343400 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1410,29 +1410,14 @@ SwUndoTblAutoFmt::SwUndoTblAutoFmt( const SwTableNode& rTblNd,
const SwTableAutoFmt& rAFmt )
: SwUndo( UNDO_TABLE_AUTOFMT ),
nSttNode( rTblNd.GetIndex() ),
- bSaveCntntAttr( sal_False )
- , m_nRepeatHeading(rTblNd.GetTable().GetRowsToRepeat())
+ m_nRepeatHeading(rTblNd.GetTable().GetRowsToRepeat())
{
- pSaveTbl = new _SaveTable( rTblNd.GetTable() );
-
- if( rAFmt.IsFont() || rAFmt.IsJustify() )
- {
- // than also go over the ContentNodes of the EndBoxes and collect
- // all paragraph attributes
- pSaveTbl->SaveCntntAttrs( (SwDoc*)rTblNd.GetDoc() );
- bSaveCntntAttr = sal_True;
- }
+ pSaveFmt = new SwTableFmt( *rAFmt.GetTableStyle() );
}
SwUndoTblAutoFmt::~SwUndoTblAutoFmt()
{
- delete pSaveTbl;
-}
-
-void SwUndoTblAutoFmt::SaveBoxCntnt( const SwTableBox& rBox )
-{
- ::boost::shared_ptr<SwUndoTblNumFmt> const p(new SwUndoTblNumFmt(rBox));
- m_Undos.push_back(p);
+ delete pSaveFmt;
}
void
@@ -1443,25 +1428,14 @@ SwUndoTblAutoFmt::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext)
OSL_ENSURE( pTblNd, "no TableNode" );
SwTable& table = pTblNd->GetTable();
- _SaveTable* pOrig = new _SaveTable( table );
- // than go also over the ContentNodes of the EndBoxes and collect
- // all paragraph attributes
- if( bSaveCntntAttr )
- pOrig->SaveCntntAttrs( &rDoc );
+ SwTableFmt* pOrig = new SwTableFmt( *(SwTableFmt*)table.GetTableFmt()->GetRegisteredIn() );
- if (bUndo)
- {
- for (size_t n = m_Undos.size(); 0 < n; --n)
- {
- m_Undos.at(n-1)->UndoImpl(rContext);
- }
+ if( bUndo )
+ table.SetRowsToRepeat( m_nRepeatHeading );
- table.SetRowsToRepeat(m_nRepeatHeading);
- }
-
- pSaveTbl->RestoreAttr( pTblNd->GetTable(), !bUndo );
- delete pSaveTbl;
- pSaveTbl = pOrig;
+ pSaveFmt->RestoreTableProperties( table );
+ delete pSaveFmt;
+ pSaveFmt = pOrig;
}
void SwUndoTblAutoFmt::UndoImpl(::sw::UndoRedoContext & rContext)