summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-11 12:53:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-13 13:08:52 +0000
commitcd8fdb46fd9a215532688585f3466d36b1daa1ac (patch)
tree8e25067a0e72ce5afe9c490f9eef567821f594c7 /editeng
parente6d7d737522124350a17a3cfdee055f03200a274 (diff)
new loplugin: useuniqueptr: editeng
Change-Id: I6df65eab882780d996ee996b5fef8020186b6d98 Reviewed-on: https://gerrit.libreoffice.org/32958 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/accessibility/AccessibleHyperlink.cxx3
-rw-r--r--editeng/source/accessibility/AccessibleHyperlink.hxx4
-rw-r--r--editeng/source/editeng/editdoc.cxx8
-rw-r--r--editeng/source/editeng/editdoc.hxx2
-rw-r--r--editeng/source/editeng/editeng.cxx13
-rw-r--r--editeng/source/editeng/editundo.cxx4
-rw-r--r--editeng/source/editeng/editundo.hxx9
-rw-r--r--editeng/source/editeng/editview.cxx7
-rw-r--r--editeng/source/editeng/eehtml.cxx6
-rw-r--r--editeng/source/editeng/eehtml.hxx3
-rw-r--r--editeng/source/editeng/eerdll.cxx3
-rw-r--r--editeng/source/editeng/impedit.hxx2
-rw-r--r--editeng/source/editeng/impedit3.cxx4
-rw-r--r--editeng/source/editeng/impedit5.cxx9
-rw-r--r--editeng/source/items/bulitem.cxx22
-rw-r--r--editeng/source/items/flditem.cxx11
-rw-r--r--editeng/source/items/frmitems.cxx18
-rw-r--r--editeng/source/items/numitem.cxx8
-rw-r--r--editeng/source/misc/acorrcfg.cxx8
-rw-r--r--editeng/source/misc/unolingu.cxx17
-rw-r--r--editeng/source/outliner/outliner.cxx4
-rw-r--r--editeng/source/outliner/outlobj.cxx1
-rw-r--r--editeng/source/outliner/outlvw.cxx3
-rw-r--r--editeng/source/uno/unotext2.cxx5
-rw-r--r--editeng/source/xml/xmltxtexp.cxx9
25 files changed, 71 insertions, 112 deletions
diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx
index 0dddfcee9e10..fd4443ccad76 100644
--- a/editeng/source/accessibility/AccessibleHyperlink.cxx
+++ b/editeng/source/accessibility/AccessibleHyperlink.cxx
@@ -39,7 +39,7 @@ namespace accessibility
AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, sal_Int32 nP, sal_uInt16 nR, sal_Int32 nStt, sal_Int32 nEnd, const OUString& rD )
: rTA( r )
{
- pFld = p;
+ pFld.reset( p );
nPara = nP;
nRealIdx = nR;
nStartIdx = nStt;
@@ -49,7 +49,6 @@ namespace accessibility
AccessibleHyperlink::~AccessibleHyperlink()
{
- delete pFld;
}
// XAccessibleAction
diff --git a/editeng/source/accessibility/AccessibleHyperlink.hxx b/editeng/source/accessibility/AccessibleHyperlink.hxx
index 9dda555ab78a..08201df3fc85 100644
--- a/editeng/source/accessibility/AccessibleHyperlink.hxx
+++ b/editeng/source/accessibility/AccessibleHyperlink.hxx
@@ -29,6 +29,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include <memory>
+
class SvxFieldItem;
class SvxAccessibleTextAdapter;
@@ -40,7 +42,7 @@ namespace accessibility
private:
SvxAccessibleTextAdapter& rTA;
- SvxFieldItem* pFld;
+ std::unique_ptr<SvxFieldItem> pFld;
sal_Int32 nPara; // EE values
sal_uInt16 nRealIdx; // EE values
sal_Int32 nStartIdx, nEndIdx; // translated values
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index e0a17849db08..b2b43909a160 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -537,19 +537,17 @@ ExtraPortionInfo::ExtraPortionInfo()
ExtraPortionInfo::~ExtraPortionInfo()
{
- delete[] pOrgDXArray;
}
void ExtraPortionInfo::SaveOrgDXArray( const long* pDXArray, sal_Int32 nLen )
{
- delete[] pOrgDXArray;
if (pDXArray)
{
- pOrgDXArray = new long[nLen];
- memcpy( pOrgDXArray, pDXArray, nLen * sizeof(long) );
+ pOrgDXArray.reset(new long[nLen]);
+ memcpy( pOrgDXArray.get(), pDXArray, nLen * sizeof(long) );
}
else
- pOrgDXArray = nullptr;
+ pOrgDXArray.reset();
}
ParaPortion::ParaPortion( ContentNode* pN ) :
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 5d0e6f5f3fb4..536646882341 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -370,7 +370,7 @@ struct ExtraPortionInfo
bool bFirstCharIsRightPunktuation;
bool bCompressed;
- long* pOrgDXArray;
+ std::unique_ptr<long[]> pOrgDXArray;
::std::vector< sal_Int32 > lineBreaksList;
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 8f37954ce5ea..6619f6e06e5c 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -94,12 +94,11 @@ static SfxItemPool* pGlobalPool=nullptr;
EditEngine::EditEngine( SfxItemPool* pItemPool )
{
- pImpEditEngine = new ImpEditEngine( this, pItemPool );
+ pImpEditEngine.reset( new ImpEditEngine( this, pItemPool ) );
}
EditEngine::~EditEngine()
{
- delete pImpEditEngine;
}
void EditEngine::EnableUndo( bool bEnable )
@@ -2772,22 +2771,20 @@ bool EditEngine::IsPageOverflow() {
EFieldInfo::EFieldInfo()
{
- pFieldItem = nullptr;
}
-EFieldInfo::EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_Int32 nPos ) : aPosition( nPara, nPos )
+EFieldInfo::EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_Int32 nPos ) :
+ pFieldItem( new SvxFieldItem( rFieldItem ) ),
+ aPosition( nPara, nPos )
{
- pFieldItem = new SvxFieldItem( rFieldItem );
}
EFieldInfo::~EFieldInfo()
{
- delete pFieldItem;
}
EFieldInfo::EFieldInfo( const EFieldInfo& rFldInfo )
- : pFieldItem(nullptr)
{
*this = rFldInfo;
}
@@ -2797,7 +2794,7 @@ EFieldInfo& EFieldInfo::operator= ( const EFieldInfo& rFldInfo )
if( this == &rFldInfo )
return *this;
- pFieldItem = rFldInfo.pFieldItem ? new SvxFieldItem( *rFldInfo.pFieldItem ) : nullptr;
+ pFieldItem.reset( rFldInfo.pFieldItem ? new SvxFieldItem( *rFldInfo.pFieldItem ) : nullptr );
aCurrentText = rFldInfo.aCurrentText;
aPosition = rFldInfo.aPosition;
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index c96174feb7dc..925cf1f03752 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -371,13 +371,12 @@ EditUndoInsertFeature::EditUndoInsertFeature(
EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature) :
EditUndo(EDITUNDO_INSERTFEATURE, pEE), aEPaM(rEPaM)
{
- pFeature = rFeature.Clone();
+ pFeature.reset( rFeature.Clone() );
DBG_ASSERT( pFeature, "Feature could not be duplicated: EditUndoInsertFeature" );
}
EditUndoInsertFeature::~EditUndoInsertFeature()
{
- delete pFeature;
}
void EditUndoInsertFeature::Undo()
@@ -593,7 +592,6 @@ EditUndoTransliteration::EditUndoTransliteration(EditEngine* pEE, const ESelecti
EditUndoTransliteration::~EditUndoTransliteration()
{
- delete pTxtObj;
}
void EditUndoTransliteration::Undo()
diff --git a/editeng/source/editeng/editundo.hxx b/editeng/source/editeng/editundo.hxx
index f85ee12d5b7d..9e798a7dd2b4 100644
--- a/editeng/source/editeng/editundo.hxx
+++ b/editeng/source/editeng/editundo.hxx
@@ -134,8 +134,8 @@ public:
class EditUndoInsertFeature : public EditUndo
{
private:
- EPaM aEPaM;
- SfxPoolItem* pFeature;
+ EPaM aEPaM;
+ std::unique_ptr<SfxPoolItem> pFeature;
public:
EditUndoInsertFeature(EditEngine* pEE, const EPaM& rEPaM, const SfxPoolItem& rFeature);
@@ -251,7 +251,8 @@ private:
ESelection aNewESel;
sal_Int32 nMode;
- EditTextObject* pTxtObj;
+ std::unique_ptr<EditTextObject>
+ pTxtObj;
OUString aText;
public:
@@ -259,7 +260,7 @@ public:
virtual ~EditUndoTransliteration() override;
void SetText( const OUString& rText ) { aText = rText; }
- void SetText( EditTextObject* pObj ) { pTxtObj = pObj; }
+ void SetText( EditTextObject* pObj ) { pTxtObj.reset( pObj ); }
void SetNewSelection( const ESelection& rSel ) { aNewESel = rSel; }
virtual void Undo() override;
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 732f774eaff3..897569e58fbc 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -155,17 +155,16 @@ LanguageType EditView::CheckLanguage(
EditView::EditView( EditEngine* pEng, vcl::Window* pWindow )
{
- pImpEditView = new ImpEditView( this, pEng, pWindow );
+ pImpEditView.reset( new ImpEditView( this, pEng, pWindow ) );
}
EditView::~EditView()
{
- delete pImpEditView;
}
ImpEditEngine* EditView::GetImpEditEngine() const
{
- return pImpEditView->pEditEngine->pImpEditEngine;
+ return pImpEditView->pEditEngine->pImpEditEngine.get();
}
EditEngine* EditView::GetEditEngine() const
@@ -291,7 +290,7 @@ void EditView::GetSelectionRectangles(std::vector<Rectangle>& rLogicRects) const
void EditView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice )
{
- pImpEditView->pEditEngine->pImpEditEngine->Paint( pImpEditView, rRect, pTargetDevice );
+ pImpEditView->pEditEngine->pImpEditEngine->Paint( pImpEditView.get(), rRect, pTargetDevice );
}
void EditView::SetEditEngine( EditEngine* pEditEng )
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index 44aabf82c9ed..be16f0366480 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -67,7 +67,6 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, const OUString& rBaseURL, SvKeyVa
EditHTMLParser::~EditHTMLParser()
{
- delete pCurAnchor;
}
SvParserState EditHTMLParser::CallParser(EditEngine* pEE, const EditPaM& rPaM)
@@ -780,7 +779,7 @@ void EditHTMLParser::AnchorStart()
aRootURL.GetNewAbsURL( aRef, &aTargetURL );
aURL = aTargetURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
}
- pCurAnchor = new AnchorInfo;
+ pCurAnchor.reset( new AnchorInfo );
pCurAnchor->aHRef = aURL;
}
}
@@ -794,8 +793,7 @@ void EditHTMLParser::AnchorEnd()
SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
aCurSel = mpEditEngine->InsertField(aCurSel, aFld);
bFieldsInserted = true;
- delete pCurAnchor;
- pCurAnchor = nullptr;
+ pCurAnchor.reset();
if (mpEditEngine->IsImportHandlerSet())
{
diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx
index 08563bc72cab..633c453f60b8 100644
--- a/editeng/source/editeng/eehtml.hxx
+++ b/editeng/source/editeng/eehtml.hxx
@@ -39,7 +39,8 @@ private:
EditSelection aCurSel;
OUString aBaseURL;
EditEngine* mpEditEngine;
- AnchorInfo* pCurAnchor;
+ std::unique_ptr<AnchorInfo>
+ pCurAnchor;
bool bInPara:1;
bool bWasInPara:1; // Remember bInPara before HeadingStart, because afterwards it will be gone.
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 08d95aa7402b..558c475acaa6 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -200,13 +200,12 @@ EditResId::EditResId(sal_uInt16 nId)
}
EditDLL::EditDLL()
+ : pGlobalData( new GlobalEditData )
{
- pGlobalData = new GlobalEditData;
}
EditDLL::~EditDLL()
{
- delete pGlobalData;
}
static ResMgr* pResMgr=nullptr;
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 6f97901265bd..b47421f91916 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -144,7 +144,7 @@ struct DragAndDropInfo
struct ImplIMEInfos
{
OUString aOldTextAfterStartPos;
- ExtTextInputAttr* pAttribs;
+ std::unique_ptr<ExtTextInputAttr[]> pAttribs;
EditPaM aPos;
sal_Int32 nLen;
bool bCursor;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index cd90dbbbc3d8..59022d7fa599 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -447,7 +447,7 @@ void ImpEditEngine::FormatDoc()
{
for (EditView* pView : aEditViews)
{
- ImpEditView* pImpView = pView->pImpEditView;
+ ImpEditView* pImpView = pView->pImpEditView.get();
if ( pImpView->DoAutoHeight() )
{
Size aSz( pImpView->GetOutputArea().GetWidth(), nCurTextHeight );
@@ -4481,7 +4481,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" );
long* pDXArray = pLine->GetCharPosArray().data() + (nTxtPortionStart - pLine->GetStart());
if ( pTP->GetExtraInfos()->pOrgDXArray )
- memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray, (pTP->GetLen()-1)*sizeof(sal_Int32) );
+ memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray.get(), (pTP->GetLen()-1)*sizeof(sal_Int32) );
ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, (sal_uInt16)nCompressPercent, true );
}
}
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 100af463f818..0d300818c02a 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -825,21 +825,18 @@ ImplIMEInfos::ImplIMEInfos( const EditPaM& rPos, const OUString& rOldTextAfterSt
ImplIMEInfos::~ImplIMEInfos()
{
- delete[] pAttribs;
}
void ImplIMEInfos::CopyAttribs( const ExtTextInputAttr* pA, sal_uInt16 nL )
{
nLen = nL;
- delete[] pAttribs;
- pAttribs = new ExtTextInputAttr[ nL ];
- memcpy( pAttribs, pA, nL*sizeof(ExtTextInputAttr) );
+ pAttribs.reset( new ExtTextInputAttr[ nL ] );
+ memcpy( pAttribs.get(), pA, nL*sizeof(ExtTextInputAttr) );
}
void ImplIMEInfos::DestroyAttribs()
{
- delete[] pAttribs;
- pAttribs = nullptr;
+ pAttribs.reset();
nLen = 0;
}
diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx
index 1283f3287532..1e2e6a81a62b 100644
--- a/editeng/source/items/bulitem.cxx
+++ b/editeng/source/items/bulitem.cxx
@@ -133,7 +133,7 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich )
nStyle = SvxBulletStyle::NONE;
}
else
- pGraphicObject = new GraphicObject( aBmp );
+ pGraphicObject.reset( new GraphicObject( aBmp ) );
}
sal_Int32 nTmp(0);
@@ -159,7 +159,8 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich )
SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
{
aFont = rItem.aFont;
- pGraphicObject = ( rItem.pGraphicObject ? new GraphicObject( *rItem.pGraphicObject ) : nullptr );
+ if (rItem.pGraphicObject)
+ pGraphicObject.reset( new GraphicObject( *rItem.pGraphicObject ) );
aPrevText = rItem.aPrevText;
aFollowText = rItem.aFollowText;
nStart = rItem.nStart;
@@ -172,7 +173,6 @@ SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
SvxBulletItem::~SvxBulletItem()
{
- delete pGraphicObject;
}
@@ -273,12 +273,7 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c
if( ( nStyle == SvxBulletStyle::BMP ) &&
( !pGraphicObject || ( GraphicType::NONE == pGraphicObject->GetType() ) || ( GraphicType::Default == pGraphicObject->GetType() ) ) )
{
- if( pGraphicObject )
- {
- delete( const_cast< SvxBulletItem* >( this )->pGraphicObject );
- const_cast< SvxBulletItem* >( this )->pGraphicObject = nullptr;
- }
-
+ const_cast< SvxBulletItem* >( this )->pGraphicObject.reset();
const_cast< SvxBulletItem* >( this )->nStyle = SvxBulletStyle::NONE;
}
@@ -366,16 +361,11 @@ void SvxBulletItem::SetGraphicObject( const GraphicObject& rGraphicObject )
{
if( ( GraphicType::NONE == rGraphicObject.GetType() ) || ( GraphicType::Default == rGraphicObject.GetType() ) )
{
- if( pGraphicObject )
- {
- delete pGraphicObject;
- pGraphicObject = nullptr;
- }
+ pGraphicObject.reset();
}
else
{
- delete pGraphicObject;
- pGraphicObject = new GraphicObject( rGraphicObject );
+ pGraphicObject.reset( new GraphicObject( rGraphicObject ) );
}
}
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 8edcd9c2687a..6ff64b926bbe 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -271,28 +271,27 @@ MetaAction* SvxFieldData::createEndComment()
SvxFieldItem::SvxFieldItem( SvxFieldData* pFld, const sal_uInt16 nId ) :
SfxPoolItem( nId )
+ , pField( pFld ) // belongs directly to the item
{
- pField = pFld; // belongs directly to the item
}
SvxFieldItem::SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId ) :
SfxPoolItem( nId )
+ , pField( rField.Clone() )
{
- pField = rField.Clone();
}
SvxFieldItem::SvxFieldItem( const SvxFieldItem& rItem ) :
SfxPoolItem ( rItem )
+ , pField( rItem.GetField() ? rItem.GetField()->Clone() : nullptr )
{
- pField = rItem.GetField() ? rItem.GetField()->Clone() : nullptr;
}
SvxFieldItem::~SvxFieldItem()
{
- delete pField;
}
@@ -332,7 +331,7 @@ SvStream& SvxFieldItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) co
WriteSvPersistBase( aPStrm , &aDummyData );
}
else
- WriteSvPersistBase( aPStrm, pField );
+ WriteSvPersistBase( aPStrm, pField.get() );
return rStrm;
}
@@ -343,7 +342,7 @@ bool SvxFieldItem::operator==( const SfxPoolItem& rItem ) const
assert(SfxPoolItem::operator==(rItem));
const SvxFieldData* pOtherFld = static_cast<const SvxFieldItem&>(rItem).GetField();
- if( pField == pOtherFld )
+ if( pField.get() == pOtherFld )
return true;
if( pField == nullptr || pOtherFld == nullptr )
return false;
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 501dd71f4880..f8b6695e5a10 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3082,16 +3082,15 @@ SvxLineItem::SvxLineItem( const sal_uInt16 nId ) :
SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) :
-
SfxPoolItem ( rCpy )
{
- pLine = rCpy.GetLine() ? new SvxBorderLine( *rCpy.GetLine() ) : nullptr;
+ if (rCpy.GetLine())
+ pLine.reset( new SvxBorderLine( *rCpy.GetLine() ) );
}
SvxLineItem::~SvxLineItem()
{
- delete pLine;
}
@@ -3107,7 +3106,7 @@ bool SvxLineItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
- return CmpBrdLn( pLine, static_cast<const SvxLineItem&>(rAttr).GetLine() );
+ return CmpBrdLn( pLine.get(), static_cast<const SvxLineItem&>(rAttr).GetLine() );
}
@@ -3123,7 +3122,7 @@ bool SvxLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemId ) const
nMemId &= ~CONVERT_TWIPS;
if ( nMemId == 0 )
{
- rVal = uno::makeAny( SvxBoxItem::SvxLineToLine(pLine, bConvert) );
+ rVal = uno::makeAny( SvxBoxItem::SvxLineToLine(pLine.get(), bConvert) );
return true;
}
else if ( pLine )
@@ -3155,9 +3154,9 @@ bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId )
if ( lcl_extractBorderLine(rVal, aLine) )
{
if ( !pLine )
- pLine = new SvxBorderLine;
+ pLine.reset( new SvxBorderLine );
if( !SvxBoxItem::LineToSvxLine(aLine, *pLine, bConvert) )
- DELETEZ( pLine );
+ pLine.reset();
return true;
}
return false;
@@ -3165,7 +3164,7 @@ bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId )
else if ( rVal >>= nVal )
{
if ( !pLine )
- pLine = new SvxBorderLine;
+ pLine.reset( new SvxBorderLine );
switch ( nMemId )
{
@@ -3250,8 +3249,7 @@ SfxPoolItem* SvxLineItem::Create( SvStream& rStrm, sal_uInt16 ) const
void SvxLineItem::SetLine( const SvxBorderLine* pNew )
{
- delete pLine;
- pLine = pNew ? new SvxBorderLine( *pNew ) : nullptr;
+ pLine.reset( pNew ? new SvxBorderLine( *pNew ) : nullptr );
}
#define LOAD_GRAPHIC ((sal_uInt16)0x0001)
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 3d7a3b438ab1..0045d9994f39 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -918,12 +918,11 @@ SfxPoolItem* SvxNumBulletItem::Create(SvStream &rStream, sal_uInt16 /*nItemVersi
SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) :
SfxPoolItem(rCopy.Which())
{
- pNumRule = new SvxNumRule(*rCopy.pNumRule);
+ pNumRule.reset( new SvxNumRule(*rCopy.pNumRule) );
}
SvxNumBulletItem::~SvxNumBulletItem()
{
- delete pNumRule;
}
bool SvxNumBulletItem::operator==( const SfxPoolItem& rCopy) const
@@ -949,7 +948,7 @@ SvStream& SvxNumBulletItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion
bool SvxNumBulletItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
{
- rVal <<= SvxCreateNumRule( pNumRule );
+ rVal <<= SvxCreateNumRule( pNumRule.get() );
return true;
}
@@ -968,8 +967,7 @@ bool SvxNumBulletItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberI
delete pNewRule;
pNewRule = pConverted;
}
- delete pNumRule;
- pNumRule = pNewRule;
+ pNumRule.reset( pNewRule );
return true;
}
catch(const lang::IllegalArgumentException&)
diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index fd227fc171ea..a2b0ceff9863 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -66,7 +66,7 @@ SvxAutoCorrCfg::SvxAutoCorrCfg() :
aPath.insertName("acor");
*pS = aPath.GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
}
- pAutoCorrect = new SvxAutoCorrect( sSharePath, sUserPath );
+ pAutoCorrect.reset( new SvxAutoCorrect( sSharePath, sUserPath ) );
aBaseConfig.Load(true);
aSwConfig.Load(true);
@@ -74,20 +74,18 @@ SvxAutoCorrCfg::SvxAutoCorrCfg() :
SvxAutoCorrCfg::~SvxAutoCorrCfg()
{
- delete pAutoCorrect;
}
void SvxAutoCorrCfg::SetAutoCorrect(SvxAutoCorrect *const pNew)
{
- if (pNew != pAutoCorrect)
+ if (pNew != pAutoCorrect.get())
{
if (pNew && (pAutoCorrect->GetFlags() != pNew->GetFlags()))
{
aBaseConfig.SetModified();
aSwConfig.SetModified();
}
- delete pAutoCorrect;
- pAutoCorrect = pNew;
+ pAutoCorrect.reset( pNew );
}
}
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index e8af80883467..c0a446b4b8fb 100644
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -75,16 +75,15 @@ static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl()
class ThesDummy_Impl :
public cppu::WeakImplHelper< XThesaurus >
{
- uno::Reference< XThesaurus > xThes; // the real one...
- Sequence< lang::Locale > *pLocaleSeq;
+ uno::Reference< XThesaurus > xThes; // the real one...
+ std::unique_ptr<Sequence< lang::Locale >> pLocaleSeq;
void GetCfgLocales();
void GetThes_Impl();
public:
- ThesDummy_Impl() : pLocaleSeq(nullptr) {}
- virtual ~ThesDummy_Impl() override;
+ ThesDummy_Impl() {}
// XSupportedLocales
virtual css::uno::Sequence< css::lang::Locale > SAL_CALL
@@ -105,12 +104,6 @@ public:
};
-ThesDummy_Impl::~ThesDummy_Impl()
-{
- delete pLocaleSeq;
-}
-
-
void ThesDummy_Impl::GetCfgLocales()
{
if (!pLocaleSeq)
@@ -120,7 +113,7 @@ void ThesDummy_Impl::GetCfgLocales()
Sequence < OUString > aNodeNames( aCfg.GetNodeNames( aNode ) );
const OUString *pNodeNames = aNodeNames.getConstArray();
sal_Int32 nLen = aNodeNames.getLength();
- pLocaleSeq = new Sequence< lang::Locale >( nLen );
+ pLocaleSeq.reset( new Sequence< lang::Locale >( nLen ) );
lang::Locale *pLocale = pLocaleSeq->getArray();
for (sal_Int32 i = 0; i < nLen; ++i)
{
@@ -140,7 +133,7 @@ void ThesDummy_Impl::GetThes_Impl()
if (xThes.is())
{
// no longer needed...
- delete pLocaleSeq; pLocaleSeq = nullptr;
+ pLocaleSeq.reset();
}
}
}
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 3e50f60bd605..ca1bdf3d3709 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1290,7 +1290,7 @@ size_t Outliner::InsertView( OutlinerView* pView, size_t nIndex )
advance( it, nIndex );
ActualIndex = nIndex;
}
- pEditEngine->InsertView( pView->pEditView, nIndex );
+ pEditEngine->InsertView( pView->pEditView.get(), nIndex );
return ActualIndex;
}
@@ -1302,7 +1302,7 @@ void Outliner::RemoveView( OutlinerView* pView )
if ( *it == pView )
{
pView->pEditView->HideCursor(); // HACK
- pEditEngine->RemoveView( pView->pEditView );
+ pEditEngine->RemoveView( pView->pEditView.get() );
aViewList.erase( it );
break;
}
diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx
index 3eba88e27435..539e4c2b2652 100644
--- a/editeng/source/outliner/outlobj.cxx
+++ b/editeng/source/outliner/outlobj.cxx
@@ -53,7 +53,6 @@ OutlinerParaObjData::OutlinerParaObjData( const OutlinerParaObjData& r ):
OutlinerParaObjData::~OutlinerParaObjData()
{
- delete mpEditTextObject;
}
bool OutlinerParaObjData::operator==(const OutlinerParaObjData& rCandidate) const
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 9d2a82b040d2..2c176c242a94 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -52,13 +52,12 @@ OutlinerView::OutlinerView( Outliner* pOut, vcl::Window* pWin )
{
pOwner = pOut;
- pEditView = new EditView( pOut->pEditEngine, pWin );
+ pEditView.reset( new EditView( pOut->pEditEngine, pWin ) );
pEditView->SetSelectionMode( EE_SELMODE_TXTONLY );
}
OutlinerView::~OutlinerView()
{
- delete pEditView;
}
void OutlinerView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice )
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index a5d593e64a2a..e56443a1bea2 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -45,15 +45,12 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase
{
mxParentText = const_cast<SvxUnoTextBase*>(&_rText);
if( mrText.GetEditSource() )
- mpEditSource = mrText.GetEditSource()->Clone();
- else
- mpEditSource = nullptr;
+ mpEditSource.reset( mrText.GetEditSource()->Clone() );
mnNextParagraph = 0;
}
SvxUnoTextContentEnumeration::~SvxUnoTextContentEnumeration() throw()
{
- delete mpEditSource;
}
// container::XEnumeration
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
index 9b4c6f386e80..710f0accd6c6 100644
--- a/editeng/source/xml/xmltxtexp.cxx
+++ b/editeng/source/xml/xmltxtexp.cxx
@@ -62,8 +62,8 @@ class SvxEditEngineSourceImpl;
class SvxEditEngineSourceImpl : public salhelper::SimpleReferenceObject
{
private:
- EditEngine* mpEditEngine;
- SvxTextForwarder* mpTextForwarder;
+ EditEngine* mpEditEngine;
+ std::unique_ptr<SvxTextForwarder> mpTextForwarder;
virtual ~SvxEditEngineSourceImpl() override;
@@ -81,15 +81,14 @@ SvxEditEngineSourceImpl::SvxEditEngineSourceImpl( EditEngine* pEditEngine )
SvxEditEngineSourceImpl::~SvxEditEngineSourceImpl()
{
- delete mpTextForwarder;
}
SvxTextForwarder* SvxEditEngineSourceImpl::GetTextForwarder()
{
if (!mpTextForwarder)
- mpTextForwarder = new SvxEditEngineForwarder( *mpEditEngine );
+ mpTextForwarder.reset( new SvxEditEngineForwarder( *mpEditEngine ) );
- return mpTextForwarder;
+ return mpTextForwarder.get();
}
// SvxTextEditSource