summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ivan <alexnivan@yahoo.com>2013-08-12 20:59:41 +0300
committerAlex Ivan <alexnivan@yahoo.com>2013-08-12 20:59:41 +0300
commitbef91df4dc67cb0af0f57c323f1c8339dbf5a329 (patch)
treed60849cb08f40aca00c004f99b239be47e56095d
parent6538a97573635fe9d8cfa595963d7d18394a25c6 (diff)
Fix undo resize table causing lose of table style
_SaveTable class now memorizes the name of the table style applied to the table and it is reapplied after undoing. Not the most elegant solution, but given how the _Save* classes currently store data on the table, this solution avoids modifying too much and possibly breaking other things. Change-Id: I5c2afb0cdd5eb447f548249e9afa1dd6d648e3a9
-rw-r--r--sw/source/core/undo/untbl.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 6aca5e7e7776..9a89ab1a67ab 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -116,6 +116,7 @@ class _SaveTable
SfxItemSet aTblSet;
_SaveLine* pLine;
const SwTable* pSwTable;
+ String sSaveFmtName;
SfxItemSets aSets;
SwFrmFmts aFrmFmts;
sal_uInt16 nLineCount;
@@ -874,6 +875,11 @@ _SaveTable::_SaveTable( const SwTable& rTbl, sal_uInt16 nLnCnt, bool bSaveFml )
bModifyBox = false;
bNewModel = rTbl.IsNewModel();
aTblSet.Put( rTbl.GetFrmFmt()->GetAttrSet() );
+
+ SwTableFmt* pSaveFmt = (SwTableFmt*)rTbl.GetTableFmt()->GetRegisteredIn();
+ if( pSaveFmt )
+ sSaveFmtName = pSaveFmt->GetName();
+
pLine = new _SaveLine( 0, *rTbl.GetTabLines()[ 0 ], *this );
_SaveLine* pLn = pLine;
@@ -931,6 +937,7 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, bool bMdfyBox )
// first, get back attributes of TableFrmFormat
SwFrmFmt* pFmt = rTbl.GetFrmFmt();
+ SwDoc* pDoc = pFmt->GetDoc();
SfxItemSet& rFmtSet = (SfxItemSet&)pFmt->GetAttrSet();
rFmtSet.ClearItem();
rFmtSet.Put( aTblSet );
@@ -971,6 +978,14 @@ void _SaveTable::RestoreAttr( SwTable& rTbl, bool bMdfyBox )
pLn->RestoreAttr( *rTbl.GetTabLines()[ n ], *this );
}
+ if( !sSaveFmtName.Len() )
+ SwTableFmt::RestoreTableProperties( NULL, rTbl );
+ else
+ {
+ SwTableFmt* pStyle = pDoc->FindTblFmtByName( sSaveFmtName, sal_True );
+ SwTableFmt::RestoreTableProperties( pStyle, rTbl );
+ }
+
aFrmFmts.clear();
bModifyBox = false;
}