summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-06-14 11:17:05 +0200
committerMichael Stahl <mstahl@redhat.com>2012-06-20 19:46:39 +0200
commit20aa56cc713866255475aa7fbc4218bf0a58b581 (patch)
tree78d4c54c53d278bf33847162a53ffa5d5765c9d4
parent59713265ece84a7775dfed209f4b42c53ec95a34 (diff)
Convert SV_DECL_PTRARR(SfxViewShellArr_Impl) to std::vector
Change-Id: I91c33be902e20f72623c3d9642057db5eb6e30ba
-rw-r--r--sfx2/inc/arrdecl.hxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx2
-rw-r--r--sfx2/source/view/viewsh.cxx18
3 files changed, 11 insertions, 11 deletions
diff --git a/sfx2/inc/arrdecl.hxx b/sfx2/inc/arrdecl.hxx
index 64633faabe0a..ad25bea7a413 100644
--- a/sfx2/inc/arrdecl.hxx
+++ b/sfx2/inc/arrdecl.hxx
@@ -40,7 +40,7 @@ class SfxViewFrame;
SV_DECL_PTRARR( SfxViewFrameArr_Impl, SfxViewFrame*, 4 )
class SfxViewShell;
-SV_DECL_PTRARR( SfxViewShellArr_Impl, SfxViewShell*, 4 )
+class SfxViewShellArr_Impl : public std::vector<SfxViewShell*> {};
struct SfxTbxCtrlFactory;
class SfxTbxCtrlFactArr_Impl : public std::vector<SfxTbxCtrlFactory*>
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 760225405601..c4ccb6dbaee2 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2205,7 +2205,7 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl
return sal_False;
}
- DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" );
+ DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().size(), "Inconsistent view arrays!" );
return sal_True;
}
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 31f421f6bafa..3afdbef12b20 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1297,9 +1297,8 @@ SfxViewShell::SfxViewShell
StartListening(*pViewFrame->GetObjectShell());
// Insert into list
- const SfxViewShell *pThis = this; // due to the sick Array syntax
SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl();
- rViewArr.Insert(pThis, rViewArr.Count() );
+ rViewArr.push_back(this);
}
//--------------------------------------------------------------------
@@ -1311,7 +1310,8 @@ SfxViewShell::~SfxViewShell()
// Remove from list
const SfxViewShell *pThis = this;
SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl();
- rViewArr.Remove( rViewArr.GetPos(pThis) );
+ SfxViewShellArr_Impl::iterator it = std::find( rViewArr.begin(), rViewArr.end(), pThis );
+ rViewArr.erase( it );
if ( pImp->xClipboardListener.is() )
{
@@ -1544,9 +1544,9 @@ SfxViewShell* SfxViewShell::GetFirst
// search for a SfxViewShell of the specified type
SfxViewShellArr_Impl &rShells = SFX_APP()->GetViewShells_Impl();
SfxViewFrameArr_Impl &rFrames = SFX_APP()->GetViewFrames_Impl();
- for ( sal_uInt16 nPos = 0; nPos < rShells.Count(); ++nPos )
+ for ( sal_uInt16 nPos = 0; nPos < rShells.size(); ++nPos )
{
- SfxViewShell *pShell = rShells.GetObject(nPos);
+ SfxViewShell *pShell = rShells[nPos];
if ( pShell )
{
// sometimes dangling SfxViewShells exist that point to a dead SfxViewFrame
@@ -1582,13 +1582,13 @@ SfxViewShell* SfxViewShell::GetNext
SfxViewShellArr_Impl &rShells = SFX_APP()->GetViewShells_Impl();
SfxViewFrameArr_Impl &rFrames = SFX_APP()->GetViewFrames_Impl();
sal_uInt16 nPos;
- for ( nPos = 0; nPos < rShells.Count(); ++nPos )
- if ( rShells.GetObject(nPos) == &rPrev )
+ for ( nPos = 0; nPos < rShells.size(); ++nPos )
+ if ( rShells[nPos] == &rPrev )
break;
- for ( ++nPos; nPos < rShells.Count(); ++nPos )
+ for ( ++nPos; nPos < rShells.size(); ++nPos )
{
- SfxViewShell *pShell = rShells.GetObject(nPos);
+ SfxViewShell *pShell = rShells[nPos];
if ( pShell )
{
// sometimes dangling SfxViewShells exist that point to a dead SfxViewFrame