summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/anchoreddrawobject.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-26 14:08:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-27 08:36:19 +0200
commit07e5c4381ac405b4379767f9735152b8f0314faa (patch)
tree848eaf2e2955271b9626c11c875abb72083e4898 /sw/source/core/layout/anchoreddrawobject.cxx
parent10f2196266dd3bb0fe6c8da0c5967f80815e9492 (diff)
loplugin:useuniqueptr in SwObjPosOscillationControl
Point is a small object, no need to store separately on the heap Change-Id: Id8fb1829b711831860ad1d7709fb4bf71ae8ff09 Reviewed-on: https://gerrit.libreoffice.org/61002 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/layout/anchoreddrawobject.cxx')
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx25
1 files changed, 5 insertions, 20 deletions
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 0a4292638342..88f9969a422f 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -137,11 +137,10 @@ class SwObjPosOscillationControl
private:
const SwAnchoredDrawObject* mpAnchoredDrawObj;
- std::vector<Point*> maObjPositions;
+ std::vector<Point> maObjPositions;
public:
explicit SwObjPosOscillationControl( const SwAnchoredDrawObject& _rAnchoredDrawObj );
- ~SwObjPosOscillationControl();
bool OscillationDetected();
};
@@ -152,17 +151,6 @@ SwObjPosOscillationControl::SwObjPosOscillationControl(
{
}
-SwObjPosOscillationControl::~SwObjPosOscillationControl()
-{
- while ( !maObjPositions.empty() )
- {
- Point* pPos = maObjPositions.back();
- delete pPos;
-
- maObjPositions.pop_back();
- }
-}
-
bool SwObjPosOscillationControl::OscillationDetected()
{
bool bOscillationDetected = false;
@@ -174,22 +162,19 @@ bool SwObjPosOscillationControl::OscillationDetected()
}
else
{
- Point* pNewObjPos = new Point( mpAnchoredDrawObj->GetObjRect().Pos() );
- for ( std::vector<Point*>::iterator aObjPosIter = maObjPositions.begin();
- aObjPosIter != maObjPositions.end();
- ++aObjPosIter )
+ Point aNewObjPos = mpAnchoredDrawObj->GetObjRect().Pos();
+ for ( auto const & pt : maObjPositions )
{
- if ( *pNewObjPos == *(*aObjPosIter) )
+ if ( aNewObjPos == pt )
{
// position already occurred -> oscillation
bOscillationDetected = true;
- delete pNewObjPos;
break;
}
}
if ( !bOscillationDetected )
{
- maObjPositions.push_back( pNewObjPos );
+ maObjPositions.push_back( aNewObjPos );
}
}