diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-09-04 21:30:15 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-09-07 16:49:58 +0200 |
commit | a68eaa09a4979dc4814301f137e4186c85dee54f (patch) | |
tree | be5a055e8fd7e6214f1b037d47bb9c3f9edb5ba0 /sw | |
parent | b7a5b788f37707f9d0c473877be9777ce784175a (diff) |
sw: convert boost::ptr_vector to std::vector<std::unique_ptr>
Change-Id: I341fb7c0712dff77ebfed41560a487f85c27c25a
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/tblsel.hxx | 12 | ||||
-rw-r--r-- | sw/source/core/doc/docsort.cxx | 38 | ||||
-rw-r--r-- | sw/source/core/doc/tblcpy.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 54 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl1.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/frmedt/tblsel.cxx | 10 |
8 files changed, 83 insertions, 76 deletions
diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx index 2979dc941bc5..1b7000e3883b 100644 --- a/sw/inc/tblsel.hxx +++ b/sw/inc/tblsel.hxx @@ -153,7 +153,7 @@ void MakeSelUnions( SwSelUnions&, const SwLayoutFrm *pStart, class _FndBox; class _FndLine; -typedef boost::ptr_vector<_FndBox> _FndBoxes; +typedef std::vector<std::unique_ptr<_FndBox>> FndBoxes_t; typedef std::vector<std::unique_ptr<_FndLine>> FndLines_t; class _FndBox @@ -194,12 +194,16 @@ public: class _FndLine { SwTableLine* pLine; - _FndBoxes aBoxes; + FndBoxes_t m_Boxes; _FndBox* pUpper; + + _FndLine(_FndLine const&) = delete; + _FndLine& operator=(_FndLine const&) = delete; + public: _FndLine(SwTableLine* pL, _FndBox* pFB=0) : pLine(pL), pUpper(pFB) {} - const _FndBoxes& GetBoxes() const { return aBoxes; } - _FndBoxes& GetBoxes() { return aBoxes; } + const FndBoxes_t& GetBoxes() const { return m_Boxes; } + FndBoxes_t& GetBoxes() { return m_Boxes; } const SwTableLine* GetLine() const { return pLine; } SwTableLine* GetLine() { return pLine; } const _FndBox* GetUpper() const { return pUpper; } diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 138d4a614788..9c4dd17bd4cd 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -776,12 +776,12 @@ FlatFndBox::~FlatFndBox() bool FlatFndBox::CheckLineSymmetry(const _FndBox& rBox) { const FndLines_t &rLines = rBox.GetLines(); - _FndBoxes::size_type nBoxes {0}; + FndBoxes_t::size_type nBoxes {0}; for (FndLines_t::size_type i=0; i < rLines.size(); ++i) { const _FndLine* pLn = rLines[i].get(); - const _FndBoxes& rBoxes = pLn->GetBoxes(); + const FndBoxes_t& rBoxes = pLn->GetBoxes(); // Number of Boxes of all Lines is unequal -> no symmetry if( i && nBoxes != rBoxes.size()) @@ -797,12 +797,12 @@ bool FlatFndBox::CheckLineSymmetry(const _FndBox& rBox) /// Check Box for symmetry (All Boxes of a Line need to have same number of Lines) bool FlatFndBox::CheckBoxSymmetry(const _FndLine& rLn) { - const _FndBoxes &rBoxes = rLn.GetBoxes(); + const FndBoxes_t &rBoxes = rLn.GetBoxes(); FndLines_t::size_type nLines {0}; - for(_FndBoxes::size_type i=0; i < rBoxes.size(); ++i) + for (FndBoxes_t::size_type i = 0; i < rBoxes.size(); ++i) { - _FndBox const*const pBox = &rBoxes[i]; + _FndBox const*const pBox = rBoxes[i].get(); const FndLines_t& rLines = pBox->GetLines(); // Number of Lines of all Boxes is unequal -> no symmetry @@ -829,10 +829,11 @@ sal_uInt16 FlatFndBox::GetColCount(const _FndBox& rBox) { // The Boxes of a Line sal_uInt16 nCount = 0; - const _FndBoxes& rBoxes = pLine->GetBoxes(); - for( const auto &rB : rBoxes ) - // Iterate recursively over the Lines - nCount += rB.GetLines().empty() ? 1 : GetColCount(rB); + const FndBoxes_t& rBoxes = pLine->GetBoxes(); + for (const auto &rpB : rBoxes) + { // Iterate recursively over the Lines + nCount += rpB->GetLines().empty() ? 1 : GetColCount(*rpB); + } if( nSum < nCount ) nSum = nCount; @@ -850,12 +851,15 @@ sal_uInt16 FlatFndBox::GetRowCount(const _FndBox& rBox) sal_uInt16 nLines = 0; for (const auto & pLine : rLines) { // The Boxes of a Line - const _FndBoxes& rBoxes = pLine->GetBoxes(); + const FndBoxes_t& rBoxes = pLine->GetBoxes(); sal_uInt16 nLn = 1; - for(const auto &rB : rBoxes) - if (rB.GetLines().size()) - // Iterate recursively over the Lines - nLn = std::max(GetRowCount(rB), nLn); + for (const auto &rpB : rBoxes) + { + if (rpB->GetLines().size()) + { // Iterate recursively over the Lines + nLn = std::max(GetRowCount(*rpB), nLn); + } + } nLines = nLines + nLn; } @@ -873,12 +877,12 @@ void FlatFndBox::FillFlat(const _FndBox& rBox, bool bLastBox) for (const auto & pLine : rLines) { // The Boxes of a Line - const _FndBoxes& rBoxes = pLine->GetBoxes(); + const FndBoxes_t& rBoxes = pLine->GetBoxes(); sal_uInt16 nOldCol = nCol; - for( _FndBoxes::size_type j = 0; j < rBoxes.size(); ++j ) + for( FndBoxes_t::size_type j = 0; j < rBoxes.size(); ++j ) { // Check the Box if it's an atomic one - const _FndBox *const pBox = &rBoxes[j]; + const _FndBox *const pBox = rBoxes[j].get(); if( pBox->GetLines().empty() ) { diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index a31e9268f26f..08fd897109fc 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -213,8 +213,8 @@ namespace SwTableLine *pLine2 = rLines[ ++nEndLn ]; SwTableBox *pTmpBox = pLine2->GetTabBoxes()[0]; _FndLine *pInsLine = new _FndLine( pLine2, &rFndBox ); - _FndBox *pFndBox = new _FndBox( pTmpBox, pInsLine ); - pInsLine->GetBoxes().insert(pInsLine->GetBoxes().begin(), pFndBox); + std::unique_ptr<_FndBox> pFndBox(new _FndBox(pTmpBox, pInsLine)); + pInsLine->GetBoxes().insert(pInsLine->GetBoxes().begin(), std::move(pFndBox)); rFndLines.push_back(std::unique_ptr<_FndLine>(pInsLine)); } } @@ -858,7 +858,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, // See if the Box count is high enough for the Lines SwTableLine* pLastLn = GetTabLines().back(); - pSttBox = pFLine->GetBoxes()[0].GetBox(); + pSttBox = pFLine->GetBoxes()[0]->GetBox(); const SwTableBoxes::size_type nSttBox = pFLine->GetLine()->GetTabBoxes().GetPos( pSttBox ); for( SwTableLines::size_type n = rCpyTable.GetTabLines().size() - nNewLns; n < rCpyTable.GetTabLines().size(); ++n ) @@ -902,7 +902,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, // We have enough rows, so check the Boxes per row pFLine = aFndBox.GetLines()[ nLn % nFndCnt ].get(); SwTableLine* pLine = pFLine->GetLine(); - pSttBox = pFLine->GetBoxes()[0].GetBox(); + pSttBox = pFLine->GetBoxes()[0]->GetBox(); const SwTableBoxes::size_type nSttBox = pLine->GetTabBoxes().GetPos( pSttBox ); if( nLn >= nFndCnt ) { @@ -926,7 +926,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, } // Test for nesting - for( _FndBoxes::size_type nBx = 0; nBx < pFLine->GetBoxes().size(); ++nBx ) + for (FndBoxes_t::size_type nBx = 0; nBx < pFLine->GetBoxes().size(); ++nBx) { SwTableBox *pTmpBox = pLine->GetTabBoxes()[ nSttBox + nBx ]; if( !pTmpBox->GetSttNd() ) @@ -936,7 +936,8 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, } // if Ok, insert the Box into the FndLine pFndBox = new _FndBox( pTmpBox, pInsFLine ); - pInsFLine->GetBoxes().insert( pInsFLine->GetBoxes().begin() + nBx, pFndBox ); + pInsFLine->GetBoxes().insert( pInsFLine->GetBoxes().begin() + nBx, + std::unique_ptr<_FndBox>(pFndBox)); } aFndBox.GetLines().insert( aFndBox.GetLines().begin() + nLn, std::unique_ptr<_FndLine>(pInsFLine)); } @@ -957,7 +958,8 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, if( nBx == pFLine->GetBoxes().size() ) { pFndBox = new _FndBox( pTmpBox, pFLine ); - pFLine->GetBoxes().insert( pFLine->GetBoxes().begin() + nBx, pFndBox ); + pFLine->GetBoxes().insert(pFLine->GetBoxes().begin() + nBx, + std::unique_ptr<_FndBox>(pFndBox)); } } } @@ -970,9 +972,11 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, return false; // Test for nesting - for( auto &rBox : pFLine->GetBoxes() ) - if (!rBox.GetBox()->GetSttNd()) + for (auto &rpBox : pFLine->GetBoxes()) + { + if (!rpBox->GetBox()->GetSttNd()) return false; + } } } @@ -1007,12 +1011,12 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, pFLine = aFndBox.GetLines()[ nLn ].get(); SwTableLine* pCpyLn = rCpyTable.GetTabLines()[ nLn % rCpyTable.GetTabLines().size() ]; - for( _FndBoxes::size_type nBx = 0; nBx < pFLine->GetBoxes().size(); ++nBx ) + for (FndBoxes_t::size_type nBx = 0; nBx < pFLine->GetBoxes().size(); ++nBx) { // Copy the pCpyBox into pMyBox lcl_CpyBox( rCpyTable, pCpyLn->GetTabBoxes()[ nBx % pCpyLn->GetTabBoxes().size() ], - *this, pFLine->GetBoxes()[nBx].GetBox(), true, pUndo ); + *this, pFLine->GetBoxes()[nBx]->GetBox(), true, pUndo ); } } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index beea0769a416..40831462789f 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -322,11 +322,11 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) if( bDiffCount ) { // The first Line should be enough - _FndBoxes const& rFndBoxes = pCmpLine->GetBoxes(); + FndBoxes_t const& rFndBoxes = pCmpLine->GetBoxes(); long nSz = 0; for( auto n = rFndBoxes.size(); n; ) { - nSz += rFndBoxes[--n].GetBox()-> + nSz += rFndBoxes[--n]->GetBox()-> GetFrameFormat()->GetFrmSize().GetWidth(); } aFrmSz.SetWidth( aFrmSz.GetWidth() - @@ -385,10 +385,10 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) ::_InsTableBox( pCpyPara->pDoc, pCpyPara->pTableNd, pCpyPara->pInsLine, aFindFrm.pNewFrameFormat, pBox, pCpyPara->nInsPos++ ); - const _FndBoxes& rFndBxs = rFndBox.GetUpper()->GetBoxes(); + const FndBoxes_t& rFndBxs = rFndBox.GetUpper()->GetBoxes(); if( 8 > pCpyPara->nDelBorderFlag ? pCpyPara->nDelBorderFlag != 0 - : &rFndBox == &rFndBxs[rFndBxs.size() - 1] ) + : &rFndBox == rFndBxs[rFndBxs.size() - 1].get()) { const SvxBoxItem& rBoxItem = pBox->GetFrameFormat()->GetBox(); if( 8 > pCpyPara->nDelBorderFlag @@ -441,8 +441,7 @@ static void lcl_CopyRow(_FndLine& rFndLine, _CpyPara *const pCpyPara) } _CpyPara aPara( *pCpyPara, pNewLine ); - for (_FndBoxes::iterator it = rFndLine.GetBoxes().begin(); - it != rFndLine.GetBoxes().end(); ++it) + for (auto const& it : rFndLine.GetBoxes()) { lcl_CopyCol(*it, &aPara); } @@ -456,7 +455,7 @@ static void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, sal_uInt16 nCpyCnt // Bug 29124: Not only copy in the BaseLines. If possible, we go down as far as possible _FndBox* pFBox; if( 1 == pFndLn->GetBoxes().size() && - !( pFBox = &pFndLn->GetBoxes()[0] )->GetBox()->GetSttNd() ) + !( pFBox = pFndLn->GetBoxes()[0].get() )->GetBox()->GetSttNd() ) { // A Box with multiple Lines, so insert into these Lines for (auto &rpLine : pFBox->GetLines()) @@ -468,7 +467,7 @@ static void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, sal_uInt16 nCpyCnt { rCpyPara.pInsLine = pFndLn->GetLine(); SwTableBox* pBox = pFndLn->GetBoxes()[ bBehind ? - pFndLn->GetBoxes().size()-1 : 0 ].GetBox(); + pFndLn->GetBoxes().size()-1 : 0 ]->GetBox(); rCpyPara.nInsPos = pFndLn->GetLine()->GetTabBoxes().GetPos( pBox ); if( bBehind ) ++rCpyPara.nInsPos; @@ -479,8 +478,7 @@ static void lcl_InsCol( _FndLine* pFndLn, _CpyPara& rCpyPara, sal_uInt16 nCpyCnt rCpyPara.nDelBorderFlag = 9; else rCpyPara.nDelBorderFlag = 8; - for (_FndBoxes::iterator it = pFndLn->GetBoxes().begin(); - it != pFndLn->GetBoxes().end(); ++it) + for (auto const& it : pFndLn->GetBoxes()) { lcl_CopyCol(*it, &rCpyPara); } @@ -580,7 +578,7 @@ bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, 1 == (pFndLine = pFndBox->GetLines()[0].get())->GetBoxes().size()) { // Don't go down too far! One Line with Box needs to remain! - _FndBox* pTmpBox = &pFndLine->GetBoxes().front(); + _FndBox *const pTmpBox = pFndLine->GetBoxes().front().get(); if( !pTmpBox->GetLines().empty() ) pFndBox = pTmpBox; else @@ -1465,8 +1463,8 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) &pFndLn->GetUpper()->GetTabLines() : &pULPara->pTableNd->GetTable().GetTabLines(); - SwTableBox* pLBx = rFndLine.GetBoxes().front().GetBox(); - SwTableBox* pRBx = rFndLine.GetBoxes().back().GetBox(); + SwTableBox* pLBx = rFndLine.GetBoxes().front()->GetBox(); + SwTableBox* pRBx = rFndLine.GetBoxes().back()->GetBox(); sal_uInt16 nLeft = pFndLn->GetTabBoxes().GetPos( pLBx ); sal_uInt16 nRight = pFndLn->GetTabBoxes().GetPos( pRBx ); @@ -1533,11 +1531,11 @@ static void lcl_Merge_MoveLine(_FndLine& rFndLine, _InsULPara *const pULPara) static_cast<SwTableLineFormat*>(rFndLine.GetLine()->GetFrameFormat()), 0, pULPara->pInsBox ); _InsULPara aPara( *pULPara ); // copying aPara.pInsLine = pNewLine; - _FndBoxes & rLineBoxes = rFndLine.GetBoxes(); - for (_FndBoxes::iterator it = rLineBoxes.begin() + nStt; + FndBoxes_t & rLineBoxes = rFndLine.GetBoxes(); + for (FndBoxes_t::iterator it = rLineBoxes.begin() + nStt; it != rLineBoxes.begin() + nEnd; ++it) { - lcl_Merge_MoveBox(*it, &aPara); + lcl_Merge_MoveBox(**it, &aPara); } if( !pNewLine->GetTabBoxes().empty() ) @@ -1587,7 +1585,7 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, while( 1 == pFndBox->GetLines().size() && 1 == pFndBox->GetLines().front()->GetBoxes().size() ) { - pFndBox = &pFndBox->GetLines().front()->GetBoxes().front(); + pFndBox = pFndBox->GetLines().front()->GetBoxes().front().get(); } SwTableLine* pInsLine = new SwTableLine( @@ -1619,13 +1617,13 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, // Move the overlapping upper/lower Lines of the selected Area for (auto & it : pFndBox->GetLines().front()->GetBoxes()) { - lcl_Merge_MoveBox(it, &aPara); + lcl_Merge_MoveBox(*it, &aPara); } aPara.SetLower( pInsLine ); const auto nEnd = pFndBox->GetLines().size()-1; for (auto & it : pFndBox->GetLines()[nEnd]->GetBoxes()) { - lcl_Merge_MoveBox(it, &aPara); + lcl_Merge_MoveBox(*it, &aPara); } // Move the Boxes extending into the selected Area from left/right @@ -1702,7 +1700,7 @@ static sal_uInt16 lcl_GetBoxOffset( const _FndBox& rBox ) const _FndBox* pFirstBox = &rBox; while (!pFirstBox->GetLines().empty()) { - pFirstBox = &pFirstBox->GetLines().front()->GetBoxes().front(); + pFirstBox = pFirstBox->GetLines().front()->GetBoxes().front().get(); } sal_uInt16 nRet = 0; @@ -1726,7 +1724,7 @@ static sal_uInt16 lcl_GetLineWidth( const _FndLine& rLine ) sal_uInt16 nRet = 0; for( auto n = rLine.GetBoxes().size(); n; ) { - nRet = nRet + static_cast<sal_uInt16>(rLine.GetBoxes()[--n].GetBox() + nRet = nRet + static_cast<sal_uInt16>(rLine.GetBoxes()[--n]->GetBox() ->GetFrameFormat()->GetFrmSize().GetWidth()); } return nRet; @@ -1755,7 +1753,7 @@ static void lcl_CalcNewWidths(const FndLines_t& rFndLines, _CpyPara& rPara) sal_uLong nPos = 0; // The first selected box... const SwTableBox *const pSel = - pFndLine->GetBoxes().front().GetBox(); + pFndLine->GetBoxes().front()->GetBox(); size_t nBox = 0; // Sum up the width of all boxes before the first selected box while( nBox < nBoxCount ) @@ -1777,7 +1775,7 @@ static void lcl_CalcNewWidths(const FndLines_t& rFndLines, _CpyPara& rPara) for( nBox = 0; nBox < nBoxCount; ) { nPos += pFndLine->GetBoxes()[nBox] - .GetBox()->GetFrameFormat()->GetFrmSize().GetWidth(); + ->GetBox()->GetFrameFormat()->GetFrmSize().GetWidth(); rWidth[ ++nBox ] = nPos; } // nPos: The right border of the last selected box @@ -1997,14 +1995,16 @@ lcl_CopyLineToDoc(const _FndLine& rFndLine, _CpyPara *const pCpyPara) } else // Calculate it - for( auto &rBox : rFndLine.GetBoxes() ) + for (auto &rpBox : rFndLine.GetBoxes()) { - aPara.nOldSize += rBox.GetBox()->GetFrameFormat()->GetFrmSize().GetWidth(); + aPara.nOldSize += rpBox->GetBox()->GetFrameFormat()->GetFrmSize().GetWidth(); } - const _FndBoxes& rBoxes = rFndLine.GetBoxes(); - for (_FndBoxes::const_iterator it = rBoxes.begin(); it != rBoxes.end(); ++it) + const FndBoxes_t& rBoxes = rFndLine.GetBoxes(); + for (auto const& it : rBoxes) + { lcl_CopyBoxToDoc(*it, &aPara); + } if( pCpyPara->pTableNd->GetTable().IsNewModel() ) ++pCpyPara->nLnIdx; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 3635c4ab05ba..5f50cc95a2c6 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1860,7 +1860,7 @@ bool SwDoc::DeleteRow( const SwCursor& rCursor ) while( 1 == pFndBox->GetLines().size() && 1 == pFndBox->GetLines().front()->GetBoxes().size() ) { - _FndBox *const pTmp = & pFndBox->GetLines().front()->GetBoxes()[0]; + _FndBox *const pTmp = pFndBox->GetLines().front()->GetBoxes()[0].get(); if( pTmp->GetBox()->GetSttNd() ) break; // Else it gets too far pFndBox = pTmp; @@ -3657,8 +3657,7 @@ static bool lcl_SetAFormatLine(_FndLine &, _SetAFormatTabPara *pPara); static bool lcl_SetAFormatLine(_FndLine & rLine, _SetAFormatTabPara *pPara) { - for (_FndBoxes::iterator it = rLine.GetBoxes().begin(); - it != rLine.GetBoxes().end(); ++it) + for (auto const& it : rLine.GetBoxes()) { lcl_SetAFormatBox(*it, pPara); } @@ -3749,7 +3748,7 @@ bool SwDoc::SetTableAutoFormat( const SwSelBoxes& rBoxes, const SwTableAutoForma while( 1 == pFndBox->GetLines().size() && 1 == pFndBox->GetLines().front()->GetBoxes().size()) { - pFndBox = &pFndBox->GetLines().front()->GetBoxes()[0]; + pFndBox = pFndBox->GetLines().front()->GetBoxes()[0].get(); } if( pFndBox->GetLines().empty() ) // One too far? (only one sel. Box) @@ -3789,8 +3788,7 @@ bool SwDoc::SetTableAutoFormat( const SwSelBoxes& rBoxes, const SwTableAutoForma aPara.nCurBox = 0; aPara.nEndBox = pLine->GetBoxes().size()-1; aPara.pUndo = pUndo; - for (_FndBoxes::iterator it = pLine->GetBoxes().begin(); - it != pLine->GetBoxes().end(); ++it) + for (auto const& it : pLine->GetBoxes()) { lcl_SetAFormatBox(*it, &aPara); } @@ -3836,7 +3834,7 @@ bool SwDoc::GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGe while( 1 == pFndBox->GetLines().size() && 1 == pFndBox->GetLines().front()->GetBoxes().size()) { - pFndBox = &pFndBox->GetLines().front()->GetBoxes()[0]; + pFndBox = pFndBox->GetLines().front()->GetBoxes()[0].get(); } if( pFndBox->GetLines().empty() ) // One too far? (only one sel. Box) @@ -3862,7 +3860,7 @@ bool SwDoc::GetTableAutoFormat( const SwSelBoxes& rBoxes, SwTableAutoFormat& rGe for( sal_uInt8 nBox = 0; nBox < 4; ++nBox ) { - SwTableBox* pFBox = rLine.GetBoxes()[ aBoxArr[ nBox ] ].GetBox(); + SwTableBox* pFBox = rLine.GetBoxes()[ aBoxArr[ nBox ] ]->GetBox(); // Always apply to the first ones while( !pFBox->GetSttNd() ) pFBox = pFBox->GetTabLines()[0]->GetTabBoxes()[0]; diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 51d5fa76f696..797c159e3b30 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -207,8 +207,7 @@ bool _FindBox( _FndBox & rBox, LinesAndTable* pPara ) bool _FindLine( _FndLine& rLine, LinesAndTable* pPara ) { - for (_FndBoxes::iterator it = rLine.GetBoxes().begin(); - it != rLine.GetBoxes().end(); ++it) + for (auto const& it : rLine.GetBoxes()) { _FindBox(*it, pPara); } diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 3a2bea91b777..473540375802 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -376,7 +376,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable) while( 1 == pFndBox->GetLines().size() && 1 == pFndBox->GetLines().front()->GetBoxes().size()) { - _FndBox* pTmp = &pFndBox->GetLines().front()->GetBoxes()[0]; + _FndBox *const pTmp = pFndBox->GetLines().front()->GetBoxes()[0].get(); if( pTmp->GetBox()->GetSttNd() ) break; // otherwise too far pFndBox = pTmp; diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index a2aab4ae9f3b..26a5d1613431 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1391,8 +1391,7 @@ static bool lcl_CheckCol(_FndBox const&, bool* pPara); static bool lcl_CheckRow( const _FndLine& rFndLine, bool* pPara ) { - for (_FndBoxes::const_iterator it = rFndLine.GetBoxes().begin(); - it != rFndLine.GetBoxes().end(); ++it) + for (auto const& it : rFndLine.GetBoxes()) { lcl_CheckCol(*it, pPara); } @@ -1460,7 +1459,7 @@ sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes ) { pFndLine = pFndBox->GetLines().front().get(); if( 1 == pFndLine->GetBoxes().size() ) - pFndBox = &pFndLine->GetBoxes().front(); + pFndBox = pFndLine->GetBoxes().front().get(); else pFndBox = 0; } @@ -1473,8 +1472,7 @@ sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes ) } else if( pFndLine ) { - for (_FndBoxes::const_iterator it = pFndLine->GetBoxes().begin(), - end = pFndLine->GetBoxes().end(); it != end; ++it) + for (auto const& it : pFndLine->GetBoxes()) { lcl_CheckCol(*it, &bMergeSelOk); } @@ -2057,7 +2055,7 @@ static void _FndBoxCopyCol( SwTableBox* pBox, _FndPara* pFndPara ) return; } } - pFndPara->pFndLine->GetBoxes().push_back( pFndBox ); + pFndPara->pFndLine->GetBoxes().push_back(std::unique_ptr<_FndBox>(pFndBox)); } static void _FndLineCopyCol( SwTableLine* pLine, _FndPara* pFndPara ) |