Kaydet (Commit) 414a907d authored tarafından Jochen Nitschke's avatar Jochen Nitschke Kaydeden (comit) Noel Grandin

use unique_ptr for ScMyLabelRange

Change-Id: Ib54d28024d5f853c6f54600222be7a4285873a9b
Reviewed-on: https://gerrit.libreoffice.org/39986Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 0d8eae93
......@@ -3168,7 +3168,6 @@ void ScXMLImport::SetLabelRanges()
xRowRanges->addNew( aLabelRange, aDataRange );
}
delete *aItr;
aItr = pMyLabelRanges->erase(aItr);
}
}
......
......@@ -774,7 +774,7 @@ struct ScMyLabelRange
bool bColumnOrientation;
};
typedef std::list<const ScMyLabelRange*> ScMyLabelRanges;
typedef std::list< std::unique_ptr<const ScMyLabelRange> > ScMyLabelRanges;
struct ScMyImportValidation
{
......@@ -1103,10 +1103,10 @@ public:
void AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp);
void AddLabelRange(const ScMyLabelRange* pMyLabelRange) {
void AddLabelRange(std::unique_ptr<const ScMyLabelRange> pMyLabelRange) {
if (!pMyLabelRanges)
pMyLabelRanges = new ScMyLabelRanges;
pMyLabelRanges->push_back(pMyLabelRange); }
pMyLabelRanges->push_back(std::move(pMyLabelRange)); }
void AddValidation(const ScMyImportValidation& rValidation) {
if (!pValidations)
......
......@@ -22,6 +22,8 @@
#include <xmloff/xmltoken.hxx>
#include "xmlimprt.hxx"
#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star;
using namespace xmloff::token;
......@@ -109,13 +111,10 @@ void ScXMLLabelRangeContext::EndElement()
// Label ranges must be stored as strings until all sheets are loaded
// (like named expressions).
ScMyLabelRange* pLabelRange = new ScMyLabelRange;
pLabelRange->sLabelRangeStr = sLabelRangeStr;
pLabelRange->sDataRangeStr = sDataRangeStr;
pLabelRange->bColumnOrientation = bColumnOrientation;
auto pLabelRange = o3tl::make_unique<ScMyLabelRange>(
ScMyLabelRange{sLabelRangeStr, sDataRangeStr, bColumnOrientation});
GetScImport().AddLabelRange(pLabelRange);
GetScImport().AddLabelRange(std::move(pLabelRange));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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