From d69fdd1ed634be8426f9ff80f9411187da29f00a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 18 Jun 2012 18:04:44 +0200 Subject: Convert SV_DECL_PTRARR_DEL(SwTableLines) to std::vector Along the way, simplify a lot of the ForEach callback methods. Change-Id: I54bc87c1060f1d73470ca8b7fd645ffa23059606 --- sw/inc/swtable.hxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'sw/inc/swtable.hxx') diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 29c779a51ed2..8a6624eb2c1d 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -73,7 +73,18 @@ struct Parm; SV_DECL_REF( SwServerObject ) #endif -SV_DECL_PTRARR_DEL(SwTableLines, SwTableLine*, 10) +class SwTableLines : public std::vector { +public: + // free's any remaining child objects + ~SwTableLines(); + + // return USHRT_MAX if not found, else index of position + sal_uInt16 GetPos(const SwTableLine* pBox) const + { + const_iterator it = std::find(begin(), end(), pBox); + return it == end() ? USHRT_MAX : it - begin(); + } +}; class SwTableBoxes : public std::vector { public: @@ -89,7 +100,6 @@ public: // (for calculation in table). typedef SwTableBox* SwTableBoxPtr; SV_DECL_PTRARR_SORT( SwTableSortBoxes, SwTableBoxPtr, 25 ) -typedef SwTableLine* SwTableLinePtr; class SW_DLLPUBLIC SwTable: public SwClient //Client of FrmFmt. { @@ -176,7 +186,7 @@ public: void SetTableModel( sal_Bool bNew ){ bNewModel = bNew; } sal_Bool IsNewModel() const { return bNewModel; } - sal_uInt16 GetRowsToRepeat() const { return Min( GetTabLines().Count(), nRowsToRepeat ); } + sal_uInt16 GetRowsToRepeat() const { return Min( (sal_uInt16)GetTabLines().size(), nRowsToRepeat ); } sal_uInt16 _GetRowsToRepeat() const { return nRowsToRepeat; } void SetRowsToRepeat( sal_uInt16 nNumOfRows ) { nRowsToRepeat = nNumOfRows; } @@ -252,7 +262,7 @@ public: void FindSuperfluousRows( SwSelBoxes& rBoxes ) { _FindSuperfluousRows( rBoxes, 0, 0 ); } - void CheckRowSpan( SwTableLinePtr &rpLine, bool bUp ) const; + void CheckRowSpan( SwTableLine* &rpLine, bool bUp ) const; SwTableSortBoxes& GetTabSortBoxes() { return aSortCntBoxes; } const SwTableSortBoxes& GetTabSortBoxes() const { return aSortCntBoxes; } -- cgit