Kaydet (Commit) 00081bb2 authored tarafından August Sodora's avatar August Sodora

SV_DECL_PTRARR->std::vector

üst 4635ed7a
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
#ifndef SFX_VIEWIMP_HXX #ifndef SFX_VIEWIMP_HXX
#define SFX_VIEWIMP_HXX #define SFX_VIEWIMP_HXX
// include ---------------------------------------------------------------
#include <basic/sbxobj.hxx> #include <basic/sbxobj.hxx>
#include <sfx2/viewsh.hxx> #include <sfx2/viewsh.hxx>
#include <sfx2/viewfrm.hxx> // SvBorder #include <sfx2/viewfrm.hxx> // SvBorder
...@@ -43,13 +41,11 @@ ...@@ -43,13 +41,11 @@
#include <vcl/print.hxx> #include <vcl/print.hxx>
#include <queue> #include <queue>
// forward ---------------------------------------------------------------
class SfxOfficeDispatch; class SfxOfficeDispatch;
class SfxBaseController; class SfxBaseController;
typedef SfxShell* SfxShellPtr_Impl; typedef SfxShell* SfxShellPtr_Impl;
SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 ) typedef std::vector<SfxShellPtr_Impl> SfxShellArr_Impl;
class SfxClipboardChangeListener; class SfxClipboardChangeListener;
......
...@@ -1480,7 +1480,7 @@ sal_Bool SfxViewShell::HasSelection( sal_Bool ) const ...@@ -1480,7 +1480,7 @@ sal_Bool SfxViewShell::HasSelection( sal_Bool ) const
void SfxViewShell::AddSubShell( SfxShell& rShell ) void SfxViewShell::AddSubShell( SfxShell& rShell )
{ {
pImp->aArr.Insert( &rShell, pImp->aArr.Count() ); pImp->aArr.push_back(&rShell);
SfxDispatcher *pDisp = pFrame->GetDispatcher(); SfxDispatcher *pDisp = pFrame->GetDispatcher();
if ( pDisp->IsActive(*this) ) if ( pDisp->IsActive(*this) )
{ {
...@@ -1494,25 +1494,24 @@ void SfxViewShell::RemoveSubShell( SfxShell* pShell ) ...@@ -1494,25 +1494,24 @@ void SfxViewShell::RemoveSubShell( SfxShell* pShell )
SfxDispatcher *pDisp = pFrame->GetDispatcher(); SfxDispatcher *pDisp = pFrame->GetDispatcher();
if ( !pShell ) if ( !pShell )
{ {
sal_uInt16 nCount = pImp->aArr.Count(); size_t nCount = pImp->aArr.size();
if ( pDisp->IsActive(*this) ) if ( pDisp->IsActive(*this) )
{ {
for ( sal_uInt16 n=nCount; n>0; n-- ) for(size_t n = nCount; n > 0; --n)
pDisp->Pop( *pImp->aArr[n-1] ); pDisp->Pop(*pImp->aArr[n - 1]);
pDisp->Flush(); pDisp->Flush();
} }
pImp->aArr.clear();
pImp->aArr.Remove(0, nCount);
} }
else else
{ {
sal_uInt16 nPos = pImp->aArr.GetPos( pShell ); SfxShellArr_Impl::iterator i = std::find(pImp->aArr.begin(), pImp->aArr.end(), pShell);
if ( nPos != 0xFFFF ) if(i != pImp->aArr.end())
{ {
pImp->aArr.Remove( nPos ); pImp->aArr.erase(i);
if ( pDisp->IsActive(*this) ) if(pDisp->IsActive(*this))
{ {
pDisp->RemoveShell_Impl( *pShell ); pDisp->RemoveShell_Impl(*pShell);
pDisp->Flush(); pDisp->Flush();
} }
} }
...@@ -1521,22 +1520,21 @@ void SfxViewShell::RemoveSubShell( SfxShell* pShell ) ...@@ -1521,22 +1520,21 @@ void SfxViewShell::RemoveSubShell( SfxShell* pShell )
SfxShell* SfxViewShell::GetSubShell( sal_uInt16 nNo ) SfxShell* SfxViewShell::GetSubShell( sal_uInt16 nNo )
{ {
sal_uInt16 nCount = pImp->aArr.Count(); sal_uInt16 nCount = pImp->aArr.size();
if ( nNo<nCount ) if(nNo < nCount)
return pImp->aArr[nCount-nNo-1]; return pImp->aArr[nCount - nNo - 1];
return NULL; return NULL;
} }
void SfxViewShell::PushSubShells_Impl( sal_Bool bPush ) void SfxViewShell::PushSubShells_Impl( sal_Bool bPush )
{ {
sal_uInt16 nCount = pImp->aArr.Count();
SfxDispatcher *pDisp = pFrame->GetDispatcher(); SfxDispatcher *pDisp = pFrame->GetDispatcher();
if ( bPush ) if ( bPush )
{ {
for ( sal_uInt16 n=0; n<nCount; n++ ) for(SfxShellArr_Impl::const_iterator i = pImp->aArr.begin(); i != pImp->aArr.end(); ++i)
pDisp->Push( *pImp->aArr[n] ); pDisp->Push(**i);
} }
else if ( nCount ) else if(!pImp->aArr.empty())
{ {
SfxShell& rPopUntil = *pImp->aArr[0]; SfxShell& rPopUntil = *pImp->aArr[0];
if ( pDisp->GetShellLevel( rPopUntil ) != USHRT_MAX ) if ( pDisp->GetShellLevel( rPopUntil ) != USHRT_MAX )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment