Kaydet (Commit) 766f13a8 authored tarafından Matteo Casalin's avatar Matteo Casalin

Improved integer type consistence + some optimizations

Change-Id: I5e2a6ef9c3f744997e9e473e9431d590ba6f9d04
üst ae3d2a55
...@@ -68,10 +68,11 @@ using namespace ::com::sun::star; ...@@ -68,10 +68,11 @@ using namespace ::com::sun::star;
static void lcl_ClearLstBoxAndDelUserData( ListBox& rLstBox ) static void lcl_ClearLstBoxAndDelUserData( ListBox& rLstBox )
{ {
void* pDel; const sal_Int32 nEnd = rLstBox.GetEntryCount();
for( sal_uInt16 n = 0, nEnd = rLstBox.GetEntryCount(); n < nEnd; ++n ) for( sal_Int32 n = 0; n < nEnd; ++n )
if( 0 != ( pDel = rLstBox.GetEntryData( n )) ) {
delete (OUString*)pDel; delete reinterpret_cast<OUString *>(rLstBox.GetEntryData( n ));
}
rLstBox.Clear(); rLstBox.Clear();
} }
...@@ -426,41 +427,40 @@ IMPL_LINK( SwSortDlg, LanguageHdl, ListBox*, pLBox ) ...@@ -426,41 +427,40 @@ IMPL_LINK( SwSortDlg, LanguageHdl, ListBox*, pLBox )
if( !pColRes ) if( !pColRes )
pColRes = new CollatorResource(); pColRes = new CollatorResource();
const sal_uInt16 nLstBoxCnt = 3; const int nLstBoxCnt = 3;
ListBox* aLstArr[ nLstBoxCnt ] = { m_pTypDLB1, m_pTypDLB2, m_pTypDLB3 }; ListBox* aLstArr[ nLstBoxCnt ] = { m_pTypDLB1, m_pTypDLB2, m_pTypDLB3 };
sal_uInt16* aTypeArr[ nLstBoxCnt ] = { &nType1, &nType2, &nType3 }; sal_uInt16* aTypeArr[ nLstBoxCnt ] = { &nType1, &nType2, &nType3 };
OUString aOldStrArr[ nLstBoxCnt ]; OUString aOldStrArr[ nLstBoxCnt ];
sal_uInt16 n;
void* pUserData; for( int n = 0; n < nLstBoxCnt; ++n )
for( n = 0; n < nLstBoxCnt; ++n )
{ {
ListBox* pL = aLstArr[ n ]; ListBox* pL = aLstArr[ n ];
if( 0 != (pUserData = pL->GetEntryData( pL->GetSelectEntryPos())) ) void* pUserData = pL->GetEntryData( pL->GetSelectEntryPos() );
if (pUserData)
aOldStrArr[ n ] = *(OUString*)pUserData; aOldStrArr[ n ] = *(OUString*)pUserData;
::lcl_ClearLstBoxAndDelUserData( *pL ); ::lcl_ClearLstBoxAndDelUserData( *pL );
} }
sal_uInt16 nInsPos;
OUString sAlg, sUINm; OUString sAlg, sUINm;
for( long nCnt = 0, nEnd = aSeq.getLength(); nCnt <= nEnd; ++nCnt ) const sal_Int32 nEnd = aSeq.getLength();
for( sal_Int32 nCnt = 0; nCnt <= nEnd; ++nCnt )
{ {
if( nCnt < nEnd ) if( nCnt < nEnd )
sUINm = pColRes->GetTranslation( sAlg = aSeq[ nCnt ] ); sUINm = pColRes->GetTranslation( sAlg = aSeq[ nCnt ] );
else else
sUINm = sAlg = aNumericTxt; sUINm = sAlg = aNumericTxt;
for( n = 0; n < nLstBoxCnt; ++n ) for( int n = 0; n < nLstBoxCnt; ++n )
{ {
ListBox* pL = aLstArr[ n ]; ListBox* pL = aLstArr[ n ];
nInsPos = pL->InsertEntry( sUINm ); const sal_Int32 nInsPos = pL->InsertEntry( sUINm );
pL->SetEntryData( nInsPos, new OUString( sAlg )); pL->SetEntryData( nInsPos, new OUString( sAlg ));
if( pLBox && sAlg == aOldStrArr[ n ] ) if( pLBox && sAlg == aOldStrArr[ n ] )
pL->SelectEntryPos( nInsPos ); pL->SelectEntryPos( nInsPos );
} }
} }
for( n = 0; n < nLstBoxCnt; ++n ) for( int n = 0; n < nLstBoxCnt; ++n )
{ {
ListBox* pL = aLstArr[ n ]; ListBox* pL = aLstArr[ n ];
if( !pLBox ) if( !pLBox )
......
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