diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2011-03-04 07:38:16 -0800 |
---|---|---|
committer | Joseph Powers <jpowers27@cox.net> | 2011-03-04 07:38:16 -0800 |
commit | 2e3c45afc6c5ea74f1f8b4a7dce806e537870546 (patch) | |
tree | 38d95145a28d1f2b52c0b4bab69f66c434506166 /sd | |
parent | ff6ee6fb6d51fcb72d9666eaedd2de8f563acd2e (diff) |
Remove usage of deprecated List container.
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/sdpage2.cxx | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index 7e10fc395919..3ed970ac9ada 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -28,6 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" + +#include <vector> +#include <boost/ptr_container/ptr_vector.hpp> + #include <sfx2/docfile.hxx> #include <vcl/svapp.hxx> #include <editeng/outliner.hxx> @@ -146,10 +150,10 @@ void SdPage::SetPresentationLayout(const String& rLayoutName, // Listen mit: // - Vorlagenzeigern fuer Gliederungstextobjekt (alte und neue Vorlagen) // -Replacedaten fuer OutlinerParaObject - List aOutlineStyles; - List aOldOutlineStyles; - List aReplList; - BOOL bListsFilled = FALSE; + std::vector<SfxStyleSheetBase*> aOutlineStyles; + std::vector<SfxStyleSheetBase*> aOldOutlineStyles; + boost::ptr_vector<StyleReplaceData> aReplList; + bool bListsFilled = false; ULONG nObjCount = GetObjCount(); @@ -178,11 +182,11 @@ void SdPage::SetPresentationLayout(const String& rLayoutName, pSheet = pStShPool->Find(aOldFullName, SD_STYLE_FAMILY_MASTERPAGE); DBG_ASSERT(pSheet, "alte Gliederungsvorlage nicht gefunden"); - aOldOutlineStyles.Insert(pSheet, LIST_APPEND); + aOldOutlineStyles.push_back(pSheet); pSheet = pStShPool->Find(aFullName, SD_STYLE_FAMILY_MASTERPAGE); DBG_ASSERT(pSheet, "neue Gliederungsvorlage nicht gefunden"); - aOutlineStyles.Insert(pSheet, LIST_APPEND); + aOutlineStyles.push_back(pSheet); if (bReplaceStyleSheets && pSheet) { @@ -192,7 +196,7 @@ void SdPage::SetPresentationLayout(const String& rLayoutName, pReplData->nFamily = pSheet->GetFamily(); pReplData->aNewName = aFullName; pReplData->aName = aOldFullName; - aReplList.Insert(pReplData, LIST_APPEND); + aReplList.push_back(pReplData); } else { @@ -203,13 +207,20 @@ void SdPage::SetPresentationLayout(const String& rLayoutName, } } - bListsFilled = TRUE; + bListsFilled = true; } - SfxStyleSheet* pSheet = (SfxStyleSheet*)aOutlineStyles.First(); - SfxStyleSheet* pOldSheet = (SfxStyleSheet*)aOldOutlineStyles.First(); - while (pSheet) + SfxStyleSheet* pSheet = NULL; + SfxStyleSheet* pOldSheet = NULL; + + std::vector<SfxStyleSheetBase*>::iterator iterOut = aOutlineStyles.begin(); + std::vector<SfxStyleSheetBase*>::iterator iterOldOut = aOldOutlineStyles.begin(); + + while (iterOut != aOutlineStyles.end()) { + pSheet = reinterpret_cast<SfxStyleSheet*>(*iterOut); + pOldSheet = reinterpret_cast<SfxStyleSheet*>(*iterOldOut); + if (pSheet != pOldSheet) { pObj->EndListening(*pOldSheet); @@ -218,19 +229,18 @@ void SdPage::SetPresentationLayout(const String& rLayoutName, pObj->StartListening(*pSheet); } - pSheet = (SfxStyleSheet*)aOutlineStyles.Next(); - pOldSheet = (SfxStyleSheet*)aOldOutlineStyles.Next(); + ++iterOut; + ++iterOldOut; } OutlinerParaObject* pOPO = ((SdrTextObj*)pObj)->GetOutlinerParaObject(); if ( bReplaceStyleSheets && pOPO ) { - StyleReplaceData* pReplData = (StyleReplaceData*) aReplList.First(); - - while( pReplData ) + boost::ptr_vector<StyleReplaceData>::const_iterator it = aReplList.begin(); + while (it != aReplList.end()) { - pOPO->ChangeStyleSheets( pReplData->aName, pReplData->nFamily, pReplData->aNewName, pReplData->nNewFamily ); - pReplData = (StyleReplaceData*) aReplList.Next(); + pOPO->ChangeStyleSheets( it->aName, it->nFamily, it->aNewName, it->nNewFamily ); + ++it; } } } @@ -253,11 +263,6 @@ void SdPage::SetPresentationLayout(const String& rLayoutName, pObj->SetStyleSheet(pSheet, TRUE); } } - - for (ULONG i = 0; i < aReplList.Count(); i++) - { - delete (StyleReplaceData*) aReplList.GetObject(i); - } } |