summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Powers <jpowers27@cox.net>2011-07-13 06:58:16 -0700
committerJoseph Powers <jpowers27@cox.net>2011-07-13 06:59:16 -0700
commit66803f4a1fd5e4987cfa9abe32972fdb6515c5ec (patch)
tree7ccf0964d62cde1e3547d637c2555de91389a6c5
parent51054e7a8b14aa285b19b124184393d86064ad7e (diff)
Replace List with std::vector< Window* >
I also removed the unused Dummy class members.
-rw-r--r--svtools/inc/svtools/taskbar.hxx41
-rw-r--r--svtools/source/control/taskmisc.cxx53
2 files changed, 47 insertions, 47 deletions
diff --git a/svtools/inc/svtools/taskbar.hxx b/svtools/inc/svtools/taskbar.hxx
index 4fb126e5eefe..36b625eca650 100644
--- a/svtools/inc/svtools/taskbar.hxx
+++ b/svtools/inc/svtools/taskbar.hxx
@@ -440,30 +440,39 @@ class ImplWindowArrangeList;
// - class WindowArrange -
// -----------------------
+typedef ::std::vector< Window* > WindowList_impl;
+
class SVT_DLLPUBLIC WindowArrange
{
private:
- List* mpWinList;
- void* mpDummy;
- sal_uLong mnDummy;
+ WindowList_impl maWinList;
#ifdef _TASKBAR_CXX
- SVT_DLLPRIVATE void ImplTile( const Rectangle& rRect );
- SVT_DLLPRIVATE void ImplHorz( const Rectangle& rRect );
- SVT_DLLPRIVATE void ImplVert( const Rectangle& rRect );
- SVT_DLLPRIVATE void ImplCascade( const Rectangle& rRect );
+ SVT_DLLPRIVATE void ImplTile( const Rectangle& rRect );
+ SVT_DLLPRIVATE void ImplHorz( const Rectangle& rRect );
+ SVT_DLLPRIVATE void ImplVert( const Rectangle& rRect );
+ SVT_DLLPRIVATE void ImplCascade( const Rectangle& rRect );
#endif
public:
- WindowArrange();
- ~WindowArrange();
-
- void AddWindow( Window* pWindow, sal_uLong nPos = LIST_APPEND )
- { mpWinList->Insert( (void*)pWindow, nPos ); }
- void RemoveAllWindows()
- { mpWinList->Clear(); }
-
- void Arrange( sal_uInt16 nType, const Rectangle& rRect );
+ WindowArrange();
+ ~WindowArrange();
+
+ void AddWindow( Window* pWindow, size_t nPos = size_t(-1) )
+ {
+ if ( nPos < maWinList.size() ) {
+ maWinList.insert( maWinList.begin() + nPos, pWindow );
+ } else {
+ maWinList.push_back( pWindow );
+ }
+ }
+
+ void RemoveAllWindows()
+ {
+ maWinList.clear();
+ }
+
+ void Arrange( sal_uInt16 nType, const Rectangle& rRect );
};
#endif // _TASKBAR_HXX
diff --git a/svtools/source/control/taskmisc.cxx b/svtools/source/control/taskmisc.cxx
index 1476cacb76fb..246d107fc1d1 100644
--- a/svtools/source/control/taskmisc.cxx
+++ b/svtools/source/control/taskmisc.cxx
@@ -61,14 +61,13 @@ void TaskButtonBar::RequestHelp( const HelpEvent& rHEvt )
WindowArrange::WindowArrange()
{
- mpWinList = new List;
}
// -----------------------------------------------------------------------
WindowArrange::~WindowArrange()
{
- delete mpWinList;
+ maWinList.clear();
}
// -----------------------------------------------------------------------
@@ -103,22 +102,21 @@ static void ImplPosSizeWindow( Window* pWindow,
void WindowArrange::ImplTile( const Rectangle& rRect )
{
- sal_uInt16 nCount = (sal_uInt16)mpWinList->Count();
+ size_t nCount = maWinList.size();
if ( nCount < 3 )
{
ImplVert( rRect );
return;
}
- sal_uInt16 i;
- sal_uInt16 j;
- sal_uInt16 nCols;
- sal_uInt16 nRows;
- sal_uInt16 nActRows;
- sal_uInt16 nOffset;
+ sal_uInt16 i;
+ sal_uInt16 j;
+ sal_uInt16 nCols;
+ sal_uInt16 nRows;
+ sal_uInt16 nActRows;
+ sal_uInt16 nOffset;
long nOverWidth;
long nOverHeight;
- Window* pWindow;
long nX = rRect.Left();
long nY = rRect.Top();
long nWidth = rRect.GetWidth();
@@ -144,7 +142,7 @@ void WindowArrange::ImplTile( const Rectangle& rRect )
nWidth = 1;
nOverWidth = nRectWidth-(nWidth*nCols);
- pWindow = (Window*)mpWinList->First();
+ WindowList_impl::iterator it = maWinList.begin();
for ( i = 0; i < nCols; i++ )
{
if ( i < nOffset )
@@ -172,18 +170,17 @@ void WindowArrange::ImplTile( const Rectangle& rRect )
nTempHeight++;
nOverHeight--;
}
- ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nTempHeight );
+ ImplPosSizeWindow( *it, nX, nY, nTempWidth, nTempHeight );
nY += nTempHeight;
- pWindow = (Window*)mpWinList->Next();
- if ( !pWindow )
+ if ( ++it == maWinList.end() )
break;
}
nX += nWidth;
nY = nRectY;
- if ( !pWindow )
+ if ( it == maWinList.end() )
break;
}
}
@@ -192,7 +189,7 @@ void WindowArrange::ImplTile( const Rectangle& rRect )
void WindowArrange::ImplHorz( const Rectangle& rRect )
{
- long nCount = (long)mpWinList->Count();
+ size_t nCount = maWinList.size();
long nX = rRect.Left();
long nY = rRect.Top();
long nWidth = rRect.GetWidth();
@@ -206,9 +203,9 @@ void WindowArrange::ImplHorz( const Rectangle& rRect )
if ( nHeight < 1 )
nHeight = 1;
nOver = nRectHeight - (nCount*nHeight);
- pWindow = (Window*)mpWinList->First();
- while ( pWindow )
+ for( size_t index = 0; index < nCount; ++index )
{
+ pWindow = maWinList[ index ];
nTempHeight = nHeight;
if ( nOver > 0 )
{
@@ -217,8 +214,6 @@ void WindowArrange::ImplHorz( const Rectangle& rRect )
}
ImplPosSizeWindow( pWindow, nX, nY, nWidth, nTempHeight );
nY += nTempHeight;
-
- pWindow = (Window*)mpWinList->Next();
}
}
@@ -226,7 +221,7 @@ void WindowArrange::ImplHorz( const Rectangle& rRect )
void WindowArrange::ImplVert( const Rectangle& rRect )
{
- long nCount = (long)mpWinList->Count();
+ size_t nCount = maWinList.size();
long nX = rRect.Left();
long nY = rRect.Top();
long nWidth = rRect.GetWidth();
@@ -240,9 +235,9 @@ void WindowArrange::ImplVert( const Rectangle& rRect )
if ( nWidth < 1 )
nWidth = 1;
nOver = nRectWidth - (nCount*nWidth);
- pWindow = (Window*)mpWinList->First();
- while ( pWindow )
+ for( size_t index = 0; index < nCount; ++index )
{
+ pWindow = maWinList[ index ];
nTempWidth = nWidth;
if ( nOver > 0 )
{
@@ -251,8 +246,6 @@ void WindowArrange::ImplVert( const Rectangle& rRect )
}
ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nHeight );
nX += nTempWidth;
-
- pWindow = (Window*)mpWinList->Next();
}
}
@@ -285,7 +278,7 @@ void WindowArrange::ImplCascade( const Rectangle& rRect )
Window* pTempWindow;
// Border-Fenster suchen um den Versatz zu ermitteln
- pTempWindow = (Window*)mpWinList->First();
+ pTempWindow = maWinList.front();
pTempWindow->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
while ( !nTopBorder )
{
@@ -313,9 +306,9 @@ void WindowArrange::ImplCascade( const Rectangle& rRect )
nStartOverHeight = nRectHeight-(nHeight+(nCascadeWins*nOff));
i = 0;
- pWindow = (Window*)mpWinList->First();
- while ( pWindow )
+ for( size_t index = 0, count = maWinList.size(); index < count; ++index )
{
+ pWindow = maWinList[ index ];
if ( !i )
{
nOverWidth = nStartOverWidth;
@@ -346,8 +339,6 @@ void WindowArrange::ImplCascade( const Rectangle& rRect )
i++;
else
i = 0;
-
- pWindow = (Window*)mpWinList->Next();
}
}
@@ -355,7 +346,7 @@ void WindowArrange::ImplCascade( const Rectangle& rRect )
void WindowArrange::Arrange( sal_uInt16 nType, const Rectangle& rRect )
{
- if ( !mpWinList->Count() )
+ if ( maWinList.empty() )
return;
switch ( nType )