Kaydet (Commit) af50c7d9 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Convert SV_DECL_PTRARR(SfxViewFrameArr_Impl) to std::vector

Change-Id: I3b6f41b97d1fc375985465ea9e5c0cca9e05ba10
üst 20aa56cc
......@@ -37,7 +37,7 @@ class SfxObjectShell;
SV_DECL_PTRARR( SfxObjectShellArr_Impl, SfxObjectShell*, 4 )
class SfxViewFrame;
SV_DECL_PTRARR( SfxViewFrameArr_Impl, SfxViewFrame*, 4 )
class SfxViewFrameArr_Impl : public std::vector<SfxViewFrame*> {};
class SfxViewShell;
class SfxViewShellArr_Impl : public std::vector<SfxViewShell*> {};
......
......@@ -252,7 +252,7 @@ public:
void InsertViewFrame( SfxViewFrame* pFrame )
{
StartListening( *pFrame );
C40_INSERT( SfxViewFrame, pFrame, Count() );
push_back( pFrame );
}
void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
};
......@@ -268,9 +268,9 @@ void SfxViewNotificatedFrameList_Impl::Notify( SfxBroadcaster& rBC, const SfxHin
SfxViewFrame* pFrame = (SfxViewFrame*) &rBC;
if( pFrame )
{
sal_uInt16 nPos = C40_GETPOS( SfxViewFrame, pFrame );
if( nPos != USHRT_MAX )
Remove( nPos );
iterator it = std::find( begin(), end(), pFrame );
if( it != end() )
erase( it );
}
break;
}
......@@ -1432,9 +1432,8 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh )
pDispatcher->Flush();
}
SfxViewFrame *pThis = this; // this due to the sick Array syntax
SfxViewFrameArr_Impl &rViewArr = SFX_APP()->GetViewFrames_Impl();
rViewArr.C40_INSERT(SfxViewFrame, pThis, rViewArr.Count() );
rViewArr.push_back( this );
}
SfxViewFrame::SfxViewFrame
......@@ -1491,8 +1490,8 @@ SfxViewFrame::~SfxViewFrame()
// Unregister from the Frame List.
SfxApplication *pSfxApp = SFX_APP();
SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl();
const SfxViewFrame *pThis = this;
rFrames.Remove( rFrames.GetPos(pThis) );
SfxViewFrameArr_Impl::iterator it = std::find( rFrames.begin(), rFrames.end(), this );
rFrames.erase( it );
// Delete Member
KillDispatcher_Impl();
......@@ -1539,9 +1538,9 @@ SfxViewFrame* SfxViewFrame::GetFirst
SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl();
// search for a SfxDocument of the specified type
for ( sal_uInt16 nPos = 0; nPos < rFrames.Count(); ++nPos )
for ( sal_uInt16 nPos = 0; nPos < rFrames.size(); ++nPos )
{
SfxViewFrame *pFrame = rFrames.GetObject(nPos);
SfxViewFrame *pFrame = rFrames[nPos];
if ( ( !pDoc || pDoc == pFrame->GetObjectShell() )
&& ( !bOnlyIfVisible || pFrame->IsVisible() )
)
......@@ -1565,14 +1564,14 @@ SfxViewFrame* SfxViewFrame::GetNext
// refind the specified predecessor
sal_uInt16 nPos;
for ( nPos = 0; nPos < rFrames.Count(); ++nPos )
if ( rFrames.GetObject(nPos) == &rPrev )
for ( nPos = 0; nPos < rFrames.size(); ++nPos )
if ( rFrames[nPos] == &rPrev )
break;
// search for a Frame of the specified type
for ( ++nPos; nPos < rFrames.Count(); ++nPos )
for ( ++nPos; nPos < rFrames.size(); ++nPos )
{
SfxViewFrame *pFrame = rFrames.GetObject(nPos);
SfxViewFrame *pFrame = rFrames[nPos];
if ( ( !pDoc || pDoc == pFrame->GetObjectShell() )
&& ( !bOnlyIfVisible || pFrame->IsVisible() )
)
......@@ -2205,7 +2204,7 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl
return sal_False;
}
DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().size(), "Inconsistent view arrays!" );
DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().size() == SFX_APP()->GetViewShells_Impl().size(), "Inconsistent view arrays!" );
return sal_True;
}
......
......@@ -1552,9 +1552,9 @@ SfxViewShell* SfxViewShell::GetFirst
// sometimes dangling SfxViewShells exist that point to a dead SfxViewFrame
// these ViewShells shouldn't be accessible anymore
// a destroyed ViewFrame is not in the ViewFrame array anymore, so checking this array helps
for ( sal_uInt16 n=0; n<rFrames.Count(); ++n )
for ( sal_uInt16 n=0; n<rFrames.size(); ++n )
{
SfxViewFrame *pFrame = rFrames.GetObject(n);
SfxViewFrame *pFrame = rFrames[n];
if ( pFrame == pShell->GetViewFrame() )
{
// only ViewShells with a valid ViewFrame will be returned
......@@ -1594,9 +1594,9 @@ SfxViewShell* SfxViewShell::GetNext
// sometimes dangling SfxViewShells exist that point to a dead SfxViewFrame
// these ViewShells shouldn't be accessible anymore
// a destroyed ViewFrame is not in the ViewFrame array anymore, so checking this array helps
for ( sal_uInt16 n=0; n<rFrames.Count(); ++n )
for ( sal_uInt16 n=0; n<rFrames.size(); ++n )
{
SfxViewFrame *pFrame = rFrames.GetObject(n);
SfxViewFrame *pFrame = rFrames[n];
if ( pFrame == pShell->GetViewFrame() )
{
// only ViewShells with a valid ViewFrame will be returned
......@@ -1626,9 +1626,9 @@ void SfxViewShell::Notify( SfxBroadcaster& rBC,
{
// avoid access to dangling ViewShells
SfxViewFrameArr_Impl &rFrames = SFX_APP()->GetViewFrames_Impl();
for ( sal_uInt16 n=0; n<rFrames.Count(); ++n )
for ( sal_uInt16 n=0; n<rFrames.size(); ++n )
{
SfxViewFrame *frame = rFrames.GetObject(n);
SfxViewFrame *frame = rFrames[n];
if ( frame == GetViewFrame() && &rBC == GetObjectShell() )
{
SfxItemSet* pSet = GetObjectShell()->GetMedium()->GetItemSet();
......
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