Kaydet (Commit) 7bef4fe2 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Convert SV_DECL_PTRARR_DEL( SwFmtCollConditions) to boost::ptr_vector

Change-Id: I45c66246de9d5608b630ceeb11535faf28f9c073
üst 22faf843
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
#ifndef _FMTCOL_HXX #ifndef _FMTCOL_HXX
#define _FMTCOL_HXX #define _FMTCOL_HXX
#include <svl/svarray.hxx>
#include "swdllapi.h" #include "swdllapi.h"
#include <format.hxx> #include <format.hxx>
#include <swtypes.hxx> // For MAXLEVEL. #include <swtypes.hxx> // For MAXLEVEL.
#include <boost/ptr_container/ptr_vector.hpp>
class SwDoc; // For friend. class SwDoc; // For friend.
...@@ -231,8 +231,7 @@ public: ...@@ -231,8 +231,7 @@ public:
void RegisterToFormat( SwFmt& ); void RegisterToFormat( SwFmt& );
}; };
typedef SwCollCondition* SwCollConditionPtr; class SwFmtCollConditions : public boost::ptr_vector<SwCollCondition> {};
SV_DECL_PTRARR_DEL( SwFmtCollConditions, SwCollConditionPtr, 0 )
class SW_DLLPUBLIC SwConditionTxtFmtColl : public SwTxtFmtColl class SW_DLLPUBLIC SwConditionTxtFmtColl : public SwTxtFmtColl
{ {
......
...@@ -48,8 +48,6 @@ TYPEINIT1( SwGrfFmtColl, SwFmtColl ); ...@@ -48,8 +48,6 @@ TYPEINIT1( SwGrfFmtColl, SwFmtColl );
TYPEINIT1( SwConditionTxtFmtColl, SwTxtFmtColl ); TYPEINIT1( SwConditionTxtFmtColl, SwTxtFmtColl );
TYPEINIT1( SwCollCondition, SwClient ); TYPEINIT1( SwCollCondition, SwClient );
SV_IMPL_PTRARR( SwFmtCollConditions, SwCollConditionPtr );
namespace TxtFmtCollFunc namespace TxtFmtCollFunc
{ {
...@@ -576,36 +574,36 @@ const SwCollCondition* SwConditionTxtFmtColl::HasCondition( ...@@ -576,36 +574,36 @@ const SwCollCondition* SwConditionTxtFmtColl::HasCondition(
const SwCollCondition* pFnd = 0; const SwCollCondition* pFnd = 0;
sal_uInt16 n; sal_uInt16 n;
for( n = 0; n < aCondColls.Count(); ++n ) for( n = 0; n < aCondColls.size(); ++n )
if( *( pFnd = aCondColls[ n ]) == rCond ) if( *( pFnd = &aCondColls[ n ]) == rCond )
break; break;
return n < aCondColls.Count() ? pFnd : 0; return n < aCondColls.size() ? pFnd : 0;
} }
void SwConditionTxtFmtColl::InsertCondition( const SwCollCondition& rCond ) void SwConditionTxtFmtColl::InsertCondition( const SwCollCondition& rCond )
{ {
for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n ) for( sal_uInt16 n = 0; n < aCondColls.size(); ++n )
if( *aCondColls[ n ] == rCond ) if( aCondColls[ n ] == rCond )
{ {
aCondColls.DeleteAndDestroy( n ); aCondColls.erase( aCondColls.begin() + n );
break; break;
} }
// Not found -> so insert it // Not found -> so insert it
SwCollCondition* pNew = new SwCollCondition( rCond ); SwCollCondition* pNew = new SwCollCondition( rCond );
aCondColls.Insert( pNew, aCondColls.Count() ); aCondColls.push_back( pNew );
} }
sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond ) sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond )
{ {
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n ) for( sal_uInt16 n = 0; n < aCondColls.size(); ++n )
if( *aCondColls[ n ] == rCond ) if( aCondColls[ n ] == rCond )
{ {
aCondColls.DeleteAndDestroy( n ); aCondColls.erase( aCondColls.begin() + n );
bRet = sal_True; bRet = sal_True;
} }
...@@ -615,12 +613,11 @@ sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond ) ...@@ -615,12 +613,11 @@ sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond )
void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls ) void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls )
{ {
// Copy the Conditions, but first delete the old ones // Copy the Conditions, but first delete the old ones
if( aCondColls.Count() ) aCondColls.clear();
aCondColls.DeleteAndDestroy( 0, aCondColls.Count() );
SwDoc& rDoc = *GetDoc(); 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() SwTxtFmtColl* pTmpColl = pFnd->GetTxtFmtColl()
? rDoc.CopyTxtColl( *pFnd->GetTxtFmtColl() ) ? rDoc.CopyTxtColl( *pFnd->GetTxtFmtColl() )
: 0; : 0;
...@@ -631,7 +628,7 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls ) ...@@ -631,7 +628,7 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls )
else else
pNew = new SwCollCondition( pTmpColl, pFnd->GetCondition(), pNew = new SwCollCondition( pTmpColl, pFnd->GetCondition(),
pFnd->GetSubCondition() ); pFnd->GetSubCondition() );
aCondColls.Insert( pNew, n ); aCondColls.push_back( pNew );
} }
} }
//#outline level, zhaojianwei //#outline level, zhaojianwei
......
...@@ -1055,9 +1055,9 @@ void SwXMLImport::UpdateTxtCollConditions( SwDoc *pDoc ) ...@@ -1055,9 +1055,9 @@ void SwXMLImport::UpdateTxtCollConditions( SwDoc *pDoc )
const SwFmtCollConditions& rConditions = const SwFmtCollConditions& rConditions =
((const SwConditionTxtFmtColl *)pColl)->GetCondColls(); ((const SwConditionTxtFmtColl *)pColl)->GetCondColls();
sal_Bool bSendModify = sal_False; 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() ) switch( rCond.GetCondition() )
{ {
case PARA_IN_TABLEHEAD: case PARA_IN_TABLEHEAD:
......
...@@ -115,9 +115,9 @@ void SwXMLTextParagraphExport::exportStyleContent( ...@@ -115,9 +115,9 @@ void SwXMLTextParagraphExport::exportStyleContent(
{ {
const SwFmtCollConditions& rConditions = const SwFmtCollConditions& rConditions =
((const SwConditionTxtFmtColl *)pColl)->GetCondColls(); ((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; enum XMLTokenEnum eFunc = XML_TOKEN_INVALID;
OUStringBuffer sBuffer( 20 ); OUStringBuffer sBuffer( 20 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment