summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-04 14:03:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-05 09:32:47 +0200
commit11d513d580ed8b80fd32987cb9c73716b48ca916 (patch)
treebf5a3211b85e9642dfccdfcc543dc9b2f35d5dbe /svx/source
parent1800cac964c145d9aa7e0048e0e545463901a03c (diff)
loplugin:useuniqueptr in svx
Change-Id: Iba9ceb0b86b175ef599f4de7b06bf0dccc2ba997 Reviewed-on: https://gerrit.libreoffice.org/60005 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/svdraw/svdotext.cxx7
-rw-r--r--svx/source/table/tablecolumn.cxx11
-rw-r--r--svx/source/table/tablerow.cxx11
3 files changed, 9 insertions, 20 deletions
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index b0799a92b5d8..91a5a23040bf 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -539,7 +539,7 @@ void SdrTextObj::AdaptTextMinSize()
void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, tools::Rectangle const & rAnchorRect, bool bLineWidth ) const
{
basegfx::B2DPolyPolygon aXorPolyPolygon(TakeXorPoly());
- basegfx::B2DPolyPolygon* pContourPolyPolygon = nullptr;
+ std::unique_ptr<basegfx::B2DPolyPolygon> pContourPolyPolygon;
basegfx::B2DHomMatrix aMatrix(basegfx::utils::createTranslateB2DHomMatrix(
-rAnchorRect.Left(), -rAnchorRect.Top()));
@@ -555,7 +555,7 @@ void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, tools::Rectangle
{
// Take line width into account.
// When doing the hit test, avoid this. (Performance!)
- pContourPolyPolygon = new basegfx::B2DPolyPolygon();
+ pContourPolyPolygon.reset(new basegfx::B2DPolyPolygon());
// test if shadow needs to be avoided for TakeContour()
const SfxItemSet& rSet = GetObjectItemSet();
@@ -590,8 +590,7 @@ void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, tools::Rectangle
pContourPolyPolygon->transform(aMatrix);
}
- rOutliner.SetPolygon(aXorPolyPolygon, pContourPolyPolygon);
- delete pContourPolyPolygon;
+ rOutliner.SetPolygon(aXorPolyPolygon, pContourPolyPolygon.get());
}
void SdrTextObj::TakeUnrotatedSnapRect(tools::Rectangle& rRect) const
diff --git a/svx/source/table/tablecolumn.cxx b/svx/source/table/tablecolumn.cxx
index e4007b3b35cf..7cff0359a916 100644
--- a/svx/source/table/tablecolumn.cxx
+++ b/svx/source/table/tablecolumn.cxx
@@ -142,12 +142,12 @@ void SAL_CALL TableColumn::setFastPropertyValue( sal_Int32 nHandle, const Any& a
bool bChange = false;
SdrModel& rModel(mxTableModel->getSdrTableObj()->getSdrModelFromSdrObject());
- TableColumnUndo* pUndo = nullptr;
+ std::unique_ptr<TableColumnUndo> pUndo;
if( mxTableModel.is() && mxTableModel->getSdrTableObj() && mxTableModel->getSdrTableObj()->IsInserted() && rModel.IsUndoEnabled() )
{
TableColumnRef xThis( this );
- pUndo = new TableColumnUndo( xThis );
+ pUndo.reset( new TableColumnUndo( xThis ) );
}
switch( nHandle )
@@ -201,12 +201,10 @@ void SAL_CALL TableColumn::setFastPropertyValue( sal_Int32 nHandle, const Any& a
break;
}
default:
- delete pUndo;
throw UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this));
}
if( !bOk )
{
- delete pUndo;
throw IllegalArgumentException();
}
@@ -214,13 +212,10 @@ void SAL_CALL TableColumn::setFastPropertyValue( sal_Int32 nHandle, const Any& a
{
if( pUndo )
{
- rModel.AddUndo( pUndo );
- pUndo = nullptr;
+ rModel.AddUndo( pUndo.release() );
}
mxTableModel->setModified(true);
}
-
- delete pUndo;
}
diff --git a/svx/source/table/tablerow.cxx b/svx/source/table/tablerow.cxx
index cf765b47830a..c3b4e03475ae 100644
--- a/svx/source/table/tablerow.cxx
+++ b/svx/source/table/tablerow.cxx
@@ -213,13 +213,13 @@ void SAL_CALL TableRow::setFastPropertyValue( sal_Int32 nHandle, const Any& aVal
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
bool bOk(false);
bool bChange(false);
- TableRowUndo* pUndo(nullptr);
+ std::unique_ptr<TableRowUndo> pUndo;
const bool bUndo(rTableObj.IsInserted() && rModel.IsUndoEnabled());
if( bUndo )
{
TableRowRef xThis( this );
- pUndo = new TableRowUndo( xThis );
+ pUndo.reset(new TableRowUndo( xThis ));
}
switch( nHandle )
@@ -274,13 +274,11 @@ void SAL_CALL TableRow::setFastPropertyValue( sal_Int32 nHandle, const Any& aVal
break;
}
default:
- delete pUndo;
throw UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this));
}
if( !bOk )
{
- delete pUndo;
throw IllegalArgumentException();
}
@@ -288,13 +286,10 @@ void SAL_CALL TableRow::setFastPropertyValue( sal_Int32 nHandle, const Any& aVal
{
if( pUndo )
{
- rModel.AddUndo( pUndo );
- pUndo = nullptr;
+ rModel.AddUndo( pUndo.release() );
}
mxTableModel->setModified(true);
}
-
- delete pUndo;
}