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

use unique_ptr in SwNodes::ExpandRangeForTableBox

Change-Id: I31cc9d6b962c116c64789d886b82ea476f4e5144
Reviewed-on: https://gerrit.libreoffice.org/66124
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst c7d5ad9d
...@@ -258,7 +258,7 @@ public: ...@@ -258,7 +258,7 @@ public:
SwTextFormatColl* pTextColl, SwTextFormatColl* pTextColl,
SwUndoTextToTable* pUndo ); SwUndoTextToTable* pUndo );
SwNodeRange * ExpandRangeForTableBox(const SwNodeRange & rRange); std::unique_ptr<SwNodeRange> ExpandRangeForTableBox(const SwNodeRange & rRange);
/// create a table from a vector of NodeRanges - API support /// create a table from a vector of NodeRanges - API support
SwTableNode* TextToTable( const TableRanges_t& rTableNodes, SwTableNode* TextToTable( const TableRanges_t& rTableNodes,
......
...@@ -1279,9 +1279,8 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > ...@@ -1279,9 +1279,8 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
return &rNdTable; return &rNdTable;
} }
SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange) std::unique_ptr<SwNodeRange> SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange)
{ {
SwNodeRange * pResult = nullptr;
bool bChanged = false; bool bChanged = false;
SwNodeIndex aNewStart = rRange.aStart; SwNodeIndex aNewStart = rRange.aStart;
...@@ -1335,9 +1334,9 @@ SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange) ...@@ -1335,9 +1334,9 @@ SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange)
pNode = &aIndex.GetNode(); pNode = &aIndex.GetNode();
} }
std::unique_ptr<SwNodeRange> pResult;
if (bChanged) if (bChanged)
pResult = new SwNodeRange(aNewStart, aNewEnd); pResult.reset(new SwNodeRange(aNewStart, aNewEnd));
return pResult; return pResult;
} }
......
...@@ -1835,10 +1835,10 @@ void SwXText::Impl::ConvertCell( ...@@ -1835,10 +1835,10 @@ void SwXText::Impl::ConvertCell(
SwNodeRange aTmpRange(aStartCellPam.Start()->nNode, SwNodeRange aTmpRange(aStartCellPam.Start()->nNode,
aEndCellPam.End()->nNode); aEndCellPam.End()->nNode);
SwNodeRange * pCorrectedRange = std::unique_ptr<SwNodeRange> pCorrectedRange =
m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange); m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange);
if (pCorrectedRange != nullptr) if (pCorrectedRange)
{ {
SwPaM aNewStartPaM(pCorrectedRange->aStart, 0); SwPaM aNewStartPaM(pCorrectedRange->aStart, 0);
aStartCellPam = aNewStartPaM; aStartCellPam = aNewStartPaM;
...@@ -1851,7 +1851,7 @@ void SwXText::Impl::ConvertCell( ...@@ -1851,7 +1851,7 @@ void SwXText::Impl::ConvertCell(
SwPaM aNewEndPaM(pCorrectedRange->aEnd, nEndLen); SwPaM aNewEndPaM(pCorrectedRange->aEnd, nEndLen);
aEndCellPam = aNewEndPaM; aEndCellPam = aNewEndPaM;
delete pCorrectedRange; pCorrectedRange.reset();
} }
/** check the nodes between start and end /** check the nodes between start and end
......
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