diff options
-rw-r--r-- | sw/inc/fmtcol.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/fmtcol.cxx | 31 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlfmt.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexte.cxx | 4 |
4 files changed, 20 insertions, 24 deletions
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index 80bfbf87235e..c54480e5d713 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -28,10 +28,10 @@ #ifndef _FMTCOL_HXX #define _FMTCOL_HXX -#include <svl/svarray.hxx> #include "swdllapi.h" #include <format.hxx> #include <swtypes.hxx> // For MAXLEVEL. +#include <boost/ptr_container/ptr_vector.hpp> class SwDoc; // For friend. @@ -231,8 +231,7 @@ public: void RegisterToFormat( SwFmt& ); }; -typedef SwCollCondition* SwCollConditionPtr; -SV_DECL_PTRARR_DEL( SwFmtCollConditions, SwCollConditionPtr, 0 ) +class SwFmtCollConditions : public boost::ptr_vector<SwCollCondition> {}; class SW_DLLPUBLIC SwConditionTxtFmtColl : public SwTxtFmtColl { diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 3263a5815012..0e65267f7e15 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -48,8 +48,6 @@ TYPEINIT1( SwGrfFmtColl, SwFmtColl ); TYPEINIT1( SwConditionTxtFmtColl, SwTxtFmtColl ); TYPEINIT1( SwCollCondition, SwClient ); -SV_IMPL_PTRARR( SwFmtCollConditions, SwCollConditionPtr ); - namespace TxtFmtCollFunc { @@ -576,36 +574,36 @@ const SwCollCondition* SwConditionTxtFmtColl::HasCondition( const SwCollCondition* pFnd = 0; sal_uInt16 n; - for( n = 0; n < aCondColls.Count(); ++n ) - if( *( pFnd = aCondColls[ n ]) == rCond ) + for( n = 0; n < aCondColls.size(); ++n ) + if( *( pFnd = &aCondColls[ n ]) == rCond ) break; - return n < aCondColls.Count() ? pFnd : 0; + return n < aCondColls.size() ? pFnd : 0; } void SwConditionTxtFmtColl::InsertCondition( const SwCollCondition& rCond ) { - for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n ) - if( *aCondColls[ n ] == rCond ) + for( sal_uInt16 n = 0; n < aCondColls.size(); ++n ) + if( aCondColls[ n ] == rCond ) { - aCondColls.DeleteAndDestroy( n ); + aCondColls.erase( aCondColls.begin() + n ); break; } // Not found -> so insert it SwCollCondition* pNew = new SwCollCondition( rCond ); - aCondColls.Insert( pNew, aCondColls.Count() ); + aCondColls.push_back( pNew ); } sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond ) { sal_Bool bRet = sal_False; - for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n ) - if( *aCondColls[ n ] == rCond ) + for( sal_uInt16 n = 0; n < aCondColls.size(); ++n ) + if( aCondColls[ n ] == rCond ) { - aCondColls.DeleteAndDestroy( n ); + aCondColls.erase( aCondColls.begin() + n ); bRet = sal_True; } @@ -615,12 +613,11 @@ sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond ) void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls ) { // Copy the Conditions, but first delete the old ones - if( aCondColls.Count() ) - aCondColls.DeleteAndDestroy( 0, aCondColls.Count() ); + aCondColls.clear(); SwDoc& rDoc = *GetDoc(); - for( sal_uInt16 n = 0; n < rCndClls.Count(); ++n ) + for( sal_uInt16 n = 0; n < rCndClls.size(); ++n ) { - SwCollCondition* pFnd = rCndClls[ n ]; + const SwCollCondition* pFnd = &rCndClls[ n ]; SwTxtFmtColl* pTmpColl = pFnd->GetTxtFmtColl() ? rDoc.CopyTxtColl( *pFnd->GetTxtFmtColl() ) : 0; @@ -631,7 +628,7 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls ) else pNew = new SwCollCondition( pTmpColl, pFnd->GetCondition(), pFnd->GetSubCondition() ); - aCondColls.Insert( pNew, n ); + aCondColls.push_back( pNew ); } } //#outline level, zhaojianwei diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 1993146b7ae2..30a44ebe157b 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -1055,9 +1055,9 @@ void SwXMLImport::UpdateTxtCollConditions( SwDoc *pDoc ) const SwFmtCollConditions& rConditions = ((const SwConditionTxtFmtColl *)pColl)->GetCondColls(); sal_Bool bSendModify = sal_False; - for( sal_uInt16 j=0; j < rConditions.Count() && !bSendModify; j++ ) + for( sal_uInt16 j=0; j < rConditions.size() && !bSendModify; j++ ) { - const SwCollCondition& rCond = *rConditions[j]; + const SwCollCondition& rCond = rConditions[j]; switch( rCond.GetCondition() ) { case PARA_IN_TABLEHEAD: diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index 5c8994411c8f..5098c0b2f919 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -115,9 +115,9 @@ void SwXMLTextParagraphExport::exportStyleContent( { const SwFmtCollConditions& rConditions = ((const SwConditionTxtFmtColl *)pColl)->GetCondColls(); - for( sal_uInt16 i=0; i < rConditions.Count(); i++ ) + for( sal_uInt16 i=0; i < rConditions.size(); i++ ) { - const SwCollCondition& rCond = *rConditions[i]; + const SwCollCondition& rCond = rConditions[i]; enum XMLTokenEnum eFunc = XML_TOKEN_INVALID; OUStringBuffer sBuffer( 20 ); |