diff options
-rw-r--r-- | chart2/source/controller/main/DragMethod_PieSegment.cxx | 2 | ||||
-rw-r--r-- | include/svx/svddrgmt.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/animations/motionpathtag.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svddrgmt.cxx | 58 |
4 files changed, 31 insertions, 40 deletions
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx index e9fbde74357a..4731c8252ee7 100644 --- a/chart2/source/controller/main/DragMethod_PieSegment.cxx +++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx @@ -142,7 +142,7 @@ void DragMethod_PieSegment::createSdrDragEntries() if( pObj && pPV ) { const basegfx::B2DPolyPolygon aNewPolyPolygon(pObj->TakeXorPoly()); - addSdrDragEntry(new SdrDragEntryPolyPolygon(aNewPolyPolygon)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aNewPolyPolygon))); } } } //namespace chart diff --git a/include/svx/svddrgmt.hxx b/include/svx/svddrgmt.hxx index ab6a87344511..b51769d0e740 100644 --- a/include/svx/svddrgmt.hxx +++ b/include/svx/svddrgmt.hxx @@ -23,6 +23,7 @@ #include <svx/svddrgv.hxx> #include <svx/svxdllapi.h> #include <svx/sdr/contact/objectcontact.hxx> +#include <memory> class SdrDragView; class SdrDragStat; @@ -113,7 +114,7 @@ public: class SVX_DLLPUBLIC SdrDragMethod { private: - std::vector< SdrDragEntry* > maSdrDragEntries; + std::vector< std::unique_ptr<SdrDragEntry> > maSdrDragEntries; sdr::overlay::OverlayObjectList maOverlayObjectList; SdrDragView& mrSdrDragView; @@ -124,7 +125,7 @@ private: protected: // access for derivated classes to maSdrDragEntries void clearSdrDragEntries(); - void addSdrDragEntry(SdrDragEntry* pNew); + void addSdrDragEntry(std::unique_ptr<SdrDragEntry> pNew); virtual void createSdrDragEntries(); virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact); diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index 165d67b87516..6699ade88ff7 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -106,7 +106,7 @@ void PathDragMove::createSdrDragEntries() if(maPathPolyPolygon.count()) { - addSdrDragEntry(new SdrDragEntryPolyPolygon(maPathPolyPolygon)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(maPathPolyPolygon))); } } @@ -167,7 +167,7 @@ void PathDragResize::createSdrDragEntries() if(maPathPolyPolygon.count()) { - addSdrDragEntry(new SdrDragEntryPolyPolygon(maPathPolyPolygon)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(maPathPolyPolygon))); } } @@ -221,7 +221,7 @@ void PathDragObjOwn::createSdrDragEntries() if(maPathPolyPolygon.count()) { - addSdrDragEntry(new SdrDragEntryPolyPolygon(maPathPolyPolygon)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(maPathPolyPolygon))); } } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index be78cd90fc93..430d98006fa5 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -306,20 +306,13 @@ basegfx::B2DRange SdrDragMethod::getCurrentRange() const void SdrDragMethod::clearSdrDragEntries() { - for(SdrDragEntry* p : maSdrDragEntries) - { - delete p; - } - maSdrDragEntries.clear(); } -void SdrDragMethod::addSdrDragEntry(SdrDragEntry* pNew) +void SdrDragMethod::addSdrDragEntry(std::unique_ptr<SdrDragEntry> pNew) { - if(pNew) - { - maSdrDragEntries.push_back(pNew); - } + assert(pNew); + maSdrDragEntries.push_back(std::move(pNew)); } void SdrDragMethod::createSdrDragEntries() @@ -352,7 +345,7 @@ void SdrDragMethod::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, s { // add full object drag; Clone() at the object has to work // for this - addSdrDragEntry(new SdrDragEntrySdrObject(rOriginal, rObjectContact, true/*bModify*/)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntrySdrObject(rOriginal, rObjectContact, true/*bModify*/))); } void SdrDragMethod::createSdrDragEntries_SolidDrag() @@ -404,7 +397,7 @@ void SdrDragMethod::createSdrDragEntries_SolidDrag() // when dragging a 50% transparent copy of a filled or not filled object without // outline, this is normally hard to see. Add extra wireframe in that case. This // works nice e.g. with text frames etc. - addSdrDragEntry(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly())); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly()))); } } } @@ -458,7 +451,7 @@ void SdrDragMethod::createSdrDragEntries_PolygonDrag() if(aResult.count()) { - addSdrDragEntry(new SdrDragEntryPolyPolygon(aResult)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aResult))); } } @@ -504,7 +497,7 @@ void SdrDragMethod::createSdrDragEntries_PointDrag() if(!aPositions.empty()) { - addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, true)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPointGlueDrag(aPositions, true))); } } @@ -546,7 +539,7 @@ void SdrDragMethod::createSdrDragEntries_GlueDrag() if(!aPositions.empty()) { - addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, false)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPointGlueDrag(aPositions, false))); } } @@ -691,7 +684,7 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay // clone, remember edges for(auto const & a: maSdrDragEntries) { - SdrDragEntrySdrObject* pSdrDragEntrySdrObject = dynamic_cast< SdrDragEntrySdrObject*>(a); + SdrDragEntrySdrObject* pSdrDragEntrySdrObject = dynamic_cast< SdrDragEntrySdrObject*>(a.get()); if(pSdrDragEntrySdrObject) { @@ -746,22 +739,19 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay drawinglayer::primitive2d::Primitive2DContainer aResult; drawinglayer::primitive2d::Primitive2DContainer aResultTransparent; - for(SdrDragEntry* pCandidate: maSdrDragEntries) + for(auto & pCandidate: maSdrDragEntries) { - if(pCandidate) - { - const drawinglayer::primitive2d::Primitive2DContainer aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this)); + const drawinglayer::primitive2d::Primitive2DContainer aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this)); - if(!aCandidateResult.empty()) + if(!aCandidateResult.empty()) + { + if(pCandidate->getAddToTransparent()) { - if(pCandidate->getAddToTransparent()) - { - aResultTransparent.append(aCandidateResult); - } - else - { - aResult.append(aCandidateResult); - } + aResultTransparent.append(aCandidateResult); + } + else + { + aResult.append(aCandidateResult); } } } @@ -1175,7 +1165,7 @@ void SdrDragObjOwn::createSdrDragEntries() if(pPV && pPV->PageWindowCount()) { sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact(); - addSdrDragEntry(new SdrDragEntrySdrObject(*mpClone, rOC, false)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntrySdrObject(*mpClone, rOC, false))); // potentially no wireframe needed, full drag works bAddWireframe = false; @@ -1208,7 +1198,7 @@ void SdrDragObjOwn::createSdrDragEntries() if(aDragPolyPolygon.count()) { - addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragPolyPolygon)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragPolyPolygon))); } } } @@ -1462,7 +1452,7 @@ void SdrDragMove::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr // here we want the complete primitive sequence without visible clippings rObjectContact.resetViewPort(); - addSdrDragEntry(new SdrDragEntryPrimitive2DSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo))); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPrimitive2DSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo)))); } void SdrDragMove::applyCurrentTransformationToSdrObject(SdrObject& rTarget) @@ -2887,7 +2877,7 @@ void SdrDragCrook::createSdrDragEntries() if(aDragRaster.count()) { - addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragRaster))); } } @@ -3420,7 +3410,7 @@ void SdrDragDistort::createSdrDragEntries() if(aDragRaster.count()) { - addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster)); + addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragRaster))); } } |