summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2012-01-20 00:37:42 -0500
committerAugust Sodora <augsod@gmail.com>2012-01-20 13:47:56 -0500
commit00081bb2fdf263d784082fb202d7802418ac7666 (patch)
treeba54590dfb523503662c58e594a1b0a1a71e1ce0 /sfx2
parent4635ed7aee4cf2d74e6a4459ea7c1a8cc64c97e0 (diff)
SV_DECL_PTRARR->std::vector
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/viewimp.hxx6
-rw-r--r--sfx2/source/view/viewsh.cxx34
2 files changed, 17 insertions, 23 deletions
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index edd5495a33ef..3d77c18bc55a 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -29,8 +29,6 @@
#ifndef SFX_VIEWIMP_HXX
#define SFX_VIEWIMP_HXX
-// include ---------------------------------------------------------------
-
#include <basic/sbxobj.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/viewfrm.hxx> // SvBorder
@@ -43,13 +41,11 @@
#include <vcl/print.hxx>
#include <queue>
-// forward ---------------------------------------------------------------
-
class SfxOfficeDispatch;
class SfxBaseController;
typedef SfxShell* SfxShellPtr_Impl;
-SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 )
+typedef std::vector<SfxShellPtr_Impl> SfxShellArr_Impl;
class SfxClipboardChangeListener;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 2c6bc1284420..c1bf06720f1a 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1480,7 +1480,7 @@ sal_Bool SfxViewShell::HasSelection( sal_Bool ) const
void SfxViewShell::AddSubShell( SfxShell& rShell )
{
- pImp->aArr.Insert( &rShell, pImp->aArr.Count() );
+ pImp->aArr.push_back(&rShell);
SfxDispatcher *pDisp = pFrame->GetDispatcher();
if ( pDisp->IsActive(*this) )
{
@@ -1494,25 +1494,24 @@ void SfxViewShell::RemoveSubShell( SfxShell* pShell )
SfxDispatcher *pDisp = pFrame->GetDispatcher();
if ( !pShell )
{
- sal_uInt16 nCount = pImp->aArr.Count();
+ size_t nCount = pImp->aArr.size();
if ( pDisp->IsActive(*this) )
{
- for ( sal_uInt16 n=nCount; n>0; n-- )
- pDisp->Pop( *pImp->aArr[n-1] );
+ for(size_t n = nCount; n > 0; --n)
+ pDisp->Pop(*pImp->aArr[n - 1]);
pDisp->Flush();
}
-
- pImp->aArr.Remove(0, nCount);
+ pImp->aArr.clear();
}
else
{
- sal_uInt16 nPos = pImp->aArr.GetPos( pShell );
- if ( nPos != 0xFFFF )
+ SfxShellArr_Impl::iterator i = std::find(pImp->aArr.begin(), pImp->aArr.end(), pShell);
+ if(i != pImp->aArr.end())
{
- pImp->aArr.Remove( nPos );
- if ( pDisp->IsActive(*this) )
+ pImp->aArr.erase(i);
+ if(pDisp->IsActive(*this))
{
- pDisp->RemoveShell_Impl( *pShell );
+ pDisp->RemoveShell_Impl(*pShell);
pDisp->Flush();
}
}
@@ -1521,22 +1520,21 @@ void SfxViewShell::RemoveSubShell( SfxShell* pShell )
SfxShell* SfxViewShell::GetSubShell( sal_uInt16 nNo )
{
- sal_uInt16 nCount = pImp->aArr.Count();
- if ( nNo<nCount )
- return pImp->aArr[nCount-nNo-1];
+ sal_uInt16 nCount = pImp->aArr.size();
+ if(nNo < nCount)
+ return pImp->aArr[nCount - nNo - 1];
return NULL;
}
void SfxViewShell::PushSubShells_Impl( sal_Bool bPush )
{
- sal_uInt16 nCount = pImp->aArr.Count();
SfxDispatcher *pDisp = pFrame->GetDispatcher();
if ( bPush )
{
- for ( sal_uInt16 n=0; n<nCount; n++ )
- pDisp->Push( *pImp->aArr[n] );
+ for(SfxShellArr_Impl::const_iterator i = pImp->aArr.begin(); i != pImp->aArr.end(); ++i)
+ pDisp->Push(**i);
}
- else if ( nCount )
+ else if(!pImp->aArr.empty())
{
SfxShell& rPopUntil = *pImp->aArr[0];
if ( pDisp->GetShellLevel( rPopUntil ) != USHRT_MAX )