diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-10 17:42:10 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-14 19:49:15 +0200 |
commit | b8ace0f986769cc952718ab5e262808d899d5549 (patch) | |
tree | de7a7ee9ba280585506a4429a57af862aa79c938 /sw/inc/swtable.hxx | |
parent | 5031e17d4b11181be94448702b1026bd38e0b3c4 (diff) |
Convert SV_DECL_PTRARR_DEL(SwTableBoxes) to std::vector
I added a GetPos() method because quite a lot of code used that
method and the existing code is quite tied to the precise
return values of that method.
Change-Id: I9af6b923d978abe758b63d835f228495c020455a
Diffstat (limited to 'sw/inc/swtable.hxx')
-rw-r--r-- | sw/inc/swtable.hxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index ba67780a1762..29c779a51ed2 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -37,6 +37,8 @@ #include <memory> #include <boost/noncopyable.hpp> +#include <vector> +#include <algorithm> class SwStartNode; class SwFmt; @@ -72,7 +74,16 @@ SV_DECL_REF( SwServerObject ) #endif SV_DECL_PTRARR_DEL(SwTableLines, SwTableLine*, 10) -SV_DECL_PTRARR_DEL(SwTableBoxes, SwTableBox*, 25) + +class SwTableBoxes : public std::vector<SwTableBox*> { +public: + // return USHRT_MAX if not found, else index of position + sal_uInt16 GetPos(const SwTableBox* pBox) const + { + const_iterator it = std::find(begin(), end(), pBox); + return it == end() ? USHRT_MAX : it - begin(); + } +}; // Save content-bearing box-pointers additionally in a sorted array // (for calculation in table). |