diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-16 10:58:34 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-25 00:17:04 +0200 |
commit | cf0e08c6b8d739b8b17dc533efc3e12505b2d5a9 (patch) | |
tree | 7a05e2cf05d608623ff22cc6c85895655c7a43ee /sw | |
parent | Convert SV_DECL_PTRARR_DEL(SwRubyList) to boost::ptr_vector (diff) | |
download | core-cf0e08c6b8d739b8b17dc533efc3e12505b2d5a9.tar.gz core-cf0e08c6b8d739b8b17dc533efc3e12505b2d5a9.zip |
Convert SV_DECL_PTRARR_SORT_VISIBILITY(SwPosFlyFrms) to std::set
Change-Id: Iba19e13b4402594023d9ce7c4d4fa3a9cdc9899e
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/flypos.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/layout/flypos.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/html/htmlfly.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerhelper.cxx | 11 |
6 files changed, 17 insertions, 21 deletions
diff --git a/sw/inc/flypos.hxx b/sw/inc/flypos.hxx index 5e88a69cd1c7..4a8d2fd22afd 100644 --- a/sw/inc/flypos.hxx +++ b/sw/inc/flypos.hxx @@ -31,6 +31,7 @@ #include <svl/svarray.hxx> #include <swdllapi.h> +#include <set> class SwFrmFmt; class SwNodeIndex; @@ -55,8 +56,7 @@ public: sal_uInt32 GetOrdNum() const { return nOrdNum; } }; -typedef SwPosFlyFrm* SwPosFlyFrmPtr; -SV_DECL_PTRARR_SORT_VISIBILITY( SwPosFlyFrms, SwPosFlyFrmPtr, 0, SW_DLLPUBLIC ) +class SW_DLLPUBLIC SwPosFlyFrms : public std::set<SwPosFlyFrm*> {}; #endif // _FLYPOS_HXX diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index e08fe3353324..dab617bb6369 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1044,8 +1044,8 @@ void SwDoc::GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts, if( pCmpRange && !TstFlyRange( pCmpRange, pAPos, rAnchor.GetAnchorId() )) continue; // not a valid FlyFrame - pFPos = new SwPosFlyFrm( pAPos->nNode, pFly, rPosFlyFmts.Count() ); - rPosFlyFmts.Insert( pFPos ); + pFPos = new SwPosFlyFrm( pAPos->nNode, pFly, rPosFlyFmts.size() ); + rPosFlyFmts.insert( pFPos ); } } } @@ -1093,12 +1093,12 @@ void SwDoc::GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts, if ( pCntntFrm ) { SwNodeIndex aIdx( *pCntntFrm->GetNode() ); - pFPos = new SwPosFlyFrm( aIdx, pFly, rPosFlyFmts.Count() ); + pFPos = new SwPosFlyFrm( aIdx, pFly, rPosFlyFmts.size() ); } } if ( pFPos ) { - rPosFlyFmts.Insert( pFPos ); + rPosFlyFmts.insert( pFPos ); pFPos = 0; } } diff --git a/sw/source/core/layout/flypos.cxx b/sw/source/core/layout/flypos.cxx index b77236c71159..62498df6705e 100644 --- a/sw/source/core/layout/flypos.cxx +++ b/sw/source/core/layout/flypos.cxx @@ -40,8 +40,6 @@ #include "ndindex.hxx" #include "switerator.hxx" -SV_IMPL_OP_PTRARR_SORT( SwPosFlyFrms, SwPosFlyFrmPtr ) - SwPosFlyFrm::SwPosFlyFrm( const SwNodeIndex& rIdx, const SwFrmFmt* pFmt, sal_uInt16 nArrPos ) : pFrmFmt( pFmt ), pNdIdx( (SwNodeIndex*) &rIdx ) diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 306117727d4f..4052050da576 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1891,9 +1891,9 @@ SwXParaFrameEnumeration::SwXParaFrameEnumeration( SwPosFlyFrms aFlyFrms; //get all frames that are bound at paragraph or at character rPaM.GetDoc()->GetAllFlyFmts(aFlyFrms, m_pImpl->GetCursor(), sal_False, sal_True); - for(sal_uInt16 i = 0; i < aFlyFrms.Count(); i++) + for(SwPosFlyFrms::iterator it = aFlyFrms.begin(); it != aFlyFrms.end(); ++it) { - SwPosFlyFrm* pPosFly = aFlyFrms[i]; + SwPosFlyFrm* pPosFly = *it; SwFrmFmt *const pFrmFmt = const_cast<SwFrmFmt*>(&pPosFly->GetFmt()); // create SwDepend for frame and insert into array diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx index 887ab2407ed6..9aabb328e8bd 100644 --- a/sw/source/filter/html/htmlfly.cxx +++ b/sw/source/filter/html/htmlfly.cxx @@ -312,13 +312,12 @@ void SwHTMLWriter::CollectFlyFrms() OSL_ENSURE( HTML_CFG_MAX+1 == MAX_BROWSERS, "number of browser configurations has changed" ); - sal_uInt8 nSz = (sal_uInt8)Min( pDoc->GetSpzFrmFmts()->Count(), sal_uInt16(255) ); - SwPosFlyFrms aFlyPos( nSz ); + SwPosFlyFrms aFlyPos; pDoc->GetAllFlyFmts( aFlyPos, bWriteAll ? 0 : pCurPam, sal_True ); - for( sal_uInt16 i=0; i< aFlyPos.Count(); i++ ) + for(SwPosFlyFrms::iterator it = aFlyPos.begin(); it != aFlyPos.end(); ++it) { - const SwFrmFmt& rFrmFmt = aFlyPos[i]->GetFmt(); + const SwFrmFmt& rFrmFmt = (*it)->GetFmt(); const SdrObject *pSdrObj = 0; const SwPosition *pAPos; const SwCntntNode *pACNd; @@ -369,7 +368,7 @@ void SwHTMLWriter::CollectFlyFrms() pHTMLPosFlyFrms = new SwHTMLPosFlyFrms; SwHTMLPosFlyFrm *pNew = - new SwHTMLPosFlyFrm( *aFlyPos[i], pSdrObj, nMode ); + new SwHTMLPosFlyFrm( **it, pSdrObj, nMode ); pHTMLPosFlyFrms->Insert( pNew ); } } diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index a997ee836329..7f1c13f1ad49 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -128,15 +128,14 @@ namespace sw::Frames SwPosFlyFrmsToFrames(const SwPosFlyFrms &rFlys) { sw::Frames aRet; - sal_uInt16 nEnd = rFlys.Count(); - for (sal_uInt16 nI = 0; nI < nEnd; ++nI) + for(SwPosFlyFrms::const_reverse_iterator it = rFlys.rbegin(); it != rFlys.rend(); ++it) { - const SwFrmFmt &rEntry = rFlys[nI]->GetFmt(); + const SwFrmFmt &rEntry = (*it)->GetFmt(); if (const SwPosition* pAnchor = rEntry.GetAnchor().GetCntntAnchor()) aRet.push_back(sw::Frame(rEntry, *pAnchor)); else { - SwPosition aPos(rFlys[nI]->GetNdIndex()); + SwPosition aPos((*it)->GetNdIndex()); if (SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode()) aPos.nContent.Assign(pTxtNd, 0); aRet.push_back(sw::Frame(rEntry, aPos)); @@ -499,8 +498,8 @@ namespace sw SwPosFlyFrms aFlys; rDoc.GetAllFlyFmts(aFlys, pPaM, true); sw::Frames aRet(SwPosFlyFrmsToFrames(aFlys)); - for (sal_uInt16 i = aFlys.Count(); i > 0;) - delete aFlys[--i]; + for(SwPosFlyFrms::const_reverse_iterator it = aFlys.rbegin(); it != aFlys.rend(); ++it) + delete *it; return aRet; } |