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