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

loplugin:useuniqueptr in SmCategoryDesc

Change-Id: I4a6be3c84fb7c64b5f72499e5393e44f02514201
Reviewed-on: https://gerrit.libreoffice.org/51334Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b4b2d7dd
......@@ -179,8 +179,8 @@ public:
class SmCategoryDesc
{
OUString Name;
OUString *Strings[4];
Image *Graphics[4]; /* regular bitmaps */
OUString Strings[4];
std::unique_ptr<Image> Graphics[4]; /* regular bitmaps */
sal_uInt16 Minimum[4];
sal_uInt16 Maximum[4];
sal_uInt16 Value[4];
......@@ -190,7 +190,7 @@ public:
~SmCategoryDesc();
const OUString& GetName() const { return Name; }
const OUString* GetString(sal_uInt16 Index) const { return Strings[Index]; }
const OUString& GetString(sal_uInt16 Index) const { return Strings[Index]; }
sal_uInt16 GetMinimum(sal_uInt16 Index) { return Minimum[Index]; }
sal_uInt16 GetMaximum(sal_uInt16 Index) { return Maximum[Index]; }
sal_uInt16 GetValue(sal_uInt16 Index) const { return Value[Index]; }
......@@ -198,7 +198,7 @@ public:
const Image * GetGraphic(sal_uInt16 Index) const
{
return Graphics[Index];
return Graphics[Index].get();
}
};
......
......@@ -650,14 +650,14 @@ SmCategoryDesc::SmCategoryDesc(VclBuilderContainer& rBuilder, sal_uInt16 nCatego
if (pLabel)
{
Strings [i] = new OUString(pLabel->GetText());
Strings[i] = pLabel->GetText();
FixedImage* pImage = rBuilder.get<FixedImage>(OString::number(nCategoryIdx)+"image"+OString::number(i+1));
Graphics [i] = new Image(pImage->GetImage());
Graphics[i].reset(new Image(pImage->GetImage()));
}
else
{
Strings [i] = nullptr;
Graphics [i] = nullptr;
Strings[i].clear();
Graphics[i].reset();
}
const FieldMinMax& rMinMax = pMinMaxData[ nCategoryIdx-1 ][i];
......@@ -668,11 +668,6 @@ SmCategoryDesc::SmCategoryDesc(VclBuilderContainer& rBuilder, sal_uInt16 nCatego
SmCategoryDesc::~SmCategoryDesc()
{
for (int i = 0; i < 4; ++i)
{
delete Strings [i];
delete Graphics [i];
}
}
/**************************************************************************/
......@@ -829,7 +824,7 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
if (bActive)
{
pCat = Categories[nCategory];
pFT->SetText(*pCat->GetString(i));
pFT->SetText(pCat->GetString(i));
pMF->SetMin(pCat->GetMinimum(i));
pMF->SetMax(pCat->GetMaximum(i));
......
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