diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-21 17:01:56 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-25 00:17:06 +0200 |
commit | 74dc44a67c556462185f969f694ef2d3df1f893e (patch) | |
tree | f95f387ca4931678f92a526b9d4bb51e00a87742 | |
parent | 426389981c6eb4231c8889c65e848b615b290b3a (diff) |
Convert SV_DECL_PTRARR_DEL(SwFldTypes) to std::vector
Change-Id: Ia1f52f25680d3f970aa4f7f60a8e5203326a6796
-rw-r--r-- | sw/inc/docary.hxx | 9 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/docfld.cxx | 109 | ||||
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/edit/edfld.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/edit/edfldexp.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/fields/fldlst.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 8 |
11 files changed, 95 insertions, 80 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index 9de2213e9148..2a8642229da0 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -50,8 +50,6 @@ namespace com { namespace sun { namespace star { namespace i18n { #include <swtypes.hxx> #include <svl/svarray.hxx> -typedef SwFieldType* SwFldTypePtr; - // PageDescriptor-interface // typedef SwPageDesc * SwPageDescPtr; // SV_DECL_PTRARR_DEL(SwPageDescs, SwPageDescPtr,1); @@ -65,7 +63,12 @@ SV_DECL_PTRARR_DEL(SwSpzFrmFmts,SwFrmFmtPtr,0) typedef SwCharFmt* SwCharFmtPtr; SV_DECL_PTRARR_DEL(SwCharFmts,SwCharFmtPtr,4) -SV_DECL_PTRARR_DEL( SwFldTypes, SwFldTypePtr, INIT_FLDTYPES ) +class SwFldTypes : public std::vector<SwFieldType*> { +public: + // the destructor will free all objects still in the vector + ~SwFldTypes(); + sal_uInt16 GetPos(const SwFieldType* pFieldType) const; +}; class SwTOXTypes : public std::vector<SwTOXType*> { public: diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 12e8e5ff48ed..80a2ba58692e 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -664,7 +664,7 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, { // es gibt noch versteckte InputFelder in den SetExp. Feldern const SwFldTypes& rFldTypes = *pDoc->GetFldTypes(); - const sal_uInt16 nSize = rFldTypes.Count(); + const sal_uInt16 nSize = rFldTypes.size(); // Alle Typen abklappern for( sal_uInt16 i=0; i < nSize; ++i ) @@ -676,7 +676,7 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext, else { const SwFldTypes& rFldTypes = *pDoc->GetFldTypes(); - const sal_uInt16 nSize = rFldTypes.Count(); + const sal_uInt16 nSize = rFldTypes.size(); // Alle Typen abklappern for( sal_uInt16 i=0; i < nSize; ++i ) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index de9efafd12fa..f9b829fe1766 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -144,8 +144,6 @@ using ::rtl::OUString; // Page descriptors SV_IMPL_PTRARR(SwPageDescs,SwPageDescPtr); -// Field types -SV_IMPL_PTRARR( SwFldTypes, SwFldTypePtr) /* IInterface */ sal_Int32 SwDoc::acquire() @@ -2380,11 +2378,11 @@ sal_Bool SwDoc::ConvertFieldsToText() GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE, NULL ); const SwFldTypes* pMyFldTypes = GetFldTypes(); - sal_uInt16 nCount = pMyFldTypes->Count(); + sal_uInt16 nCount = pMyFldTypes->size(); //go backward, field types are removed for(sal_uInt16 nType = nCount; nType > 0; --nType) { - const SwFieldType *pCurType = pMyFldTypes->GetObject(nType - 1); + const SwFieldType *pCurType = (*pMyFldTypes)[nType - 1]; if ( RES_POSTITFLD == pCurType->Which() ) continue; diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 9290e02d9c64..78f7e87f3165 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -84,7 +84,7 @@ SV_IMPL_OP_PTRARR_SORT( _SetGetExpFlds, _SetGetExpFldPtr ) */ SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp) { - sal_uInt16 nSize = pFldTypes->Count(), + sal_uInt16 nSize = pFldTypes->size(), nFldWhich = rFldTyp.Which(); sal_uInt16 i = INIT_FLDTYPES; @@ -149,7 +149,7 @@ SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp) break; } - pFldTypes->Insert( pNew, nSize ); + pFldTypes->insert( pFldTypes->begin() + nSize, pNew ); SetModified(); return (*pFldTypes)[ nSize ]; @@ -162,7 +162,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) // - If it's not present, it can be re-inserted. // - If the same type is found, the deleted one has to be renamed. - sal_uInt16 nSize = pFldTypes->Count(), nFldWhich = rFldTyp.Which(); + sal_uInt16 nSize = pFldTypes->size(), nFldWhich = rFldTyp.Which(); sal_uInt16 i = INIT_FLDTYPES; OSL_ENSURE( RES_SETEXPFLD == nFldWhich || @@ -198,7 +198,7 @@ void SwDoc::InsDeletedFldType( SwFieldType& rFldTyp ) } // not found, so insert and delete flag - pFldTypes->Insert( &rFldTyp, nSize ); + pFldTypes->insert( pFldTypes->begin() + nSize, &rFldTyp ); switch( nFldWhich ) { case RES_SETEXPFLD: @@ -222,7 +222,7 @@ void SwDoc::RemoveFldType(sal_uInt16 nFld) /* * Dependent fields present -> ErrRaise */ - sal_uInt16 nSize = pFldTypes->Count(); + sal_uInt16 nSize = pFldTypes->size(); if(nFld < nSize) { SwFieldType* pTmp = (*pFldTypes)[nFld]; @@ -255,7 +255,7 @@ void SwDoc::RemoveFldType(sal_uInt16 nFld) // delete field type delete pTmp; } - pFldTypes->Remove( nFld ); + pFldTypes->erase( pFldTypes->begin() + nFld ); SetModified(); } } @@ -274,7 +274,7 @@ SwFieldType* SwDoc::GetFldType( sal_uInt16 nResId, const String& rName, // #i51815# ) const { - sal_uInt16 nSize = pFldTypes->Count(), i = 0; + sal_uInt16 nSize = pFldTypes->size(), i = 0; const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); switch( nResId ) @@ -326,7 +326,7 @@ void SwDoc::UpdateFlds( SfxPoolItem *pNewHt, bool bCloseDB ) // Call Modify() for every field type, // dependent SwTxtFld get notified ... - for( sal_uInt16 i=0; i < pFldTypes->Count(); ++i) + for( sal_uInt16 i=0; i < pFldTypes->size(); ++i) { switch( (*pFldTypes)[i]->Which() ) { @@ -385,7 +385,7 @@ void SwDoc::UpdateUsrFlds() { SwCalc* pCalc = 0; const SwFieldType* pFldType; - for( sal_uInt16 i = INIT_FLDTYPES; i < pFldTypes->Count(); ++i ) + for( sal_uInt16 i = INIT_FLDTYPES; i < pFldTypes->size(); ++i ) if( RES_USERFLD == ( pFldType = (*pFldTypes)[i] )->Which() ) { if( !pCalc ) @@ -406,7 +406,7 @@ void SwDoc::UpdateUsrFlds() void SwDoc::UpdateRefFlds( SfxPoolItem* pHt ) { SwFieldType* pFldType; - for( sal_uInt16 i = 0; i < pFldTypes->Count(); ++i ) + for( sal_uInt16 i = 0; i < pFldTypes->size(); ++i ) if( RES_GETREFFLD == ( pFldType = (*pFldTypes)[i] )->Which() ) pFldType->ModifyNotification( 0, pHt ); } @@ -415,7 +415,7 @@ void SwDoc::UpdateRefFlds( SfxPoolItem* pHt ) //optimization currently only available when no fields exist. bool SwDoc::containsUpdatableFields() { - for (sal_uInt16 i = 0; i < pFldTypes->Count(); ++i) + for (sal_uInt16 i = 0; i < pFldTypes->size(); ++i) { SwFieldType* pFldType = (*pFldTypes)[i]; SwIterator<SwFmtFld,SwFieldType> aIter(*pFldType); @@ -432,7 +432,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) SwFieldType* pFldType(0); - for (sal_uInt16 i = 0; i < pFldTypes->Count(); ++i) + for (sal_uInt16 i = 0; i < pFldTypes->size(); ++i) { if( RES_TABLEFLD == ( pFldType = (*pFldTypes)[i] )->Which() ) { @@ -702,7 +702,7 @@ void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt ) // ---- Remove all unreferenced field types of a document -- void SwDoc::GCFieldTypes() { - for( sal_uInt16 n = pFldTypes->Count(); n > INIT_FLDTYPES; ) + for( sal_uInt16 n = pFldTypes->size(); n > INIT_FLDTYPES; ) if( !(*pFldTypes)[ --n ]->GetDepends() ) RemoveFldType( n ); } @@ -1255,14 +1255,14 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) // Hash table for all string replacements is filled on-the-fly. // Try to fabricate an uneven number. - sal_uInt16 nStrFmtCnt = (( pFldTypes->Count() / 7 ) + 1 ) * 7; + sal_uInt16 nStrFmtCnt = (( pFldTypes->size() / 7 ) + 1 ) * 7; SwHash** pHashStrTbl = new SwHash*[ nStrFmtCnt ]; memset( pHashStrTbl, 0, sizeof( _HashStr* ) * nStrFmtCnt ); { const SwFieldType* pFldType; // process seperately: - for( n = pFldTypes->Count(); n; ) + for( n = pFldTypes->size(); n; ) switch( ( pFldType = (*pFldTypes)[ --n ] )->Which() ) { case RES_USERFLD: @@ -1561,50 +1561,49 @@ void SwDoc::UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc ) void SwDoc::_InitFieldTypes() // is being called by the CTOR { // Field types - sal_uInt16 nFldType = 0; - pFldTypes->Insert( new SwDateTimeFieldType(this), nFldType++ ); - pFldTypes->Insert( new SwChapterFieldType, nFldType++ ); - pFldTypes->Insert( new SwPageNumberFieldType, nFldType++ ); - pFldTypes->Insert( new SwAuthorFieldType, nFldType++ ); - pFldTypes->Insert( new SwFileNameFieldType(this), nFldType++ ); - pFldTypes->Insert( new SwDBNameFieldType(this), nFldType++); - pFldTypes->Insert( new SwGetExpFieldType(this), nFldType++ ); - pFldTypes->Insert( new SwGetRefFieldType( this ), nFldType++ ); - pFldTypes->Insert( new SwHiddenTxtFieldType, nFldType++ ); - pFldTypes->Insert( new SwPostItFieldType(this), nFldType++ ); - pFldTypes->Insert( new SwDocStatFieldType(this), nFldType++); - pFldTypes->Insert( new SwDocInfoFieldType(this), nFldType++); - pFldTypes->Insert( new SwInputFieldType( this ), nFldType++ ); - pFldTypes->Insert( new SwTblFieldType( this ), nFldType++); - pFldTypes->Insert( new SwMacroFieldType(this), nFldType++ ); - pFldTypes->Insert( new SwHiddenParaFieldType, nFldType++ ); - pFldTypes->Insert( new SwDBNextSetFieldType, nFldType++ ); - pFldTypes->Insert( new SwDBNumSetFieldType, nFldType++ ); - pFldTypes->Insert( new SwDBSetNumberFieldType, nFldType++ ); - pFldTypes->Insert( new SwTemplNameFieldType(this), nFldType++); - pFldTypes->Insert( new SwTemplNameFieldType(this),nFldType++); - pFldTypes->Insert( new SwExtUserFieldType, nFldType++ ); - pFldTypes->Insert( new SwRefPageSetFieldType, nFldType++ ); - pFldTypes->Insert( new SwRefPageGetFieldType( this ), nFldType++ ); - pFldTypes->Insert( new SwJumpEditFieldType( this ), nFldType++ ); - pFldTypes->Insert( new SwScriptFieldType( this ), nFldType++ ); - pFldTypes->Insert( new SwCombinedCharFieldType, nFldType++ ); - pFldTypes->Insert( new SwDropDownFieldType, nFldType++ ); + pFldTypes->push_back( new SwDateTimeFieldType(this) ); + pFldTypes->push_back( new SwChapterFieldType ); + pFldTypes->push_back( new SwPageNumberFieldType ); + pFldTypes->push_back( new SwAuthorFieldType ); + pFldTypes->push_back( new SwFileNameFieldType(this) ); + pFldTypes->push_back( new SwDBNameFieldType(this) ); + pFldTypes->push_back( new SwGetExpFieldType(this) ); + pFldTypes->push_back( new SwGetRefFieldType( this ) ); + pFldTypes->push_back( new SwHiddenTxtFieldType ); + pFldTypes->push_back( new SwPostItFieldType(this) ); + pFldTypes->push_back( new SwDocStatFieldType(this) ); + pFldTypes->push_back( new SwDocInfoFieldType(this) ); + pFldTypes->push_back( new SwInputFieldType( this ) ); + pFldTypes->push_back( new SwTblFieldType( this ) ); + pFldTypes->push_back( new SwMacroFieldType(this) ); + pFldTypes->push_back( new SwHiddenParaFieldType ); + pFldTypes->push_back( new SwDBNextSetFieldType ); + pFldTypes->push_back( new SwDBNumSetFieldType ); + pFldTypes->push_back( new SwDBSetNumberFieldType ); + pFldTypes->push_back( new SwTemplNameFieldType(this) ); + pFldTypes->push_back( new SwTemplNameFieldType(this) ); + pFldTypes->push_back( new SwExtUserFieldType ); + pFldTypes->push_back( new SwRefPageSetFieldType ); + pFldTypes->push_back( new SwRefPageGetFieldType( this ) ); + pFldTypes->push_back( new SwJumpEditFieldType( this ) ); + pFldTypes->push_back( new SwScriptFieldType( this ) ); + pFldTypes->push_back( new SwCombinedCharFieldType ); + pFldTypes->push_back( new SwDropDownFieldType ); // Types have to be at the end! // We expect this in the InsertFldType! // MIB 14.04.95: In Sw3StringPool::Setup (sw3imp.cxx) and // lcl_sw3io_InSetExpField (sw3field.cxx) now also - pFldTypes->Insert( new SwSetExpFieldType(this, - SW_RESSTR(STR_POOLCOLL_LABEL_ABB), nsSwGetSetExpType::GSE_SEQ), nFldType++); - pFldTypes->Insert( new SwSetExpFieldType(this, - SW_RESSTR(STR_POOLCOLL_LABEL_TABLE), nsSwGetSetExpType::GSE_SEQ),nFldType++); - pFldTypes->Insert( new SwSetExpFieldType(this, - SW_RESSTR(STR_POOLCOLL_LABEL_FRAME), nsSwGetSetExpType::GSE_SEQ),nFldType++); - pFldTypes->Insert( new SwSetExpFieldType(this, - SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING), nsSwGetSetExpType::GSE_SEQ),nFldType++); + pFldTypes->push_back( new SwSetExpFieldType(this, + SW_RESSTR(STR_POOLCOLL_LABEL_ABB), nsSwGetSetExpType::GSE_SEQ) ); + pFldTypes->push_back( new SwSetExpFieldType(this, + SW_RESSTR(STR_POOLCOLL_LABEL_TABLE), nsSwGetSetExpType::GSE_SEQ) ); + pFldTypes->push_back( new SwSetExpFieldType(this, + SW_RESSTR(STR_POOLCOLL_LABEL_FRAME), nsSwGetSetExpType::GSE_SEQ) ); + pFldTypes->push_back( new SwSetExpFieldType(this, + SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING), nsSwGetSetExpType::GSE_SEQ) ); - OSL_ENSURE( nFldType == INIT_FLDTYPES, "Bad initsize: SwFldTypes" ); + OSL_ENSURE( pFldTypes->size() == INIT_FLDTYPES, "Bad initsize: SwFldTypes" ); } void SwDoc::InsDelFldInFldLst( bool bIns, const SwTxtFld& rFld ) @@ -1622,7 +1621,7 @@ const SwDBData& SwDoc::GetDBDesc() { if(aDBData.sDataSource.isEmpty()) { - const sal_uInt16 nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->size(); for(sal_uInt16 i = 0; i < nSize && aDBData.sDataSource.isEmpty(); ++i) { SwFieldType& rFldType = *((*pFldTypes)[i]); @@ -2143,7 +2142,7 @@ bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLong nLen ) void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData ) { - const sal_uInt16 nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->size(); for( sal_uInt16 i = INIT_FLDTYPES; i < nSize; ++i ) { diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index dab617bb6369..1b040159eaa0 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1167,7 +1167,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, sal_Bool bTable = sal_False; // To save some code. // Get the field first, beause we retrieve the TxtColl via the field's name - OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->Count(), + OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->size(), "FldType index out of bounds." ); SwFieldType *pType = (nId != USHRT_MAX) ? (*rDoc.GetFldTypes())[nId] : NULL; OSL_ENSURE(!pType || pType->Which() == RES_SETEXPFLD, "wrong Id for Label"); @@ -1523,7 +1523,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, ::sw::DrawUndoGuard const drawUndoGuard(rDoc.GetIDocumentUndoRedo()); // Because we get by the TxtColl's name, we need to create the field first. - OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->Count(), + OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->size(), "FldType index out of bounds" ); SwFieldType *pType = nId != USHRT_MAX ? (*rDoc.GetFldTypes())[nId] : 0; OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" ); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 4145b397d65f..52e27b845bae 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -847,8 +847,10 @@ void SwDoc::ClearDoc() xForbiddenCharsTable.clear(); - pFldTypes->DeleteAndDestroy( INIT_FLDTYPES, - pFldTypes->Count() - INIT_FLDTYPES ); + for(SwFldTypes::const_iterator it = pFldTypes->begin() + INIT_FLDTYPES; + it != pFldTypes->end(); ++it) + delete *it; + pFldTypes->erase( pFldTypes->begin() + INIT_FLDTYPES, pFldTypes->end() ); delete pNumberFormatter, pNumberFormatter = 0; diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 49967fbb596c..5ed417e77695 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -55,7 +55,7 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) const { const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); - const sal_uInt16 nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->size(); if(nResId == USHRT_MAX) { @@ -91,7 +91,7 @@ sal_uInt16 SwEditShell::GetFldTypeCount(sal_uInt16 nResId, sal_Bool bUsed ) cons SwFieldType* SwEditShell::GetFldType(sal_uInt16 nFld, sal_uInt16 nResId, sal_Bool bUsed ) const { const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); - const sal_uInt16 nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->size(); if(nResId == USHRT_MAX && nFld < nSize) { @@ -150,7 +150,7 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId) } const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); - const sal_uInt16 nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->size(); sal_uInt16 nIdx = 0; for( sal_uInt16 i = 0; i < nSize; ++i ) // Gleiche ResId -> Index erhoehen @@ -168,7 +168,7 @@ void SwEditShell::RemoveFldType(sal_uInt16 nFld, sal_uInt16 nResId) void SwEditShell::RemoveFldType(sal_uInt16 nResId, const String& rStr) { const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); - const sal_uInt16 nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->size(); const CharClass& rCC = GetAppCharClass(); String aTmp( rCC.lowercase( rStr )); @@ -509,7 +509,7 @@ void SwEditShell::ChangeAuthorityData(const SwAuthEntry* pNewData) sal_Bool SwEditShell::IsAnyDatabaseFieldInDoc()const { const SwFldTypes * pFldTypes = GetDoc()->GetFldTypes(); - const sal_uInt16 nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->size(); for(sal_uInt16 i = 0; i < nSize; ++i) { SwFieldType& rFldType = *((*pFldTypes)[i]); diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx index 9b4578c64649..357777674e17 100644 --- a/sw/source/core/edit/edfldexp.cxx +++ b/sw/source/core/edit/edfldexp.cxx @@ -47,7 +47,7 @@ using ::rtl::OUString; sal_Bool SwEditShell::IsFieldDataSourceAvailable(String& rUsedDataSource) const { const SwFldTypes * pFldTypes = GetDoc()->GetFldTypes(); - const sal_uInt16 nSize = pFldTypes->Count(); + const sal_uInt16 nSize = pFldTypes->size(); uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); if( !xMgr.is() ) return sal_False; diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index e85fca13732f..3ca892eb4ce9 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -49,6 +49,7 @@ #include <shellres.hxx> #include <calc.hxx> #include <comcore.hrc> +#include <docary.hxx> #include <math.h> @@ -763,4 +764,16 @@ String SwField::GetDescription() const return SW_RES(STR_FIELD); } +sal_uInt16 SwFldTypes::GetPos(const SwFieldType* pFieldType) const +{ + const_iterator it = std::find(begin(), end(), pFieldType); + return it == end() ? USHRT_MAX : it - begin(); +} + +SwFldTypes::~SwFldTypes() +{ + for(const_iterator it = begin(); it != end(); ++it) + delete *it; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx index cb0b774284a6..cf90dc51e628 100644 --- a/sw/source/core/fields/fldlst.cxx +++ b/sw/source/core/fields/fldlst.cxx @@ -51,7 +51,7 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, sal_Bool bBuildTmpLst ) pSrtLst = new _SetGetExpFlds(); const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes(); - const sal_uInt16 nSize = rFldTypes.Count(); + const sal_uInt16 nSize = rFldTypes.size(); // Alle Typen abklappern @@ -147,7 +147,7 @@ void SwInputFieldList::GotoFieldPos(sal_uInt16 nId) sal_uInt16 SwInputFieldList::BuildSortLst() { const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes(); - sal_uInt16 nSize = rFldTypes.Count(); + sal_uInt16 nSize = rFldTypes.size(); // Alle Typen abklappern diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 168eb28ec4fe..07df5b106f9a 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -911,7 +911,7 @@ void SwXFieldMaster::dispose(void) throw( uno::RuntimeException ) { sal_uInt16 nTypeIdx = USHRT_MAX; const SwFldTypes* pTypes = GetDoc()->GetFldTypes(); - for( sal_uInt16 i = 0; i < pTypes->Count(); i++ ) + for( sal_uInt16 i = 0; i < pTypes->size(); i++ ) { if((*pTypes)[i] == pFldType) nTypeIdx = i; @@ -2534,7 +2534,7 @@ uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void) throw uno::RuntimeException(); const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes(); - sal_uInt16 nCount = pFldTypes->Count(); + sal_uInt16 nCount = pFldTypes->size(); std::vector<String*> aFldNames; String* pString = new String(); @@ -2714,10 +2714,10 @@ SwXFieldEnumeration::SwXFieldEnumeration(SwDoc* pDc) : sal_Int32 nFillPos = 0; // const SwFldTypes* pFldTypes = pDoc->GetFldTypes(); - sal_uInt16 nCount = pFldTypes->Count(); + sal_uInt16 nCount = pFldTypes->size(); for(sal_uInt16 nType = 0; nType < nCount; ++nType) { - const SwFieldType *pCurType = pFldTypes->GetObject(nType); + const SwFieldType *pCurType = (*pFldTypes)[nType]; SwIterator<SwFmtFld,SwFieldType> aIter( *pCurType ); const SwFmtFld* pCurFldFmt = aIter.First(); while (pCurFldFmt) |