summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-06-19 14:09:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-19 21:24:35 +0200
commit4668e7e7a6322cfda854ab07eabd4322c86de980 (patch)
tree7d726a308cf69fb50c0c39f33e290fd82e525b0c
parent5c59e061c6271cfe2f8ec12ba21de50e71bd9ef4 (diff)
use more unique_ptr in WW8Export
Change-Id: I4fb6f4d42be350df5c1ccc0c87b779224000325d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117498 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx16
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx40
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx14
3 files changed, 31 insertions, 39 deletions
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index e65161558edb..29058a3cd691 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -974,9 +974,9 @@ void WW8Export::AppendFlyInFlys(const ww8::Frame& rFrameFormat,
return ;
PlcDrawObj *pDrwO;
if (TXT_HDFT == m_nTextTyp)
- pDrwO = m_pHFSdrObjs;
+ pDrwO = m_pHFSdrObjs.get();
else
- pDrwO = m_pSdrObjs;
+ pDrwO = m_pSdrObjs.get();
if (rFrameFormat.IsInline())
{
@@ -2212,18 +2212,18 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt)
CloseContainer(); // ESCHER_DggContainer
sal_uInt8 i = 2; // for header/footer and the other
- PlcDrawObj *pSdrObjs = rWrt.m_pHFSdrObjs;
- pTextBxs = rWrt.m_pHFTextBxs;
+ PlcDrawObj *pSdrObjs = rWrt.m_pHFSdrObjs.get();
+ pTextBxs = rWrt.m_pHFTextBxs.get();
// if no header/footer -> skip over
if (!pSdrObjs->size())
{
--i;
- pSdrObjs = rWrt.m_pSdrObjs;
- pTextBxs = rWrt.m_pTextBxs;
+ pSdrObjs = rWrt.m_pSdrObjs.get();
+ pTextBxs = rWrt.m_pTextBxs.get();
}
- for( ; i--; pSdrObjs = rWrt.m_pSdrObjs, pTextBxs = rWrt.m_pTextBxs )
+ for( ; i--; pSdrObjs = rWrt.m_pSdrObjs.get(), pTextBxs = rWrt.m_pTextBxs.get() )
{
// "dummy char" (or any Count ?) - why? Only Microsoft knows it.
GetStream().WriteChar( i );
@@ -2232,7 +2232,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt)
EnterGroup();
- sal_uLong nSecondShapeId = pSdrObjs == rWrt.m_pSdrObjs ? GenerateShapeId() : 0;
+ sal_uLong nSecondShapeId = pSdrObjs == rWrt.m_pSdrObjs.get() ? GenerateShapeId() : 0;
// write now all Writer-/DrawObjects
DrawObjPointerVector aSorted;
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index bd6a633bb670..9f2daa129d53 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1657,7 +1657,7 @@ sal_uInt16 WW8Export::AddRedlineAuthor( std::size_t nId )
{
if( !m_pRedlAuthors )
{
- m_pRedlAuthors = new WW8_WrtRedlineAuthor;
+ m_pRedlAuthors.reset(new WW8_WrtRedlineAuthor);
m_pRedlAuthors->AddName("Unknown");
}
return m_pRedlAuthors->AddName( SW_MOD()->GetRedlineAuthor( nId ) );
@@ -3500,15 +3500,15 @@ ErrCode WW8Export::ExportDocument_Impl()
pFootnote.reset(new WW8_WrPlcFootnoteEdn( TXT_FTN )); // Footnotes
pEdn.reset(new WW8_WrPlcFootnoteEdn( TXT_EDN )); // Endnotes
- m_pAtn = new WW8_WrPlcAnnotations; // PostIts
+ m_pAtn.reset(new WW8_WrPlcAnnotations); // PostIts
m_pFactoids.reset(new WW8_WrtFactoids); // Smart tags.
- m_pTextBxs = new WW8_WrPlcTextBoxes( TXT_TXTBOX );
- m_pHFTextBxs = new WW8_WrPlcTextBoxes( TXT_HFTXTBOX );
+ m_pTextBxs.reset(new WW8_WrPlcTextBoxes( TXT_TXTBOX ));
+ m_pHFTextBxs.reset(new WW8_WrPlcTextBoxes( TXT_HFTXTBOX ));
- m_pSdrObjs = new MainTextPlcDrawObj; // Draw-/Fly-Objects for main text
- m_pHFSdrObjs = new HdFtPlcDrawObj; // Draw-/Fly-Objects for header/footer
+ m_pSdrObjs.reset(new MainTextPlcDrawObj); // Draw-/Fly-Objects for main text
+ m_pHFSdrObjs.reset(new HdFtPlcDrawObj); // Draw-/Fly-Objects for header/footer
- m_pBkmks = new WW8_WrtBookmarks; // Bookmarks
+ m_pBkmks.reset(new WW8_WrtBookmarks); // Bookmarks
GetWriter().CreateBookmarkTable();
m_pPapPlc.reset(new WW8_WrPlcPn( *this, PAP, pFib->m_fcMin ));
@@ -3526,7 +3526,7 @@ ErrCode WW8Export::ExportDocument_Impl()
m_pMagicTable.reset(new WW8_WrMagicTable);
m_pGrf.reset(new SwWW8WrGrf( *this ));
- m_pPiece = new WW8_WrPct( pFib->m_fcMin );
+ m_pPiece.reset(new WW8_WrPct( pFib->m_fcMin ));
pDop.reset(new WW8Dop);
pDop->fRevMarking = bool( RedlineFlags::On & m_nOrigRedlineFlags );
@@ -3613,16 +3613,16 @@ ErrCode WW8Export::ExportDocument_Impl()
m_pPapPlc.reset();
pSepx.reset();
- delete m_pRedlAuthors;
- delete m_pSdrObjs;
- delete m_pHFSdrObjs;
- delete m_pTextBxs;
- delete m_pHFTextBxs;
- delete m_pAtn;
+ m_pRedlAuthors.reset();
+ m_pSdrObjs.reset();
+ m_pHFSdrObjs.reset();
+ m_pTextBxs.reset();
+ m_pHFTextBxs.reset();
+ m_pAtn.reset();
pEdn.reset();
pFootnote.reset();
- delete m_pBkmks;
- delete m_pPiece;
+ m_pBkmks.reset();
+ m_pPiece.reset();
pDop.reset();
pFib.reset();
GetWriter().SetStream( nullptr );
@@ -3847,10 +3847,7 @@ ErrCode SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed,
MSWordExportBase::MSWordExportBase( SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam, SwPaM* pOriginalPam )
: m_aMainStg(sMainStream)
, m_pISet(nullptr)
- , m_pPiece(nullptr)
, m_pTopNodeOfHdFtPage(nullptr)
- , m_pBkmks(nullptr)
- , m_pRedlAuthors(nullptr)
, m_pTableInfo(std::make_shared<ww8::WW8TableInfo>())
, m_nCharFormatStart(0)
, m_nFormatCollStart(0)
@@ -3863,17 +3860,12 @@ MSWordExportBase::MSWordExportBase( SwDoc& rDocument, std::shared_ptr<SwUnoCurso
, m_pCurrentPageDesc(nullptr)
, m_bFirstTOCNodeWithSection(false)
, m_pChpIter(nullptr)
- , m_pAtn(nullptr)
- , m_pTextBxs(nullptr)
- , m_pHFTextBxs(nullptr)
, m_pParentFrame(nullptr)
, m_pFlyOffset(nullptr)
, m_eNewAnchorType(RndStdIds::FLY_AS_CHAR)
, m_pStyAttr(nullptr)
, m_pOutFormatNode(nullptr)
, m_pCurrentStyle(nullptr)
- , m_pSdrObjs(nullptr)
- , m_pHFSdrObjs(nullptr)
, m_pEscher(nullptr)
, m_nTextTyp(0)
, m_bStyDef(false)
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index cad77799abe5..2cf9a82df7a0 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -455,7 +455,7 @@ public:
std::vector<const SwTOXType*> m_aTOXArr;
const SfxItemSet* m_pISet; // for double attributes
const SwFrameFormat* m_pFirstPageFormat = nullptr;
- WW8_WrPct* m_pPiece; // Pointer to Piece-Table
+ std::unique_ptr<WW8_WrPct> m_pPiece; // Pointer to Piece-Table
std::unique_ptr<SwNumRuleTable> m_pUsedNumTable; // all used NumRules
/// overriding numdef index -> (existing numdef index, abstractnumdef index)
std::map<size_t, std::pair<size_t, size_t>> m_OverridingNums;
@@ -468,8 +468,8 @@ public:
const SwTextNode *m_pTopNodeOfHdFtPage; ///< Top node of host page when in hd/ft
std::stack< sal_Int32 > m_aCurrentCharPropStarts; ///< To remember the position in a run.
- WW8_WrtBookmarks* m_pBkmks;
- WW8_WrtRedlineAuthor* m_pRedlAuthors;
+ std::unique_ptr<WW8_WrtBookmarks> m_pBkmks;
+ std::unique_ptr<WW8_WrtRedlineAuthor> m_pRedlAuthors;
std::shared_ptr<NfKeywordTable> m_pKeyMap;
std::unique_ptr<SvxMSExportOLEObjects> m_pOLEExp;
std::unique_ptr<SwMSConvertControls> m_pOCXExp;
@@ -499,9 +499,9 @@ public:
std::unique_ptr<WW8_WrPlcPn> m_pChpPlc;
MSWordAttrIter* m_pChpIter;
std::unique_ptr<MSWordStyles> m_pStyles;
- WW8_WrPlcAnnotations* m_pAtn;
+ std::unique_ptr<WW8_WrPlcAnnotations> m_pAtn;
std::unique_ptr<WW8_WrtFactoids> m_pFactoids;
- WW8_WrPlcTextBoxes *m_pTextBxs, *m_pHFTextBxs;
+ std::unique_ptr<WW8_WrPlcTextBoxes> m_pTextBxs, m_pHFTextBxs;
struct LinkedTextboxInfo //help analyze textbox flow links
{
@@ -537,8 +537,8 @@ public:
const sw::BroadcastingModify* m_pOutFormatNode; // write Format or Node
const SwFormat *m_pCurrentStyle; // iff bStyDef=true, then this store the current style
- MainTextPlcDrawObj *m_pSdrObjs; // Draw-/Fly-Objects
- HdFtPlcDrawObj *m_pHFSdrObjs; // Draw-/Fly-Objects in header or footer
+ std::unique_ptr<MainTextPlcDrawObj> m_pSdrObjs; // Draw-/Fly-Objects
+ std::unique_ptr<HdFtPlcDrawObj> m_pHFSdrObjs; // Draw-/Fly-Objects in header or footer
SwEscherEx* m_pEscher; // escher export class
// #i43447# - removed