diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-18 18:04:44 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-20 19:46:40 +0200 |
commit | d69fdd1ed634be8426f9ff80f9411187da29f00a (patch) | |
tree | 2d16935eccaab7779929f9d4d1b12a07a888733b /sw/inc | |
parent | 05d46a4a5afc447ece8e4297b1a9b8e9e9b99b90 (diff) |
Convert SV_DECL_PTRARR_DEL(SwTableLines) to std::vector
Along the way, simplify a lot of the ForEach callback methods.
Change-Id: I54bc87c1060f1d73470ca8b7fd645ffa23059606
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/swtable.hxx | 18 | ||||
-rw-r--r-- | sw/inc/tblsel.hxx | 4 |
2 files changed, 16 insertions, 6 deletions
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<SwTableLine*> { +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<SwTableBox*> { 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; } diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx index a4b772883fa0..63fa38a0a469 100644 --- a/sw/inc/tblsel.hxx +++ b/sw/inc/tblsel.hxx @@ -221,8 +221,8 @@ struct _FndPara : rBoxes(rPara.rBoxes), pFndLine(pFL), pFndBox(rPara.pFndBox) {} }; -sal_Bool _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara ); -SW_DLLPUBLIC sal_Bool _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara ); +SW_DLLPUBLIC void ForEach_FndLineCopyCol(SwTableLines& rLines, _FndPara* pFndPara ); + #endif // _TBLSEL_HXX |