diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-10 16:58:45 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-11 08:44:23 +0100 |
commit | a41b1d18ad26703f6a5b622f10e1126570bfd419 (patch) | |
tree | 11b3457bd786f733b0228e7539e9dad26e0c5b39 | |
parent | c7d5ad9dbfc7ada52a3ec8c38fa8420a08b126c3 (diff) |
use unique_ptr in SwNodes::ExpandRangeForTableBox
Change-Id: I31cc9d6b962c116c64789d886b82ea476f4e5144
Reviewed-on: https://gerrit.libreoffice.org/66124
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/inc/ndarr.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 6 |
3 files changed, 7 insertions, 8 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index 598397c43cf6..6153af0ad012 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -258,7 +258,7 @@ public: SwTextFormatColl* pTextColl, 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 SwTableNode* TextToTable( const TableRanges_t& rTableNodes, diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 47246bd18a69..6a173ffab31d 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1279,9 +1279,8 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > return &rNdTable; } -SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange) +std::unique_ptr<SwNodeRange> SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange) { - SwNodeRange * pResult = nullptr; bool bChanged = false; SwNodeIndex aNewStart = rRange.aStart; @@ -1335,9 +1334,9 @@ SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange) pNode = &aIndex.GetNode(); } + std::unique_ptr<SwNodeRange> pResult; if (bChanged) - pResult = new SwNodeRange(aNewStart, aNewEnd); - + pResult.reset(new SwNodeRange(aNewStart, aNewEnd)); return pResult; } diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 68d78213fb48..944851a47f2d 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1835,10 +1835,10 @@ void SwXText::Impl::ConvertCell( SwNodeRange aTmpRange(aStartCellPam.Start()->nNode, aEndCellPam.End()->nNode); - SwNodeRange * pCorrectedRange = + std::unique_ptr<SwNodeRange> pCorrectedRange = m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange); - if (pCorrectedRange != nullptr) + if (pCorrectedRange) { SwPaM aNewStartPaM(pCorrectedRange->aStart, 0); aStartCellPam = aNewStartPaM; @@ -1851,7 +1851,7 @@ void SwXText::Impl::ConvertCell( SwPaM aNewEndPaM(pCorrectedRange->aEnd, nEndLen); aEndCellPam = aNewEndPaM; - delete pCorrectedRange; + pCorrectedRange.reset(); } /** check the nodes between start and end |