Kaydet (Commit) 257b099b authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SwInsertConfig

Change-Id: I5f39956e529b98f4114139b8c3ba1391e45440ef
Reviewed-on: https://gerrit.libreoffice.org/57876
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 63ba8ffa
...@@ -118,8 +118,8 @@ class SwInsertConfig : public utl::ConfigItem ...@@ -118,8 +118,8 @@ class SwInsertConfig : public utl::ConfigItem
{ {
friend class SwModuleOptions; friend class SwModuleOptions;
InsCaptionOptArr* pCapOptions; std::unique_ptr<InsCaptionOptArr> pCapOptions;
InsCaptionOpt* pOLEMiscOpt; std::unique_ptr<InsCaptionOpt> pOLEMiscOpt;
SvGlobalName aGlobalNames[5]; SvGlobalName aGlobalNames[5];
......
...@@ -77,7 +77,7 @@ const InsCaptionOpt* SwModuleOptions::GetCapOption( ...@@ -77,7 +77,7 @@ const InsCaptionOpt* SwModuleOptions::GetCapOption(
for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++) for( sal_uInt16 nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++)
bFound = *pOleId == aInsertConfig.aGlobalNames[nId ]; bFound = *pOleId == aInsertConfig.aGlobalNames[nId ];
if(!bFound) if(!bFound)
return aInsertConfig.pOLEMiscOpt; return aInsertConfig.pOLEMiscOpt.get();
} }
return aInsertConfig.pCapOptions->Find(eType, pOleId); return aInsertConfig.pCapOptions->Find(eType, pOleId);
} }
...@@ -103,7 +103,7 @@ bool SwModuleOptions::SetCapOption(bool bHTML, const InsCaptionOpt* pOpt) ...@@ -103,7 +103,7 @@ bool SwModuleOptions::SetCapOption(bool bHTML, const InsCaptionOpt* pOpt)
if(aInsertConfig.pOLEMiscOpt) if(aInsertConfig.pOLEMiscOpt)
*aInsertConfig.pOLEMiscOpt = *pOpt; *aInsertConfig.pOLEMiscOpt = *pOpt;
else else
aInsertConfig.pOLEMiscOpt = new InsCaptionOpt(*pOpt); aInsertConfig.pOLEMiscOpt.reset(new InsCaptionOpt(*pOpt));
} }
} }
...@@ -596,15 +596,15 @@ SwInsertConfig::SwInsertConfig(bool bWeb) : ...@@ -596,15 +596,15 @@ SwInsertConfig::SwInsertConfig(bool bWeb) :
aGlobalNames[GLOB_NAME_MATH ] = SvGlobalName(SO3_SM_CLASSID); aGlobalNames[GLOB_NAME_MATH ] = SvGlobalName(SO3_SM_CLASSID);
aGlobalNames[GLOB_NAME_CHART ] = SvGlobalName(SO3_SCH_CLASSID); aGlobalNames[GLOB_NAME_CHART ] = SvGlobalName(SO3_SCH_CLASSID);
if(!bIsWeb) if(!bIsWeb)
pCapOptions = new InsCaptionOptArr; pCapOptions.reset(new InsCaptionOptArr);
Load(); Load();
} }
SwInsertConfig::~SwInsertConfig() SwInsertConfig::~SwInsertConfig()
{ {
delete pCapOptions; pCapOptions.reset();
delete pOLEMiscOpt; pOLEMiscOpt.reset();
} }
static void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset) static void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
...@@ -1072,7 +1072,7 @@ void SwInsertConfig::Load() ...@@ -1072,7 +1072,7 @@ void SwInsertConfig::Load()
case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES: case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
if(!pOLEMiscOpt) 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); lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment