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 | 4ad79ee8fe80be4b7795c797b820b798da4a1891 (patch) | |
tree | 7553fd72b669f49d32124ae8d230bb239bd15cf8 /sd/source | |
parent | e1811329389d5505175f47a9a23d0d5cb1121fc7 (diff) |
Replace List for std::vector<sd::FrameView*>.
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/core/drawdoc.cxx | 18 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel2.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 77 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 60 |
5 files changed, 58 insertions, 115 deletions
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 40e5e55e7..d49e4d127 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -156,7 +156,6 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) , mpOnlineSpellingTimer(NULL) , mpOnlineSpellingList(NULL) , mpOnlineSearchItem(NULL) -, mpFrameViewList( new List() ) , mpCustomShowList(NULL) , mpDocSh(static_cast< ::sd::DrawDocShell*>(pDrDocSh)) , mpCreatingTransferable( NULL ) @@ -412,20 +411,9 @@ SdDrawDocument::~SdDrawDocument() pLinkManager = NULL; } - ::sd::FrameView* pFrameView = NULL; - - for (sal_uLong i = 0; i < mpFrameViewList->Count(); i++) - { - // Ggf. FrameViews loeschen - pFrameView = - static_cast< ::sd::FrameView*>(mpFrameViewList->GetObject(i)); - - if (pFrameView) - delete pFrameView; - } - - delete mpFrameViewList; - mpFrameViewList = NULL; + std::vector<sd::FrameView*>::iterator pIter; + for ( pIter = maFrameViewList.begin(); pIter != maFrameViewList.end(); ++pIter ) + delete *pIter; if (mpCustomShowList) { diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 5b7ba4482..4b404f761 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -1211,13 +1211,9 @@ sal_Bool ImplSdPPTImport::Import() ::sd::FrameView* pFrameView = mpDoc->GetFrameView( 0 ); if ( !pFrameView ) { - List* pFrameViewList = mpDoc->GetFrameViewList(); - if ( pFrameViewList ) - { - pFrameView = new ::sd::FrameView( mpDoc ); - if ( pFrameView ) - pFrameViewList->Insert( pFrameView ); - } + std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList(); + pFrameView = new ::sd::FrameView( mpDoc ); + rViews.push_back( pFrameView ); } if ( pFrameView ) { diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx index de12c38bc..82f261ed6 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 33b6b64c9..58479bb17 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); } } } diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 3a8d4dcaa..6ecbaa9ec 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -618,9 +618,9 @@ uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewD if( !xRet.is() ) { - List* pFrameViewList = mpDoc->GetFrameViewList(); + const std::vector<sd::FrameView*> &rList = mpDoc->GetFrameViewList(); - if( pFrameViewList && pFrameViewList->Count() ) + if( !rList.empty() ) { xRet = uno::Reference < container::XIndexAccess >::query(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")))); @@ -629,19 +629,13 @@ uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewD DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" ); if( xCont.is() ) { - sal_uInt32 i; - for( i = 0; i < pFrameViewList->Count(); i++ ) + for( sal_uInt32 i = 0, n = rList.size(); i < n; i++ ) { - ::sd::FrameView* pFrameView = - static_cast< ::sd::FrameView*>( - pFrameViewList->GetObject(i)); + ::sd::FrameView* pFrameView = rList[ i ]; - if(pFrameView) - { - uno::Sequence< beans::PropertyValue > aSeq; - pFrameView->WriteUserDataSequence( aSeq ); - xCont->insertByIndex( i, uno::makeAny( aSeq ) ); - } + uno::Sequence< beans::PropertyValue > aSeq; + pFrameView->WriteUserDataSequence( aSeq ); + xCont->insertByIndex( i, uno::makeAny( aSeq ) ); } } } @@ -662,36 +656,24 @@ void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container: { const sal_Int32 nCount = xData->getCount(); - List* pFrameViewList = mpDoc->GetFrameViewList(); - - DBG_ASSERT( pFrameViewList, "No FrameViewList?" ); - if( pFrameViewList ) - { - ::sd::FrameView* pFrameView; + std::vector<sd::FrameView*>::iterator pIter; + std::vector<sd::FrameView*> &rViews = mpDoc->GetFrameViewList(); - sal_uInt32 i; - for ( i = 0; i < pFrameViewList->Count(); i++) - { - // Ggf. FrameViews loeschen - pFrameView = static_cast< ::sd::FrameView*>( - pFrameViewList->GetObject(i)); + for ( pIter = rViews.begin(); pIter != rViews.end(); ++pIter ) + delete *pIter; - if (pFrameView) - delete pFrameView; - } + rViews.clear(); - pFrameViewList->Clear(); - - uno::Sequence< beans::PropertyValue > aSeq; - sal_Int32 nIndex; - for( nIndex = 0; nIndex < nCount; nIndex++ ) + ::sd::FrameView* pFrameView; + uno::Sequence< beans::PropertyValue > aSeq; + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + if( xData->getByIndex( nIndex ) >>= aSeq ) { - if( xData->getByIndex( nIndex ) >>= aSeq ) - { - pFrameView = new ::sd::FrameView( mpDoc ); - pFrameView->ReadUserDataSequence( aSeq ); - pFrameViewList->Insert( pFrameView ); - } + pFrameView = new ::sd::FrameView( mpDoc ); + + pFrameView->ReadUserDataSequence( aSeq ); + rViews.push_back( pFrameView ); } } } |