[Libreoffice-commits] .: svtools/source

Joseph Powers jpowers at kemper.freedesktop.org
Tue Feb 8 22:18:57 PST 2011


 svtools/source/dialogs/filedlg2.cxx |   58 +++++++++++++++++++++---------------
 1 file changed, 35 insertions(+), 23 deletions(-)

New commits:
commit c2bcd53df63fc20c16dd14d84df566839fdcd4fa
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Tue Feb 8 22:18:52 2011 -0800

    Remove DECLARE_LIST( UniStringList, UniString* )

diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx
index ab7b3da..f117499 100644
--- a/svtools/source/dialogs/filedlg2.cxx
+++ b/svtools/source/dialogs/filedlg2.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -43,6 +43,7 @@
 #include <com/sun/star/i18n/XCollator.hpp>
 
 #include <svtools/stdctrl.hxx>
+#include <vector>
 
 #ifdef _MSC_VER
 #pragma optimize ("", off)
@@ -53,8 +54,7 @@
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
 
-
-DECLARE_LIST( UniStringList, UniString* )
+typedef ::std::vector< UniString* > UniStringList;
 
 #define STD_BTN_WIDTH	80
 #define STD_BTN_HEIGHT	26
@@ -133,7 +133,7 @@ ImpPathDialog::ImpPathDialog( PathDialog* pDlg, RESOURCE_TYPE nType, BOOL bCreat
 
     pDlg->SetHelpId( HID_FILEDLG_PATHDLG );
 
-    lang::Locale aLocale = Application::GetSettings().GetLocale(); 
+    lang::Locale aLocale = Application::GetSettings().GetLocale();
     xCollator = ::vcl::unohelper::CreateCollator();
     if( xCollator.is() )
         xCollator->loadDefaultCollator( aLocale, 1 );
@@ -463,24 +463,30 @@ void ImpPathDialog::UpdateEntries( const BOOL )
             {
                 if( FileStat( rEntry ).GetKind() & FSYS_KIND_DIR )
                 {
-                    ULONG l = 0;
+                    size_t l = 0;
                     if( xCollator.is() )
                     {
-                        for( l = 0; l < aSortDirList.Count(); l++ )
-                            if( xCollator->compareString( *aSortDirList.GetObject(l), aName ) > 0 )
+                        for( l = 0; l < aSortDirList.size(); l++ )
+                            if( xCollator->compareString( *aSortDirList[ l ], aName ) > 0 )
                                 break;
                     }
-                    aSortDirList.Insert( new UniString( aName ), l );
+                    if ( l < aSortDirList.size() ) {
+                        UniStringList::iterator it = aSortDirList.begin();
+                        ::std::advance( it, l );
+                        aSortDirList.insert( it, new UniString( aName ) );
+                    } else {
+                        aSortDirList.push_back( new UniString( aName ) );
+                    }
                 }
             }
         }
 
-        for( ULONG l = 0; l < aSortDirList.Count(); l++ )
+        for( size_t l = 0; l < aSortDirList.size(); l++ )
         {
             UniString aEntryStr( aTabString );
-            aEntryStr += *aSortDirList.GetObject(l);
+            aEntryStr += *aSortDirList[ l ];
             pDirList->InsertEntry( aEntryStr );
-            delete aSortDirList.GetObject(l);
+            delete aSortDirList[ l ];
         }
     }
 
@@ -1017,7 +1023,7 @@ void ImpFileDialog::UpdateEntries( const BOOL bWithDirs )
     WildCard aTmpMask( aWildCard, ';' );
     if ( nEntries )
     {
-        UniStringList	aSortDirList;
+        UniStringList aSortDirList;
         for ( USHORT n = 0; n < nEntries; n++ )
         {
             DirEntry& rEntry = aDir[n];
@@ -1047,25 +1053,31 @@ void ImpFileDialog::UpdateEntries( const BOOL bWithDirs )
                     }
                     else
                     {
-                        ULONG l = 0;
+                        size_t l = 0;
                         if( xCollator.is() )
                         {
-                            for( l = 0; l < aSortDirList.Count(); l++ )
-                                if( xCollator->compareString( *aSortDirList.GetObject(l), aName ) > 0 )
+                            for( l = 0; l < aSortDirList.size(); l++ )
+                                if( xCollator->compareString( *aSortDirList[ l ], aName ) > 0 )
                                     break;
                         }
-                        aSortDirList.Insert( new UniString( aName ), l );
+                        if ( l < aSortDirList.size() ) {
+                            UniStringList::iterator it = aSortDirList.begin();
+                            ::std::advance( it, l );
+                            aSortDirList.insert( it, new UniString( aName ) );
+                        } else {
+                            aSortDirList.push_back( new UniString( aName ) );
+                        }
+                    }
+                }
             }
         }
-        }
-    }
-    for( ULONG l = 0; l < aSortDirList.Count(); l++ )
+        for( size_t l = 0; l < aSortDirList.size(); l++ )
         {
             UniString aEntryStr( aTabString );
-            aEntryStr += *aSortDirList.GetObject(l);
-        pDirList->InsertEntry( aEntryStr );
-        delete aSortDirList.GetObject(l);
-    }
+            aEntryStr += *aSortDirList[ l ];
+            pDirList->InsertEntry( aEntryStr );
+            delete aSortDirList[ l ];
+        }
     }
 
     if( bWithDirs )


More information about the Libreoffice-commits mailing list