diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-14 15:03:14 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-08-16 15:14:57 +0200 |
commit | 7758eaf702849691dcf24472d864ee7ff6d02345 (patch) | |
tree | 508c82198240f2b8d746702ac73fc0acca624b10 /svx/inc | |
parent | c8a68356b4c8f8f45405da8e76baeb38a930941f (diff) |
Convert SdrUShortCont from Container to std::set
Change-Id: Ic7e929d4f20cd737eb15dacdb5718b6c79c80aaf
Diffstat (limited to 'svx/inc')
-rw-r--r-- | svx/inc/svx/svdmark.hxx | 106 |
1 files changed, 4 insertions, 102 deletions
diff --git a/svx/inc/svx/svdmark.hxx b/svx/inc/svx/svdmark.hxx index 4b68fed64e1f..429570b99475 100644 --- a/svx/inc/svx/svdmark.hxx +++ b/svx/inc/svx/svdmark.hxx @@ -45,106 +45,8 @@ class SdrObject; class SdrPageView; // Ein Container fuer USHORTs (im Prinzip ein dynamisches Array) -class SVX_DLLPUBLIC SdrUShortCont -{ - Container maArray; - sal_Bool mbSorted; - -private: - void CheckSort(sal_uLong nPos); - -public: - SdrUShortCont(sal_uInt16 nBlock, sal_uInt16 nInit, sal_uInt16 nResize) - : maArray(nBlock, nInit, nResize), - mbSorted(sal_True) - {} - - SdrUShortCont(const SdrUShortCont& rCont) - : maArray(rCont.maArray), - mbSorted(rCont.mbSorted) - {} - - /** helper to migrate to stl containers */ - std::set< sal_uInt16 > getContainer(); - - SdrUShortCont& operator=(const SdrUShortCont& rCont) - { - maArray = rCont.maArray; - mbSorted = rCont.mbSorted; - return *this; - } - - sal_Bool operator==(const SdrUShortCont& rCont) const - { - return maArray == rCont.maArray; - } +class SVX_DLLPUBLIC SdrUShortCont : public std::set<sal_uInt16> {}; - sal_Bool operator!=(const SdrUShortCont& rCont) const - { - return maArray != rCont.maArray; - } - - void Clear() - { - maArray.Clear(); - mbSorted = sal_True; - } - - void Sort() const; - - void ForceSort() const - { - if(!mbSorted) - { - Sort(); - } - } - - void Insert(sal_uInt16 nElem, sal_uLong nPos = CONTAINER_APPEND) - { - maArray.Insert((void*)sal_uLong(nElem),nPos); - - if(mbSorted) - { - CheckSort(nPos); - } - } - - void Remove(sal_uLong nPos) - { - maArray.Remove(nPos); - } - - void Replace(sal_uInt16 nElem, sal_uLong nPos) - { - maArray.Replace((void*)sal_uLong(nElem), nPos); - - if(mbSorted) - { - CheckSort(nPos); - } - } - - sal_uInt16 GetObject(sal_uLong nPos) const - { - return sal_uInt16(sal_uIntPtr(maArray.GetObject(nPos))); - } - - sal_uLong GetPos(sal_uInt16 nElem) const - { - return maArray.GetPos((void*)(sal_uLong)nElem); - } - - sal_uLong GetCount() const - { - return maArray.Count(); - } - - sal_Bool Exist(sal_uInt16 nElem) const - { - return (CONTAINER_ENTRY_NOTFOUND != maArray.GetPos((void*)(sal_uLong)nElem)); - } -}; // Alles was eine View ueber ein markiertes Objekt wissen muss class SVX_DLLPUBLIC SdrMark : public sdr::ObjectUser @@ -250,7 +152,7 @@ public: SdrUShortCont* ForceMarkedPoints() { if(!mpPoints) - mpPoints = new SdrUShortCont(1024, 32, 32); + mpPoints = new SdrUShortCont; return mpPoints; } @@ -258,7 +160,7 @@ public: SdrUShortCont* ForceMarkedLines() { if(!mpLines) - mpLines = new SdrUShortCont(1024, 32, 32); + mpLines = new SdrUShortCont; return mpLines; } @@ -266,7 +168,7 @@ public: SdrUShortCont* ForceMarkedGluePoints() { if(!mpGluePoints) - mpGluePoints = new SdrUShortCont(1024, 32, 32); + mpGluePoints = new SdrUShortCont; return mpGluePoints; } |