diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-13 16:16:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-15 11:27:20 +0200 |
commit | 18e20676024baecaf5719139f80f053f5f1e784a (patch) | |
tree | 54e7d15b178ee373c0c72e153d9b1a427963d889 /svx/source/svdraw | |
parent | 82a7c54ad8b9b193e767fcafb5316d3f05e21001 (diff) |
loplugin:useuniqueptr in OverlayObjectList
Change-Id: I641d93e54504c27bcc49bae8edf6286c0a9a471f
Reviewed-on: https://gerrit.libreoffice.org/59024
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r-- | svx/source/svdraw/svdcrtv.cxx | 24 | ||||
-rw-r--r-- | svx/source/svdraw/svddrgmt.cxx | 14 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdhdl.cxx | 84 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdsnpv.cxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/svdview.cxx | 6 |
7 files changed, 75 insertions, 77 deletions
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index fac7c2a28245..051866a9b27d 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -77,10 +77,10 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S Size aHalfLogicSize(xTargetOverlay->getOutputDevice().PixelToLogic(Size(4 * fScalingFactor, 4 * fScalingFactor))); // object - sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new sdr::overlay::OverlayPolyPolygonStripedAndFilled( - aB2DPolyPolygon); + std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew(new sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aB2DPolyPolygon)); xTargetOverlay->add(*pNew); - maObjects.append(pNew); + maObjects.append(std::move(pNew)); // glue points for(sal_uInt16 i(0); i < 4; i++) @@ -101,10 +101,10 @@ ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, S basegfx::B2DPolyPolygon aTempPolyPoly; aTempPolyPoly.append(aTempPoly); - pNew = new sdr::overlay::OverlayPolyPolygonStripedAndFilled( - aTempPolyPoly); - xTargetOverlay->add(*pNew); - maObjects.append(pNew); + std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew2(new sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aTempPolyPoly)); + xTargetOverlay->add(*pNew2); + maObjects.append(std::move(pNew2)); } } } @@ -145,18 +145,18 @@ void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView& rView, { const sdr::contact::ViewContact& rVC = pObject->GetViewContact(); const drawinglayer::primitive2d::Primitive2DContainer aSequence = rVC.getViewIndependentPrimitive2DContainer(); - sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence); + std::unique_ptr<sdr::overlay::OverlayObject> pNew(new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence)); xOverlayManager->add(*pNew); - maObjects.append(pNew); + maObjects.append(std::move(pNew)); } if(rPolyPoly.count()) { - sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new sdr::overlay::OverlayPolyPolygonStripedAndFilled( - rPolyPoly); + std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew(new sdr::overlay::OverlayPolyPolygonStripedAndFilled( + rPolyPoly)); xOverlayManager->add(*pNew); - maObjects.append(pNew); + maObjects.append(std::move(pNew)); } } } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 46dfcc322ab7..30269bf5344b 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -769,9 +769,9 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay if(!aResult.empty()) { - sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResult); + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new sdr::overlay::OverlayPrimitive2DSequenceObject(aResult)); rOverlayManager.add(*pNewOverlayObject); - addToOverlayObjectList(pNewOverlayObject); + addToOverlayObjectList(std::move(pNewOverlayObject)); } if(!aResultTransparent.empty()) @@ -779,9 +779,9 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5)); aResultTransparent = drawinglayer::primitive2d::Primitive2DContainer { aUnifiedTransparencePrimitive2D }; - sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent); + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent)); rOverlayManager.add(*pNewOverlayObject); - addToOverlayObjectList(pNewOverlayObject); + addToOverlayObjectList(std::move(pNewOverlayObject)); } } @@ -793,11 +793,11 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay const basegfx::B2DPoint aTopLeft(aActionRectangle.Left(), aActionRectangle.Top()); const basegfx::B2DPoint aBottomRight(aActionRectangle.Right(), aActionRectangle.Bottom()); - sdr::overlay::OverlayRollingRectangleStriped* pNew = new sdr::overlay::OverlayRollingRectangleStriped( - aTopLeft, aBottomRight, true, false); + std::unique_ptr<sdr::overlay::OverlayRollingRectangleStriped> pNew(new sdr::overlay::OverlayRollingRectangleStriped( + aTopLeft, aBottomRight, true, false)); rOverlayManager.add(*pNew); - addToOverlayObjectList(pNew); + addToOverlayObjectList(std::move(pNew)); } } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index e6616c0247e0..bfe91b5268b8 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1190,15 +1190,15 @@ bool SdrObjEditView::SdrBeginTextEdit( rtl::Reference< sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); if (xManager.is()) { - TextEditOverlayObject* pNewTextEditOverlayObject = new TextEditOverlayObject( + std::unique_ptr<TextEditOverlayObject> pNewTextEditOverlayObject(new TextEditOverlayObject( aHilightColor, *pTextEditOutlinerView, - bVisualizeSurroundingFrame); + bVisualizeSurroundingFrame)); xManager->add(*pNewTextEditOverlayObject); xManager->add(const_cast<sdr::overlay::OverlaySelection&>(*pNewTextEditOverlayObject->getOverlaySelection())); - maTEOverlayGroup.append(pNewTextEditOverlayObject); + maTEOverlayGroup.append(std::move(pNewTextEditOverlayObject)); } } } diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 68052c193e7f..a0b0291e02b0 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -565,7 +565,7 @@ void SdrHdl::CreateB2dIAObject() if (xManager.is()) { basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); - sdr::overlay::OverlayObject* pNewOverlayObject = nullptr; + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject; if (getenv ("SVX_DRAW_HANDLES") && (eKindOfMarker == BitmapMarkerKind::Rect_7x7 || eKindOfMarker == BitmapMarkerKind::Rect_9x9 || eKindOfMarker == BitmapMarkerKind::Rect_11x11)) { double fSize = 7.0; @@ -604,19 +604,19 @@ void SdrHdl::CreateB2dIAObject() default: break; } - pNewOverlayObject = new sdr::overlay::OverlayHandle(aPosition, aB2DSize, /*HandleStrokeColor*/COL_BLACK, aHandleFillColor); + pNewOverlayObject.reset(new sdr::overlay::OverlayHandle(aPosition, aB2DSize, /*HandleStrokeColor*/COL_BLACK, aHandleFillColor)); } else { - pNewOverlayObject = CreateOverlayObject( + pNewOverlayObject.reset(CreateOverlayObject( aPosition, eColIndex, eKindOfMarker, - aMoveOutsideOffset); + aMoveOutsideOffset)); } // OVERLAYMANAGER if (pNewOverlayObject) { xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -1112,17 +1112,17 @@ void SdrHdlColor::CreateB2dIAObject() { BitmapEx aBmpCol(CreateColorDropper(aMarkerColor)); basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); - sdr::overlay::OverlayObject* pNewOverlayObject = new + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new sdr::overlay::OverlayBitmapEx( aPosition, aBmpCol, static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Width() - 1) >> 1, static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Height() - 1) >> 1 - ); + )); // OVERLAYMANAGER xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -1274,15 +1274,14 @@ void SdrHdlGradient::CreateB2dIAObject() basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y()); - sdr::overlay::OverlayObject* pNewOverlayObject = new + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new sdr::overlay::OverlayLineStriped( aPosition, aMidPos - ); - DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); + )); pNewOverlayObject->setBaseColor(IsGradient() ? COL_BLACK : COL_BLUE); xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); // arrowhead Point aLeft(aMidPoint.X() + static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth), @@ -1294,17 +1293,16 @@ void SdrHdlGradient::CreateB2dIAObject() basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y()); basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y()); - pNewOverlayObject = new + pNewOverlayObject.reset(new sdr::overlay::OverlayTriangle( aPositionLeft, aPosition2, aPositionRight, IsGradient() ? COL_BLACK : COL_BLUE - ); - DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); + )); xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -1421,18 +1419,18 @@ void SdrHdlLine::CreateB2dIAObject() basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y()); basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y()); - sdr::overlay::OverlayObject* pNewOverlayObject = new + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new sdr::overlay::OverlayLineStriped( aPosition1, aPosition2 - ); + )); // OVERLAYMANAGER // color(?) pNewOverlayObject->setBaseColor(COL_LIGHTRED); xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -1479,11 +1477,11 @@ void SdrHdlBezWgt::CreateB2dIAObject() if(!aPosition1.equal(aPosition2)) { - sdr::overlay::OverlayObject* pNewOverlayObject = new + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new sdr::overlay::OverlayLineStriped( aPosition1, aPosition2 - ); + )); // OVERLAYMANAGER // line part is not hittable pNewOverlayObject->setHittable(false); @@ -1492,7 +1490,7 @@ void SdrHdlBezWgt::CreateB2dIAObject() pNewOverlayObject->setBaseColor(COL_LIGHTBLUE); xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -1530,15 +1528,15 @@ void E3dVolumeMarker::CreateB2dIAObject() rtl::Reference< sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); if (xManager.is() && aWireframePoly.count()) { - sdr::overlay::OverlayObject* pNewOverlayObject = new - sdr::overlay::OverlayPolyPolygonStripedAndFilled( - aWireframePoly); + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new + sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aWireframePoly)); // OVERLAYMANAGER pNewOverlayObject->setBaseColor(COL_BLACK); xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -1593,16 +1591,16 @@ void ImpEdgeHdl::CreateB2dIAObject() if (xManager.is()) { basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); - sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject( + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(CreateOverlayObject( aPosition, eColIndex, - eKindOfMarker); + eKindOfMarker)); // OVERLAYMANAGER if (pNewOverlayObject) { xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -1709,16 +1707,16 @@ void ImpMeasureHdl::CreateB2dIAObject() if (xManager.is()) { basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); - sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject( + std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(CreateOverlayObject( aPosition, eColIndex, - eKindOfMarker); + eKindOfMarker)); // OVERLAYMANAGER if (pNewOverlayObject) { xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -1776,7 +1774,7 @@ void ImpTextframeHdl::CreateB2dIAObject() const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor()); const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); - sdr::overlay::OverlayRectangle* pNewOverlayObject = new sdr::overlay::OverlayRectangle( + std::unique_ptr<sdr::overlay::OverlayRectangle> pNewOverlayObject(new sdr::overlay::OverlayRectangle( aTopLeft, aBottomRight, aHilightColor, @@ -1784,12 +1782,12 @@ void ImpTextframeHdl::CreateB2dIAObject() 3.0, 3.0, nRotationAngle * -F_PI18000, - true); // allow animation; the Handle is not shown at text edit time + true)); // allow animation; the Handle is not shown at text edit time // OVERLAYMANAGER pNewOverlayObject->setHittable(false); xManager->add(*pNewOverlayObject); - maOverlayGroup.append(pNewOverlayObject); + maOverlayGroup.append(std::move(pNewOverlayObject)); } } } @@ -2364,7 +2362,7 @@ void SdrCropHdl::CreateB2dIAObject() { basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); - sdr::overlay::OverlayObject* pOverlayObject = nullptr; + std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject; // animate focused handles if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this)) @@ -2376,7 +2374,7 @@ void SdrCropHdl::CreateB2dIAObject() const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime(); - pOverlayObject = new sdr::overlay::OverlayAnimatedBitmapEx( + pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx( aPosition, aBmpEx1, aBmpEx2, @@ -2386,26 +2384,26 @@ void SdrCropHdl::CreateB2dIAObject() static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1, static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1, mfShearX, - mfRotation); + mfRotation)); } else { // create centered handle as default - pOverlayObject = new sdr::overlay::OverlayBitmapEx( + pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx( aPosition, aBmpEx1, static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1, static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1, 0.0, mfShearX, - mfRotation); + mfRotation)); } // OVERLAYMANAGER if(pOverlayObject) { xManager->add(*pOverlayObject); - maOverlayGroup.append(pOverlayObject); + maOverlayGroup.append(std::move(pOverlayObject)); } } } @@ -2613,13 +2611,13 @@ void SdrCropViewHdl::CreateB2dIAObject() rtl::Reference< sdr::overlay::OverlayManager > xManager = rPageWindow.GetOverlayManager(); if(xManager.is()) { - sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence); + std::unique_ptr<sdr::overlay::OverlayObject> pNew(new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence)); // only informative object, no hit pNew->setHittable(false); xManager->add(*pNew); - maOverlayGroup.append(pNew); + maOverlayGroup.append(std::move(pNew)); } } } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index c4eca039c19d..084d936e1baa 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -94,10 +94,10 @@ ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx: if (xTargetOverlay.is()) { - sdr::overlay::OverlayRollingRectangleStriped* pNew = new sdr::overlay::OverlayRollingRectangleStriped( - rStartPos, rStartPos, false); + std::unique_ptr<sdr::overlay::OverlayRollingRectangleStriped> pNew(new sdr::overlay::OverlayRollingRectangleStriped( + rStartPos, rStartPos, false)); xTargetOverlay->add(*pNew); - maObjects.append(pNew); + maObjects.append(std::move(pNew)); } } } diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx index 1dc96f0c6a51..55664027168a 100644 --- a/svx/source/svdraw/svdsnpv.cxx +++ b/svx/source/svdraw/svdsnpv.cxx @@ -62,10 +62,10 @@ ImplPageOriginOverlay::ImplPageOriginOverlay(const SdrPaintView& rView, const ba if (xTargetOverlay.is()) { - sdr::overlay::OverlayCrosshairStriped* aNew = new sdr::overlay::OverlayCrosshairStriped( - maPosition); + std::unique_ptr<sdr::overlay::OverlayCrosshairStriped> aNew(new sdr::overlay::OverlayCrosshairStriped( + maPosition)); xTargetOverlay->add(*aNew); - maObjects.append(aNew); + maObjects.append(std::move(aNew)); } } } @@ -136,10 +136,10 @@ ImplHelpLineOverlay::ImplHelpLineOverlay( if (xTargetOverlay.is()) { - sdr::overlay::OverlayHelplineStriped* aNew = new sdr::overlay::OverlayHelplineStriped( - maPosition, meHelpLineKind); + std::unique_ptr<sdr::overlay::OverlayHelplineStriped> aNew(new sdr::overlay::OverlayHelplineStriped( + maPosition, meHelpLineKind)); xTargetOverlay->add(*aNew); - maObjects.append(aNew); + maObjects.append(std::move(aNew)); } } } diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index 3cdbec76c362..f428714e8b81 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -96,11 +96,11 @@ void SdrDropMarkerOverlay::ImplCreateOverlays( if (xTargetOverlay.is()) { - sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new sdr::overlay::OverlayPolyPolygonStripedAndFilled( - rLinePolyPolygon); + std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew(new sdr::overlay::OverlayPolyPolygonStripedAndFilled( + rLinePolyPolygon)); xTargetOverlay->add(*pNew); - maObjects.append(pNew); + maObjects.append(std::move(pNew)); } } } |