summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--starmath/inc/dialog.hxx8
-rw-r--r--starmath/source/dialog.cxx15
2 files changed, 9 insertions, 14 deletions
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 7de61cf8b7dd..6b71b2791a6c 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -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();
}
};
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index beb269afdc62..7c9024596cff 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -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));