summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ivan <alexnivan@yahoo.com>2013-08-22 15:43:00 +0300
committerAlex Ivan <alexnivan@yahoo.com>2013-08-22 15:43:00 +0300
commit80090c35ad14c860abd195f6ced5fc37270e8943 (patch)
tree54c3780fb3a687dbf83ee8181e3335b42a99d6da
parentf84b527b5919b6e0d6b0ab434448582dcc632ec0 (diff)
Adjust format parent assigning
Modify format parent assigning mechanism so that the format is claimed when assigning the parent, if it has other dependencies, instead of attempting to have each element created with its own Sw*Fmt on insertion. Change-Id: I569b2a865d41fa6da57e0a0cb090a0fbccddb13c
-rw-r--r--sw/source/core/doc/swtblfmt.cxx8
-rw-r--r--sw/source/core/docnode/ndtbl.cxx10
2 files changed, 9 insertions, 9 deletions
diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index 5e3d88d8d7fa..823f073df439 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -299,7 +299,7 @@ void SwTableFmt::AssignLineParents( SwTableFmt* pSrcFmt, SwTable &rTable )
sal_uInt16 nLines = rTable.GetTabLines().size();
for( sal_uInt16 n = 0; n < nLines; ++n )
{
- SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rTable.GetTabLines()[ n ]->GetFrmFmt();
+ SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rTable.GetTabLines()[ n ]->ClaimFrmFmt();
SwTableLineFmt* pFmt = 0;
if( pSrcFmt )
@@ -336,7 +336,7 @@ void SwTableFmt::AssignBoxParents( SwTableLineFmt* pSrcLineFmt, SwTableLine &rLi
sal_uInt16 nBoxes = rLine.GetTabBoxes().size();
for( sal_uInt16 n = 0; n < nBoxes; ++n )
{
- SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->GetFrmFmt();
+ SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->ClaimFrmFmt();
SwTableBoxFmt* pFmt = 0;
if( pSrcLineFmt )
@@ -374,7 +374,7 @@ void SwTableFmt::AssignLineParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTable
sal_uInt16 nLines = rBox.GetTabLines().size();
for( sal_uInt16 n = 0; n < nLines; ++n )
{
- SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rBox.GetTabLines()[ n ]->GetFrmFmt();
+ SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rBox.GetTabLines()[ n ]->ClaimFrmFmt();
if( pSrcLineFmt )
{
@@ -398,7 +398,7 @@ void SwTableFmt::AssignBoxParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTableB
sal_uInt16 nBoxes = rLine.GetTabBoxes().size();
for( sal_uInt16 n = 0; n < nBoxes; ++n )
{
- SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->GetFrmFmt();
+ SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->ClaimFrmFmt();
if( pSrcBoxFmt )
{
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 36763c82d2f9..896861f47faa 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -167,7 +167,7 @@ lcl_SetDfltBoxAttr(SwTableBox& rBox, DfltBoxAttrList_t & rBoxFmtArr,
(*pMap)[pBoxFrmFmt] = pNewTableBoxFmt;
}
- rBox.ChgFrmFmt( new SwTableBoxFmt( *pNewTableBoxFmt) );
+ rBox.ChgFrmFmt( pNewTableBoxFmt );
}
static SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, std::vector<SwTableBoxFmt*> &rBoxFmtArr,
@@ -455,7 +455,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
SwTableLines& rLines = pNdTbl->GetTabLines();
for( sal_uInt16 n = 0; n < nRows; ++n )
{
- SwTableLine* pLine = new SwTableLine( new SwTableLineFmt( *pLineFmt ), nCols, 0 );
+ SwTableLine* pLine = new SwTableLine( pLineFmt, nCols, 0 );
rLines.insert( rLines.begin() + n, pLine );
SwTableBoxes& rBoxes = pLine->GetTabBoxes();
for( sal_uInt16 i = 0; i < nCols; ++i )
@@ -464,10 +464,10 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
if( bDfltBorders )
{
sal_uInt8 nBoxId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
- pBoxF = new SwTableBoxFmt( *::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId, pTAFmt == 0) );
+ pBoxF = ::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId, pTAFmt == 0);
}
else
- pBoxF = new SwTableBoxFmt( *pBoxFmt );
+ pBoxF = pBoxFmt;
// For AutoFormat on input: the columns are set when inserting the Table
// The Array contains the columns positions and not their widths!
@@ -736,7 +736,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
::lcl_SetDfltBoxAttr( *pBox, *aBoxFmtArr1, nId, pTAFmt == 0 );
else
{
- pBoxF = new SwTableBoxFmt ( *::lcl_CreateDfltBoxFmt( *this, *aBoxFmtArr2, USHRT_MAX, nId, pTAFmt == 0 ) );
+ pBoxF = ::lcl_CreateDfltBoxFmt( *this, *aBoxFmtArr2, USHRT_MAX, nId, pTAFmt == 0 );
pBoxF->SetFmtAttr( pBox->GetFrmFmt()->GetFrmSize() );
pBox->ChgFrmFmt( pBoxF );
}