Kaydet (Commit) 1ea153bb authored tarafından Matteo Casalin's avatar Matteo Casalin

Use better/auto int types, remove a couple of OUStrings copies

Change-Id: I911742bddba1dac2641d7d2ac1dad0ed195474dd
üst 58cfb9b0
...@@ -1581,7 +1581,7 @@ void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::s ...@@ -1581,7 +1581,7 @@ void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::s
VclPtr< ListBox > pBox = GetAs< ListBox >(); VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox ) if ( pBox )
{ {
for ( sal_uInt16 n = nCount; n; ) for ( sal_Int16 n = nCount; n; )
pBox->RemoveEntry( nPos + (--n) ); pBox->RemoveEntry( nPos + (--n) );
} }
} }
...@@ -1613,12 +1613,12 @@ OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Run ...@@ -1613,12 +1613,12 @@ OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Run
VclPtr< ListBox > pBox = GetAs< ListBox >(); VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox ) if ( pBox )
{ {
sal_uInt16 nEntries = pBox->GetEntryCount(); auto n = pBox->GetEntryCount();
aSeq = ::com::sun::star::uno::Sequence< OUString>( nEntries ); aSeq = ::com::sun::star::uno::Sequence< OUString>( n );
for ( sal_uInt16 n = nEntries; n; ) while (n)
{ {
--n; --n;
aSeq.getArray()[n] = OUString( pBox->GetEntry( n ) ); aSeq.getArray()[n] = pBox->GetEntry( n );
} }
} }
return aSeq; return aSeq;
...@@ -1639,9 +1639,9 @@ sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::Runtime ...@@ -1639,9 +1639,9 @@ sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::Runtime
VclPtr< ListBox > pBox = GetAs< ListBox >(); VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox ) if ( pBox )
{ {
sal_uInt16 nSelEntries = pBox->GetSelectEntryCount(); const sal_Int32 nSelEntries = pBox->GetSelectEntryCount();
aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nSelEntries ); aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nSelEntries );
for ( sal_uInt16 n = 0; n < nSelEntries; n++ ) for ( sal_Int32 n = 0; n < nSelEntries; ++n )
aSeq.getArray()[n] = pBox->GetSelectEntryPos( n ); aSeq.getArray()[n] = pBox->GetSelectEntryPos( n );
} }
return aSeq; return aSeq;
...@@ -1666,10 +1666,10 @@ OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeExce ...@@ -1666,10 +1666,10 @@ OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeExce
VclPtr< ListBox > pBox = GetAs< ListBox >(); VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox ) if ( pBox )
{ {
sal_uInt16 nSelEntries = pBox->GetSelectEntryCount(); const sal_Int32 nSelEntries = pBox->GetSelectEntryCount();
aSeq = ::com::sun::star::uno::Sequence< OUString>( nSelEntries ); aSeq = ::com::sun::star::uno::Sequence< OUString>( nSelEntries );
for ( sal_uInt16 n = 0; n < nSelEntries; n++ ) for ( sal_Int32 n = 0; n < nSelEntries; ++n )
aSeq.getArray()[n] = OUString( pBox->GetSelectEntry( n ) ); aSeq.getArray()[n] = pBox->GetSelectEntry( n );
} }
return aSeq; return aSeq;
} }
...@@ -1701,9 +1701,9 @@ void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int1 ...@@ -1701,9 +1701,9 @@ void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int1
if ( pBox ) if ( pBox )
{ {
bool bChanged = false; bool bChanged = false;
for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; ) for ( auto n = aPositions.getLength(); n; )
{ {
sal_uInt16 nPos = (sal_uInt16) aPositions.getConstArray()[--n]; const auto nPos = aPositions.getConstArray()[--n];
if ( pBox->IsEntryPosSelected( nPos ) != bool(bSelect) ) if ( pBox->IsEntryPosSelected( nPos ) != bool(bSelect) )
{ {
pBox->SelectEntryPos( nPos, bSelect ); pBox->SelectEntryPos( nPos, bSelect );
...@@ -1891,7 +1891,7 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s ...@@ -1891,7 +1891,7 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::uno::Sequence<sal_Int16> aItems; ::com::sun::star::uno::Sequence<sal_Int16> aItems;
if ( Value >>= aItems ) if ( Value >>= aItems )
{ {
for ( sal_uInt16 n = pListBox->GetEntryCount(); n; ) for ( auto n = pListBox->GetEntryCount(); n; )
pListBox->SelectEntryPos( --n, false ); pListBox->SelectEntryPos( --n, false );
if ( aItems.getLength() ) if ( aItems.getLength() )
...@@ -1947,10 +1947,10 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s ...@@ -1947,10 +1947,10 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
break; break;
case BASEPROPERTY_STRINGITEMLIST: case BASEPROPERTY_STRINGITEMLIST:
{ {
sal_uInt16 nItems = pListBox->GetEntryCount(); const sal_Int32 nItems = pListBox->GetEntryCount();
::com::sun::star::uno::Sequence< OUString> aSeq( nItems ); ::com::sun::star::uno::Sequence< OUString> aSeq( nItems );
OUString* pStrings = aSeq.getArray(); OUString* pStrings = aSeq.getArray();
for ( sal_uInt16 n = 0; n < nItems; n++ ) for ( sal_Int32 n = 0; n < nItems; ++n )
pStrings[n] = pListBox->GetEntry( n ); pStrings[n] = pListBox->GetEntry( n );
aProp <<= aSeq; aProp <<= aSeq;
...@@ -4288,9 +4288,9 @@ OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru ...@@ -4288,9 +4288,9 @@ OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru
VclPtr< ComboBox > pBox = GetAs< ComboBox >(); VclPtr< ComboBox > pBox = GetAs< ComboBox >();
if ( pBox ) if ( pBox )
{ {
sal_uInt16 nEntries = pBox->GetEntryCount(); auto n = pBox->GetEntryCount();
aSeq = ::com::sun::star::uno::Sequence< OUString>( nEntries ); aSeq = ::com::sun::star::uno::Sequence< OUString>( n );
for ( sal_uInt16 n = nEntries; n; ) while ( n )
{ {
--n; --n;
aSeq.getArray()[n] = pBox->GetEntry( n ); aSeq.getArray()[n] = pBox->GetEntry( n );
...@@ -4398,10 +4398,10 @@ void VCLXComboBox::setProperty( const OUString& PropertyName, const ::com::sun:: ...@@ -4398,10 +4398,10 @@ void VCLXComboBox::setProperty( const OUString& PropertyName, const ::com::sun::
break; break;
case BASEPROPERTY_STRINGITEMLIST: case BASEPROPERTY_STRINGITEMLIST:
{ {
sal_uInt16 nItems = pComboBox->GetEntryCount(); const sal_Int32 nItems = pComboBox->GetEntryCount();
::com::sun::star::uno::Sequence< OUString> aSeq( nItems ); ::com::sun::star::uno::Sequence< OUString> aSeq( nItems );
OUString* pStrings = aSeq.getArray(); OUString* pStrings = aSeq.getArray();
for ( sal_uInt16 n = 0; n < nItems; n++ ) for ( sal_Int32 n = 0; n < nItems; ++n )
pStrings[n] = pComboBox->GetEntry( n ); pStrings[n] = pComboBox->GetEntry( n );
aProp <<= aSeq; aProp <<= aSeq;
......
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