From f2e17f8f6b6724d7e56d6583d79434372f6221bd Mon Sep 17 00:00:00 2001 From: Ivan Timofeev Date: Tue, 31 Jan 2012 21:38:43 +0400 Subject: erase garbage after std::remove this fixes commit 5a71069339b3a3c118f3015d978799ef66db7564 --- sd/inc/cusshow.hxx | 1 + sd/source/core/cusshow.cxx | 7 ++++++- sd/source/core/drawdoc_animations.cxx | 6 +----- sd/source/ui/unoidl/unocpres.cxx | 10 ++++++++-- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'sd') diff --git a/sd/inc/cusshow.hxx b/sd/inc/cusshow.hxx index 1bd361452b6d..74c6cfab1b6c 100644 --- a/sd/inc/cusshow.hxx +++ b/sd/inc/cusshow.hxx @@ -71,6 +71,7 @@ public: PageVec& PagesVector(); void ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage ); + void RemovePage( const SdPage* pPage ); void SetName(const String& rName); String GetName() const; diff --git a/sd/source/core/cusshow.cxx b/sd/source/core/cusshow.cxx index dcdb343469b8..d3233b76ef8c 100644 --- a/sd/source/core/cusshow.cxx +++ b/sd/source/core/cusshow.cxx @@ -106,7 +106,7 @@ void SdCustomShow::ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage ) { if( !pNewPage ) { - ::std::remove(maPages.begin(), maPages.end(), pOldPage); + RemovePage(pOldPage); } else { @@ -114,6 +114,11 @@ void SdCustomShow::ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage ) } } +void SdCustomShow::RemovePage( const SdPage* pPage ) +{ + maPages.erase(::std::remove(maPages.begin(), maPages.end(), pPage), maPages.end()); +} + void SdCustomShow::SetName(const String& rName) { aName = rName; diff --git a/sd/source/core/drawdoc_animations.cxx b/sd/source/core/drawdoc_animations.cxx index de62ec5b53df..375dd4d6296e 100644 --- a/sd/source/core/drawdoc_animations.cxx +++ b/sd/source/core/drawdoc_animations.cxx @@ -43,11 +43,7 @@ void SdDrawDocument::ReplacePageInCustomShows( const SdPage* pOldPage, const SdP for (sal_uLong i = 0; i < mpCustomShowList->Count(); i++) { SdCustomShow* pCustomShow = (SdCustomShow*) mpCustomShowList->GetObject(i); - if( pNewPage == 0 ) - ::std::remove(pCustomShow->PagesVector().begin(), pCustomShow->PagesVector().end(), - pOldPage); - else - pCustomShow->ReplacePage(pOldPage,pNewPage); + pCustomShow->ReplacePage(pOldPage, pNewPage); } } } diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx index e0aa857e2824..e44f61eda751 100644 --- a/sd/source/ui/unoidl/unocpres.cxx +++ b/sd/source/ui/unoidl/unocpres.cxx @@ -144,10 +144,16 @@ void SAL_CALL SdXCustomPresentation::removeByIndex( sal_Int32 Index ) if( xPage.is() ) { - SvxDrawPage* pPage = SvxDrawPage::getImplementation( xPage ); + SvxDrawPage* pPage = SvxDrawPage::getImplementation( xPage ); if(pPage) - ::std::remove(mpSdCustomShow->PagesVector().begin(), mpSdCustomShow->PagesVector().end(), + { + SdCustomShow::PageVec::iterator it = std::find( + mpSdCustomShow->PagesVector().begin(), + mpSdCustomShow->PagesVector().end(), pPage->GetSdrPage()); + if (it != mpSdCustomShow->PagesVector().end()) + mpSdCustomShow->PagesVector().erase(it); + } } } -- cgit