diff options
-rw-r--r-- | include/o3tl/sorted_vector.hxx | 17 | ||||
-rw-r--r-- | include/svx/polypolygoneditor.hxx | 7 | ||||
-rw-r--r-- | include/svx/svdmark.hxx | 4 | ||||
-rw-r--r-- | svx/source/inc/fmvwimp.hxx | 1 | ||||
-rw-r--r-- | svx/source/svdraw/polypolygoneditor.cxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/svdglev.cxx | 2 |
6 files changed, 29 insertions, 14 deletions
diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx index 28ef75817fa7..803a044535e8 100644 --- a/include/o3tl/sorted_vector.hxx +++ b/include/o3tl/sorted_vector.hxx @@ -42,6 +42,7 @@ private: typedef typename std::vector<Value>::iterator iterator; public: typedef typename std::vector<Value>::const_iterator const_iterator; + typedef typename std::vector<Value>::const_reverse_iterator const_reverse_iterator; typedef typename std::vector<Value>::difference_type difference_type; typedef typename std::vector<Value>::size_type size_type; @@ -98,9 +99,9 @@ public: } // like C++ 2011: erase with const_iterator (doesn't change sort order) - void erase(const_iterator const& position) + const_iterator erase(const_iterator const& position) { // C++98 has vector::erase(iterator), so call that - m_vector.erase(m_vector.begin() + (position - m_vector.begin())); + return m_vector.erase(m_vector.begin() + (position - m_vector.begin())); } void erase(const_iterator const& first, const_iterator const& last) @@ -159,6 +160,18 @@ public: return m_vector.end(); } + // Only return a const iterator, so that the vector cannot be directly updated. + const_reverse_iterator rbegin() const + { + return m_vector.rbegin(); + } + + // Only return a const iterator, so that the vector cannot be directly updated. + const_reverse_iterator rend() const + { + return m_vector.rend(); + } + const Value& front() const { return m_vector.front(); diff --git a/include/svx/polypolygoneditor.hxx b/include/svx/polypolygoneditor.hxx index e8b6138dffa4..347bbc4a92a5 100644 --- a/include/svx/polypolygoneditor.hxx +++ b/include/svx/polypolygoneditor.hxx @@ -26,6 +26,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <set> +#include <o3tl/sorted_vector.hxx> namespace sdr { @@ -41,15 +42,15 @@ public: /** returns true if the B2DPolyPolygon was changed. Warning: B2DPolyPolygon can be empty after this operation! */ - bool DeletePoints( const std::set< sal_uInt16 >& rAbsPoints ); + bool DeletePoints( const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints ); /** returns true if the B2DPolyPolygon was changed. */ - bool SetSegmentsKind(SdrPathSegmentKind eKind, const std::set< sal_uInt16 >& rAbsPoints); + bool SetSegmentsKind(SdrPathSegmentKind eKind, const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints); /** returns true if the B2DPolyPolygon was changed. */ - bool SetPointsSmooth( basegfx::B2VectorContinuity eFlags, const std::set< sal_uInt16 >& rAbsPoints); + bool SetPointsSmooth( basegfx::B2VectorContinuity eFlags, const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints); /** Outputs the relative position ( polygon number and point number in that polygon ) from the absolute point number. False is returned if the given absolute point is greater not inside this B2DPolyPolygon diff --git a/include/svx/svdmark.hxx b/include/svx/svdmark.hxx index f5f9c7b539d5..1b121a58f86e 100644 --- a/include/svx/svdmark.hxx +++ b/include/svx/svdmark.hxx @@ -21,12 +21,12 @@ #define INCLUDED_SVX_SVDMARK_HXX #include <config_options.h> +#include <o3tl/sorted_vector.hxx> #include <rtl/ustring.hxx> #include <svx/svxdllapi.h> #include <svx/sdrobjectuser.hxx> #include <memory> -#include <set> #include <vector> namespace tools { class Rectangle; } @@ -35,7 +35,7 @@ class SdrObjList; class SdrObject; class SdrPageView; -typedef std::set<sal_uInt16> SdrUShortCont; +typedef o3tl::sorted_vector<sal_uInt16> SdrUShortCont; /** diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx index 1e6a01dab0cb..278c4eda597b 100644 --- a/svx/source/inc/fmvwimp.hxx +++ b/svx/source/inc/fmvwimp.hxx @@ -23,6 +23,7 @@ #include <map> #include <memory> +#include <set> #include <svx/svdmark.hxx> #include <svx/svdobj.hxx> diff --git a/svx/source/svdraw/polypolygoneditor.cxx b/svx/source/svdraw/polypolygoneditor.cxx index 1f82f0436544..b3f6d3bc5175 100644 --- a/svx/source/svdraw/polypolygoneditor.cxx +++ b/svx/source/svdraw/polypolygoneditor.cxx @@ -30,11 +30,11 @@ PolyPolygonEditor::PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygo { } -bool PolyPolygonEditor::DeletePoints( const std::set< sal_uInt16 >& rAbsPoints ) +bool PolyPolygonEditor::DeletePoints( const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints ) { bool bPolyPolyChanged = false; - std::set< sal_uInt16 >::const_reverse_iterator aIter( rAbsPoints.rbegin() ); + auto aIter( rAbsPoints.rbegin() ); for( ; aIter != rAbsPoints.rend(); ++aIter ) { sal_uInt32 nPoly, nPnt; @@ -62,11 +62,11 @@ bool PolyPolygonEditor::DeletePoints( const std::set< sal_uInt16 >& rAbsPoints ) return bPolyPolyChanged; } -bool PolyPolygonEditor::SetSegmentsKind(SdrPathSegmentKind eKind, const std::set< sal_uInt16 >& rAbsPoints ) +bool PolyPolygonEditor::SetSegmentsKind(SdrPathSegmentKind eKind, const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints ) { bool bPolyPolyChanged = false; - std::set< sal_uInt16 >::const_reverse_iterator aIter( rAbsPoints.rbegin() ); + auto aIter( rAbsPoints.rbegin() ); for( ; aIter != rAbsPoints.rend(); ++aIter ) { sal_uInt32 nPolyNum, nPntNum; @@ -122,11 +122,11 @@ bool PolyPolygonEditor::SetSegmentsKind(SdrPathSegmentKind eKind, const std::set return bPolyPolyChanged; } -bool PolyPolygonEditor::SetPointsSmooth( basegfx::B2VectorContinuity eFlags, const std::set< sal_uInt16 >& rAbsPoints) +bool PolyPolygonEditor::SetPointsSmooth( basegfx::B2VectorContinuity eFlags, const o3tl::sorted_vector< sal_uInt16 >& rAbsPoints) { bool bPolyPolygonChanged(false); - std::set< sal_uInt16 >::const_reverse_iterator aIter( rAbsPoints.rbegin() ); + auto aIter( rAbsPoints.rbegin() ); for( ; aIter != rAbsPoints.rend(); ++aIter ) { sal_uInt32 nPolyNum, nPntNum; diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx index 5f81d38575ab..9d1f19c558cf 100644 --- a/svx/source/svdraw/svdglev.cxx +++ b/svx/source/svdraw/svdglev.cxx @@ -297,7 +297,7 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints() } for(const auto& rId : aIdsToErase) rPts.erase(rId); - rPts.insert(aIdsToInsert.begin(), aIdsToInsert.end()); + rPts.insert(aIdsToInsert); } } if( bUndo ) |