summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ivan <alexnivan@yahoo.com>2013-08-28 15:40:28 +0300
committerAlex Ivan <alexnivan@yahoo.com>2013-08-28 15:40:28 +0300
commit33d2dde3bf0f754ec07a093135fabf07ea7cac06 (patch)
tree146e22b87e3b0db9ef2f2cbbdbc2cf881f0cab88
parent574579ae5c940377ff5125cf7ca360fe3cf7d1e6 (diff)
Apply table style copying from writer to writer
After the table is copied to the new doc, we search for a style with the same name in this doc, and, if one exists, we apply that one, else, we apply the one from the clipboard. Change-Id: I8e3b6b15efa9d7a267cb48223a6f0d62dde46d6f
-rw-r--r--sw/source/core/doc/tblrwcl.cxx8
-rw-r--r--sw/source/core/docnode/ndcopy.cxx9
2 files changed, 15 insertions, 2 deletions
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 70560a72cbf1..53514b19c9fb 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -46,6 +46,7 @@
#include <cellatr.hxx>
#include <mvsave.hxx>
#include <swtblfmt.hxx>
+#include <tblafmt.hxx>
#include <swddetbl.hxx>
#include <poolfmt.hxx>
#include <tblrwcl.hxx>
@@ -2152,10 +2153,15 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
pInsDoc->CopyTxtColl( *pSrcDoc->GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN ) );
}
+ SwTableFmt* pStyle = (SwTableFmt*)GetTableFmt()->GetRegisteredIn();
+ SwTableAutoFmt* pAutoFmt = 0;
+ if( pStyle )
+ pAutoFmt = new SwTableAutoFmt( pStyle->GetName(), pStyle );
+
SwTable* pNewTbl = (SwTable*)pInsDoc->InsertTable(
SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ),
rPos, 1, 1, GetFrmFmt()->GetHoriOrient().GetHoriOrient(),
- 0, 0, sal_False, IsNewModel() );
+ pAutoFmt, 0, sal_False, IsNewModel() );
if( !pNewTbl )
return false;
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 7df0ae4e5d9c..692d23e6dabb 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -428,7 +428,12 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
}
}
- SwFrmFmt* pTblFmt = pDoc->MakeTblFrmFmt( sTblName, pDoc->GetDfltFrmFmt() );
+ SwTableFmt* pStyle = (SwTableFmt*)GetTable().GetTableFmt()->GetRegisteredIn();
+ SwTableFmt* pActualStyle = pDoc->FindTblFmtByName( pStyle->GetName(), sal_True );
+ if( !pActualStyle )
+ pActualStyle = pStyle;
+
+ SwFrmFmt* pTblFmt = pDoc->MakeTblFrmFmt( sTblName, pStyle ? pStyle : pDoc->GetDfltFrmFmt() );
pTblFmt->CopyAttrs( *GetTable().GetFrmFmt() );
SwTableNode* pTblNd = new SwTableNode( rIdx );
SwEndNode* pEndNd = new SwEndNode( rIdx, *pTblNd );
@@ -491,6 +496,8 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
if( pDDEType )
pDDEType->IncRefCnt();
+ SwTableFmt::AssignFormatParents( pActualStyle, rTbl );
+
CHECK_TABLE( GetTable() );
return pTblNd;
}