Kaydet (Commit) 7cdf0551 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

use unique_ptr for memory owning ptr

Change-Id: I26efcebf750ff9947b936e990ce87ddbcb41b7ba
üst 82ed61ab
......@@ -33,6 +33,8 @@
#include <rtl/ref.hxx>
#include "scdllapi.h"
#include <memory>
#include <boost/noncopyable.hpp>
class EditEngine;
......@@ -111,7 +113,7 @@ public:
class ScHeaderFooterTextData : private boost::noncopyable
{
private:
EditTextObject* mpTextObj;
std::unique_ptr<EditTextObject> mpTextObj;
rtl::Reference<ScHeaderFooterContentObj> rContentObj;
sal_uInt16 nPart;
ScEditEngineDefaulter* pEditEngine;
......@@ -132,7 +134,7 @@ public:
sal_uInt16 GetPart() const { return nPart; }
rtl::Reference<ScHeaderFooterContentObj> GetContentObj() const { return rContentObj; }
const EditTextObject* GetTextObject() const { return mpTextObj; }
const EditTextObject* GetTextObject() const { return mpTextObj.get(); }
void dispose() { rContentObj.clear(); }
};
......
......@@ -198,7 +198,6 @@ ScHeaderFooterTextData::~ScHeaderFooterTextData()
delete pForwarder;
delete pEditEngine;
delete mpTextObj;
}
SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder()
......@@ -247,15 +246,13 @@ void ScHeaderFooterTextData::UpdateData()
{
if (pEditEngine)
{
delete mpTextObj;
mpTextObj = pEditEngine->CreateTextObject();
mpTextObj.reset(pEditEngine->CreateTextObject());
}
}
void ScHeaderFooterTextData::UpdateData(EditEngine& rEditEngine)
{
delete mpTextObj;
mpTextObj = rEditEngine.CreateTextObject();
mpTextObj.reset(rEditEngine.CreateTextObject());
bDataValid = false;
}
......
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