summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-23 15:20:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-24 08:35:16 +0200
commit257b099bc4d904ebd4fae0ccd668de5ce7570d18 (patch)
tree65c42606098f5020f9dc0298637fb758a7c2c4f5
parent63ba8ffa5c390c04e22a74015a64cefc2bf228ea (diff)
loplugin:useuniqueptr in SwInsertConfig
Change-Id: I5f39956e529b98f4114139b8c3ba1391e45440ef Reviewed-on: https://gerrit.libreoffice.org/57876 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/modcfg.hxx4
-rw-r--r--sw/source/uibase/config/modcfg.cxx12
2 files changed, 8 insertions, 8 deletions
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index f4d82aaf2be3..cfdd94814231 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -118,8 +118,8 @@ class SwInsertConfig : public utl::ConfigItem
{
friend class SwModuleOptions;
- InsCaptionOptArr* pCapOptions;
- InsCaptionOpt* pOLEMiscOpt;
+ std::unique_ptr<InsCaptionOptArr> pCapOptions;
+ std::unique_ptr<InsCaptionOpt> pOLEMiscOpt;
SvGlobalName aGlobalNames[5];
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 3d73202fdb70..3a0b41f3a1b9 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -77,7 +77,7 @@ const InsCaptionOpt* SwModuleOptions::GetCapOption(
for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++)
bFound = *pOleId == aInsertConfig.aGlobalNames[nId ];
if(!bFound)
- return aInsertConfig.pOLEMiscOpt;
+ return aInsertConfig.pOLEMiscOpt.get();
}
return aInsertConfig.pCapOptions->Find(eType, pOleId);
}
@@ -103,7 +103,7 @@ bool SwModuleOptions::SetCapOption(bool bHTML, const InsCaptionOpt* pOpt)
if(aInsertConfig.pOLEMiscOpt)
*aInsertConfig.pOLEMiscOpt = *pOpt;
else
- aInsertConfig.pOLEMiscOpt = new InsCaptionOpt(*pOpt);
+ aInsertConfig.pOLEMiscOpt.reset(new InsCaptionOpt(*pOpt));
}
}
@@ -596,15 +596,15 @@ SwInsertConfig::SwInsertConfig(bool bWeb) :
aGlobalNames[GLOB_NAME_MATH ] = SvGlobalName(SO3_SM_CLASSID);
aGlobalNames[GLOB_NAME_CHART ] = SvGlobalName(SO3_SCH_CLASSID);
if(!bIsWeb)
- pCapOptions = new InsCaptionOptArr;
+ pCapOptions.reset(new InsCaptionOptArr);
Load();
}
SwInsertConfig::~SwInsertConfig()
{
- delete pCapOptions;
- delete pOLEMiscOpt;
+ pCapOptions.reset();
+ pOLEMiscOpt.reset();
}
static void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
@@ -1072,7 +1072,7 @@ void SwInsertConfig::Load()
case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
if(!pOLEMiscOpt)
{
- pOLEMiscOpt = new InsCaptionOpt(OLE_CAP);
+ pOLEMiscOpt.reset(new InsCaptionOpt(OLE_CAP));
}
lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
break;