summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-09-30 23:09:06 +0200
committerMichael Stahl <mstahl@redhat.com>2015-10-01 11:28:58 +0200
commitba785e0c93102e354c646c96a1de29f468080108 (patch)
treecb7c527bad3339cd53f6ecf08b6071aff42b74f2
parentd119c840b76a250c79f30bae246fad0b255817d2 (diff)
sw: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I913648a8dd407c5629df7a0355d2cfdf66240cf9
-rw-r--r--sw/source/core/inc/UndoSort.hxx8
-rw-r--r--sw/source/core/undo/unsort.cxx40
2 files changed, 27 insertions, 21 deletions
diff --git a/sw/source/core/inc/UndoSort.hxx b/sw/source/core/inc/UndoSort.hxx
index 426b862ac3e1..4bc178bf44e4 100644
--- a/sw/source/core/inc/UndoSort.hxx
+++ b/sw/source/core/inc/UndoSort.hxx
@@ -21,9 +21,12 @@
#define INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
#include <undobj.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+
#include <rtl/ustring.hxx>
+#include <memory>
+#include <vector>
+
struct SwSortOptions;
class SwTableNode;
class SwUndoAttrTable;
@@ -59,8 +62,7 @@ typedef std::vector<SwNodeIndex*> SwUndoSortList;
class SwUndoSort : public SwUndo, private SwUndRng
{
SwSortOptions* pSortOpt;
- boost::ptr_vector<SwSortUndoElement>
- aSortList;
+ std::vector<std::unique_ptr<SwSortUndoElement>> m_SortList;
SwUndoAttrTable* pUndoTableAttr;
SwRedlineData* pRedlData;
sal_uLong nTableNd;
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index a32c1cbe2e03..42b4d81a8f07 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -94,12 +94,12 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
const SwTable& rTable = pTableNd->GetTable();
SwMovedBoxes aMovedList;
- for( size_t i=0; i < aSortList.size(); i++)
+ for (size_t i=0; i < m_SortList.size(); i++)
{
const SwTableBox* pSource = rTable.GetTableBox(
- *aSortList[i].SORT_TXT_TBL.TBL.pSource );
+ *m_SortList[i]->SORT_TXT_TBL.TBL.pSource );
const SwTableBox* pTarget = rTable.GetTableBox(
- *aSortList[i].SORT_TXT_TBL.TBL.pTarget );
+ *m_SortList[i]->SORT_TXT_TBL.TBL.pTarget );
// move back
MoveCell(&rDoc, pTarget, pSource,
@@ -125,17 +125,21 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext)
// The IndexList must be created based on (asc.) sorted SourcePosition.
SwUndoSortList aIdxList;
- for( size_t i = 0; i < aSortList.size(); ++i)
- for( size_t ii=0; ii < aSortList.size(); ++ii )
- if( aSortList[ii].SORT_TXT_TBL.TXT.nSource == nSttNode + i )
+ for (size_t i = 0; i < m_SortList.size(); ++i)
+ {
+ for (size_t ii = 0; ii < m_SortList.size(); ++ii)
+ {
+ if (m_SortList[ii]->SORT_TXT_TBL.TXT.nSource == nSttNode + i)
{
SwNodeIndex* pIdx = new SwNodeIndex( rDoc.GetNodes(),
- aSortList[ii].SORT_TXT_TBL.TXT.nTarget );
+ m_SortList[ii]->SORT_TXT_TBL.TXT.nTarget );
aIdxList.insert( aIdxList.begin() + i, pIdx );
break;
}
+ }
+ }
- for(size_t i=0; i < aSortList.size(); ++i)
+ for (size_t i = 0; i < m_SortList.size(); ++i)
{
SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode + i );
SwNodeRange aRg( *aIdxList[i], 0, *aIdxList[i], 1 );
@@ -169,12 +173,12 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
const SwTable& rTable = pTableNd->GetTable();
SwMovedBoxes aMovedList;
- for(size_t i=0; i < aSortList.size(); ++i)
+ for (size_t i = 0; i < m_SortList.size(); ++i)
{
const SwTableBox* pSource = rTable.GetTableBox(
- *aSortList[i].SORT_TXT_TBL.TBL.pSource );
+ *m_SortList[i]->SORT_TXT_TBL.TBL.pSource );
const SwTableBox* pTarget = rTable.GetTableBox(
- *aSortList[i].SORT_TXT_TBL.TBL.pTarget );
+ *m_SortList[i]->SORT_TXT_TBL.TBL.pTarget );
// move back
MoveCell(&rDoc, pSource, pTarget,
@@ -203,14 +207,14 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext)
SwUndoSortList aIdxList;
- for( size_t i = 0; i < aSortList.size(); ++i)
+ for (size_t i = 0; i < m_SortList.size(); ++i)
{ // current position is starting point
SwNodeIndex* pIdx = new SwNodeIndex( rDoc.GetNodes(),
- aSortList[i].SORT_TXT_TBL.TXT.nSource);
+ m_SortList[i]->SORT_TXT_TBL.TXT.nSource);
aIdxList.insert( aIdxList.begin() + i, pIdx );
}
- for( size_t i = 0; i < aSortList.size(); ++i)
+ for (size_t i = 0; i < m_SortList.size(); ++i)
{
SwNodeIndex aIdx( rDoc.GetNodes(), nSttNode + i);
SwNodeRange aRg( *aIdxList[i], 0, *aIdxList[i], 1 );
@@ -245,14 +249,14 @@ void SwUndoSort::RepeatImpl(::sw::RepeatContext & rContext)
void SwUndoSort::Insert( const OUString& rOrgPos, const OUString& rNewPos)
{
- SwSortUndoElement* pEle = new SwSortUndoElement(rOrgPos, rNewPos);
- aSortList.push_back( pEle );
+ std::unique_ptr<SwSortUndoElement> p(new SwSortUndoElement(rOrgPos, rNewPos));
+ m_SortList.push_back(std::move(p));
}
void SwUndoSort::Insert( sal_uLong nOrgPos, sal_uLong nNewPos)
{
- SwSortUndoElement* pEle = new SwSortUndoElement(nOrgPos, nNewPos);
- aSortList.push_back( pEle );
+ std::unique_ptr<SwSortUndoElement> p(new SwSortUndoElement(nOrgPos, nNewPos));
+ m_SortList.push_back(std::move(p));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */