diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2011-06-08 15:43:44 -0430 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2011-06-10 18:46:33 +0200 |
commit | 418e1c560a9c6c68a1918e8a9b95ef276ce78ab1 (patch) | |
tree | 0ef56a2b5271405275d20ebcc7bcc3f74968cdf8 /sd/source/ui/docshell | |
parent | 6614d67510f067daef67cf6e8b704b409e1b4744 (diff) |
Replace List for std::vector<sd::FrameView*>.
Diffstat (limited to 'sd/source/ui/docshell')
-rw-r--r-- | sd/source/ui/docshell/docshel2.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 77 |
2 files changed, 31 insertions, 54 deletions
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index 47340e07ba7c..5f1737cc6c57 100644 --- a/sd/source/ui/docshell/docshel2.cxx +++ b/sd/source/ui/docshell/docshel2.cxx @@ -79,11 +79,11 @@ void DrawDocShell::Draw(OutputDevice* pOut, const JobSetup&, sal_uInt16 nAspect) SdPage* pSelectedPage = NULL; - List* pFrameViewList = mpDoc->GetFrameViewList(); - if( pFrameViewList && pFrameViewList->Count() ) + const std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList(); + if( !rViews.empty() ) { - FrameView* pFrameView = (FrameView*)pFrameViewList->GetObject(0); - if( pFrameView && pFrameView->GetPageKind() == PK_STANDARD ) + sd::FrameView* pFrameView = rViews[0]; + if( pFrameView->GetPageKind() == PK_STANDARD ) { sal_uInt16 nSelectedPage = pFrameView->GetSelectedPage(); pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD); diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index f2b27c6ac72a..d87363f30b06 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -348,44 +348,32 @@ void DrawDocShell::GetState(SfxItemSet &rSet) void DrawDocShell::InPlaceActivate( sal_Bool bActive ) { + ViewShell* pViewSh = NULL; + SfxViewShell* pSfxViewSh = NULL; + SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false); + std::vector<FrameView*> &rViews = mpDoc->GetFrameViewList(); + if( !bActive ) { - FrameView* pFrameView = NULL; - List* pFrameViewList = mpDoc->GetFrameViewList(); - - DBG_ASSERT( pFrameViewList, "No FrameViewList?" ); - if( pFrameViewList ) - { - sal_uInt32 i; - for ( i = 0; i < pFrameViewList->Count(); i++) - { - // Ggf. FrameViews loeschen - pFrameView = (FrameView*) pFrameViewList->GetObject(i); + std::vector<FrameView*>::iterator pIter; + for ( pIter = rViews.begin(); pIter != rViews.end(); ++pIter ) + delete *pIter; - if (pFrameView) - delete pFrameView; - } - - pFrameViewList->Clear(); + rViews.clear(); - ViewShell* pViewSh = NULL; - SfxViewShell* pSfxViewSh = NULL; - SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false); + while (pSfxViewFrame) + { + // Anzahl FrameViews ermitteln + pSfxViewSh = pSfxViewFrame->GetViewShell(); + pViewSh = PTR_CAST( ViewShell, pSfxViewSh ); - while (pSfxViewFrame) + if ( pViewSh && pViewSh->GetFrameView() ) { - // Anzahl FrameViews ermitteln - pSfxViewSh = pSfxViewFrame->GetViewShell(); - pViewSh = PTR_CAST( ViewShell, pSfxViewSh ); - - if ( pViewSh && pViewSh->GetFrameView() ) - { - pViewSh->WriteFrameViewData(); - pFrameViewList->Insert( new FrameView( mpDoc, pViewSh->GetFrameView() ) ); - } - - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); + pViewSh->WriteFrameViewData(); + rViews.push_back( new FrameView( mpDoc, pViewSh->GetFrameView() ) ); } + + pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); } } @@ -393,29 +381,18 @@ void DrawDocShell::InPlaceActivate( sal_Bool bActive ) if( bActive ) { - List* pFrameViewList = mpDoc->GetFrameViewList(); - - DBG_ASSERT( pFrameViewList, "No FrameViewList?" ); - if( pFrameViewList ) + for( sal_uInt32 i = 0; pSfxViewFrame && (i < rViews.size()); i++ ) { - ViewShell* pViewSh = NULL; - SfxViewShell* pSfxViewSh = NULL; - SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false); + // Anzahl FrameViews ermitteln + pSfxViewSh = pSfxViewFrame->GetViewShell(); + pViewSh = PTR_CAST( ViewShell, pSfxViewSh ); - sal_uInt32 i; - for( i = 0; pSfxViewFrame && (i < pFrameViewList->Count()); i++ ) + if ( pViewSh ) { - // Anzahl FrameViews ermitteln - pSfxViewSh = pSfxViewFrame->GetViewShell(); - pViewSh = PTR_CAST( ViewShell, pSfxViewSh ); - - if ( pViewSh ) - { - pViewSh->ReadFrameViewData( (FrameView*)pFrameViewList->GetObject(i) ); - } - - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); + pViewSh->ReadFrameViewData( rViews[ i ] ); } + + pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); } } } |