summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-14 10:37:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-01-15 06:57:43 +0100
commit9c6cd998aeb7061f38ec1334e160d002008dd66b (patch)
tree4b9db5ccf30bf6984f82ff1fd48a566fdebccccf /sw
parent1c4acfdcb10b2cdeac8efb331fc9db8d01de9c66 (diff)
use unique_ptr in sw
Change-Id: I8c472a7d363eb308e9ec78aadd7f1f20c824447b Reviewed-on: https://gerrit.libreoffice.org/66317 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx10
-rw-r--r--sw/source/uibase/wrtsh/wrtsh2.cxx26
2 files changed, 17 insertions, 19 deletions
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index b0b0cde57768..3fdd90134014 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -480,7 +480,7 @@ void MSWordExportBase::AbstractNumberingDefinitions()
}
// Attributes of the numbering
- wwFont *pPseudoFont = nullptr;
+ std::unique_ptr<wwFont> pPseudoFont;
const SfxItemSet* pOutSet = nullptr;
// cbGrpprlChpx
@@ -500,8 +500,8 @@ void MSWordExportBase::AbstractNumberingDefinitions()
if ( sFontName.isEmpty() )
sFontName = pBulletFont->GetFamilyName();
- pPseudoFont = new wwFont( sFontName, pBulletFont->GetPitch(),
- eFamily, eChrSet);
+ pPseudoFont.reset(new wwFont( sFontName, pBulletFont->GetPitch(),
+ eFamily, eChrSet));
}
else
pOutSet = &rFormat.GetCharFormat()->GetAttrSet();
@@ -531,12 +531,10 @@ void MSWordExportBase::AbstractNumberingDefinitions()
rFormat.GetNumAdjust(),
aNumLvlPos,
nFollow,
- pPseudoFont, pOutSet,
+ pPseudoFont.get(), pOutSet,
nIndentAt, nFirstLineIndex, nListTabPos,
sNumStr,
rFormat.GetNumberingType()==SVX_NUM_BITMAP ? rFormat.GetBrush():nullptr);
-
- delete pPseudoFont;
}
AttrOutput().EndAbstractNumbering();
}
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index bff262badbf3..5fccd756bae9 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -134,14 +134,17 @@ void SwWrtShell::Insert(SwField const &rField)
void SwWrtShell::UpdateInputFields( SwInputFieldList* pLst )
{
// Go through the list of fields and updating
- SwInputFieldList* pTmp = pLst;
- if( !pTmp )
- pTmp = new SwInputFieldList( this );
+ std::unique_ptr<SwInputFieldList> pTmp;
+ if (!pLst)
+ {
+ pTmp.reset(new SwInputFieldList( this ));
+ pLst = pTmp.get();
+ }
- const size_t nCnt = pTmp->Count();
+ const size_t nCnt = pLst->Count();
if(nCnt)
{
- pTmp->PushCursor();
+ pLst->PushCursor();
bool bCancel = false;
@@ -153,7 +156,7 @@ void SwWrtShell::UpdateInputFields( SwInputFieldList* pLst )
{
for (size_t i = 0; i < nCnt; i++)
{
- if (pField == pTmp->GetField(i))
+ if (pField == pLst->GetField(i))
{
nIndex = i;
break;
@@ -165,8 +168,8 @@ void SwWrtShell::UpdateInputFields( SwInputFieldList* pLst )
{
bool bPrev = nIndex > 0;
bool bNext = nIndex < nCnt - 1;
- pTmp->GotoFieldPos(nIndex);
- pField = pTmp->GetField(nIndex);
+ pLst->GotoFieldPos(nIndex);
+ pField = pLst->GetField(nIndex);
if (pField->GetTyp()->Which() == SwFieldIds::Dropdown)
{
bCancel = StartDropDownFieldDlg(pField, bPrev, bNext, GetView().GetFrameWeld(), &ePressedButton);
@@ -177,7 +180,7 @@ void SwWrtShell::UpdateInputFields( SwInputFieldList* pLst )
if (!bCancel)
{
// Otherwise update error at multi-selection:
- pTmp->GetField(nIndex)->GetTyp()->UpdateFields();
+ pLst->GetField(nIndex)->GetTyp()->UpdateFields();
if (ePressedButton == FieldDialogPressedButton::Previous && nIndex > 0)
nIndex--;
@@ -188,11 +191,8 @@ void SwWrtShell::UpdateInputFields( SwInputFieldList* pLst )
}
}
- pTmp->PopCursor();
+ pLst->PopCursor();
}
-
- if( !pLst )
- delete pTmp;
}
// Listener class: will close InputField dialog if input field(s)