Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hello lo-devs,

this patch removes another use of the tools Table class.

regards

Marcel Metz

---
 vcl/source/control/combobox.cxx |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)


diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 584e493..97abfc1 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -27,6 +27,7 @@
  ************************************************************************/
 
 
+#include <set>
 #include <comphelper/string.hxx>
 #include <tools/table.hxx>
 #include <tools/debug.hxx>
@@ -44,15 +45,7 @@
 
 // =======================================================================
 
-inline sal_uLong ImplCreateKey( sal_uInt16 nPos )
-{
-    // Key = Pos+1, wegen Pos 0
-    return nPos+1;
-}
-
-// -----------------------------------------------------------------------
-
-static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText, xub_Unicode 
cTokenSep, const ImplEntryList* pEntryList )
+static void lcl_GetSelectedEntries( ::std::set< sal_uInt16 >& rSelectedPos, const XubString& 
rText, xub_Unicode cTokenSep, const ImplEntryList* pEntryList )
 {
     for (xub_StrLen n = comphelper::string::getTokenCount(rText, cTokenSep); n;)
     {
@@ -60,7 +53,7 @@ static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText,
         aToken = comphelper::string::strip(aToken, ' ');
         sal_uInt16 nPos = pEntryList->FindEntry( aToken );
         if ( nPos != LISTBOX_ENTRY_NOTFOUND )
-            rSelectedPos.Insert( ImplCreateKey( nPos ), (void*)sal_IntPtr(1L) );
+            rSelectedPos.insert( nPos );
     }
 }
 
@@ -417,13 +410,13 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
             }
 
             // Fehlende Eintraege anhaengen...
-            Table aSelInText;
+            ::std::set< sal_uInt16 > aSelInText;
             lcl_GetSelectedEntries( aSelInText, aText, mcMultiSep, mpImplLB->GetEntryList() );
             sal_uInt16 nSelectedEntries = mpImplLB->GetEntryList()->GetSelectEntryCount();
             for ( sal_uInt16 n = 0; n < nSelectedEntries; n++ )
             {
                 sal_uInt16 nP = mpImplLB->GetEntryList()->GetSelectEntryPos( n );
-                if ( !aSelInText.IsKeyValid( ImplCreateKey( nP ) ) )
+                if ( !aSelInText.count( nP ) )
                 {
                     if ( aText.Len() && (aText.GetChar( aText.Len()-1 ) != mcMultiSep) )
                         aText += mcMultiSep;
@@ -952,10 +945,10 @@ void ComboBox::ImplUpdateFloatSelection()
     }
     else
     {
-        Table aSelInText;
+        ::std::set< sal_uInt16 > aSelInText;
         lcl_GetSelectedEntries( aSelInText, mpSubEdit->GetText(), mcMultiSep, 
mpImplLB->GetEntryList() );
         for ( sal_uInt16 n = 0; n < mpImplLB->GetEntryList()->GetEntryCount(); n++ )
-            mpImplLB->SelectEntry( n, aSelInText.IsKeyValid( ImplCreateKey( n ) ) );
+            mpImplLB->SelectEntry( n, aSelInText.count( n ) );
     }
     mpImplLB->SetCallSelectionChangedHdl( sal_True );
 }


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.