summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/basflt/fltshell.cxx36
-rw-r--r--sw/source/filter/html/htmlatr.cxx25
-rw-r--r--sw/source/filter/html/htmlfld.cxx2
-rw-r--r--sw/source/filter/html/htmltab.cxx17
-rw-r--r--sw/source/filter/html/swhtml.cxx11
-rw-r--r--sw/source/filter/html/swhtml.hxx2
-rw-r--r--sw/source/filter/html/wrthtml.cxx1
-rw-r--r--sw/source/filter/html/wrthtml.hxx4
-rw-r--r--sw/source/filter/inc/fltshell.hxx4
-rw-r--r--sw/source/filter/inc/msfilter.hxx2
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx8
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx1
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx11
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx4
-rw-r--r--sw/source/filter/ww8/ww8glsy.cxx3
-rw-r--r--sw/source/filter/ww8/ww8glsy.hxx5
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx4
-rw-r--r--sw/source/filter/ww8/ww8par.cxx10
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx3
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx21
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx12
-rw-r--r--sw/source/filter/ww8/ww8toolbar.cxx6
-rw-r--r--sw/source/filter/ww8/ww8toolbar.hxx4
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx14
-rw-r--r--sw/source/filter/xml/xmlbrsh.cxx1
-rw-r--r--sw/source/filter/xml/xmlbrshi.hxx2
-rw-r--r--sw/source/filter/xml/xmlfmt.cxx29
27 files changed, 98 insertions, 144 deletions
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index e95c8fa7a5a6..803df6aa2aa8 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -96,11 +96,11 @@ static OUString lcl_getTypePath(OUString& rType)
SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt)
: m_aMkPos(rStartPos)
, m_aPtPos(rStartPos)
+ , pAttr( pHt ) // store a copy of the attribute
, mnStartCP(-1)
, mnEndCP(-1)
, bIsParaEnd(false)
{
- pAttr = pHt; // store a copy of the attribute
bOld = false; // used for marking Attributes *before* skipping field results
bOpen = true; // lock the attribute --> may first
bConsumedByField = false;
@@ -109,7 +109,6 @@ SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt)
SwFltStackEntry::~SwFltStackEntry()
{
// Although attribute got passed as pointer, it gets deleted here
- delete pAttr;
}
void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos)
@@ -372,15 +371,15 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
// query handle
bF = true;
}
- else if (nAttrId == RES_FLTR_BOOKMARK && nHand == static_cast<SwFltBookmark*>(rEntry.pAttr)->GetHandle())
+ else if (nAttrId == RES_FLTR_BOOKMARK && nHand == static_cast<SwFltBookmark*>(rEntry.pAttr.get())->GetHandle())
{
bF = true;
}
- else if (nAttrId == RES_FLTR_ANNOTATIONMARK && nHand == static_cast<CntUInt16Item*>(rEntry.pAttr)->GetValue())
+ else if (nAttrId == RES_FLTR_ANNOTATIONMARK && nHand == static_cast<CntUInt16Item*>(rEntry.pAttr.get())->GetValue())
{
bF = true;
}
- else if (nAttrId == RES_FLTR_RDFMARK && nHand == static_cast<SwFltRDFMark*>(rEntry.pAttr)->GetHandle())
+ else if (nAttrId == RES_FLTR_RDFMARK && nHand == static_cast<SwFltRDFMark*>(rEntry.pAttr.get())->GetHandle())
{
bF = true;
}
@@ -532,7 +531,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
{
case RES_FLTR_ANCHOR:
{
- SwFrameFormat* pFormat = static_cast<SwFltAnchor*>(rEntry.pAttr)->GetFrameFormat();
+ SwFrameFormat* pFormat = static_cast<SwFltAnchor*>(rEntry.pAttr.get())->GetFrameFormat();
if (pFormat != nullptr)
{
MakePoint(rEntry, pDoc, aRegion);
@@ -560,7 +559,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
case RES_FLTR_NUMRULE: // insert Numrule
{
- const OUString& rNumNm = static_cast<SfxStringItem*>(rEntry.pAttr)->GetValue();
+ const OUString& rNumNm = static_cast<SfxStringItem*>(rEntry.pAttr.get())->GetValue();
SwNumRule* pNumRule = pDoc->FindNumRulePtr( rNumNm );
if( pNumRule )
{
@@ -588,8 +587,8 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
case RES_FLTR_BOOKMARK:
{
- SwFltBookmark* pB = static_cast<SwFltBookmark*>(rEntry.pAttr);
- const OUString& rName = static_cast<SwFltBookmark*>(rEntry.pAttr)->GetName();
+ SwFltBookmark* pB = static_cast<SwFltBookmark*>(rEntry.pAttr.get());
+ const OUString& rName = static_cast<SwFltBookmark*>(rEntry.pAttr.get())->GetName();
if (IsFlagSet(BOOK_TO_VAR_REF))
{
@@ -631,7 +630,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
{
if (MakeBookRegionOrPoint(rEntry, pDoc, aRegion, true))
{
- SwFltRDFMark* pMark = static_cast<SwFltRDFMark*>(rEntry.pAttr);
+ SwFltRDFMark* pMark = static_cast<SwFltRDFMark*>(rEntry.pAttr.get());
if (aRegion.GetNode().IsTextNode())
{
SwTextNode& rTextNode = *aRegion.GetNode().GetTextNode();
@@ -657,7 +656,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
SwPosition* pPoint = aRegion.GetPoint();
- SwFltTOX* pTOXAttr = static_cast<SwFltTOX*>(rEntry.pAttr);
+ SwFltTOX* pTOXAttr = static_cast<SwFltTOX*>(rEntry.pAttr.get());
// test if on this node there had been a pagebreak BEFORE the
// tox attribute was put on the stack
@@ -702,7 +701,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
pDoc->getIDocumentRedlineAccess().SetRedlineFlags( RedlineFlags::On
| RedlineFlags::ShowInsert
| RedlineFlags::ShowDelete );
- SwFltRedline& rFltRedline = *static_cast<SwFltRedline*>(rEntry.pAttr);
+ SwFltRedline& rFltRedline = *static_cast<SwFltRedline*>(rEntry.pAttr.get());
if( USHRT_MAX != rFltRedline.nAutorNoPrev )
{
@@ -780,7 +779,7 @@ SfxPoolItem* SwFltControlStack::GetFormatStackAttr(sal_uInt16 nWhich, sal_uInt16
{
if (pPos)
*pPos = nSize;
- return rEntry.pAttr; // Ok, so stop
+ return rEntry.pAttr.get(); // Ok, so stop
}
}
return nullptr;
@@ -797,7 +796,7 @@ const SfxPoolItem* SwFltControlStack::GetOpenStackAttr(const SwPosition& rPos, s
SwFltStackEntry &rEntry = *m_Entries[--nSize];
if (rEntry.bOpen && rEntry.pAttr->Which() == nWhich && rEntry.m_aMkPos == aFltPos)
{
- return rEntry.pAttr;
+ return rEntry.pAttr.get();
}
}
return nullptr;
@@ -893,20 +892,19 @@ void SwFltControlStack::Delete(const SwPaM &rPam)
SwFltAnchor::SwFltAnchor(SwFrameFormat* pFormat) :
SfxPoolItem(RES_FLTR_ANCHOR), pFrameFormat(pFormat)
{
- pClient = new SwFltAnchorClient(this);
- pFrameFormat->Add(pClient);
+ pClient.reset( new SwFltAnchorClient(this) );
+ pFrameFormat->Add(pClient.get());
}
SwFltAnchor::SwFltAnchor(const SwFltAnchor& rCpy) :
SfxPoolItem(RES_FLTR_ANCHOR), pFrameFormat(rCpy.pFrameFormat)
{
- pClient = new SwFltAnchorClient(this);
- pFrameFormat->Add(pClient);
+ pClient.reset( new SwFltAnchorClient(this) );
+ pFrameFormat->Add(pClient.get());
}
SwFltAnchor::~SwFltAnchor()
{
- delete pClient;
}
void SwFltAnchor::SetFrameFormat(SwFrameFormat * _pFrameFormat)
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 286c0b19b415..406a5661e0b3 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -296,8 +296,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
if( pReferenceFormat || nDeep==0 )
{
- pItemSet = new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
- pFormat->GetAttrSet().GetRanges() );
+ pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
+ pFormat->GetAttrSet().GetRanges() ) );
// if the differences to a different style are supposed to be
// written, hard attribute is necessary. This is always true
// for styles that are not derived from HTML-tag styles.
@@ -311,8 +311,7 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
// later on
if( !pItemSet->Count() )
{
- delete pItemSet;
- pItemSet = nullptr;
+ pItemSet.reset();
}
}
@@ -361,8 +360,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
if( rSet != rRef )
{
if( !pItemSet )
- pItemSet = new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
- pFormat->GetAttrSet().GetRanges() );
+ pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
+ pFormat->GetAttrSet().GetRanges() ) );
pItemSet->Put( rSet );
}
}
@@ -391,8 +390,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
if( eLang != eDfltLang )
{
if( !pItemSet )
- pItemSet = new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
- pFormat->GetAttrSet().GetRanges() );
+ pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
+ pFormat->GetAttrSet().GetRanges() ) );
pItemSet->Put( rLang );
}
@@ -408,8 +407,8 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
if( rTmpLang.GetLanguage() != eLang )
{
if( !pItemSet )
- pItemSet = new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
- pFormat->GetAttrSet().GetRanges() );
+ pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
+ pFormat->GetAttrSet().GetRanges() ) );
pItemSet->Put( rTmpLang );
}
}
@@ -419,7 +418,6 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
SwHTMLFormatInfo::~SwHTMLFormatInfo()
{
- delete pItemSet;
}
void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat,
@@ -1027,14 +1025,14 @@ class HTMLStartEndPos
{
sal_Int32 nStart;
sal_Int32 nEnd;
- SfxPoolItem* pItem;
+ std::unique_ptr<SfxPoolItem> pItem;
public:
HTMLStartEndPos( const SfxPoolItem& rItem, sal_Int32 nStt, sal_Int32 nE );
~HTMLStartEndPos();
- const SfxPoolItem *GetItem() const { return pItem; }
+ const SfxPoolItem *GetItem() const { return pItem.get(); }
void SetStart( sal_Int32 nStt ) { nStart = nStt; }
sal_Int32 GetStart() const { return nStart; }
@@ -1052,7 +1050,6 @@ HTMLStartEndPos::HTMLStartEndPos( const SfxPoolItem& rItem, sal_Int32 nStt,
HTMLStartEndPos::~HTMLStartEndPos()
{
- delete pItem;
}
typedef std::vector<HTMLStartEndPos *> HTMLStartEndPositions;
diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx
index 282a1d6c7535..15e3d4b3f273 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -624,7 +624,7 @@ void SwHTMLParser::InsertComment( const OUString& rComment, const sal_Char *pTag
break;
if( RES_TXTATR_FIELD == pAttr->pItem->Which() &&
- RES_SCRIPTFLD == static_cast<const SwFormatField *>(pAttr->pItem)->GetField()->GetTyp()->Which() )
+ RES_SCRIPTFLD == static_cast<const SwFormatField *>(pAttr->pItem.get())->GetField()->GetTyp()->Which() )
{
bMoveFwd = false;
break;
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 94e4dc9e7435..3b3faa062f6f 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -107,7 +107,7 @@ class HTMLTableContext
SwTableNode *pTableNd; // table node
SwFrameFormat *pFrameFormat; // der Fly frame::Frame, containing the table
- SwPosition *pPos; // position behind the table
+ std::unique_ptr<SwPosition> pPos; // position behind the table
size_t nContextStAttrMin;
size_t nContextStMin;
@@ -145,7 +145,7 @@ public:
void SavePREListingXMP( SwHTMLParser& rParser );
void RestorePREListingXMP( SwHTMLParser& rParser );
- SwPosition *GetPos() const { return pPos; }
+ SwPosition *GetPos() const { return pPos.get(); }
void SetTableNode( SwTableNode *pNd ) { pTableNd = pNd; }
SwTableNode *GetTableNode() const { return pTableNd; }
@@ -2715,7 +2715,6 @@ void HTMLTable::MakeParentContents()
HTMLTableContext::~HTMLTableContext()
{
- delete pPos;
}
void HTMLTableContext::SavePREListingXMP( SwHTMLParser& rParser )
@@ -3026,7 +3025,7 @@ class CellSaveStruct : public SectionSaveStruct
HTMLTableCnts* m_pCnts; // Liste aller Inhalte
HTMLTableCnts* m_pCurrCnts; // der aktuelle Inhalt oder 0
- SwNodeIndex *m_pNoBreakEndNodeIndex;// Absatz-Index eines </NOBR>
+ std::unique_ptr<SwNodeIndex> m_pNoBreakEndNodeIndex;// Absatz-Index eines </NOBR>
double m_nValue;
@@ -3051,8 +3050,6 @@ public:
CellSaveStruct( SwHTMLParser& rParser, HTMLTable *pCurTable, bool bHd,
bool bReadOpt );
- virtual ~CellSaveStruct() override;
-
void AddContents( HTMLTableCnts *pNewCnts );
HTMLTableCnts *GetFirstContents() { return m_pCnts; }
@@ -3222,11 +3219,6 @@ CellSaveStruct::CellSaveStruct( SwHTMLParser& rParser, HTMLTable *pCurTable,
rParser.PushContext( pCntxt );
}
-CellSaveStruct::~CellSaveStruct()
-{
- delete m_pNoBreakEndNodeIndex;
-}
-
void CellSaveStruct::AddContents( HTMLTableCnts *pNewCnts )
{
if( m_pCnts )
@@ -3295,8 +3287,7 @@ void CellSaveStruct::EndNoBreak( const SwPosition& rPos )
{
if( m_bNoBreak )
{
- delete m_pNoBreakEndNodeIndex;
- m_pNoBreakEndNodeIndex = new SwNodeIndex( rPos.nNode );
+ m_pNoBreakEndNodeIndex.reset( new SwNodeIndex( rPos.nNode ) );
m_nNoBreakEndContentPos = rPos.nContent.GetIndex();
m_bNoBreak = false;
}
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 9b4fac0e3d48..6c927f430fd3 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2808,7 +2808,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
{
case RES_FLTR_BOOKMARK: // insert bookmark
{
- const OUString sName( static_cast<SfxStringItem*>(pAttr->pItem)->GetValue() );
+ const OUString sName( static_cast<SfxStringItem*>(pAttr->pItem.get())->GetValue() );
IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess();
IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findMark( sName );
if( ppBkmk != pMarkAccess->getAllMarksEnd() &&
@@ -2834,7 +2834,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
{
sal_uInt16 nFieldWhich =
pPostIts
- ? static_cast<const SwFormatField *>(pAttr->pItem)->GetField()->GetTyp()->Which()
+ ? static_cast<const SwFormatField *>(pAttr->pItem.get())->GetField()->GetTyp()->Which()
: 0;
if( pPostIts && (RES_POSTITFLD == nFieldWhich ||
RES_SCRIPTFLD == nFieldWhich) )
@@ -2882,7 +2882,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable,
// ggfs. ein Bookmark anspringen
if( RES_TXTATR_INETFMT == nWhich &&
JUMPTO_MARK == m_eJumpTo &&
- m_sJmpMark == static_cast<SwFormatINetFormat*>(pAttr->pItem)->GetName() )
+ m_sJmpMark == static_cast<SwFormatINetFormat*>(pAttr->pItem.get())->GetName() )
{
m_bChkJumpMark = true;
m_eJumpTo = JUMPTO_NONE;
@@ -5427,11 +5427,11 @@ HTMLAttr::HTMLAttr( const SwPosition& rPos, const SfxPoolItem& rItem,
bInsAtStart( true ),
bLikePara( false ),
bValid( true ),
+ pItem( rItem.Clone() ),
pNext( nullptr ),
pPrev( nullptr ),
ppHead( ppHd )
{
- pItem = rItem.Clone();
}
HTMLAttr::HTMLAttr( const HTMLAttr &rAttr, const SwNodeIndex &rEndPara,
@@ -5443,16 +5443,15 @@ HTMLAttr::HTMLAttr( const HTMLAttr &rAttr, const SwNodeIndex &rEndPara,
bInsAtStart( rAttr.bInsAtStart ),
bLikePara( rAttr.bLikePara ),
bValid( rAttr.bValid ),
+ pItem( rAttr.pItem->Clone() ),
pNext( nullptr ),
pPrev( nullptr ),
ppHead( ppHd )
{
- pItem = rAttr.pItem->Clone();
}
HTMLAttr::~HTMLAttr()
{
- delete pItem;
}
HTMLAttr *HTMLAttr::Clone(const SwNodeIndex& rEndPara, sal_Int32 nEndCnt) const
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 6ef39ce7dd88..7b57351e6f47 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -80,7 +80,7 @@ class HTMLAttr
bool bLikePara : 1; // Attribut ueber dem gesamten Absatz setzen
bool bValid : 1; // ist das Attribut gueltig?
- SfxPoolItem* pItem;
+ std::unique_ptr<SfxPoolItem> pItem;
HTMLAttr *pNext; // noch zu schliessene Attrs mit unterschiedl. Werten
HTMLAttr *pPrev; // bereits geschlossene aber noch nicht gesetze Attrs
HTMLAttr **ppHead; // der Listenkopf
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 64631a56a396..bdc9f0ad50a7 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -157,7 +157,6 @@ SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL )
SwHTMLWriter::~SwHTMLWriter()
{
- delete m_pNumRuleInfo;
}
void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 7694b179f295..794027f0f05e 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -211,7 +211,7 @@ struct SwHTMLFormatInfo
OString aToken; // das auszugebende Token
OUString aClass; // die auszugebende Klasse
- SfxItemSet *pItemSet; // der auszugebende Attribut-Set
+ std::unique_ptr<SfxItemSet> pItemSet; // der auszugebende Attribut-Set
sal_Int32 nLeftMargin; // ein par default-Werte fuer
sal_Int32 nRightMargin; // Absatz-Vorlagen
@@ -256,7 +256,7 @@ class IDocumentStylePoolAccess;
class SwHTMLWriter : public Writer
{
SwHTMLPosFlyFrames *m_pHTMLPosFlyFrames;
- SwHTMLNumRuleInfo *m_pNumRuleInfo;// aktuelle Numerierung
+ std::unique_ptr<SwHTMLNumRuleInfo> m_pNumRuleInfo;// aktuelle Numerierung
SwHTMLNumRuleInfo *m_pNextNumRuleInfo;
sal_uInt32 m_nHTMLMode; // Beschreibung der Export-Konfiguration
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index 702e12f5792e..4ba7b72c7eac 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -97,7 +97,7 @@ public:
SwFltPosition m_aMkPos;
SwFltPosition m_aPtPos;
- SfxPoolItem * pAttr;// Format Attribute
+ std::unique_ptr<SfxPoolItem> pAttr;// Format Attribute
bool bOld; // to mark Attributes *before* skipping field results
bool bOpen; //Entry open, awaiting being closed
@@ -193,7 +193,7 @@ class SwFltAnchorClient;
class SW_DLLPUBLIC SwFltAnchor : public SfxPoolItem
{
SwFrameFormat* pFrameFormat;
- SwFltAnchorClient * pClient;
+ std::unique_ptr<SwFltAnchorClient> pClient;
public:
SwFltAnchor(SwFrameFormat* pFlyFormat);
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index 3710424fba00..bc9f26fbd71e 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -239,7 +239,7 @@ namespace sw
{
private:
//I hate these things stupid pImpl things, but its warranted here
- ::myImplHelpers::StyleMapperImpl<SwCharFormat> *mpImpl;
+ std::unique_ptr<::myImplHelpers::StyleMapperImpl<SwCharFormat>> mpImpl;
public:
explicit CharStyleMapper(SwDoc &rDoc);
~CharStyleMapper();
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 9c0139e78661..996711a1f11a 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -729,7 +729,7 @@ namespace sw
bool operator()(const SwFltStackEntry *pEntry) const
{
const SwFltRedline *pTest = static_cast<const SwFltRedline *>
- (pEntry->pAttr);
+ (pEntry->pAttr.get());
return (pEntry->bOpen && (pTest->eType == meType));
}
};
@@ -817,7 +817,7 @@ namespace sw
mrDoc.getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowInsert |
RedlineFlags::ShowDelete);
const SwFltRedline *pFltRedline = static_cast<const SwFltRedline*>
- (pEntry->pAttr);
+ (pEntry->pAttr.get());
if (USHRT_MAX != pFltRedline->nAutorNoPrev)
{
@@ -847,9 +847,9 @@ namespace sw
const SwFltStackEntry *pTwoE) const
{
const SwFltRedline *pOne= static_cast<const SwFltRedline*>
- (pOneE->pAttr);
+ (pOneE->pAttr.get());
const SwFltRedline *pTwo= static_cast<const SwFltRedline*>
- (pTwoE->pAttr);
+ (pTwoE->pAttr.get());
//Return the earlier time, if two have the same time, prioritize
//inserts over deletes
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 7e64c7f3fc64..b9fbd570fac0 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -475,7 +475,6 @@ namespace sw
CharStyleMapper::~CharStyleMapper()
{
- delete mpImpl;
}
CharStyleMapper::StyleResult CharStyleMapper::GetStyle(
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 0b139cf3ac2d..23a7122890e4 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -155,8 +155,8 @@ MSWordStyles::MSWordStyles( MSWordExportBase& rExport, bool bListStyles )
(bListStyles ? m_rExport.m_pDoc->GetNumRuleTable().size() - 1 : 0);
// somewhat generous ( free for up to 15 )
- m_pFormatA = new SwFormat*[ nAlloc ];
- memset( m_pFormatA, 0, nAlloc * sizeof( SwFormat* ) );
+ m_pFormatA.reset( new SwFormat*[ nAlloc ] );
+ memset( m_pFormatA.get(), 0, nAlloc * sizeof( SwFormat* ) );
memset( m_aHeadingParagraphStyles, -1 , MAXLEVEL * sizeof( sal_uInt16));
BuildStylesTable();
@@ -165,7 +165,6 @@ MSWordStyles::MSWordStyles( MSWordExportBase& rExport, bool bListStyles )
MSWordStyles::~MSWordStyles()
{
- delete[] m_pFormatA;
}
// Sty_SetWWSlot() dependencies for the styles -> zero is allowed
@@ -1029,7 +1028,6 @@ MSWordSections::~MSWordSections()
WW8_WrPlcSepx::~WW8_WrPlcSepx()
{
- delete pTextPos;
}
bool MSWordSections::HeaderFooterWritten()
@@ -1763,7 +1761,7 @@ bool WW8_WrPlcSepx::WriteKFText( WW8Export& rWrt )
sal_uLong nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
OSL_ENSURE( !pTextPos, "who set the pointer?" );
- pTextPos = new WW8_WrPlc0( nCpStart );
+ pTextPos.reset( new WW8_WrPlc0( nCpStart ) );
WriteFootnoteEndText( rWrt, nCpStart );
CheckForFacinPg( rWrt );
@@ -1803,8 +1801,7 @@ bool WW8_WrPlcSepx::WriteKFText( WW8Export& rWrt )
}
else
{
- delete pTextPos;
- pTextPos = nullptr;
+ pTextPos.reset();
}
return rWrt.pFib->m_ccpHdr != 0;
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index b5e649b0cee6..6cbb890ab07f 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -239,7 +239,7 @@ class WW8_WrPlcSepx : public MSWordSections
std::vector< std::shared_ptr<WW8_PdAttrDesc> > m_SectionAttributes;
// hack to prevent adding sections in endnotes
bool m_bHeaderFooterWritten;
- WW8_WrPlc0* pTextPos; // Position of the headers/footers
+ std::unique_ptr<WW8_WrPlc0> pTextPos; // Position of the headers/footers
WW8_WrPlcSepx( const WW8_WrPlcSepx& ) = delete;
WW8_WrPlcSepx& operator=( const WW8_WrPlcSepx& ) = delete;
@@ -1514,7 +1514,7 @@ class MSWordStyles
{
MSWordExportBase& m_rExport;
sal_uInt16 m_aHeadingParagraphStyles[MAXLEVEL];
- SwFormat** m_pFormatA; ///< Slot <-> Character and paragraph style array (0 for list styles).
+ std::unique_ptr<SwFormat*[]> m_pFormatA; ///< Slot <-> Character and paragraph style array (0 for list styles).
sal_uInt16 m_nUsedSlots;
bool m_bListStyles; ///< If list styles are requested to be exported as well.
std::map<sal_uInt16, const SwNumRule*> m_aNumRules; ///< Slot <-> List style map.
diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index c80a26082796..24a13480f100 100644
--- a/sw/source/filter/ww8/ww8glsy.cxx
+++ b/sw/source/filter/ww8/ww8glsy.cxx
@@ -48,8 +48,7 @@ WW8Glossary::WW8Glossary(tools::SvRef<SotStorageStream> &refStrm, sal_uInt8 nVer
if (xTableStream.Is() && SVSTREAM_OK == xTableStream->GetError())
{
xTableStream->SetEndian(SvStreamEndian::LITTLE);
- pGlossary =
- new WW8GlossaryFib(*refStrm, nVersion, *xTableStream, aWwFib);
+ pGlossary.reset( new WW8GlossaryFib(*refStrm, nVersion, *xTableStream, aWwFib) );
}
}
}
diff --git a/sw/source/filter/ww8/ww8glsy.hxx b/sw/source/filter/ww8/ww8glsy.hxx
index abd9518015ef..117e66d3cb8a 100644
--- a/sw/source/filter/ww8/ww8glsy.hxx
+++ b/sw/source/filter/ww8/ww8glsy.hxx
@@ -59,12 +59,11 @@ class WW8Glossary
public:
WW8Glossary( tools::SvRef<SotStorageStream> &refStrm, sal_uInt8 nVersion, SotStorage *pStg);
bool Load( SwTextBlocks &rBlocks, bool bSaveRelFile );
- ~WW8Glossary() { delete pGlossary; }
- WW8GlossaryFib *GetFib() { return pGlossary; }
+ WW8GlossaryFib *GetFib() { return pGlossary.get(); }
sal_uInt16 GetNoStrings() const { return nStrings; }
private:
- WW8GlossaryFib *pGlossary;
+ std::unique_ptr<WW8GlossaryFib> pGlossary;
tools::SvRef<SotStorageStream> xTableStream;
tools::SvRef<SotStorageStream> &rStrm;
tools::SvRef<SotStorage> xStg;
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 53d782b2e5e7..3bd74491fcbf 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -650,7 +650,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp,
OUString sURL;
for (size_t nI = m_pCtrlStck->size(); nI > nCount; --nI)
{
- const SfxPoolItem *pItem = ((*m_pCtrlStck)[nI-1]).pAttr;
+ const SfxPoolItem *pItem = ((*m_pCtrlStck)[nI-1]).pAttr.get();
sal_uInt16 nWhich = pItem->Which();
if (nWhich == RES_TXTATR_INETFMT)
{
@@ -686,7 +686,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp,
{
for (size_t i = nCurrentCount; i < m_pCtrlStck->size(); ++i)
{
- const SfxPoolItem *pItem = ((*m_pCtrlStck)[i]).pAttr;
+ const SfxPoolItem *pItem = ((*m_pCtrlStck)[i]).pAttr.get();
sal_uInt16 nWhich = pItem->Which();
if( nWhich < RES_FLTRATTR_BEGIN ||
nWhich >= RES_FLTRATTR_END )
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 0a42707dbf6e..a586b9af226e 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1388,7 +1388,7 @@ void SwWW8ReferencedFltEndStack::SetAttrInDoc( const SwPosition& rTmpPos,
// and which is not referenced.
bool bInsertBookmarkIntoDoc = true;
- SwFltBookmark* pFltBookmark = dynamic_cast<SwFltBookmark*>(rEntry.pAttr);
+ SwFltBookmark* pFltBookmark = dynamic_cast<SwFltBookmark*>(rEntry.pAttr.get());
if ( pFltBookmark != nullptr && pFltBookmark->IsTOCBookmark() )
{
const OUString& rName = pFltBookmark->GetName();
@@ -1429,7 +1429,7 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
SwPaM aRegion(rTmpPos);
if (rEntry.MakeRegion(pDoc, aRegion, false))
{
- SvxLRSpaceItem aNewLR( *static_cast<SvxLRSpaceItem*>(rEntry.pAttr) );
+ SvxLRSpaceItem aNewLR( *static_cast<SvxLRSpaceItem*>(rEntry.pAttr.get()) );
sal_uLong nStart = aRegion.Start()->nNode.GetIndex();
sal_uLong nEnd = aRegion.End()->nNode.GetIndex();
for(; nStart <= nEnd; ++nStart)
@@ -1502,7 +1502,7 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
if (nullptr != (pFrame = SwWW8ImplReader::ContainsSingleInlineGraphic(aRegion)))
{
const SwFormatINetFormat *pAttr = static_cast<const SwFormatINetFormat *>(
- rEntry.pAttr);
+ rEntry.pAttr.get());
SwFormatURL aURL;
aURL.SetURL(pAttr->GetValue(), false);
aURL.SetTargetFrameName(pAttr->GetTargetFrame());
@@ -1590,7 +1590,7 @@ const SfxPoolItem* SwWW8FltControlStack::GetStackAttr(const SwPosition& rPos,
* means props that end at 3 are not included
*/
{
- return rEntry.pAttr;
+ return rEntry.pAttr.get();
}
}
}
@@ -1637,7 +1637,7 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos,
SwNodeIndex aIdx(rEntry.m_aMkPos.m_nNode, 1);
SwPaM aPaM(aIdx, rEntry.m_aMkPos.m_nContent);
- SwFormatField& rFormatField = *static_cast<SwFormatField*>(rEntry.pAttr);
+ SwFormatField& rFormatField = *static_cast<SwFormatField*>(rEntry.pAttr.get());
SwField* pField = rFormatField.GetField();
if (!RefToVar(pField, rEntry))
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 24eae0d5f134..cb14e24c7b2e 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1285,9 +1285,8 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pField,
{
SwGetExpField aField( static_cast<SwGetExpFieldType*>(
pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_GETEXPFLD)), sName, nsSwGetSetExpType::GSE_STRING, 0);
- delete rEntry.pAttr;
SwFormatField aTmp(aField);
- rEntry.pAttr = aTmp.Clone();
+ rEntry.pAttr.reset( aTmp.Clone() );
pRet = &rEntry;
}
}
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 6c16920b68e6..039b24ce5183 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1933,10 +1933,10 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos,
nPLCF = bValid ? std::min(nRemainingSize, static_cast<std::size_t>(nPLCF)) : nValidMin;
// Pointer to Pos- and Struct-array
- pPLCF_PosArray = new sal_Int32[ ( nPLCF + 3 ) / 4 ];
+ pPLCF_PosArray.reset( new sal_Int32[ ( nPLCF + 3 ) / 4 ] );
pPLCF_PosArray[0] = 0;
- nPLCF = bValid ? pSt->ReadBytes(pPLCF_PosArray, nPLCF) : nValidMin;
+ nPLCF = bValid ? pSt->ReadBytes(pPLCF_PosArray.get(), nPLCF) : nValidMin;
nPLCF = std::max(nPLCF, nValidMin);
@@ -2086,8 +2086,8 @@ void WW8PLCF::ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF)
if (bValid)
{
// Pointer to Pos-array
- pPLCF_PosArray = new WW8_CP[ ( nPLCF + 3 ) / 4 ];
- bValid = checkRead(rSt, pPLCF_PosArray, nPLCF);
+ pPLCF_PosArray.reset( new WW8_CP[ ( nPLCF + 3 ) / 4 ] );
+ bValid = checkRead(rSt, pPLCF_PosArray.get(), nPLCF);
}
if (bValid)
@@ -2114,8 +2114,7 @@ void WW8PLCF::ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF)
void WW8PLCF::MakeFailedPLCF()
{
nIMax = 0;
- delete[] pPLCF_PosArray;
- pPLCF_PosArray = new sal_Int32[2];
+ pPLCF_PosArray.reset( new sal_Int32[2] );
pPLCF_PosArray[0] = pPLCF_PosArray[1] = WW8_CP_MAX;
pPLCF_Contents = reinterpret_cast<sal_uInt8*>(&pPLCF_PosArray[nIMax + 1]);
}
@@ -2149,7 +2148,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN)
{
size_t nSiz = 6 * nIMax + 4;
size_t nElems = ( nSiz + 3 ) / 4;
- pPLCF_PosArray = new sal_Int32[ nElems ]; // Pointer to Pos-array
+ pPLCF_PosArray.reset( new sal_Int32[ nElems ] ); // Pointer to Pos-array
for (sal_Int32 i = 0; i < ncpN && !failure; ++i)
{
@@ -2283,10 +2282,10 @@ WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos,
bValid = false;
nPLCF = bValid ? std::min(nRemainingSize, static_cast<std::size_t>(nPLCF)) : nValidMin;
- pPLCF_PosArray = new sal_Int32[ ( nPLCF + 3 ) / 4 ]; // Pointer to Pos-array
+ pPLCF_PosArray.reset( new sal_Int32[ ( nPLCF + 3 ) / 4 ] ); // Pointer to Pos-array
pPLCF_PosArray[0] = 0;
- nPLCF = bValid ? pSt->ReadBytes(pPLCF_PosArray, nPLCF) : nValidMin;
+ nPLCF = bValid ? pSt->ReadBytes(pPLCF_PosArray.get(), nPLCF) : nValidMin;
nPLCF = std::max(nPLCF, nValidMin);
nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
@@ -6853,8 +6852,8 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
if( nMax )
{
// allocate Index Array
- pFontA = new WW8_FFN[ nMax ];
- WW8_FFN* p = pFontA;
+ pFontA.reset( new WW8_FFN[ nMax ] );
+ WW8_FFN* p = pFontA.get();
if( eVersion <= ww::eWW2 )
{
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index eff6796d72b3..fab19068750b 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -209,7 +209,7 @@ struct WW8PLCFxSave1
class WW8PLCFspecial // iterator for PLCFs
{
private:
- sal_Int32* pPLCF_PosArray; ///< pointer to Pos-array and to the whole structure
+ std::unique_ptr<sal_Int32[]> pPLCF_PosArray; ///< pointer to Pos-array and to the whole structure
sal_uInt8* pPLCF_Contents; ///< pointer to content-array-part of Pos-array
long nIMax; ///< number of elements
long nIdx; ///< marker where we currently are
@@ -221,7 +221,6 @@ private:
public:
WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos, sal_uInt32 nPLCF,
sal_uInt32 nStruct);
- ~WW8PLCFspecial() { delete[] pPLCF_PosArray; }
long GetIdx() const { return nIdx; }
void SetIdx( long nI ) { nIdx = nI; }
long GetIMax() const { return nIMax; }
@@ -283,7 +282,7 @@ private:
class WW8PLCF // Iterator for PLCFs
{
private:
- WW8_CP* pPLCF_PosArray; // pointer to Pos-array and the whole structure
+ std::unique_ptr<WW8_CP[]> pPLCF_PosArray; // pointer to Pos-array and the whole structure
sal_uInt8* pPLCF_Contents; // pointer to content-array-part of Pos-array
sal_Int32 nIMax; // number of elements
sal_Int32 nIdx;
@@ -310,7 +309,6 @@ public:
WW8PLCF(SvStream& rSt, WW8_FC nFilePos, sal_Int32 nPLCF, int nStruct,
WW8_CP nStartPos, sal_Int32 nPN, sal_Int32 ncpN);
- ~WW8PLCF(){ delete[] pPLCF_PosArray; }
sal_Int32 GetIdx() const { return nIdx; }
void SetIdx( sal_Int32 nI ) { nIdx = nI; }
sal_Int32 GetIMax() const { return nIMax; }
@@ -331,7 +329,7 @@ class WW8PLCFpcd
{
friend class WW8PLCFpcd_Iter;
- sal_Int32* pPLCF_PosArray; // pointer to Pos-array and the whole structure
+ std::unique_ptr<sal_Int32[]> pPLCF_PosArray; // pointer to Pos-array and the whole structure
sal_uInt8* pPLCF_Contents; // pointer to content-array-part of Pos-array
long nIMax;
sal_uInt32 nStru;
@@ -342,7 +340,6 @@ class WW8PLCFpcd
public:
WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos, sal_uInt32 nPLCF,
sal_uInt32 nStruct);
- ~WW8PLCFpcd(){ delete[] pPLCF_PosArray; }
};
/* multiple WW8PLCFpcd_Iter may point to the same WW8PLCFpcd !!! */
@@ -1560,12 +1557,11 @@ private:
WW8Fonts(const WW8Fonts&) = delete;
WW8Fonts& operator=(const WW8Fonts&) = delete;
protected:
- WW8_FFN* pFontA; // Array of Pointers to Font Description
+ std::unique_ptr<WW8_FFN[]> pFontA; // Array of Pointers to Font Description
sal_uInt16 nMax; // Array-Size
public:
WW8Fonts( SvStream& rSt, WW8Fib& rFib );
- ~WW8Fonts() { delete[] pFontA; }
const WW8_FFN* GetFont( sal_uInt16 nNum ) const;
sal_uInt16 GetMax() const { return nMax; }
};
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index a0dce1d2c8ab..ae317235d0aa 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -981,7 +981,6 @@ PlfAcd::PlfAcd() :
PlfAcd::~PlfAcd()
{
- delete[] rgacd;
}
bool PlfAcd::Read( SvStream &rS)
@@ -1000,7 +999,7 @@ bool PlfAcd::Read( SvStream &rS)
}
if (iMac)
{
- rgacd = new Acd[ iMac ];
+ rgacd.reset( new Acd[ iMac ] );
for ( sal_Int32 index = 0; index < iMac; ++index )
{
if ( !rgacd[ index ].Read( rS ) )
@@ -1033,7 +1032,6 @@ PlfKme::PlfKme() :
PlfKme::~PlfKme()
{
- delete[] rgkme;
}
bool PlfKme::Read(SvStream &rS)
@@ -1044,7 +1042,7 @@ bool PlfKme::Read(SvStream &rS)
rS.ReadInt32( iMac );
if ( iMac )
{
- rgkme = new Kme[ iMac ];
+ rgkme.reset( new Kme[ iMac ] );
for( sal_Int32 index=0; index<iMac; ++index )
{
if ( !rgkme[ index ].Read( rS ) )
diff --git a/sw/source/filter/ww8/ww8toolbar.hxx b/sw/source/filter/ww8/ww8toolbar.hxx
index c5079f4eb617..c37176f647ae 100644
--- a/sw/source/filter/ww8/ww8toolbar.hxx
+++ b/sw/source/filter/ww8/ww8toolbar.hxx
@@ -231,7 +231,7 @@ public:
class PlfAcd: public Tcg255SubStruct
{
sal_Int32 iMac;
- Acd* rgacd;
+ std::unique_ptr<Acd[]> rgacd;
PlfAcd(const PlfAcd&) = delete;
PlfAcd& operator = ( const PlfAcd&) = delete;
@@ -268,7 +268,7 @@ public:
class PlfKme : public Tcg255SubStruct
{
sal_Int32 iMac;
- Kme* rgkme;
+ std::unique_ptr<Kme[]> rgkme;
PlfKme(const PlfKme&) = delete;
PlfKme& operator = ( const PlfKme&) = delete;
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index a4e2f55f1df3..9a47127c0ce5 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -79,7 +79,7 @@ static SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> const & rRange )
class XTextRangeOrNodeIndexPosition
{
Reference<XTextRange> xRange;
- SwNodeIndex* pIndex; // pIndex will point to the *previous* node
+ std::unique_ptr<SwNodeIndex> pIndex; // pIndex will point to the *previous* node
public:
XTextRangeOrNodeIndexPosition();
@@ -103,25 +103,17 @@ XTextRangeOrNodeIndexPosition::XTextRangeOrNodeIndexPosition() :
XTextRangeOrNodeIndexPosition::~XTextRangeOrNodeIndexPosition()
{
- delete pIndex;
}
void XTextRangeOrNodeIndexPosition::Set( Reference<XTextRange> & rRange )
{
xRange = rRange->getStart(); // set bookmark
- if (nullptr != pIndex)
- {
- delete pIndex;
- pIndex = nullptr;
- }
+ pIndex.reset();
}
void XTextRangeOrNodeIndexPosition::Set( SwNodeIndex& rIndex )
{
- if (nullptr != pIndex)
- delete pIndex;
-
- pIndex = new SwNodeIndex(rIndex);
+ pIndex.reset( new SwNodeIndex(rIndex) );
(*pIndex)-- ; // previous node!!!
xRange = nullptr;
}
diff --git a/sw/source/filter/xml/xmlbrsh.cxx b/sw/source/filter/xml/xmlbrsh.cxx
index d31249bbf796..1a64f534c355 100644
--- a/sw/source/filter/xml/xmlbrsh.cxx
+++ b/sw/source/filter/xml/xmlbrsh.cxx
@@ -183,7 +183,6 @@ SwXMLBrushItemImportContext::SwXMLBrushItemImportContext(
SwXMLBrushItemImportContext::~SwXMLBrushItemImportContext()
{
- delete pItem;
}
SwXMLBrushItemExport::SwXMLBrushItemExport( SwXMLExport& rExp ) :
diff --git a/sw/source/filter/xml/xmlbrshi.hxx b/sw/source/filter/xml/xmlbrshi.hxx
index 7a507ddc5902..dc6076499773 100644
--- a/sw/source/filter/xml/xmlbrshi.hxx
+++ b/sw/source/filter/xml/xmlbrshi.hxx
@@ -36,7 +36,7 @@ class SwXMLBrushItemImportContext : public SvXMLImportContext
{
private:
css::uno::Reference < css::io::XOutputStream > xBase64Stream;
- SvxBrushItem *pItem;
+ std::unique_ptr<SvxBrushItem> pItem;
void ProcessAttrs(
const css::uno::Reference<css::xml::sax::XAttributeList > & xAttrList,
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index dd792d307a30..fbe0ff77878b 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -335,10 +335,10 @@ SvXMLImportContext *SwXMLTextStyleContext_Impl::CreateChildContext(
class SwXMLItemSetStyleContext_Impl : public SvXMLStyleContext
{
- OUString sMasterPageName;
- SfxItemSet *pItemSet;
+ OUString sMasterPageName;
+ std::unique_ptr<SfxItemSet> pItemSet;
SwXMLTextStyleContext_Impl *pTextStyle;
- SvXMLStylesContext &rStyles;
+ SvXMLStylesContext &rStyles;
OUString sDataStyleName;
@@ -368,7 +368,6 @@ public:
const uno::Reference< xml::sax::XAttributeList > & xAttrList,
SvXMLStylesContext& rStylesC,
sal_uInt16 nFamily);
- virtual ~SwXMLItemSetStyleContext_Impl() override;
virtual void CreateAndInsert( bool bOverwrite ) override;
@@ -378,7 +377,7 @@ public:
const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override;
// The item set may be empty!
- SfxItemSet *GetItemSet() { return pItemSet; }
+ SfxItemSet *GetItemSet() { return pItemSet.get(); }
bool HasMasterPageName() const { return bHasMasterPageName; }
@@ -434,16 +433,16 @@ SvXMLImportContext *SwXMLItemSetStyleContext_Impl::CreateItemSetContext(
switch( GetFamily() )
{
case XML_STYLE_FAMILY_TABLE_TABLE:
- pItemSet = new SfxItemSet( rItemPool, aTableSetRange );
+ pItemSet.reset( new SfxItemSet( rItemPool, aTableSetRange ) );
break;
case XML_STYLE_FAMILY_TABLE_COLUMN:
- pItemSet = new SfxItemSet( rItemPool, RES_FRM_SIZE, RES_FRM_SIZE, 0 );
+ pItemSet.reset( new SfxItemSet( rItemPool, RES_FRM_SIZE, RES_FRM_SIZE, 0 ) );
break;
case XML_STYLE_FAMILY_TABLE_ROW:
- pItemSet = new SfxItemSet( rItemPool, aTableLineSetRange );
+ pItemSet.reset( new SfxItemSet( rItemPool, aTableLineSetRange ) );
break;
case XML_STYLE_FAMILY_TABLE_CELL:
- pItemSet = new SfxItemSet( rItemPool, aTableBoxSetRange );
+ pItemSet.reset( new SfxItemSet( rItemPool, aTableBoxSetRange ) );
break;
default:
OSL_ENSURE( false,
@@ -456,8 +455,7 @@ SvXMLImportContext *SwXMLItemSetStyleContext_Impl::CreateItemSetContext(
*pItemSet );
if( !pContext )
{
- delete pItemSet;
- pItemSet = nullptr;
+ pItemSet.reset();
}
return pContext;
@@ -479,11 +477,6 @@ SwXMLItemSetStyleContext_Impl::SwXMLItemSetStyleContext_Impl( SwXMLImport& rImpo
{
}
-SwXMLItemSetStyleContext_Impl::~SwXMLItemSetStyleContext_Impl()
-{
- delete pItemSet;
-}
-
void SwXMLItemSetStyleContext_Impl::CreateAndInsert( bool bOverwrite )
{
if( pTextStyle )
@@ -564,7 +557,7 @@ void SwXMLItemSetStyleContext_Impl::ConnectPageDesc()
if( !pItemSet )
{
SfxItemPool& rItemPool = pDoc->GetAttrPool();
- pItemSet = new SfxItemSet( rItemPool, aTableSetRange );
+ pItemSet.reset( new SfxItemSet( rItemPool, aTableSetRange ) );
}
const SfxPoolItem *pItem;
@@ -603,7 +596,7 @@ bool SwXMLItemSetStyleContext_Impl::ResolveDataStyleName()
SwDoc *pDoc = SwImport::GetDocFromXMLImport( GetSwImport() );
SfxItemPool& rItemPool = pDoc->GetAttrPool();
- pItemSet = new SfxItemSet( rItemPool, aTableBoxSetRange );
+ pItemSet.reset( new SfxItemSet( rItemPool, aTableBoxSetRange ) );
}
SwTableBoxNumFormat aNumFormatItem(nFormat);
pItemSet->Put(aNumFormatItem);