[Libreoffice-commits] .: 37 commits - sw/inc sw/source
Michael Stahl
mst at kemper.freedesktop.org
Mon Jun 25 11:17:32 PDT 2012
sw/inc/doc.hxx | 2
sw/inc/fesh.hxx | 4
sw/inc/ftnidx.hxx | 4
sw/inc/swunohelper.hxx | 8 -
sw/inc/undobj.hxx | 2
sw/source/core/attr/swatrset.cxx | 2
sw/source/core/crsr/crstrvl.cxx | 3
sw/source/core/doc/docdesc.cxx | 4
sw/source/core/doc/doctxm.cxx | 16 +-
sw/source/core/doc/ftnidx.cxx | 9 -
sw/source/core/doc/poolfmt.cxx | 5
sw/source/core/doc/tblrwcl.cxx | 35 ++---
sw/source/core/docnode/ndtbl.cxx | 139 +++++++++++-----------
sw/source/core/docnode/ndtbl1.cxx | 171 ++++++++++++++--------------
sw/source/core/docnode/node2lay.cxx | 24 +--
sw/source/core/fields/reffld.cxx | 19 +--
sw/source/core/frmedt/fedesc.cxx | 8 -
sw/source/core/frmedt/fefly1.cxx | 19 +--
sw/source/core/frmedt/tblsel.cxx | 18 +-
sw/source/core/inc/doctxm.hxx | 3
sw/source/core/inc/ftnboss.hxx | 8 -
sw/source/core/inc/tblrwcl.hxx | 10 -
sw/source/core/layout/ftnfrm.cxx | 38 +++---
sw/source/core/layout/layouter.cxx | 16 +-
sw/source/core/layout/newfrm.cxx | 3
sw/source/core/layout/pagechg.cxx | 5
sw/source/core/layout/paintfrm.cxx | 21 +--
sw/source/core/layout/tabfrm.cxx | 4
sw/source/core/layout/trvlfrm.cxx | 6
sw/source/core/ole/ndole.cxx | 78 +++++++-----
sw/source/core/table/swtable.cxx | 51 +++-----
sw/source/core/undo/untblk.cxx | 11 -
sw/source/core/unocore/swunohelper.cxx | 8 -
sw/source/core/unocore/unoobj.cxx | 2
sw/source/core/unocore/unoobj2.cxx | 4
sw/source/core/unocore/unosett.cxx | 3
sw/source/core/unocore/unostyle.cxx | 12 -
sw/source/core/view/vprint.cxx | 7 -
sw/source/filter/basflt/shellio.cxx | 2
sw/source/filter/html/htmlcss1.cxx | 7 -
sw/source/filter/html/htmlsect.cxx | 3
sw/source/filter/html/swhtml.cxx | 3
sw/source/filter/html/wrthtml.cxx | 2
sw/source/filter/inc/fltglbls.hxx | 115 ------------------
sw/source/filter/rtf/rtffld.cxx | 9 -
sw/source/filter/rtf/rtfnum.cxx | 16 +-
sw/source/filter/rtf/rtftbl.cxx | 12 -
sw/source/filter/rtf/swparrtf.cxx | 26 +---
sw/source/filter/rtf/swparrtf.hxx | 3
sw/source/filter/ww1/fltshell.cxx | 17 --
sw/source/filter/ww8/rtfattributeoutput.cxx | 3
sw/source/filter/ww8/rtfexport.cxx | 8 -
sw/source/filter/ww8/wrtw8esh.cxx | 54 +++-----
sw/source/filter/ww8/wrtw8nds.cxx | 4
sw/source/filter/ww8/wrtw8sty.cxx | 17 +-
sw/source/filter/ww8/wrtww8.cxx | 5
sw/source/filter/ww8/wrtww8.hxx | 17 +-
sw/source/filter/ww8/ww8atr.cxx | 15 +-
sw/source/filter/ww8/ww8par.cxx | 4
sw/source/filter/ww8/ww8par6.cxx | 2
sw/source/ui/app/appenv.cxx | 4
sw/source/ui/app/docsh2.cxx | 4
sw/source/ui/app/docstyle.cxx | 83 ++++++-------
sw/source/ui/app/mainwn.cxx | 17 +-
sw/source/ui/dbui/dbmgr.cxx | 2
sw/source/ui/utlui/gloslst.cxx | 2
66 files changed, 533 insertions(+), 705 deletions(-)
New commits:
commit 6fadb99a0bf97a5e96f6702ab626fee5d13a3b2e
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Jun 25 17:55:31 2012 +0200
remove some unnecessary but harmless vector(0)
Change-Id: I756f3c601e7eafd22946998963c9fd73e754643a
diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx
index bbd6cbd..98ee2a6 100644
--- a/sw/source/core/inc/tblrwcl.hxx
+++ b/sw/source/core/inc/tblrwcl.hxx
@@ -163,7 +163,7 @@ class SwShareBoxFmt
public:
SwShareBoxFmt( const SwFrmFmt& rFmt )
- : pOldFmt( &rFmt ), aNewFmts()
+ : pOldFmt( &rFmt )
{}
const SwFrmFmt& GetOldFormat() const { return *pOldFmt; }
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 54154a8..d2205e2 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -857,9 +857,7 @@ void WW8Export::AppendFlyInFlys(const sw::Frame& rFrmFmt,
MSWord_SdrAttrIter::MSWord_SdrAttrIter( MSWordExportBase& rWr,
const EditTextObject& rEditObj, sal_uInt8 nTyp )
- : MSWordAttrIter( rWr ), pEditObj(&rEditObj), pEditPool(0),
- aTxtAtrArr(), aChrTxtAtrArr( 0 ), aChrSetArr( 0 ),
- mnTyp(nTyp)
+ : MSWordAttrIter( rWr ), pEditObj(&rEditObj), pEditPool(0), mnTyp(nTyp)
{
NextPara( 0 );
}
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index ac6c514..26eef0b 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1907,7 +1907,7 @@ void MSWordExportBase::WriteHeaderFooterText( const SwFmt& rFmt, bool bHeader )
// WW8_WrPlcFtnEdn ist die Klasse fuer Fuss- und Endnoten
//------------------------------------------------------------------------------
WW8_WrPlcSubDoc::WW8_WrPlcSubDoc()
- : aCntnt( 0 ), pTxtPos( 0 )
+ : pTxtPos( 0 )
{
}
commit 1199f99b26034b6e84e6c59ab1eb288ac64e048e
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 17:55:56 2012 +0200
Convert fields in class SwUpdFtnEndNtAtEnd from Svptrarr to std::vector
Change-Id: I67631707788ec273b994d59db6e08aabb6b62991
diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx
index 055d6d5..40b969f 100644
--- a/sw/inc/ftnidx.hxx
+++ b/sw/inc/ftnidx.hxx
@@ -58,11 +58,11 @@ public:
class SwUpdFtnEndNtAtEnd
{
- SvPtrarr aFtnSects, aEndSects;
+ std::vector<const SwSectionNode*> aFtnSects, aEndSects;
std::vector<sal_uInt16> aFtnNums, aEndNums;
public:
- SwUpdFtnEndNtAtEnd() : aFtnSects( 0 ), aEndSects( 0 ) {}
+ SwUpdFtnEndNtAtEnd() : aFtnSects(), aEndSects() {}
static const SwSectionNode* FindSectNdWithEndAttr(
const SwTxtFtn& rTxtFtn );
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index b3ceedc..1b6393c 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -338,7 +338,7 @@ sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn,
const SwSectionNode& rNd )
{
sal_uInt16 nRet = 0, nWh;
- SvPtrarr* pArr;
+ std::vector<const SwSectionNode*>* pArr;
std::vector<sal_uInt16> *pNum;
if( rTxtFtn.GetFtn().IsEndNote() )
{
@@ -352,10 +352,9 @@ sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn,
pNum = &aFtnNums;
nWh = RES_FTN_AT_TXTEND;
}
- void* pNd = (void*)&rNd;
- for( sal_uInt16 n = pArr->Count(); n; )
- if( pArr->GetObject( --n ) == pNd )
+ for( sal_uInt16 n = pArr->size(); n; )
+ if( (*pArr)[ --n ] == &rNd )
{
nRet = ++((*pNum)[ n ]);
break;
@@ -363,7 +362,7 @@ sal_uInt16 SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn,
if( !nRet )
{
- pArr->Insert( pNd, pArr->Count() );
+ pArr->push_back( &rNd );
nRet = ((SwFmtFtnEndAtTxtEnd&)rNd.GetSection().GetFmt()->
GetFmtAttr( nWh )).GetOffset();
++nRet;
commit 3a92dc80e39b9c92571324b04c6be3b73e4c02f9
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 17:48:36 2012 +0200
Convert local var from Svptrarr to std::vector
Change-Id: I192bb3c923024b13346cfaa89f34bdddad8434cf
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index f56f878..7d50585 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -1313,7 +1313,7 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
aFndBox.DelFrms( *this );
_CpyTabFrms aFrmArr;
- SvPtrarr aLastBoxArr;
+ std::vector<SwTableBoxFmt*> aLastBoxArr;
sal_uInt16 nFndPos;
for( sal_uInt16 n = 0; n < aSelBoxes.Count(); ++n )
{
@@ -1350,14 +1350,13 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
pLastBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
nBoxSz - ( nNewBoxSz * nCnt ), 0 ) );
}
- void* p = pLastBoxFmt;
- aLastBoxArr.Insert( p, nFndPos );
+ aLastBoxArr.insert( aLastBoxArr.begin() + nFndPos, pLastBoxFmt );
}
else
{
aFindFrm = aFrmArr[ nFndPos ];
pSelBox->ChgFrmFmt( (SwTableBoxFmt*)aFindFrm.pNewFrmFmt );
- pLastBoxFmt = (SwTableBoxFmt*)aLastBoxArr[ nFndPos ];
+ pLastBoxFmt = aLastBoxArr[ nFndPos ];
}
// Insert the Boxes at the Position
@@ -1386,7 +1385,7 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
rCTF.Value.pFrmFmt == aFindFrm.pNewFrmFmt )
{
aFrmArr.Remove( i );
- aLastBoxArr.Remove( i );
+ aLastBoxArr.erase( aLastBoxArr.begin() + i );
}
}
}
commit afa691c22026e0b525e6ce76c6f8a2333d7f2202
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 17:45:36 2012 +0200
Convert class _SplitTable_Para from using Svptrarr to std::map
Along the way, clean up the code. Using a map is much clearer
than using co-ordinated arrays.
Change-Id: Ic736791e202572cbf7f919f06492d90823537b01
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index fc308e3..9ea5548 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -3291,25 +3291,22 @@ sal_Bool lcl_ChgTblSize( SwTable& rTbl )
class _SplitTable_Para
{
- SvPtrarr aSrc, aDest;
+ std::map<SwFrmFmt*, SwFrmFmt*> aSrcDestMap;
SwTableNode* pNewTblNd;
SwTable& rOldTbl;
public:
_SplitTable_Para( SwTableNode* pNew, SwTable& rOld )
- : aSrc( 16 ), aDest( 16 ), pNewTblNd( pNew ), rOldTbl( rOld )
+ : aSrcDestMap(), pNewTblNd( pNew ), rOldTbl( rOld )
{}
- sal_uInt16 SrcFmt_GetPos( void* pFmt ) const
- { return aSrc.GetPos( pFmt ); }
-
- void DestFmt_Insert( void* pFmt )
- { aDest.Insert( pFmt, aDest.Count() ); }
-
- void SrcFmt_Insert( void* pFmt )
- { aSrc.Insert( pFmt, aSrc.Count() ); }
+ SwFrmFmt* GetDestFmt( SwFrmFmt* pSrcFmt ) const
+ {
+ std::map<SwFrmFmt*, SwFrmFmt*>::const_iterator it = aSrcDestMap.find( pSrcFmt );
+ return it == aSrcDestMap.end() ? NULL : it->second;
+ }
- SwFrmFmt* DestFmt_Get( sal_uInt16 nPos ) const
- { return (SwFrmFmt*)aDest[ nPos ]; }
+ void InsertSrcDest( SwFrmFmt* pSrcFmt, SwFrmFmt* pDestFmt )
+ { aSrcDestMap[ pSrcFmt ] = pDestFmt; }
void ChgBox( SwTableBox* pBox )
{
@@ -3324,14 +3321,13 @@ static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara );
static void lcl_SplitTable_CpyLine( SwTableLine* pLn, _SplitTable_Para* pPara )
{
SwFrmFmt *pSrcFmt = pLn->GetFrmFmt();
- sal_uInt16 nPos = pPara->SrcFmt_GetPos( pSrcFmt );
- if( USHRT_MAX == nPos )
+ SwTableLineFmt* pDestFmt = (SwTableLineFmt*) pPara->GetDestFmt( pSrcFmt );
+ if( pDestFmt == NULL )
{
- pPara->DestFmt_Insert( pLn->ClaimFrmFmt() );
- pPara->SrcFmt_Insert( pSrcFmt );
+ pPara->InsertSrcDest( pSrcFmt, pLn->ClaimFrmFmt() );
}
else
- pLn->ChgFrmFmt( (SwTableLineFmt*)pPara->DestFmt_Get( nPos ) );
+ pLn->ChgFrmFmt( pDestFmt );
for( SwTableBoxes::iterator it = pLn->GetTabBoxes().begin();
it != pLn->GetTabBoxes().end(); ++it)
@@ -3341,14 +3337,13 @@ static void lcl_SplitTable_CpyLine( SwTableLine* pLn, _SplitTable_Para* pPara )
static void lcl_SplitTable_CpyBox( SwTableBox* pBox, _SplitTable_Para* pPara )
{
SwFrmFmt *pSrcFmt = pBox->GetFrmFmt();
- sal_uInt16 nPos = pPara->SrcFmt_GetPos( pSrcFmt );
- if( USHRT_MAX == nPos )
+ SwTableBoxFmt* pDestFmt = (SwTableBoxFmt*)pPara->GetDestFmt( pSrcFmt );
+ if( pDestFmt == NULL )
{
- pPara->DestFmt_Insert( pBox->ClaimFrmFmt() );
- pPara->SrcFmt_Insert( pSrcFmt );
+ pPara->InsertSrcDest( pSrcFmt, pBox->ClaimFrmFmt() );
}
else
- pBox->ChgFrmFmt( (SwTableBoxFmt*)pPara->DestFmt_Get( nPos ) );
+ pBox->ChgFrmFmt( pDestFmt );
if( pBox->GetSttNd() )
pPara->ChgBox( pBox );
commit 3a6664c1448c94d337a28bb12da8c0cf4f526988
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 17:21:43 2012 +0200
Convert code from Svptrarr to std::vector
In the process, clean up the confusion caused by storing
completely different stuff in the same vector.
Change-Id: I6b688a0bec82bec340f520f01adfa9648a73a068
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 7581885..fc308e3 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -143,48 +143,52 @@ void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, sal_uInt8 nId )
rFmt.SetFmtAttr( aBox );
}
-void lcl_SetDfltBoxAttr( SwTableBox& rBox, SvPtrarr &rBoxFmtArr, sal_uInt8 nId,
+typedef struct {
+ SwFrmFmt* pBoxFrmFmt;
+ SwTableBoxFmt* pTableBoxFmt;
+} DfltBoxAttrTmp;
+typedef std::vector<DfltBoxAttrTmp> DfltBoxAttrTmpVec;
+typedef std::vector<DfltBoxAttrTmpVec*> DfltBoxAttrTmpVecVec;
+
+void lcl_SetDfltBoxAttr( SwTableBox& rBox, DfltBoxAttrTmpVecVec &rBoxFmtArr, sal_uInt8 nId,
const SwTableAutoFmt* pAutoFmt = 0 )
{
- SvPtrarr* pArr = (SvPtrarr*)rBoxFmtArr[ nId ];
+ DfltBoxAttrTmpVec* pArr = rBoxFmtArr[ nId ];
if( !pArr )
{
- pArr = new SvPtrarr;
- rBoxFmtArr.Replace( pArr, nId );
+ pArr = new DfltBoxAttrTmpVec;
+ rBoxFmtArr[ nId ] = pArr;
}
- SwTableBoxFmt* pNewBoxFmt = 0;
- SwFrmFmt* pBoxFmt = rBox.GetFrmFmt();
- for( sal_uInt16 n = 0; n < pArr->Count(); n += 2 )
- if( pArr->GetObject( n ) == pBoxFmt )
+ SwTableBoxFmt* pNewTableBoxFmt = 0;
+ SwFrmFmt* pBoxFrmFmt = rBox.GetFrmFmt();
+ for( sal_uInt16 n = 0; n < pArr->size(); ++n )
+ if( (*pArr)[n].pBoxFrmFmt == pBoxFrmFmt )
{
- pNewBoxFmt = (SwTableBoxFmt*)pArr->GetObject( n + 1 );
+ pNewTableBoxFmt = (*pArr)[n].pTableBoxFmt;
break;
}
- if( !pNewBoxFmt )
+ if( !pNewTableBoxFmt )
{
- SwDoc* pDoc = pBoxFmt->GetDoc();
+ SwDoc* pDoc = pBoxFrmFmt->GetDoc();
// das Format ist also nicht vorhanden, also neu erzeugen
- pNewBoxFmt = pDoc->MakeTableBoxFmt();
- pNewBoxFmt->SetFmtAttr( pBoxFmt->GetAttrSet().Get( RES_FRM_SIZE ) );
+ pNewTableBoxFmt = pDoc->MakeTableBoxFmt();
+ pNewTableBoxFmt->SetFmtAttr( pBoxFrmFmt->GetAttrSet().Get( RES_FRM_SIZE ) );
if( pAutoFmt )
- pAutoFmt->UpdateToSet( nId, (SfxItemSet&)pNewBoxFmt->GetAttrSet(),
+ pAutoFmt->UpdateToSet( nId, (SfxItemSet&)pNewTableBoxFmt->GetAttrSet(),
SwTableAutoFmt::UPDATE_BOX,
pDoc->GetNumberFormatter( sal_True ) );
else
- ::lcl_SetDfltBoxAttr( *pNewBoxFmt, nId );
+ ::lcl_SetDfltBoxAttr( *pNewTableBoxFmt, nId );
- void* p = pBoxFmt;
- pArr->Insert( p, pArr->Count() );
- p = pNewBoxFmt;
- pArr->Insert( p, pArr->Count() );
+ pArr->push_back( { pBoxFrmFmt, pNewTableBoxFmt } );
}
- rBox.ChgFrmFmt( pNewBoxFmt );
+ rBox.ChgFrmFmt( pNewTableBoxFmt );
}
-SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr,
+SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, std::vector<SwTableBoxFmt*> &rBoxFmtArr,
sal_uInt16 nCols, sal_uInt8 nId )
{
if ( !rBoxFmtArr[nId] )
@@ -194,12 +198,12 @@ SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr,
pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
USHRT_MAX / nCols, 0 ));
::lcl_SetDfltBoxAttr( *pBoxFmt, nId );
- rBoxFmtArr.Replace( pBoxFmt, nId );
+ rBoxFmtArr[ nId ] = pBoxFmt;
}
- return (SwTableBoxFmt*)rBoxFmtArr[nId];
+ return rBoxFmtArr[nId];
}
-SwTableBoxFmt *lcl_CreateAFmtBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr,
+SwTableBoxFmt *lcl_CreateAFmtBoxFmt( SwDoc &rDoc, std::vector<SwTableBoxFmt*> &rBoxFmtArr,
const SwTableAutoFmt& rAutoFmt,
sal_uInt16 nCols, sal_uInt8 nId )
{
@@ -212,9 +216,9 @@ SwTableBoxFmt *lcl_CreateAFmtBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr,
if( USHRT_MAX != nCols )
pBoxFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
USHRT_MAX / nCols, 0 ));
- rBoxFmtArr.Replace( pBoxFmt, nId );
+ rBoxFmtArr[ nId ] = pBoxFmt;
}
- return (SwTableBoxFmt*)rBoxFmtArr[nId];
+ return rBoxFmtArr[nId];
}
SwTableNode* SwDoc::IsIdxInTbl(const SwNodeIndex& rIdx)
@@ -473,7 +477,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
pNdTbl->SetRowsToRepeat( nRowsToRepeat );
pNdTbl->SetTableModel( bNewModel );
- SvPtrarr aBoxFmtArr( 0 );
+ std::vector<SwTableBoxFmt*> aBoxFmtArr;
SwTableBoxFmt* pBoxFmt = 0;
if( !bDfltBorders && !pTAFmt )
{
@@ -483,8 +487,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
else
{
const sal_uInt16 nBoxArrLen = pTAFmt ? 16 : 4;
- for( sal_uInt16 i = 0; i < nBoxArrLen; ++i )
- aBoxFmtArr.Insert( (void*)0, i );
+ aBoxFmtArr.resize( nBoxArrLen, NULL );
}
SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1 );
@@ -760,12 +763,18 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
if( pTAFmt || ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) )
{
sal_uInt8 nBoxArrLen = pTAFmt ? 16 : 4;
- SvPtrarr aBoxFmtArr( nBoxArrLen );
+ boost::scoped_ptr< DfltBoxAttrTmpVecVec > aBoxFmtArr1;
+ boost::scoped_ptr< std::vector<SwTableBoxFmt*> > aBoxFmtArr2;
+ if( bUseBoxFmt )
{
- for( sal_uInt8 i = 0; i < nBoxArrLen; ++i )
- aBoxFmtArr.Insert( (void*)0, i );
+ aBoxFmtArr1.reset(new DfltBoxAttrTmpVecVec( nBoxArrLen, NULL ));
+ }
+ else
+ {
+ aBoxFmtArr2.reset(new std::vector<SwTableBoxFmt*>( nBoxArrLen, NULL ));
}
+
SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1 );
SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0;
@@ -789,11 +798,11 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
nId = nId + static_cast<sal_uInt8>(!i ? 0 :
( i+1 == nCols ? 3 : (1 + ((i-1) & 1))));
if( bUseBoxFmt )
- ::lcl_SetDfltBoxAttr( *pBox, aBoxFmtArr, nId, pTAFmt );
+ ::lcl_SetDfltBoxAttr( *pBox, *aBoxFmtArr1, nId, pTAFmt );
else
{
- bChgSz = 0 == aBoxFmtArr[ nId ];
- pBoxF = ::lcl_CreateAFmtBoxFmt( *this, aBoxFmtArr,
+ bChgSz = 0 == (*aBoxFmtArr2)[ nId ];
+ pBoxF = ::lcl_CreateAFmtBoxFmt( *this, *aBoxFmtArr2,
*pTAFmt, USHRT_MAX, nId );
}
@@ -828,11 +837,11 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
{
sal_uInt8 nId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
if( bUseBoxFmt )
- ::lcl_SetDfltBoxAttr( *pBox, aBoxFmtArr, nId );
+ ::lcl_SetDfltBoxAttr( *pBox, *aBoxFmtArr1, nId );
else
{
- bChgSz = 0 == aBoxFmtArr[ nId ];
- pBoxF = ::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr,
+ bChgSz = 0 == (*aBoxFmtArr2)[ nId ];
+ pBoxF = ::lcl_CreateDfltBoxFmt( *this, *aBoxFmtArr2,
USHRT_MAX, nId );
}
}
@@ -850,8 +859,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
{
for( sal_uInt8 i = 0; i < nBoxArrLen; ++i )
{
- SvPtrarr* pArr = (SvPtrarr*)aBoxFmtArr[ i ];
- delete pArr;
+ delete (*aBoxFmtArr1)[ i ];
}
}
}
commit 772101649cf16233bbaf0900aa9ebbc915151a95
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 14:52:00 2012 +0200
Convert SwDoc::UnProtectCells to use std::vector
Change-Id: Ib1b4756bf26934ded941a7c91c6742e03b942f59
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index d4a1c12..7581885 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4466,22 +4466,22 @@ sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() )
: 0;
- SvPtrarr aFmts( 16 ), aNewFmts( 16 );
+ std::vector<SwFrmFmt*> aFmts, aNewFmts;
for( sal_uInt16 i = rBoxes.Count(); i; )
{
SwTableBox* pBox = rBoxes[ --i ];
SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
if( pBoxFmt->GetProtect().IsCntntProtected() )
{
- sal_uInt16 nFnd = aFmts.GetPos( pBoxFmt );
- if( USHRT_MAX != nFnd )
- pBox->ChgFrmFmt( (SwTableBoxFmt*)aNewFmts[ nFnd ] );
+ std::vector<SwFrmFmt*>::iterator it = std::find( aFmts.begin(), aFmts.end(), pBoxFmt );
+ if( aFmts.end() != it )
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)*it );
else
{
- aFmts.Insert( pBoxFmt, aFmts.Count() );
+ aFmts.push_back( pBoxFmt );
pBoxFmt = pBox->ClaimFrmFmt();
pBoxFmt->ResetFmtAttr( RES_PROTECT );
- aNewFmts.Insert( pBoxFmt, aNewFmts.Count() );
+ aNewFmts.push_back( pBoxFmt );
}
bChgd = sal_True;
}
commit 688dcf0dc155e6278ab9d3a2c61bb720cd792c82
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 14:44:16 2012 +0200
Convert CollectLines methods from Svptrarr to std::vector
Change-Id: I41cdf07194ccbb89600b799d32325634130b0a65
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 3e586b1..e96634c 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -168,10 +168,10 @@ sal_Bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
//Alle veraenderten Zeilen erhalten ggf. ein eigenes FrmFmt.
//Natuerlich darf jede Zeile nur einmal angefasst werden.
-inline void InsertLine( SvPtrarr& rLineArr, SwTableLine* pLine )
+inline void InsertLine( std::vector<SwTableLine*>& rLineArr, SwTableLine* pLine )
{
- if( USHRT_MAX == rLineArr.GetPos( pLine ) )
- rLineArr.Insert( pLine, rLineArr.Count() );
+ if( rLineArr.end() == std::find( rLineArr.begin(), rLineArr.end(), pLine ) )
+ rLineArr.push_back( pLine );
}
//-----------------------------------------------------------------------------
@@ -192,12 +192,12 @@ sal_Bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed )
struct LinesAndTable
{
- SvPtrarr &rLines;
- const SwTable &rTable;
- sal_Bool bInsertLines;
+ std::vector<SwTableLine*> &rLines;
+ const SwTable &rTable;
+ bool bInsertLines;
- LinesAndTable( SvPtrarr &rL, const SwTable &rTbl ) :
- rLines( rL ), rTable( rTbl ), bInsertLines( sal_True ) {}
+ LinesAndTable( std::vector<SwTableLine*> &rL, const SwTable &rTbl ) :
+ rLines( rL ), rTable( rTbl ), bInsertLines( true ) {}
};
@@ -243,7 +243,7 @@ sal_Bool _FindLine( _FndLine& rLine, LinesAndTable* pPara )
return sal_True;
}
-void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLines )
+void lcl_CollectLines( std::vector<SwTableLine*> &rArr, const SwCursor& rCursor, bool bRemoveLines )
{
//Zuerst die selektierten Boxen einsammeln.
SwSelBoxes aBoxes;
@@ -266,14 +266,14 @@ void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLine
// (Not for row split)
if ( bRemoveLines )
{
- for ( sal_uInt16 i = 0; i < rArr.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < rArr.size(); ++i )
{
- SwTableLine *pUpLine = (SwTableLine*)rArr[i];
- for ( sal_uInt16 k = 0; k < rArr.Count(); ++k )
+ SwTableLine *pUpLine = rArr[i];
+ for ( sal_uInt16 k = 0; k < rArr.size(); ++k )
{
- if ( k != i && ::lcl_IsAnLower( pUpLine, (SwTableLine*)rArr[k] ) )
+ if ( k != i && ::lcl_IsAnLower( pUpLine, rArr[k] ) )
{
- rArr.Remove( k );
+ rArr.erase( rArr.begin() + k );
if ( k <= i )
--i;
--k;
@@ -335,10 +335,10 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew )
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
- SvPtrarr aRowArr( 25 ); //Zum sammeln Lines.
+ std::vector<SwTableLine*> aRowArr; //Zum sammeln Lines.
::lcl_CollectLines( aRowArr, rCursor, false );
- if( aRowArr.Count() )
+ if( !aRowArr.empty() )
{
if (GetIDocumentUndoRedo().DoesUndo())
{
@@ -346,10 +346,10 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew )
}
std::vector<SwTblFmtCmp*> aFmtCmp;
- aFmtCmp.reserve( Max( 255, (int)aRowArr.Count() ) );
+ aFmtCmp.reserve( Max( 255, (int)aRowArr.size() ) );
- for( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
- ::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
+ for( sal_uInt16 i = 0; i < aRowArr.size(); ++i )
+ ::lcl_ProcessRowAttr( aFmtCmp, aRowArr[i], rNew );
SwTblFmtCmp::Delete( aFmtCmp );
SetModified();
@@ -368,17 +368,16 @@ void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
- SvPtrarr aRowArr( 25 ); //Zum sammeln der Lines.
+ std::vector<SwTableLine*> aRowArr; //Zum sammeln der Lines.
::lcl_CollectLines( aRowArr, rCursor, false );
- if( aRowArr.Count() )
+ if( !aRowArr.empty() )
{
- rpSz = &(SwFmtRowSplit&)((SwTableLine*)aRowArr[0])->
- GetFrmFmt()->GetRowSplit();
+ rpSz = &(SwFmtRowSplit&)aRowArr[0]->GetFrmFmt()->GetRowSplit();
- for ( sal_uInt16 i = 1; i < aRowArr.Count() && rpSz; ++i )
+ for ( sal_uInt16 i = 1; i < aRowArr.size() && rpSz; ++i )
{
- if ( (*rpSz).GetValue() != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetRowSplit().GetValue() )
+ if ( (*rpSz).GetValue() != aRowArr[i]->GetFrmFmt()->GetRowSplit().GetValue() )
rpSz = 0;
}
if ( rpSz )
@@ -396,10 +395,10 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew )
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
- SvPtrarr aRowArr( 25 ); //Zum sammeln Lines.
+ std::vector<SwTableLine*> aRowArr; //Zum sammeln Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
- if( aRowArr.Count() )
+ if( !aRowArr.empty() )
{
if (GetIDocumentUndoRedo().DoesUndo())
{
@@ -407,9 +406,9 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew )
}
std::vector<SwTblFmtCmp*> aFmtCmp;
- aFmtCmp.reserve( Max( 255, (int)aRowArr.Count() ) );
- for ( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
- ::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
+ aFmtCmp.reserve( Max( 255, (int)aRowArr.size() ) );
+ for ( sal_uInt16 i = 0; i < aRowArr.size(); ++i )
+ ::lcl_ProcessRowSize( aFmtCmp, aRowArr[i], rNew );
SwTblFmtCmp::Delete( aFmtCmp );
SetModified();
@@ -428,17 +427,16 @@ void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
- SvPtrarr aRowArr( 25 ); //Zum sammeln der Lines.
+ std::vector<SwTableLine*> aRowArr; //Zum sammeln der Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
- if( aRowArr.Count() )
+ if( !aRowArr.empty() )
{
- rpSz = &(SwFmtFrmSize&)((SwTableLine*)aRowArr[0])->
- GetFrmFmt()->GetFrmSize();
+ rpSz = &(SwFmtFrmSize&)aRowArr[0]->GetFrmFmt()->GetFrmSize();
- for ( sal_uInt16 i = 1; i < aRowArr.Count() && rpSz; ++i )
+ for ( sal_uInt16 i = 1; i < aRowArr.size() && rpSz; ++i )
{
- if ( *rpSz != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetFrmSize() )
+ if ( *rpSz != aRowArr[i]->GetFrmFmt()->GetFrmSize() )
rpSz = 0;
}
if ( rpSz )
@@ -453,19 +451,19 @@ sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly )
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
- SvPtrarr aRowArr( 25 ); //Zum sammeln der Lines.
+ std::vector<SwTableLine*> aRowArr; //Zum sammeln der Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
- if( 1 < aRowArr.Count() )
+ if( 1 < aRowArr.size() )
{
if( !bTstOnly )
{
long nHeight = 0;
sal_uInt16 i;
- for ( i = 0; i < aRowArr.Count(); ++i )
+ for ( i = 0; i < aRowArr.size(); ++i )
{
- SwIterator<SwFrm,SwFmt> aIter( *((SwTableLine*)aRowArr[i])->GetFrmFmt() );
+ SwIterator<SwFrm,SwFmt> aIter( *aRowArr[i]->GetFrmFmt() );
SwFrm* pFrm = aIter.First();
while ( pFrm )
{
@@ -482,8 +480,8 @@ sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly )
}
std::vector<SwTblFmtCmp*> aFmtCmp;
- aFmtCmp.reserve( Max( 255, (int)aRowArr.Count() ) );
- for( i = 0; i < aRowArr.Count(); ++i )
+ aFmtCmp.reserve( Max( 255, (int)aRowArr.size() ) );
+ for( i = 0; i < aRowArr.size(); ++i )
::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], aNew );
SwTblFmtCmp::Delete( aFmtCmp );
@@ -503,10 +501,10 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
- SvPtrarr aRowArr( 25 ); //Zum sammeln Lines.
+ std::vector<SwTableLine*> aRowArr; //Zum sammeln Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
- if( aRowArr.Count() )
+ if( !aRowArr.empty() )
{
if (GetIDocumentUndoRedo().DoesUndo())
{
@@ -514,10 +512,10 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew
}
std::vector<SwTblFmtCmp*> aFmtCmp;
- aFmtCmp.reserve( Max( 255, (int)aRowArr.Count() ) );
+ aFmtCmp.reserve( Max( 255, (int)aRowArr.size() ) );
- for( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
- ::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
+ for( sal_uInt16 i = 0; i < aRowArr.size(); ++i )
+ ::lcl_ProcessRowAttr( aFmtCmp, aRowArr[i], rNew );
SwTblFmtCmp::Delete( aFmtCmp );
SetModified();
@@ -534,16 +532,16 @@ sal_Bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
- SvPtrarr aRowArr( 25 ); //Zum sammeln Lines.
+ std::vector<SwTableLine*> aRowArr; //Zum sammeln Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
- if( aRowArr.Count() )
+ if( !aRowArr.empty() )
{
- rToFill = ((SwTableLine*)aRowArr[0])->GetFrmFmt()->GetBackground();
+ rToFill = aRowArr[0]->GetFrmFmt()->GetBackground();
bRet = sal_True;
- for ( sal_uInt16 i = 1; i < aRowArr.Count(); ++i )
- if ( rToFill != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetBackground() )
+ for ( sal_uInt16 i = 1; i < aRowArr.size(); ++i )
+ if ( rToFill != aRowArr[i]->GetFrmFmt()->GetBackground() )
{
bRet = sal_False;
break;
commit 4fbbc5a65f28ed1705daeeaeee2bca80dff53828
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 14:10:06 2012 +0200
Convert CollectCells methods from Svptrarr to std::vector
Change-Id: Ic248760338b759476971821252bcfd838e901fef
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index fc3cdd4..3e586b1 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -557,14 +557,14 @@ sal_Bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill
#* Class : SwDoc
#* Methoden : SetTabBorders(), GetTabBorders()
#***********************************************************************/
-inline void InsertCell( SvPtrarr& rCellArr, SwCellFrm* pCellFrm )
+inline void InsertCell( std::vector<SwCellFrm*>& rCellArr, SwCellFrm* pCellFrm )
{
- if( USHRT_MAX == rCellArr.GetPos( pCellFrm ) )
- rCellArr.Insert( pCellFrm, rCellArr.Count() );
+ if( rCellArr.end() == std::find( rCellArr.begin(), rCellArr.end(), pCellFrm ) )
+ rCellArr.push_back( pCellFrm );
}
//-----------------------------------------------------------------------------
-void lcl_CollectCells( SvPtrarr &rArr, const SwRect &rUnion,
+void lcl_CollectCells( std::vector<SwCellFrm*> &rArr, const SwRect &rUnion,
SwTabFrm *pTab )
{
SwLayoutFrm *pCell = pTab->FirstCell();
@@ -663,7 +663,8 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
const SwRect &rUnion = pUnion->GetUnion();
const sal_Bool bLast = i == aUnions.size() - 1 ? sal_True : sal_False;
- SvPtrarr aCellArr( 255 );
+ std::vector<SwCellFrm*> aCellArr;
+ aCellArr.reserve( 255 );
::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
//Alle Zellenkanten, die mit dem UnionRect uebereinstimmen oder
@@ -674,9 +675,9 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
//handelt doch keine Aussenkanten sein.
//Aussenkanten werden links, rechts, oben und unten gesetzt.
//Innenkanten werden nur oben und links gesetzt.
- for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j )
+ for ( sal_uInt16 j = 0; j < aCellArr.size(); ++j )
{
- SwCellFrm *pCell = (SwCellFrm*)aCellArr[j];
+ SwCellFrm *pCell = aCellArr[j];
const sal_Bool bVert = pTab->IsVertical();
const sal_Bool bRTL = pTab->IsRightToLeft();
sal_Bool bTopOver, bLeftOver, bRightOver, bBottomOver;
@@ -859,12 +860,13 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
{
SwSelUnion *pUnion = &aUnions[i];
SwTabFrm *pTab = pUnion->GetTable();
- SvPtrarr aCellArr( 255 );
+ std::vector<SwCellFrm*> aCellArr;
+ aCellArr.reserve( 255 );
::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
- for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j )
+ for ( sal_uInt16 j = 0; j < aCellArr.size(); ++j )
{
- SwCellFrm *pCell = ( SwCellFrm* )aCellArr[j];
+ SwCellFrm *pCell = aCellArr[j];
//Grundsaetzlich nichts setzen in HeadlineRepeats.
if ( pTab->IsFollow() && pTab->IsInHeadline( *pCell ) )
@@ -945,12 +947,13 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
const sal_Bool bFirst = i == 0 ? sal_True : sal_False;
const sal_Bool bLast = i == aUnions.size() - 1 ? sal_True : sal_False;
- SvPtrarr aCellArr( 255 );
+ std::vector<SwCellFrm*> aCellArr;
+ aCellArr.reserve(255);
::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab );
- for ( sal_uInt16 j = 0; j < aCellArr.Count(); ++j )
+ for ( sal_uInt16 j = 0; j < aCellArr.size(); ++j )
{
- const SwCellFrm *pCell = (const SwCellFrm*)aCellArr[j];
+ SwCellFrm *pCell = aCellArr[j];
const sal_Bool bVert = pTab->IsVertical();
const sal_Bool bRTL = pTab->IsRightToLeft();
sal_Bool bTopOver, bLeftOver, bRightOver, bBottomOver;
commit d515ae78bba6a4553d15b0eac0ce9a6f8c8ac3fb
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 14:05:48 2012 +0200
Convert methods in SwTblFmtCmp from Svptrarr to std:vector
Change-Id: Id5ea2ebef401ac414dea5d5376ceaaea08bfe855
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index ba2f350..fc3cdd4 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -79,8 +79,8 @@ public:
SwTblFmtCmp( SwFrmFmt *pOld, SwFrmFmt *pNew, sal_Int16 nType );
- static SwFrmFmt *FindNewFmt( SvPtrarr &rArr, SwFrmFmt*pOld, sal_Int16 nType );
- static void Delete( SvPtrarr &rArr );
+ static SwFrmFmt *FindNewFmt( std::vector<SwTblFmtCmp*> &rArr, SwFrmFmt*pOld, sal_Int16 nType );
+ static void Delete( std::vector<SwTblFmtCmp*> &rArr );
};
@@ -89,21 +89,21 @@ SwTblFmtCmp::SwTblFmtCmp( SwFrmFmt *pO, SwFrmFmt *pN, sal_Int16 nT )
{
}
-SwFrmFmt *SwTblFmtCmp::FindNewFmt( SvPtrarr &rArr, SwFrmFmt *pOld, sal_Int16 nType )
+SwFrmFmt *SwTblFmtCmp::FindNewFmt( std::vector<SwTblFmtCmp*> &rArr, SwFrmFmt *pOld, sal_Int16 nType )
{
- for ( sal_uInt16 i = 0; i < rArr.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < rArr.size(); ++i )
{
- SwTblFmtCmp *pCmp = (SwTblFmtCmp*)rArr[i];
+ SwTblFmtCmp *pCmp = rArr[i];
if ( pCmp->pOld == pOld && pCmp->nType == nType )
return pCmp->pNew;
}
return 0;
}
-void SwTblFmtCmp::Delete( SvPtrarr &rArr )
+void SwTblFmtCmp::Delete( std::vector<SwTblFmtCmp*> &rArr )
{
- for ( sal_uInt16 i = 0; i < rArr.Count(); ++i )
- delete (SwTblFmtCmp*)rArr[i];
+ for ( sal_uInt16 i = 0; i < rArr.size(); ++i )
+ delete rArr[i];
}
void lcl_GetStartEndCell( const SwCursor& rCrsr,
@@ -285,7 +285,7 @@ void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLine
//-----------------------------------------------------------------------------
-void lcl_ProcessRowAttr( SvPtrarr& rFmtCmp, SwTableLine* pLine, const SfxPoolItem& rNew )
+void lcl_ProcessRowAttr( std::vector<SwTblFmtCmp*>& rFmtCmp, SwTableLine* pLine, const SfxPoolItem& rNew )
{
SwFrmFmt *pNewFmt;
if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( rFmtCmp, pLine->GetFrmFmt(), 0 )))
@@ -295,15 +295,15 @@ void lcl_ProcessRowAttr( SvPtrarr& rFmtCmp, SwTableLine* pLine, const SfxPoolIte
SwFrmFmt *pOld = pLine->GetFrmFmt();
SwFrmFmt *pNew = pLine->ClaimFrmFmt();
pNew->SetFmtAttr( rNew );
- rFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, 0 ), rFmtCmp.Count());
+ rFmtCmp.push_back( new SwTblFmtCmp( pOld, pNew, 0 ) );
}
}
//-----------------------------------------------------------------------------
-void lcl_ProcessBoxSize( SvPtrarr &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew );
+void lcl_ProcessBoxSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew );
-void lcl_ProcessRowSize( SvPtrarr &rFmtCmp, SwTableLine *pLine, const SwFmtFrmSize &rNew )
+void lcl_ProcessRowSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableLine *pLine, const SwFmtFrmSize &rNew )
{
lcl_ProcessRowAttr( rFmtCmp, pLine, rNew );
SwTableBoxes &rBoxes = pLine->GetTabBoxes();
@@ -313,7 +313,7 @@ void lcl_ProcessRowSize( SvPtrarr &rFmtCmp, SwTableLine *pLine, const SwFmtFrmSi
//-----------------------------------------------------------------------------
-void lcl_ProcessBoxSize( SvPtrarr &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew )
+void lcl_ProcessBoxSize( std::vector<SwTblFmtCmp*> &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew )
{
SwTableLines &rLines = pBox->GetTabLines();
if ( !rLines.empty() )
@@ -345,7 +345,8 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew )
GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
}
- SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ) );
+ std::vector<SwTblFmtCmp*> aFmtCmp;
+ aFmtCmp.reserve( Max( 255, (int)aRowArr.Count() ) );
for( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
@@ -405,7 +406,8 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew )
GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
}
- SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ) );
+ std::vector<SwTblFmtCmp*> aFmtCmp;
+ aFmtCmp.reserve( Max( 255, (int)aRowArr.Count() ) );
for ( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
SwTblFmtCmp::Delete( aFmtCmp );
@@ -479,7 +481,8 @@ sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly )
new SwUndoAttrTbl(*pTblNd));
}
- SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ) );
+ std::vector<SwTblFmtCmp*> aFmtCmp;
+ aFmtCmp.reserve( Max( 255, (int)aRowArr.Count() ) );
for( i = 0; i < aRowArr.Count(); ++i )
::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], aNew );
SwTblFmtCmp::Delete( aFmtCmp );
@@ -510,7 +513,8 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew
GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
}
- SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ) );
+ std::vector<SwTblFmtCmp*> aFmtCmp;
+ aFmtCmp.reserve( Max( 255, (int)aRowArr.Count() ) );
for( sal_uInt16 i = 0; i < aRowArr.Count(); ++i )
::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
@@ -603,7 +607,8 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) );
}
- SvPtrarr aFmtCmp( 255 );
+ std::vector<SwTblFmtCmp*> aFmtCmp;
+ aFmtCmp.reserve( 255 );
const SvxBoxItem* pSetBox;
const SvxBoxInfoItem *pSetBoxInfo;
@@ -787,7 +792,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
SwFrmFmt *pOld = pBox->GetFrmFmt();
SwFrmFmt *pNew = pBox->ClaimFrmFmt();
pNew->SetFmtAttr( aBox );
- aFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, nType ), aFmtCmp.Count());
+ aFmtCmp.push_back( new SwTblFmtCmp( pOld, pNew, nType ) );
}
}
@@ -1130,7 +1135,8 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) );
}
- SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aBoxes.Count()) ) );
+ std::vector<SwTblFmtCmp*> aFmtCmp;
+ aFmtCmp.reserve( Max( 255, (int)aBoxes.Count() ) );
for ( sal_uInt16 i = 0; i < aBoxes.Count(); ++i )
{
SwTableBox *pBox = aBoxes[i];
@@ -1143,7 +1149,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
SwFrmFmt *pOld = pBox->GetFrmFmt();
SwFrmFmt *pNew = pBox->ClaimFrmFmt();
pNew->SetFmtAttr( rNew );
- aFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, 0 ), aFmtCmp.Count());
+ aFmtCmp.push_back( new SwTblFmtCmp( pOld, pNew, 0 ) );
}
}
commit db5ae90477c0ea851b5c85d8eeefe474cd5d70af
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 13:40:02 2012 +0200
Convert SwNode2LayImpl::pUpperFrms field from Svptrarr to std::vector
Change-Id: I8f1e1c8a0dc92bf0451198d72a264e2d00ae0b0d
diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx
index 08f475e..0f6794e 100644
--- a/sw/source/core/docnode/node2lay.cxx
+++ b/sw/source/core/docnode/node2lay.cxx
@@ -49,7 +49,7 @@ class SwNode2LayImpl
{
SwIterator<SwFrm,SwModify>* pIter;
SwModify* pMod;
- SvPtrarr *pUpperFrms;// Zum Einsammeln der Upper
+ std::vector<SwFrm*>* pUpperFrms;// Zum Einsammeln der Upper
sal_uLong nIndex; // Der Index des einzufuegenden Nodes
sal_Bool bMaster : 1; // sal_True => nur Master , sal_False => nur Frames ohne Follow
sal_Bool bInit : 1; // Ist am SwClient bereits ein First()-Aufruf erfolgt?
@@ -261,7 +261,7 @@ SwFrm* SwNode2LayImpl::NextFrm()
void SwNode2LayImpl::SaveUpperFrms()
{
- pUpperFrms = new SvPtrarr( 0 );
+ pUpperFrms = new std::vector<SwFrm*>;
SwFrm* pFrm;
while( 0 != (pFrm = NextFrm()) )
{
@@ -275,8 +275,8 @@ void SwNode2LayImpl::SaveUpperFrms()
pFrm->FindSctFrm()->ColLock();
if( pPrv && pPrv->IsSctFrm() )
((SwSectionFrm*)pPrv)->LockJoin();
- pUpperFrms->Insert( (void*)pPrv, pUpperFrms->Count() );
- pUpperFrms->Insert( (void*)pFrm, pUpperFrms->Count() );
+ pUpperFrms->push_back( pPrv );
+ pUpperFrms->push_back( pFrm );
}
}
delete pIter;
@@ -356,9 +356,9 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong
SwFrm* pNxt;
SwLayoutFrm* pUp;
if( (pNd = rNds[nStt])->IsCntntNode() )
- for( sal_uInt16 n = 0; n < pUpperFrms->Count(); )
+ for( sal_uInt16 n = 0; n < pUpperFrms->size(); )
{
- pNxt = (SwFrm*)(*pUpperFrms)[n++];
+ pNxt = (*pUpperFrms)[n++];
if( bFirst && pNxt && pNxt->IsSctFrm() )
((SwSectionFrm*)pNxt)->UnlockJoin();
pUp = (SwLayoutFrm*)(*pUpperFrms)[n++];
@@ -371,9 +371,9 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong
(*pUpperFrms)[n-2] = pNew;
}
else if( pNd->IsTableNode() )
- for( sal_uInt16 x = 0; x < pUpperFrms->Count(); )
+ for( sal_uInt16 x = 0; x < pUpperFrms->size(); )
{
- pNxt = (SwFrm*)(*pUpperFrms)[x++];
+ pNxt = (*pUpperFrms)[x++];
if( bFirst && pNxt && pNxt->IsSctFrm() )
((SwSectionFrm*)pNxt)->UnlockJoin();
pUp = (SwLayoutFrm*)(*pUpperFrms)[x++];
@@ -390,9 +390,9 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong
else if( pNd->IsSectionNode() )
{
nStt = pNd->EndOfSectionIndex();
- for( sal_uInt16 x = 0; x < pUpperFrms->Count(); )
+ for( sal_uInt16 x = 0; x < pUpperFrms->size(); )
{
- pNxt = (SwFrm*)(*pUpperFrms)[x++];
+ pNxt = (*pUpperFrms)[x++];
if( bFirst && pNxt && pNxt->IsSctFrm() )
((SwSectionFrm*)pNxt)->UnlockJoin();
pUp = (SwLayoutFrm*)(*pUpperFrms)[x++];
@@ -404,9 +404,9 @@ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong
}
bFirst = sal_False;
}
- for( sal_uInt16 x = 0; x < pUpperFrms->Count(); ++x )
+ for( sal_uInt16 x = 0; x < pUpperFrms->size(); ++x )
{
- SwFrm* pTmp = (SwFrm*)(*pUpperFrms)[++x];
+ SwFrm* pTmp = (*pUpperFrms)[++x];
if( pTmp->IsFtnFrm() )
((SwFtnFrm*)pTmp)->ColUnlock();
else if ( pTmp->IsInSct() )
commit a68012caed65549661ccddebd9dbba4cbf6691ef
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 13:36:37 2012 +0200
Convert local method lcl_GetLayTree from using Svptrarr to std::vector
Change-Id: I806788657a250cccb3740b8b064315e94f58d2f5
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 8bcb2fb..c9f3bf1 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -77,7 +77,7 @@ using ::rtl::OUString;
extern void InsertSort( std::vector<sal_uInt16>& rArr, sal_uInt16 nIdx, sal_uInt16* pInsPos = 0 );
-void lcl_GetLayTree( const SwFrm* pFrm, SvPtrarr& rArr )
+void lcl_GetLayTree( const SwFrm* pFrm, std::vector<const SwFrm*>& rArr )
{
while( pFrm )
{
@@ -85,8 +85,7 @@ void lcl_GetLayTree( const SwFrm* pFrm, SvPtrarr& rArr )
pFrm = pFrm->GetUpper();
else
{
- void* p = (void*)pFrm;
- rArr.Insert( p, rArr.Count() );
+ rArr.push_back( pFrm );
// bei der Seite ist schluss
if( pFrm->IsPageFrm() )
@@ -115,18 +114,18 @@ sal_Bool IsFrameBehind( const SwTxtNode& rMyNd, sal_uInt16 nMySttPos,
if( !pFrm || !pMyFrm || pFrm == pMyFrm )
return sal_False;
- SvPtrarr aRefArr( 10 ), aArr( 10 );
+ std::vector<const SwFrm*> aRefArr, aArr;
::lcl_GetLayTree( pFrm, aRefArr );
::lcl_GetLayTree( pMyFrm, aArr );
- sal_uInt16 nRefCnt = aRefArr.Count() - 1, nCnt = aArr.Count() - 1;
+ sal_uInt16 nRefCnt = aRefArr.size() - 1, nCnt = aArr.size() - 1;
sal_Bool bVert = sal_False;
sal_Bool bR2L = sal_False;
// solange bis ein Frame ungleich ist ?
while( nRefCnt && nCnt && aRefArr[ nRefCnt ] == aArr[ nCnt ] )
{
- const SwFrm* pTmpFrm = (const SwFrm*)aArr[ nCnt ];
+ const SwFrm* pTmpFrm = aArr[ nCnt ];
bVert = pTmpFrm->IsVertical();
bR2L = pTmpFrm->IsRightToLeft();
--nCnt, --nRefCnt;
@@ -141,8 +140,8 @@ sal_Bool IsFrameBehind( const SwTxtNode& rMyNd, sal_uInt16 nMySttPos,
--nRefCnt;
}
- const SwFrm* pRefFrm = (const SwFrm*)aRefArr[ nRefCnt ];
- const SwFrm* pFldFrm = (const SwFrm*)aArr[ nCnt ];
+ const SwFrm* pRefFrm = aRefArr[ nRefCnt ];
+ const SwFrm* pFldFrm = aArr[ nCnt ];
// unterschiedliche Frames, dann ueberpruefe deren Y-/X-Position
sal_Bool bRefIsLower = sal_False;
@@ -174,9 +173,9 @@ sal_Bool IsFrameBehind( const SwTxtNode& rMyNd, sal_uInt16 nMySttPos,
pRefFrm = 0;
}
else if( ( FRM_COLUMN | FRM_CELL ) & pFldFrm->GetType() )
- pFldFrm = (const SwFrm*)aArr[ nCnt - 1 ];
+ pFldFrm = aArr[ nCnt - 1 ];
else
- pRefFrm = (const SwFrm*)aRefArr[ nRefCnt - 1 ];
+ pRefFrm = aRefArr[ nRefCnt - 1 ];
}
if( pRefFrm ) // als Flag missbrauchen
commit 51bf3fb3aa35ccd7e777186b34969450c03e4515
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 13:32:49 2012 +0200
Convert local vars in lcl_FindStartEndRow from Svptrarr to std::vector
Change-Id: I4c429fa1b2e175f3cf5f24cad7d0d2ff401ed473
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 1730e37..8444e87 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -1579,37 +1579,35 @@ void lcl_FindStartEndRow( const SwLayoutFrm *&rpStart,
while ( rpEnd->GetNext() )
rpEnd = (SwLayoutFrm*)rpEnd->GetNext();
- SvPtrarr aSttArr( 8 ), aEndArr( 8 );
+ std::deque<const SwLayoutFrm *> aSttArr, aEndArr;
const SwLayoutFrm *pTmp;
for( pTmp = rpStart; (FRM_CELL|FRM_ROW) & pTmp->GetType();
pTmp = pTmp->GetUpper() )
{
- void* p = (void*)pTmp;
- aSttArr.Insert( p, 0 );
+ aSttArr.push_front( pTmp );
}
for( pTmp = rpEnd; (FRM_CELL|FRM_ROW) & pTmp->GetType();
pTmp = pTmp->GetUpper() )
{
- void* p = (void*)pTmp;
- aEndArr.Insert( p, 0 );
+ aEndArr.push_front( pTmp );
}
- for( sal_uInt16 n = 0; n < aEndArr.Count() && n < aSttArr.Count(); ++n )
+ for( sal_uInt16 n = 0; n < aEndArr.size() && n < aSttArr.size(); ++n )
if( aSttArr[ n ] != aEndArr[ n ] )
{
// first unequal line or box - all odds are
if( n & 1 ) // 1, 3, 5, ... are boxes
{
- rpStart = (SwLayoutFrm*)aSttArr[ n ];
- rpEnd = (SwLayoutFrm*)aEndArr[ n ];
+ rpStart = aSttArr[ n ];
+ rpEnd = aEndArr[ n ];
}
else // 0, 2, 4, ... are lines
{
// check if start & end line are the first & last Line of the
// box. If not return these cells.
// Else the hole line with all Boxes has to be deleted.
- rpStart = (SwLayoutFrm*)aSttArr[ n+1 ];
- rpEnd = (SwLayoutFrm*)aEndArr[ n+1 ];
+ rpStart = aSttArr[ n+1 ];
+ rpEnd = aEndArr[ n+1 ];
if( n )
{
const SwCellFrm* pCellFrm = (SwCellFrm*)aSttArr[ n-1 ];
commit 0d70bdf1e038a0dee79ca448f994932a3b655413
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 13:28:59 2012 +0200
Remove unnecessary forward declaration
Change-Id: I602b38d7dcf494778e6bfa2d92e8393cc0efa3fd
diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx
index 1c30222..02c5d20 100644
--- a/sw/source/core/inc/doctxm.hxx
+++ b/sw/source/core/inc/doctxm.hxx
@@ -35,7 +35,6 @@
#include <section.hxx>
class SwTOXInternational;
-class SvPtrarr;
class SwPageDesc;
class SwTxtNode;
class SwTxtFmtColl;
commit 359b76bc494051d27318ca6b8ae19035c7955252
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 13:26:58 2012 +0200
Convert SwTOXBaseSection::UpdatePageNum param from Svptrarr to std::vector
Change-Id: I707586eea89cd6250b7c5777c68e51acc88e0701
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index e814d27..db44bc3 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1879,7 +1879,7 @@ void SwTOXBaseSection::UpdatePageNum()
{
// Loop over all SourceNodes
std::vector<sal_uInt16> aNums; // the PageNumber
- SvPtrarr aDescs; // The PageDescriptors matching the PageNumbers
+ std::vector<SwPageDesc*> aDescs; // The PageDescriptors matching the PageNumbers
std::vector<sal_uInt16> *pMainNums = 0; // contains page numbers of main entries
// process run in lines
@@ -1940,7 +1940,7 @@ void SwTOXBaseSection::UpdatePageNum()
if( i >= aNums.size() || aNums[ i ] != nPage )
{
aNums.insert(aNums.begin() + i, nPage);
- aDescs.Insert( (void*)pAktPage->GetPageDesc(), i );
+ aDescs.insert(aDescs.begin() + i, pAktPage->GetPageDesc() );
}
// is it a main entry?
if(TOX_SORT_INDEX == pSortBase->GetType() &&
@@ -1986,7 +1986,7 @@ sal_Bool lcl_HasMainEntry( const std::vector<sal_uInt16>* pMainEntryNums, sal_uI
void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
const std::vector<sal_uInt16>& rNums,
- const SvPtrarr & rDescs,
+ const std::vector<SwPageDesc*>& rDescs,
const std::vector<sal_uInt16>* pMainEntryNums,
const SwTOXInternational& rIntl )
{
@@ -2009,7 +2009,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
sal_uInt16 nOld = rNums[0],
nBeg = nOld,
nCount = 0;
- String aNumStr( SvxNumberType( ((SwPageDesc*)rDescs[0])->GetNumType() ).
+ String aNumStr( SvxNumberType( rDescs[0]->GetNumType() ).
GetNumStr( nBeg ) );
if( pCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg ))
{
@@ -2038,7 +2038,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
for( i = 1; i < rNums.size(); ++i)
{
- SvxNumberType aType( ((SwPageDesc*)rDescs[i])->GetNumType() );
+ SvxNumberType aType( rDescs[i]->GetNumType() );
if( TOX_INDEX == SwTOXBase::GetType() )
{ // Summarize for the following
// Add up all following
@@ -2105,8 +2105,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
aNumStr.AppendAscii( sPageDeli );
//#58127# If nCount == 0, then the only PageNumber is already in aNumStr!
if(nCount)
- aNumStr += SvxNumberType( ((SwPageDesc*)rDescs[i-1])->
- GetNumType() ).GetNumStr( nBeg+nCount );
+ aNumStr += SvxNumberType( rDescs[i-1]->GetNumType() ).GetNumStr( nBeg+nCount );
}
}
pNd->InsertText( aNumStr, aPos,
diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx
index c3b0ee7..1c30222 100644
--- a/sw/source/core/inc/doctxm.hxx
+++ b/sw/source/core/inc/doctxm.hxx
@@ -74,7 +74,7 @@ class SwTOXBaseSection : public SwTOXBase, public SwSection
// replace page num placeholder with actual page number
void _UpdatePageNum( SwTxtNode* pNd,
const std::vector<sal_uInt16>& rNums,
- const SvPtrarr &rDescs,
+ const std::vector<SwPageDesc*>& rDescs,
const std::vector<sal_uInt16>* pMainEntryNums,
const SwTOXInternational& rIntl );
commit b570cc6f22bca9dfde82d72ac17534934260913c
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 12:01:01 2012 +0200
Convert SwShareBoxFmt and SwShareBoxFmts from Svptrarr to std::vector
Change-Id: I9f3b53992af8db54c6e8229c750143a1d5f047a7
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 0bbc137..f56f878 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -4534,8 +4534,8 @@ sal_Bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
SwFrmFmt* SwShareBoxFmt::GetFormat( long nWidth ) const
{
SwFrmFmt *pRet = 0, *pTmp;
- for( sal_uInt16 n = aNewFmts.Count(); n; )
- if( ( pTmp = (SwFrmFmt*)aNewFmts[ --n ])->GetFrmSize().GetWidth()
+ for( sal_uInt16 n = aNewFmts.size(); n; )
+ if( ( pTmp = aNewFmts[ --n ])->GetFrmSize().GetWidth()
== nWidth )
{
pRet = pTmp;
@@ -4550,8 +4550,8 @@ SwFrmFmt* SwShareBoxFmt::GetFormat( const SfxPoolItem& rItem ) const
sal_uInt16 nWhich = rItem.Which();
SwFrmFmt *pRet = 0, *pTmp;
const SfxPoolItem& rFrmSz = pOldFmt->GetFmtAttr( RES_FRM_SIZE, sal_False );
- for( sal_uInt16 n = aNewFmts.Count(); n; )
- if( SFX_ITEM_SET == ( pTmp = (SwFrmFmt*)aNewFmts[ --n ])->
+ for( sal_uInt16 n = aNewFmts.size(); n; )
+ if( SFX_ITEM_SET == ( pTmp = aNewFmts[ --n ])->
GetItemState( nWhich, sal_False, &pItem ) && *pItem == rItem &&
pTmp->GetFmtAttr( RES_FRM_SIZE, sal_False ) == rFrmSz )
{
@@ -4561,23 +4561,21 @@ SwFrmFmt* SwShareBoxFmt::GetFormat( const SfxPoolItem& rItem ) const
return pRet;
}
-void SwShareBoxFmt::AddFormat( const SwFrmFmt& rNew )
+void SwShareBoxFmt::AddFormat( SwFrmFmt& rNew )
{
- void* pFmt = (void*)&rNew;
- aNewFmts.Insert( pFmt, aNewFmts.Count() );
+ aNewFmts.push_back( &rNew );
}
-sal_Bool SwShareBoxFmt::RemoveFormat( const SwFrmFmt& rFmt )
+bool SwShareBoxFmt::RemoveFormat( const SwFrmFmt& rFmt )
{
// returns sal_True, if we can delete
if( pOldFmt == &rFmt )
return sal_True;
- void* p = (void*)&rFmt;
- sal_uInt16 nFnd = aNewFmts.GetPos( p );
- if( USHRT_MAX != nFnd )
- aNewFmts.Remove( nFnd );
- return 0 == aNewFmts.Count();
+ std::vector<SwFrmFmt*>::iterator it = std::find( aNewFmts.begin(), aNewFmts.end(), &rFmt );
+ if( aNewFmts.end() != it )
+ aNewFmts.erase( it );
+ return aNewFmts.empty();
}
SwShareBoxFmts::~SwShareBoxFmts()
@@ -4600,7 +4598,7 @@ SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt,
: 0;
}
-void SwShareBoxFmts::AddFormat( const SwFrmFmt& rOld, const SwFrmFmt& rNew )
+void SwShareBoxFmts::AddFormat( const SwFrmFmt& rOld, SwFrmFmt& rNew )
{
{
sal_uInt16 nPos;
diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx
index a7884e1..bbd6cbd 100644
--- a/sw/source/core/inc/tblrwcl.hxx
+++ b/sw/source/core/inc/tblrwcl.hxx
@@ -159,20 +159,20 @@ void lcl_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara );
class SwShareBoxFmt
{
const SwFrmFmt* pOldFmt;
- SvPtrarr aNewFmts;
+ std::vector<SwFrmFmt*> aNewFmts;
public:
SwShareBoxFmt( const SwFrmFmt& rFmt )
- : pOldFmt( &rFmt ), aNewFmts( 1 )
+ : pOldFmt( &rFmt ), aNewFmts()
{}
const SwFrmFmt& GetOldFormat() const { return *pOldFmt; }
SwFrmFmt* GetFormat( long nWidth ) const;
SwFrmFmt* GetFormat( const SfxPoolItem& rItem ) const;
- void AddFormat( const SwFrmFmt& rFmt );
+ void AddFormat( SwFrmFmt& rFmt );
// returnt sal_True, wenn geloescht werden kann
- sal_Bool RemoveFormat( const SwFrmFmt& rFmt );
+ bool RemoveFormat( const SwFrmFmt& rFmt );
};
@@ -192,7 +192,7 @@ public:
SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, long nWidth ) const;
SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, const SfxPoolItem& ) const;
- void AddFormat( const SwFrmFmt& rOld, const SwFrmFmt& rNew );
+ void AddFormat( const SwFrmFmt& rOld, SwFrmFmt& rNew );
void SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz );
void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
commit 2b5aa5cf373aa933255c582716408d960a025503
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 11:38:00 2012 +0200
Convert methods in ftnbos.hxx from Svptrarr to std::vector
Change-Id: Ia2424719aa45fecbe0d3642683bbdc581aaf78ee
diff --git a/sw/source/core/inc/ftnboss.hxx b/sw/source/core/inc/ftnboss.hxx
index 2083fc0..c1b78bf 100644
--- a/sw/source/core/inc/ftnboss.hxx
+++ b/sw/source/core/inc/ftnboss.hxx
@@ -53,6 +53,8 @@ public:
#define NA_GROW_ADJUST 2
#define NA_ADJUST_GROW 3
+typedef std::vector<SwFtnFrm*> SwFtnFrms;
+
class SwFtnBossFrm: public SwLayoutFrm
{
// for private footnote operations
@@ -108,7 +110,7 @@ public:
// <_pRefFtnBossFrm> has to be referenced by an object.
static void _CollectFtns( const SwCntntFrm* _pRef,
SwFtnFrm* _pFtn,
- SvPtrarr& _rFtnArr,
+ SwFtnFrms& _rFtnArr,
const sal_Bool _bCollectOnlyPreviousFtns = sal_False,
const SwFtnBossFrm* _pRefFtnBossFrm = NULL);
// The parameter <_bCollectOnlyPreviousFtns> controls if only footnotes
@@ -116,9 +118,9 @@ public:
// collected.
void CollectFtns( const SwCntntFrm* _pRef,
SwFtnBossFrm* _pOld,
- SvPtrarr& _rFtnArr,
+ SwFtnFrms& _rFtnArr,
const sal_Bool _bCollectOnlyPreviousFtns = sal_False );
- void _MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc = sal_False );
+ void _MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc = sal_False );
void MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest,
SwTxtFtn *pAttr );
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index c7124fd..5f78c91 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1931,7 +1931,7 @@ void SwFtnBossFrm::ChangeFtnRef( const SwCntntFrm *pOld, const SwTxtFtn *pAttr,
/// footnote boss frame <this> have to be collected.
void SwFtnBossFrm::CollectFtns( const SwCntntFrm* _pRef,
SwFtnBossFrm* _pOld,
- SvPtrarr& _rFtnArr,
+ SwFtnFrms& _rFtnArr,
const sal_Bool _bCollectOnlyPreviousFtns )
{
SwFtnFrm *pFtn = _pOld->FindFirstFtn();
@@ -1989,10 +1989,10 @@ void SwFtnBossFrm::CollectFtns( const SwCntntFrm* _pRef,
|* SwFtnBossFrm::_CollectFtns()
|*
|*************************************************************************/
-inline void FtnInArr( SvPtrarr& rFtnArr, SwFtnFrm* pFtn )
+inline void FtnInArr( SwFtnFrms& rFtnArr, SwFtnFrm* pFtn )
{
- if ( USHRT_MAX == rFtnArr.GetPos( (VoidPtr)pFtn ) )
- rFtnArr.Insert( (VoidPtr)pFtn, rFtnArr.Count() );
+ if ( rFtnArr.end() == std::find( rFtnArr.begin(), rFtnArr.end(), pFtn ) )
+ rFtnArr.push_back( pFtn );
}
/// OD 03.04.2003 #108446# - add parameters <_bCollectOnlyPreviousFtns> and
@@ -2003,7 +2003,7 @@ inline void FtnInArr( SvPtrarr& rFtnArr, SwFtnFrm* pFtn )
/// Adjust parameter names.
void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
SwFtnFrm* _pFtn,
- SvPtrarr& _rFtnArr,
+ SwFtnFrms& _rFtnArr,
sal_Bool _bCollectOnlyPreviousFtns,
const SwFtnBossFrm* _pRefFtnBossFrm)
{
@@ -2018,7 +2018,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
//(der Inhalt zu einem Attribut kann ueber mehrere Seiten verteilt sein)
//und ausschneiden.
- SvPtrarr aNotFtnArr( 20 ); //Zur Robustheit werden hier die nicht
+ SwFtnFrms aNotFtnArr; //Zur Robustheit werden hier die nicht
//dazugehoerigen Fussnoten eingetragen.
//Wenn eine Fussnote zweimal angefasst wird
//ists vorbei! So kommt die Funktion auch
@@ -2135,8 +2135,8 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
break;
}
if ( pNxtFtn &&
- USHRT_MAX == _rFtnArr.GetPos( (VoidPtr)pNxtFtn ) &&
- USHRT_MAX == aNotFtnArr.GetPos( (VoidPtr)pNxtFtn ) )
+ _rFtnArr.end() == std::find( _rFtnArr.begin(), _rFtnArr.end(), pNxtFtn ) &&
+ aNotFtnArr.end() == std::find( aNotFtnArr.begin(), aNotFtnArr.end(), pNxtFtn ) )
_pFtn = pNxtFtn;
else
break;
@@ -2150,7 +2150,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
|*************************************************************************/
-void SwFtnBossFrm::_MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc )
+void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc )
{
//Alle Fussnoten die von pRef referenziert werden muessen von der
//aktuellen Position, die sich durch die alte Spalte/Seite ergab, auf eine
@@ -2162,9 +2162,9 @@ void SwFtnBossFrm::_MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc )
// #i21478# - keep last inserted footnote in order to
// format the content of the following one.
SwFtnFrm* pLastInsertedFtn = 0L;
- for ( sal_uInt16 i = 0; i < rFtnArr.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < rFtnArr.size(); ++i )
{
- SwFtnFrm *pFtn = (SwFtnFrm*)rFtnArr[i];
+ SwFtnFrm *pFtn = rFtnArr[i];
SwFtnBossFrm* pRefBoss = pFtn->GetRef()->FindFtnBossFrm( sal_True );
if( pRefBoss != this )
@@ -2377,9 +2377,9 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest,
OSL_ENSURE( pDestBoss, "+SwPageFrm::MoveFtns: no destination boss" );
if( pDestBoss ) // robust
{
- SvPtrarr aFtnArr( 5 );
+ SwFtnFrms aFtnArr;
pDestBoss->_CollectFtns( pDest, pFtn, aFtnArr );
- if ( aFtnArr.Count() )
+ if ( !aFtnArr.empty() )
{
pDestBoss->_MoveFtns( aFtnArr, sal_True );
SwPageFrm* pSrcPage = FindPageFrm();
@@ -2888,7 +2888,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
if( !pStart )
pStart = ContainsCntnt();
- SvPtrarr aFtnArr( 5 );
+ SwFtnFrms aFtnArr;
while ( IsAnLower( pStart ) )
{
@@ -2906,13 +2906,13 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
OSL_ENSURE( pOldBoss->IsInSct() == pNewBoss->IsInSct(),
"MoveLowerFtns: Section confusion" );
- SvPtrarr *pFtnArr;
+ SwFtnFrms *pFtnArr;
SwLayoutFrm* pNewChief = 0;
SwLayoutFrm* pOldChief = 0;
if( pStart && pOldBoss->IsInSct() && ( pOldChief = pOldBoss->FindSctFrm() )
!= ( pNewChief = pNewBoss->FindSctFrm() ) )
{
- pFtnArr = new SvPtrarr( 5 );
+ pFtnArr = new SwFtnFrms;
pOldChief = pOldBoss->FindFtnBossFrm( sal_True );
pNewChief = pNewBoss->FindFtnBossFrm( sal_True );
while( pOldChief->IsAnLower( pStart ) )
@@ -2922,7 +2922,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
(SwFtnBossFrm*)pOldBoss, *pFtnArr );
pStart = pStart->GetNextCntntFrm();
}
- if( !pFtnArr->Count() )
+ if( pFtnArr->empty() )
{
delete pFtnArr;
pFtnArr = NULL;
@@ -2931,9 +2931,9 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
else
pFtnArr = NULL;
- if ( aFtnArr.Count() || pFtnArr )
+ if ( !aFtnArr.empty() || pFtnArr )
{
- if( aFtnArr.Count() )
+ if( !aFtnArr.empty() )
pNewBoss->_MoveFtns( aFtnArr, sal_True );
if( pFtnArr )
{
diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx
index aa2ac46..68264c9 100644
--- a/sw/source/core/layout/layouter.cxx
+++ b/sw/source/core/layout/layouter.cxx
@@ -60,7 +60,7 @@ class SwEndnoter
{
SwLayouter* pMaster;
SwSectionFrm* pSect;
- SvPtrarr* pEndArr;
+ SwFtnFrms* pEndArr;
public:
SwEndnoter( SwLayouter* pLay )
: pMaster( pLay ), pSect( NULL ), pEndArr( NULL ) {}
@@ -69,7 +69,7 @@ public:
void CollectEndnote( SwFtnFrm* pFtn );
const SwSectionFrm* GetSect() const { return pSect; }
void InsertEndnotes();
- sal_Bool HasEndnotes() const { return pEndArr && pEndArr->Count(); }
+ sal_Bool HasEndnotes() const { return pEndArr && !pEndArr->empty(); }
};
void SwEndnoter::CollectEndnotes( SwSectionFrm* pSct )
@@ -84,7 +84,7 @@ void SwEndnoter::CollectEndnotes( SwSectionFrm* pSct )
void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
{
- if( pEndArr && USHRT_MAX != pEndArr->GetPos( (VoidPtr)pFtn ) )
+ if( pEndArr && pEndArr->end() != std::find( pEndArr->begin(), pEndArr->end(), pFtn ) )
return;
if( pFtn->GetUpper() )
@@ -117,9 +117,9 @@ void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
}
else if( pEndArr )
{
- for ( sal_uInt16 i = 0; i < pEndArr->Count(); ++i )
+ for ( sal_uInt16 i = 0; i < pEndArr->size(); ++i )
{
- SwFtnFrm *pEndFtn = (SwFtnFrm*)((*pEndArr)[i]);
+ SwFtnFrm *pEndFtn = (*pEndArr)[i];
if( pEndFtn->GetAttr() == pFtn->GetAttr() )
{
delete pFtn;
@@ -128,15 +128,15 @@ void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
}
}
if( !pEndArr )
- pEndArr = new SvPtrarr( 5 ); // deleted from the SwLayouter
- pEndArr->Insert( (VoidPtr)pFtn, pEndArr->Count() );
+ pEndArr = new SwFtnFrms; // deleted from the SwLayouter
+ pEndArr->push_back( pFtn );
}
void SwEndnoter::InsertEndnotes()
{
if( !pSect )
return;
- if( !pEndArr || !pEndArr->Count() )
+ if( !pEndArr || pEndArr->empty() )
{
pSect = NULL;
return;
commit e0b82cafcea4efc91ed1f43ffa0e3aec5236e849
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 10:42:06 2012 +0200
Convert local variable from Svptrarr to std::vector
Change-Id: I1fc34aa0beffd487c80313e3fed2db158578a6ad
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index c6d4e62..f60ec46 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -641,7 +641,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
static const long nAdd = 20;
- SvPtrarr aCheck( 64 );
+ std::vector<SwLineRect*> aCheck;
for (size_t i = 0; i < this->size(); ++i)
{
@@ -649,7 +649,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
if ( !rL1.GetTab() || rL1.IsPainted() || rL1.IsLocked() )
continue;
- aCheck.Remove( 0, aCheck.Count() );
+ aCheck.clear();
const sal_Bool bVert = rL1.Height() > rL1.Width();
long nL1a, nL1b, nL1c, nL1d;
@@ -692,23 +692,22 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
(nL1c >= nL2c && nL1b - nAdd < nL2c) ||
(nL1b <= nL2b && nL1c + nAdd > nL2b)) )
{
- SwLineRect *pMSC = &rL2;
- aCheck.Insert( pMSC, aCheck.Count() );
+ aCheck.push_back( &rL2 );
}
}
- if ( aCheck.Count() < 2 )
+ if ( aCheck.size() < 2 )
continue;
sal_Bool bRemove = sal_False;
// For each line test all following ones.
- for ( sal_uInt16 k = 0; !bRemove && k < aCheck.Count(); ++k )
+ for ( sal_uInt16 k = 0; !bRemove && k < aCheck.size(); ++k )
{
- SwLineRect &rR1 = (SwLineRect&)*(SwLineRect*)aCheck[k];
+ SwLineRect &rR1 = *aCheck[k];
- for ( sal_uInt16 k2 = k+1; !bRemove && k2 < aCheck.Count(); ++k2 )
+ for ( sal_uInt16 k2 = k+1; !bRemove && k2 < aCheck.size(); ++k2 )
{
- SwLineRect &rR2 = (SwLineRect&)*(SwLineRect*)aCheck[k2];
+ SwLineRect &rR2 = *aCheck[k2];
if ( bVert )
{
SwLineRect *pLA = 0;
@@ -738,7 +737,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
if ( isFull() )
{
--i;
- k = aCheck.Count();
+ k = aCheck.size();
break;
}
}
@@ -778,7 +777,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut )
if ( isFull() )
{
--i;
- k = aCheck.Count();
+ k = aCheck.size();
break;
}
}
commit 4055b68f6b4eb45d6ce18a7f3cf74659d2a7e8ca
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Jun 25 18:53:01 2012 +0200
fix previous commit:
The SwOLELRUCache::InsertObj is wrong for the case when the vector is
empty; because "it != begin()" is false then (whereas "if (nPos)" is
true), the object would not be inserted.
Also do some more cleanup while at it.
Change-Id: I9107c8861c77f99b92654aac11fb4d96cccd4307
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index a01e858..006cdcc 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -68,10 +68,13 @@ using namespace utl;
using namespace com::sun::star::uno;
using namespace com::sun::star;
-class SwOLELRUCache : private std::deque<SwOLEObj*>, private utl::ConfigItem
+class SwOLELRUCache
+ : private utl::ConfigItem
{
- sal_uInt16 nLRU_InitSize;
- sal_Bool bInUnload;
+private:
+ typedef std::deque<SwOLEObj *> OleObjects_t;
+ OleObjects_t m_OleObjects;
+ sal_Int32 m_nLRU_InitSize;
uno::Sequence< rtl::OUString > GetPropertyNames();
public:
@@ -82,16 +85,17 @@ public:
virtual void Commit();
void Load();
- void SetInUnload( sal_Bool bFlag ) { bInUnload = bFlag; }
-
void InsertObj( SwOLEObj& rObj );
void RemoveObj( SwOLEObj& rObj );
void RemovePtr( SwOLEObj* pObj )
{
- iterator it = std::find( begin(), end(), pObj );
- if( it != end() )
- erase( it );
+ OleObjects_t::iterator const it =
+ std::find(m_OleObjects.begin(), m_OleObjects.end(), pObj);
+ if (it != m_OleObjects.end())
+ {
+ m_OleObjects.erase(it);
+ }
}
};
@@ -897,10 +901,8 @@ String SwOLEObj::GetDescription()
SwOLELRUCache::SwOLELRUCache()
- : std::deque<SwOLEObj*>(),
- utl::ConfigItem(OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Cache"))),
- nLRU_InitSize( 20 ),
- bInUnload( sal_False )
+ : utl::ConfigItem(OUString("Office.Common/Cache"))
+ , m_nLRU_InitSize( 20 )
{
EnableNotification( GetPropertyNames() );
Load();
@@ -935,16 +937,16 @@ void SwOLELRUCache::Load()
*pValues >>= nVal;
{
- if( nVal < nLRU_InitSize )
+ if (nVal < m_nLRU_InitSize)
{
// size of cache has been changed
- sal_uInt16 nCount = size();
- sal_uInt16 nPos = nCount;
+ sal_Int32 nCount = m_OleObjects.size();
+ sal_Int32 nPos = nCount;
// try to remove the last entries until new maximum size is reached
while( nCount > nVal )
{
- SwOLEObj* pObj = operator[]( --nPos );
+ SwOLEObj *const pObj = m_OleObjects[ --nPos ];
if ( pObj->UnloadObject() )
nCount--;
if ( !nPos )
@@ -953,28 +955,32 @@ void SwOLELRUCache::Load()
}
}
- nLRU_InitSize = (sal_uInt16)nVal;
+ m_nLRU_InitSize = nVal;
}
}
void SwOLELRUCache::InsertObj( SwOLEObj& rObj )
{
SwOLEObj* pObj = &rObj;
- iterator it = std::find( begin(), end(), pObj );
- if( it != begin() )
+ OleObjects_t::iterator it =
+ std::find(m_OleObjects.begin(), m_OleObjects.end(), pObj);
+ if (it != m_OleObjects.end() && it != m_OleObjects.begin())
{
- // object is currently not the first in cache
- if( it != end() )
- erase( it );
-
- push_front( pObj );
+ // object in cache but is currently not the first in cache
+ m_OleObjects.erase(it);
+ it = m_OleObjects.end();
+ }
+ if (it == m_OleObjects.end())
+ {
+ m_OleObjects.push_front( pObj );
- // try to remove objects if necessary (of course not the freshly inserted one at nPos=0)
- sal_uInt16 nCount = size();
- sal_uInt16 nPos = nCount-1;
- while( nPos && nCount > nLRU_InitSize )
+ // try to remove objects if necessary
+ // (of course not the freshly inserted one at nPos=0)
+ sal_Int32 nCount = m_OleObjects.size();
+ sal_Int32 nPos = nCount-1;
+ while (nPos && nCount > m_nLRU_InitSize)
{
- pObj = operator[]( nPos-- );
+ pObj = m_OleObjects[ nPos-- ];
if ( pObj->UnloadObject() )
nCount--;
}
@@ -983,11 +989,16 @@ void SwOLELRUCache::InsertObj( SwOLEObj& rObj )
void SwOLELRUCache::RemoveObj( SwOLEObj& rObj )
{
- iterator it = std::find( begin(), end(), &rObj );
- if ( it != end() )
- erase( it );
- if( empty() )
+ OleObjects_t::iterator const it =
+ std::find(m_OleObjects.begin(), m_OleObjects.end(), &rObj);
+ if (it != m_OleObjects.end())
+ {
+ m_OleObjects.erase(it);
+ }
+ if (m_OleObjects.empty())
+ {
DELETEZ( pOLELRU_Cache );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 8f5018277b83c3ad763a9d29efcdfbe4071c457f
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 10:31:35 2012 +0200
Convert class SwOLELRUCache from Svptrarr to std::deque
Change-Id: I9c63a346db6b8ba3d463d5a9d78ccc21b7f6be5f
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 89d53d0..a01e858 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -68,7 +68,7 @@ using namespace utl;
using namespace com::sun::star::uno;
using namespace com::sun::star;
-class SwOLELRUCache : private SvPtrarr, private utl::ConfigItem
+class SwOLELRUCache : private std::deque<SwOLEObj*>, private utl::ConfigItem
{
sal_uInt16 nLRU_InitSize;
sal_Bool bInUnload;
@@ -83,16 +83,15 @@ public:
void Load();
void SetInUnload( sal_Bool bFlag ) { bInUnload = bFlag; }
- using SvPtrarr::Count;
void InsertObj( SwOLEObj& rObj );
void RemoveObj( SwOLEObj& rObj );
void RemovePtr( SwOLEObj* pObj )
{
- sal_uInt16 nPos = SvPtrarr::GetPos( pObj );
- if( USHRT_MAX != nPos )
- SvPtrarr::Remove( nPos );
+ iterator it = std::find( begin(), end(), pObj );
+ if( it != end() )
+ erase( it );
}
};
@@ -898,7 +897,7 @@ String SwOLEObj::GetDescription()
SwOLELRUCache::SwOLELRUCache()
- : SvPtrarr( 64 ),
+ : std::deque<SwOLEObj*>(),
utl::ConfigItem(OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Cache"))),
nLRU_InitSize( 20 ),
bInUnload( sal_False )
@@ -939,13 +938,13 @@ void SwOLELRUCache::Load()
if( nVal < nLRU_InitSize )
{
// size of cache has been changed
- sal_uInt16 nCount = SvPtrarr::Count();
+ sal_uInt16 nCount = size();
sal_uInt16 nPos = nCount;
// try to remove the last entries until new maximum size is reached
while( nCount > nVal )
{
- SwOLEObj* pObj = (SwOLEObj*) SvPtrarr::GetObject( --nPos );
+ SwOLEObj* pObj = operator[]( --nPos );
if ( pObj->UnloadObject() )
nCount--;
if ( !nPos )
@@ -961,21 +960,21 @@ void SwOLELRUCache::Load()
void SwOLELRUCache::InsertObj( SwOLEObj& rObj )
{
SwOLEObj* pObj = &rObj;
- sal_uInt16 nPos = SvPtrarr::GetPos( pObj );
- if( nPos )
+ iterator it = std::find( begin(), end(), pObj );
+ if( it != begin() )
{
// object is currently not the first in cache
- if( USHRT_MAX != nPos )
- SvPtrarr::Remove( nPos );
+ if( it != end() )
+ erase( it );
- SvPtrarr::Insert( pObj, 0 );
+ push_front( pObj );
// try to remove objects if necessary (of course not the freshly inserted one at nPos=0)
- sal_uInt16 nCount = SvPtrarr::Count();
- nPos = nCount-1;
+ sal_uInt16 nCount = size();
+ sal_uInt16 nPos = nCount-1;
while( nPos && nCount > nLRU_InitSize )
{
- pObj = (SwOLEObj*) SvPtrarr::GetObject( nPos-- );
+ pObj = operator[]( nPos-- );
if ( pObj->UnloadObject() )
nCount--;
}
@@ -984,10 +983,10 @@ void SwOLELRUCache::InsertObj( SwOLEObj& rObj )
void SwOLELRUCache::RemoveObj( SwOLEObj& rObj )
{
- sal_uInt16 nPos = SvPtrarr::GetPos( &rObj );
- if ( nPos != 0xFFFF )
- SvPtrarr::Remove( nPos );
- if( !Count() )
+ iterator it = std::find( begin(), end(), &rObj );
+ if ( it != end() )
+ erase( it );
+ if( empty() )
DELETEZ( pOLELRU_Cache );
}
commit 64fff61725bd8c668f23c7f6304f87962b613140
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 10:17:25 2012 +0200
Convert some local methods from Svptrarr to std::vector<SwFmt*>
Change-Id: I071199c477bd27ac30c71f65c1b8938525ce2a58
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index a9b3602..5dbbabe 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -321,26 +321,26 @@ SwTable::~SwTable()
|* SwTable::Modify()
|*
|*************************************************************************/
-inline void FmtInArr( SvPtrarr& rFmtArr, SwFmt* pBoxFmt )
+static void FmtInArr( std::vector<SwFmt*>& rFmtArr, SwFmt* pBoxFmt )
{
- sal_Bool bRet = USHRT_MAX != rFmtArr.GetPos( (VoidPtr)pBoxFmt );
- if( !bRet )
- rFmtArr.Insert( (VoidPtr)pBoxFmt, rFmtArr.Count() );
+ std::vector<SwFmt*>::const_iterator it = std::find( rFmtArr.begin(), rFmtArr.end(), pBoxFmt );
+ if ( it == rFmtArr.end() )
+ rFmtArr.push_back( pBoxFmt );
}
-void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld,
- const long nNew, SvPtrarr& rFmtArr );
+static void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld,
+ const long nNew, std::vector<SwFmt*>& rFmtArr );
-void lcl_ModifyLines( SwTableLines &rLines, const long nOld,
- const long nNew, SvPtrarr& rFmtArr, const bool bCheckSum )
+static void lcl_ModifyLines( SwTableLines &rLines, const long nOld,
+ const long nNew, std::vector<SwFmt*>& rFmtArr, const bool bCheckSum )
{
for ( sal_uInt16 i = 0; i < rLines.size(); ++i )
::lcl_ModifyBoxes( rLines[i]->GetTabBoxes(), nOld, nNew, rFmtArr );
if( bCheckSum )
{
- for( sal_uInt16 i = 0; i < rFmtArr.Count(); ++i )
+ for( sal_uInt16 i = 0; i < rFmtArr.size(); ++i )
{
- SwFmt* pFmt = (SwFmt*)rFmtArr[i];
+ SwFmt* pFmt = rFmtArr[i];
sal_uInt64 nBox = pFmt->GetFrmSize().GetWidth();
nBox *= nNew;
nBox /= nOld;
@@ -352,8 +352,8 @@ void lcl_ModifyLines( SwTableLines &rLines, const long nOld,
}
}
-void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld,
- const long nNew, SvPtrarr& rFmtArr )
+static void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld,
+ const long nNew, std::vector<SwFmt*>& rFmtArr )
{
sal_uInt64 nSum = 0; // To avoid rounding errors we summarize all box widths
sal_uInt64 nOriginalSum = 0; // Sum of original widths
@@ -430,7 +430,8 @@ void SwTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
void SwTable::AdjustWidths( const long nOld, const long nNew )
{
- SvPtrarr aFmtArr( (sal_uInt8)aLines[0]->GetTabBoxes().size() );
+ std::vector<SwFmt*> aFmtArr;
+ aFmtArr.reserve( aLines[0]->GetTabBoxes().size() );
::lcl_ModifyLines( aLines, nOld, nNew, aFmtArr, true );
}
commit dee4d5ef92ca60dfd0f93ba16bd6eda166072351
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 09:46:55 2012 +0200
Remove unused header file fltglbls.hxx
Change-Id: I7a5ad66d5c2d0f1f78e43f641f95b899a3ab51c1
diff --git a/sw/source/filter/inc/fltglbls.hxx b/sw/source/filter/inc/fltglbls.hxx
deleted file mode 100644
index 6dcac83..0000000
--- a/sw/source/filter/inc/fltglbls.hxx
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _FLTGLBS_HXX
-#define _FLTGLBS_HXX
-
-#include <tools/string.hxx>
-#include <i18npool/lang.h>
-#include <svl/svarray.hxx>
-
-
-class SfxPoolItem;
-class SwDoc;
-class SwPaM;
-class SwTable;
-
-class SvNumberFormatter;
-
-
-class ExcGlob;
-extern ExcGlob *pExcGlob;
-
-class LotGlob;
-extern LotGlob *pLotGlob;
-
-// ----- Basis-Klasse ----------------------------------------------------
-class FilterGlobals
-{
-protected:
- SvPtrarr aTblFmts;
- sal_uInt16 nColStart;
- sal_uInt16 nColEnd;
- sal_uInt16 nRowStart;
- sal_uInt16 nRowEnd;
- sal_uInt16 nAnzCols;
- sal_uInt16 nAnzRows;
-
-public:
- FilterGlobals( SwDoc& rDoc, const SwPaM& rPam );
- ~FilterGlobals();
-
- SwDoc *pD;
- SwPaM *pPam;
- const SwTable *pTable;
-
- SvNumberFormatter *pNumFormatter;
- LanguageType eDefLanguage;
- sal_uLong nStandard;
- sal_uLong nDefFormat; // = 0xFFFFFFFF
-
- void SetRange( sal_uInt16 nCS, sal_uInt16 nCE, sal_uInt16 nRS, sal_uInt16 nRE );
-
- sal_Bool IsInColRange( sal_uInt16 nCol )
- { return ( nCol >= nColStart && nCol <= nColEnd ); }
- sal_Bool IsInRowRange( sal_uInt16 nRow )
- { return ( nRow >= nRowStart && nRow <= nRowEnd ); }
- sal_Bool IsInRange( sal_uInt16 nCol, sal_uInt16 nRow )
- { return IsInRowRange(nRow) && IsInColRange(nCol); }
-
- void NormalizeCol( sal_uInt16 &rCol ) { rCol -= nColStart; }
- void NormalizeRow( sal_uInt16 &rRow ) { rRow -= nRowStart; }
- void Normalize( sal_uInt16 &rCol, sal_uInt16 &rRow )
- { NormalizeCol( rCol ); NormalizeRow( rRow ); }
-
- sal_uInt16 AnzCols() const { return nAnzCols; }
- sal_uInt16 AnzRows() const { return nAnzRows; }
-
- sal_Bool ColRangeLimitter( sal_uInt16 &rCS, sal_uInt16 &rCE );
-
- void InsertText( sal_uInt16 nCol, sal_uInt16 nRow, const String& rStr );
- void CreateTable();
- void InsertAttr( const SfxPoolItem& rItem );
-
- inline void ColLimitter( sal_uInt16 &rCol );
- inline void RowLimitter( sal_uInt16 &rRow );
-};
-
-
-
-
-
-inline void FilterGlobals::ColLimitter( sal_uInt16 &rCol )
-{
- if( rCol < nColStart )
- rCol = nColStart;
- else if( rCol > nColEnd )
- rCol = nColEnd;
-}
-
-inline void FilterGlobals::RowLimitter( sal_uInt16 &rRow )
-{
- if( rRow < nRowStart )
- rRow = nRowStart;
- else if( rRow > nRowEnd )
- rRow = nRowEnd;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 875ee66f2445000089874a880084d92792116dfe
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Jun 25 18:01:40 2012 +0200
fix previous commit:
do not call std::vector::vector(size_t).
Change-Id: I634de4cebe49ffe2df8def15a7be99dcb2601d24
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 461ba5d..a9b3602 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -696,8 +696,9 @@ struct Parm
std::deque<SwTableBox*> aBoxArr;
SwShareBoxFmts aShareFmts;
- Parm( const SwTabCols &rN, const SwTabCols &rO ) :
- rNew( rN ), rOld( rO ), nNewWish(0), nOldWish(0), aBoxArr( 10 ){}
+ Parm( const SwTabCols &rN, const SwTabCols &rO )
+ : rNew( rN ), rOld( rO ), nNewWish(0), nOldWish(0)
+ {}
};
void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm );
commit 81321de64f60347f68ac6027cca5e5b2879cf857
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 22 08:54:13 2012 +0200
Convert SvPtrarr aBoxArr to std::deque<SwTableBox*>
Change-Id: I97634289e94f34e18d00d88d81d99dae1e593ec1
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index d106b48..461ba5d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -693,19 +693,12 @@ struct Parm
const SwTabCols &rOld;
long nNewWish,
nOldWish;
- SvPtrarr aBoxArr;
+ std::deque<SwTableBox*> aBoxArr;
SwShareBoxFmts aShareFmts;
Parm( const SwTabCols &rN, const SwTabCols &rO ) :
rNew( rN ), rOld( rO ), nNewWish(0), nOldWish(0), aBoxArr( 10 ){}
};
-inline sal_Bool BoxInArr( SvPtrarr& rArr, SwTableBox* pBox )
-{
- sal_Bool bRet = USHRT_MAX != rArr.GetPos( (VoidPtr)pBox );
- if( !bRet )
- rArr.Insert( (VoidPtr)pBox, rArr.Count() );
- return bRet;
-}
void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm );
@@ -862,7 +855,7 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm )
}
}
-void lcl_ProcessBoxPtr( SwTableBox *pBox, SvPtrarr &rBoxArr,
+void lcl_ProcessBoxPtr( SwTableBox *pBox, std::deque<SwTableBox*> &rBoxArr,
sal_Bool bBefore )
{
if ( !pBox->GetTabLines().empty() )
@@ -876,9 +869,9 @@ void lcl_ProcessBoxPtr( SwTableBox *pBox, SvPtrarr &rBoxArr,
}
}
else if ( bBefore )
- rBoxArr.Insert( (VoidPtr)pBox, 0 );
+ rBoxArr.push_front( pBox );
else
- rBoxArr.Insert( (VoidPtr)pBox, rBoxArr.Count() );
+ rBoxArr.push_back( pBox );
}
void lcl_AdjustBox( SwTableBox *pBox, const long nDiff, Parm &rParm );
@@ -1035,9 +1028,9 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
//Nachdem wir haufenweise Boxen (hoffentlich alle und in der richtigen
//Reihenfolge) eingetragen haben, brauchen diese nur noch rueckwaerts
//verarbeitet zu werden.
- for ( int j = aParm.aBoxArr.Count()-1; j >= 0; --j )
+ for ( int j = aParm.aBoxArr.size()-1; j >= 0; --j )
{
- SwTableBox *pBox = (SwTableBox*)aParm.aBoxArr[ static_cast< sal_uInt16 >(j)];
+ SwTableBox *pBox = aParm.aBoxArr[j];
::lcl_ProcessBoxSet( pBox, aParm );
}
}
commit e22cc759097feedd53cd56337b1b4a9813ba3d60
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 21 17:56:59 2012 +0200
Convert pFrmFmts member from Svptrarr to std::vector
Change-Id: I628709ab09318917083f71dde9f06cfb1c8d1a49
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 31140af..ecc4c55 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -233,7 +233,7 @@ class SwUndoInsLayFmt;
class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveCntnt
{
SwTxtFmtColl *pTxtFmtColl, *pLastNdColl;
- SvPtrarr* pFrmFmts;
+ std::vector<SwFrmFmt*>* pFrmFmts;
::std::vector< ::boost::shared_ptr<SwUndoInsLayFmt> > m_FlyUndos;
SwRedlineData* pRedlData;
sal_Bool bSttWasTxtNd;
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 9888f31..f027645 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -70,8 +70,8 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
nSttNode == pAPos->nNode.GetIndex() )
{
if( !pFrmFmts )
- pFrmFmts = new SvPtrarr;
- pFrmFmts->Insert( pFmt, pFrmFmts->Count() );
+ pFrmFmts = new std::vector<SwFrmFmt*>;
+ pFrmFmts->push_back( pFmt );
}
}
}
@@ -112,7 +112,7 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, sal_Bool bScanFlys,
{
// than collect all new Flys
SwDoc* pDoc = (SwDoc*)rPam.GetDoc();
- sal_uInt16 nFndPos, nArrLen = pDoc->GetSpzFrmFmts()->size();
+ sal_uInt16 nArrLen = pDoc->GetSpzFrmFmts()->size();
for( sal_uInt16 n = 0; n < nArrLen; ++n )
{
SwFrmFmt* pFmt = (*pDoc->GetSpzFrmFmts())[n];
@@ -122,15 +122,16 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, sal_Bool bScanFlys,
(pAnchor->GetAnchorId() == FLY_AT_PARA) &&
nSttNode == pAPos->nNode.GetIndex() )
{
+ std::vector<SwFrmFmt*>::iterator it;
if( !pFrmFmts ||
- USHRT_MAX == ( nFndPos = pFrmFmts->GetPos( pFmt ) ) )
+ pFrmFmts->end() == ( it = std::find( pFrmFmts->begin(), pFrmFmts->end(), pFmt ) ) )
{
::boost::shared_ptr<SwUndoInsLayFmt> const pFlyUndo(
new SwUndoInsLayFmt(pFmt, 0, 0));
m_FlyUndos.push_back(pFlyUndo);
}
else
- pFrmFmts->Remove( nFndPos );
+ pFrmFmts->erase( it );
}
}
delete pFrmFmts, pFrmFmts = 0;
commit ace0b43a026626dfbf0623800c24600d2d9480b5
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 21 17:42:31 2012 +0200
Convert SwRTFParser::RemoveUnusedNumRules from Svptrarr top std::vector
Change-Id: I38b5c23e59399babb8bfc2c52455bfff0f7c062e
diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx
index 39218c4..13d963d 100644
--- a/sw/source/filter/rtf/rtfnum.cxx
+++ b/sw/source/filter/rtf/rtfnum.cxx
@@ -689,7 +689,7 @@ void SwRTFParser::RemoveUnusedNumRule( SwNumRule* pRule )
void SwRTFParser::RemoveUnusedNumRules()
{
SwListEntry* pEntry;
- SvPtrarr aDelArr;
+ std::set<SwNumRule*> aDelArr;
size_t n;
for( n = aListArr.size(); n; )
{
@@ -704,20 +704,20 @@ void SwRTFParser::RemoveUnusedNumRules()
}
if (unused)
{
- void * p = pDoc->GetNumRuleTbl()[pEntry->nListDocPos];
+ SwNumRule* p = pDoc->GetNumRuleTbl()[pEntry->nListDocPos];
// dont delete named char formats
- if( USHRT_MAX == aDelArr.GetPos( p ) &&
- ((SwNumRule*)p)->GetName().EqualsAscii( RTF_NUMRULE_NAME, 0,
+ if( aDelArr.find( p ) == aDelArr.end() &&
+ p->GetName().EqualsAscii( RTF_NUMRULE_NAME, 0,
sizeof( RTF_NUMRULE_NAME )) )
- aDelArr.Insert( p, aDelArr.Count() );
+ aDelArr.insert( p );
}
}
}
- for( n = aDelArr.Count(); n; )
+ while( !aDelArr.empty() )
{
- SwNumRule* pDel = (SwNumRule*)aDelArr[ --n ];
- RemoveUnusedNumRule( pDel );
+ RemoveUnusedNumRule( *aDelArr.begin() );
+ aDelArr.erase( aDelArr.begin() );
}
}
commit f31ff2cf20650912179904ee04b58714e3561d6a
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 21 17:19:08 2012 +0200
Remove unused member aTblFmts
Change-Id: Iff6180bce4787bb6118a3bab6b4d9cff255e3f37
diff --git a/sw/source/filter/rtf/rtftbl.cxx b/sw/source/filter/rtf/rtftbl.cxx
index 73947ba..3e4fc19 100644
--- a/sw/source/filter/rtf/rtftbl.cxx
+++ b/sw/source/filter/rtf/rtftbl.cxx
@@ -553,12 +553,6 @@ void SwRTFParser::ReadTable( int nToken )
pOldTblNd = pTableNode;
bNewTbl = sal_False;
-
- {
- //TabellenUmrandungen optimieren
- void* p = pFmt;
- aTblFmts.Insert( p, aTblFmts.Count() );
- }
}
else
{
@@ -653,12 +647,6 @@ void SwRTFParser::ReadTable( int nToken )
m_nCurrentBox = 0;
pOldTblNd = pTableNode;
-
- {
- // TabellenUmrandungen optimieren
- void* p = pFmt;
- aTblFmts.Insert( p, aTblFmts.Count() );
- }
}
}
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index ad02571..cdd6e63 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -227,7 +227,6 @@ SwRTFParser::SwRTFParser(SwDoc* pD,
maCharStyleMapper(*pD),
maSegments(*this),
maInsertedTables(*pD),
- aTblFmts(0),
mpBookmarkStart(0),
mpRedlineStack(0),
pGrfAttrSet(0),
diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx
index 5e1cf16..6b009f9 100644
--- a/sw/source/filter/rtf/swparrtf.hxx
+++ b/sw/source/filter/rtf/swparrtf.hxx
@@ -303,7 +303,6 @@ class SwRTFParser : public SvxRTFParser
SwFlySaveArr aFlyArr; // Flys als Letzes im Doc setzen
std::vector<bool> aMergeBoxes; // Flags fuer gemergte Zellen
SwListArr aListArr;
- SvPtrarr aTblFmts;
std::vector<SwCharFmt*> aRubyCharFmts;
BookmarkPosition* mpBookmarkStart;
sw::util::RedlineStack *mpRedlineStack;
commit 1c6fcbc2df45ab18a97373195ca21967e3c10e13
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jun 21 17:07:29 2012 +0200
Convert aRubyCharFmts member from Svptrarr to std:vector
Change-Id: I397953f1e2a52a2de7fbdf4ad14cad715fe6fd28
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index da3ba11..b7888b0 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -712,9 +712,9 @@ int SwRTFParser::MakeFieldInst( String& rFieldStr )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list