diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2011-06-04 10:46:37 -0430 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2011-06-10 18:46:24 +0200 |
commit | 6614d67510f067daef67cf6e8b704b409e1b4744 (patch) | |
tree | 29efd6fa7e65e1f435259b3b67e6470f94b05db9 /sd/source | |
parent | e80486eb27163033eae39cffbcaeeff52902d61d (diff) |
Replace List with std::vector<NavDocInfo>.
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/dlg/navigatr.cxx | 32 | ||||
-rw-r--r-- | sd/source/ui/inc/navigatr.hxx | 2 |
2 files changed, 11 insertions, 23 deletions
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index fa7412447805..5a354b2acb37 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -97,7 +97,6 @@ SdNavigatorWin::SdNavigatorWin( mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings ); mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings ); - mpDocList = new List(); ApplyImageList(); // load images *before* calculating sizes to get something useful !!! @@ -156,13 +155,6 @@ SdNavigatorWin::~SdNavigatorWin() { delete mpNavigatorCtrlItem; delete mpPageNameCtrlItem; - - // Liste der DocInfos loeschen - long nCount = mpDocList->Count(); - while( nCount-- ) - delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 ); - - delete mpDocList; } // ----------------------------------------------------------------------- @@ -695,9 +687,7 @@ void SdNavigatorWin::RefreshDocumentLB( const String* pDocName ) maLbDocs.Clear(); // Liste der DocInfos loeschen - long nCount = mpDocList->Count(); - while( nCount-- ) - delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 ); + maDocList.clear(); if( mbDocImported ) maLbDocs.InsertEntry( aStr, 0 ); @@ -710,15 +700,15 @@ void SdNavigatorWin::RefreshDocumentLB( const String* pDocName ) ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, pSfxDocShell ); if( pDocShell && !pDocShell->IsInDestruction() && ( pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) ) { - NavDocInfo* pInfo = new NavDocInfo(); - pInfo->mpDocShell = pDocShell; + NavDocInfo aInfo ; + aInfo.mpDocShell = pDocShell; SfxMedium *pMedium = pDocShell->GetMedium(); aStr = pMedium ? pMedium->GetName() : String(); if( aStr.Len() ) - pInfo->SetName(); + aInfo.SetName(); else - pInfo->SetName( sal_False ); + aInfo.SetName( sal_False ); // z.Z. wird wieder der Name der Shell genommen (also ohne Pfad) // da Koose es als Fehler ansieht, wenn er Pfad in URL-Notation // angezeigt wird! @@ -727,11 +717,11 @@ void SdNavigatorWin::RefreshDocumentLB( const String* pDocName ) maLbDocs.InsertEntry( aStr, LISTBOX_APPEND ); if( pDocShell == pCurrentDocShell ) - pInfo->SetActive(); + aInfo.SetActive(); else - pInfo->SetActive( sal_False ); + aInfo.SetActive( sal_False ); - mpDocList->Insert( pInfo, LIST_APPEND ); + maDocList.push_back( aInfo ); } pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0 , sal_False ); } @@ -762,7 +752,7 @@ sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool b NavDocInfo* SdNavigatorWin::GetDocInfo() { - long nPos = maLbDocs.GetSelectEntryPos(); + sal_uInt32 nPos = maLbDocs.GetSelectEntryPos(); if( mbDocImported ) { @@ -773,9 +763,7 @@ NavDocInfo* SdNavigatorWin::GetDocInfo() nPos--; } - NavDocInfo* pInfo = (NavDocInfo*)mpDocList->GetObject( nPos ); - - return( pInfo ); + return nPos < maDocList.size() ? &(maDocList[ nPos ]) : NULL; } /************************************************************************* diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx index bc1ebceeee11..97ee713edf1f 100644 --- a/sd/source/ui/inc/navigatr.hxx +++ b/sd/source/ui/inc/navigatr.hxx @@ -128,7 +128,7 @@ private: sal_Bool mbDocImported; String maDropFileName; NavigatorDragType meDragType; - List* mpDocList; + std::vector<NavDocInfo> maDocList; SfxBindings* mpBindings; SdNavigatorControllerItem* mpNavigatorCtrlItem; SdPageNameControllerItem* mpPageNameCtrlItem; |