Kaydet (Commit) 1b82bcb4 authored tarafından Joseph Powers's avatar Joseph Powers

Remove DECLARE_LIST( ImpLineList, ImpLineListData* )

üst 87c3b65c
...@@ -39,11 +39,12 @@ ...@@ -39,11 +39,12 @@
#include <vcl/field.hxx> #include <vcl/field.hxx>
class ImplFontList; class ImplFontList;
class ImpLineList;
class FontList; class FontList;
class ImplColorListData; class ImplColorListData;
class ImpLineListData;
typedef ::std::vector< ImplColorListData* > ImpColorList; typedef ::std::vector< ImplColorListData* > ImpColorList;
typedef ::std::vector< ImpLineListData* > ImpLineList;
#define STYLE_SOLID ( ( USHORT ) 0 ) #define STYLE_SOLID ( ( USHORT ) 0 )
#define STYLE_DOTTED ( ( USHORT ) 1 ) #define STYLE_DOTTED ( ( USHORT ) 1 )
......
...@@ -293,8 +293,6 @@ struct ImpLineListData ...@@ -293,8 +293,6 @@ struct ImpLineListData
USHORT nStyle; USHORT nStyle;
}; };
DECLARE_LIST( ImpLineList, ImpLineListData* )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
inline const Color& LineListBox::GetPaintColor( void ) const inline const Color& LineListBox::GetPaintColor( void ) const
...@@ -498,7 +496,7 @@ void LineListBox::ImplInit() ...@@ -498,7 +496,7 @@ void LineListBox::ImplInit()
{ {
aTxtSize.Width() = GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( "99,99 mm" ) ) ); aTxtSize.Width() = GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( "99,99 mm" ) ) );
aTxtSize.Height() = GetTextHeight(); aTxtSize.Height() = GetTextHeight();
pLineList = new ImpLineList; pLineList = new ImpLineList();
eUnit = FUNIT_POINT; eUnit = FUNIT_POINT;
eSourceUnit = FUNIT_POINT; eSourceUnit = FUNIT_POINT;
...@@ -532,15 +530,12 @@ LineListBox::LineListBox( Window* pParent, const ResId& rResId ) : ...@@ -532,15 +530,12 @@ LineListBox::LineListBox( Window* pParent, const ResId& rResId ) :
LineListBox::~LineListBox() LineListBox::~LineListBox()
{ {
ULONG n = 0; for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) {
ULONG nCount = pLineList->Count(); if ( (*pLineList)[ i ] ) {
while ( n < nCount ) delete (*pLineList)[ i ];
{ }
ImpLineListData* pData = pLineList->GetObject( n );
if ( pData )
delete pData;
n++;
} }
pLineList->clear();
delete pLineList; delete pLineList;
} }
...@@ -549,8 +544,15 @@ LineListBox::~LineListBox() ...@@ -549,8 +544,15 @@ LineListBox::~LineListBox()
USHORT LineListBox::InsertEntry( const XubString& rStr, USHORT nPos ) USHORT LineListBox::InsertEntry( const XubString& rStr, USHORT nPos )
{ {
nPos = ListBox::InsertEntry( rStr, nPos ); nPos = ListBox::InsertEntry( rStr, nPos );
if ( nPos != LISTBOX_ERROR ) if ( nPos != LISTBOX_ERROR ) {
pLineList->Insert( NULL, nPos ); if ( nPos < pLineList->size() ) {
ImpLineList::iterator it = pLineList->begin();
::std::advance( it, nPos );
pLineList->insert( it, NULL );
} else {
pLineList->push_back( NULL );
}
}
return nPos; return nPos;
} }
...@@ -570,7 +572,13 @@ USHORT LineListBox::InsertEntry( long nLine1, long nLine2, long nDistance, ...@@ -570,7 +572,13 @@ USHORT LineListBox::InsertEntry( long nLine1, long nLine2, long nDistance,
pData->nLine2 = nLine2; pData->nLine2 = nLine2;
pData->nDistance = nDistance; pData->nDistance = nDistance;
pData->nStyle = nStyle; pData->nStyle = nStyle;
pLineList->Insert( pData, nPos ); if ( nPos < pLineList->size() ) {
ImpLineList::iterator it = pLineList->begin();
::std::advance( it, nPos );
pLineList->insert( it, pData );
} else {
pLineList->push_back( pData );
}
} }
return nPos; return nPos;
...@@ -581,26 +589,26 @@ USHORT LineListBox::InsertEntry( long nLine1, long nLine2, long nDistance, ...@@ -581,26 +589,26 @@ USHORT LineListBox::InsertEntry( long nLine1, long nLine2, long nDistance,
void LineListBox::RemoveEntry( USHORT nPos ) void LineListBox::RemoveEntry( USHORT nPos )
{ {
ListBox::RemoveEntry( nPos ); ListBox::RemoveEntry( nPos );
ImpLineListData* pData = pLineList->Remove( nPos );
if ( pData ) if ( nPos < pLineList->size() ) {
delete pData; ImpLineList::iterator it = pLineList->begin();
::std::advance( it, nPos );
if ( *it ) delete *it;
pLineList->erase( it );
}
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void LineListBox::Clear() void LineListBox::Clear()
{ {
ULONG n = 0; for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) {
ULONG nCount = pLineList->Count(); if ( (*pLineList)[ i ] ) {
while ( n < nCount ) delete (*pLineList)[ i ];
{ }
ImpLineListData* pData = pLineList->GetObject( n );
if ( pData )
delete pData;
n++;
} }
pLineList->clear();
pLineList->Clear();
ListBox::Clear(); ListBox::Clear();
} }
...@@ -609,23 +617,19 @@ void LineListBox::Clear() ...@@ -609,23 +617,19 @@ void LineListBox::Clear()
USHORT LineListBox::GetEntryPos( long nLine1, long nLine2, USHORT LineListBox::GetEntryPos( long nLine1, long nLine2,
long nDistance, USHORT nStyle ) const long nDistance, USHORT nStyle ) const
{ {
ULONG n = 0; for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) {
ULONG nCount = pLineList->Count(); ImpLineListData* pData = (*pLineList)[ n ];
while ( n < nCount )
{
ImpLineListData* pData = pLineList->GetObject( n );
if ( pData ) if ( pData )
{ {
if ( (pData->nLine1 == nLine1) && if ( (pData->nLine1 == nLine1)
(pData->nLine2 == nLine2) && && (pData->nLine2 == nLine2)
(pData->nDistance == nDistance) && && (pData->nDistance == nDistance)
(pData->nStyle == nStyle) ) && (pData->nStyle == nStyle)
return (USHORT)n; ) {
return (USHORT)i;
}
} }
n++;
} }
return LISTBOX_ENTRY_NOTFOUND; return LISTBOX_ENTRY_NOTFOUND;
} }
...@@ -633,45 +637,32 @@ USHORT LineListBox::GetEntryPos( long nLine1, long nLine2, ...@@ -633,45 +637,32 @@ USHORT LineListBox::GetEntryPos( long nLine1, long nLine2,
long LineListBox::GetEntryLine1( USHORT nPos ) const long LineListBox::GetEntryLine1( USHORT nPos ) const
{ {
ImpLineListData* pData = pLineList->GetObject( nPos ); ImpLineListData* pData = (nPos < pLineList->size()) ? (*pLineList)[ nPos ] : NULL;
if ( pData ) return ( pData ) ? pData->nLine1 : 0;
return pData->nLine1;
else
return 0;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
long LineListBox::GetEntryLine2( USHORT nPos ) const long LineListBox::GetEntryLine2( USHORT nPos ) const
{ {
ImpLineListData* pData = pLineList->GetObject( nPos ); ImpLineListData* pData = (nPos < pLineList->size()) ? (*pLineList)[ nPos ] : NULL;
if ( pData ) return ( pData ) ? pData->nLine2 : 0;
return pData->nLine2;
else
return 0;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
long LineListBox::GetEntryDistance( USHORT nPos ) const long LineListBox::GetEntryDistance( USHORT nPos ) const
{ {
ImpLineListData* pData = pLineList->GetObject( nPos ); ImpLineListData* pData = (nPos < pLineList->size()) ? (*pLineList)[ nPos ] : NULL;
if ( pData ) return ( pData ) ? pData->nDistance : 0;
return pData->nDistance;
else
return 0;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
USHORT LineListBox::GetEntryStyle( USHORT nPos ) const USHORT LineListBox::GetEntryStyle( USHORT nPos ) const
{ {
USHORT nStyle = STYLE_SOLID; ImpLineListData* pData = (nPos < pLineList->size()) ? (*pLineList)[ nPos ] : NULL;
ImpLineListData* pData = pLineList->GetObject( nPos ); return ( pData ) ? pData->nStyle : STYLE_SOLID;
if ( pData )
nStyle = pData->nStyle;
return nStyle;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -680,7 +671,7 @@ void LineListBox::UpdateLineColors( void ) ...@@ -680,7 +671,7 @@ void LineListBox::UpdateLineColors( void )
{ {
if( UpdatePaintLineColor() ) if( UpdatePaintLineColor() )
{ {
ULONG nCount = pLineList->Count(); size_t nCount = pLineList->size();
if( !nCount ) if( !nCount )
return; return;
...@@ -690,10 +681,10 @@ void LineListBox::UpdateLineColors( void ) ...@@ -690,10 +681,10 @@ void LineListBox::UpdateLineColors( void )
// exchange entries which containing lines // exchange entries which containing lines
SetUpdateMode( FALSE ); SetUpdateMode( FALSE );
USHORT nSelEntry = GetSelectEntryPos(); USHORT nSelEntry = GetSelectEntryPos();
for( ULONG n = 0 ; n < nCount ; ++n ) for( size_t n = 0 ; n < nCount ; ++n )
{ {
ImpLineListData* pData = pLineList->GetObject( n ); ImpLineListData* pData = (*pLineList)[ n ];
if( pData ) if( pData )
{ {
// exchange listbox data // exchange listbox data
......
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