[Libreoffice-commits] .: 5 commits - svtools/source tools/bootstrp tools/inc tools/source vcl/inc vcl/source vcl/unx vcl/util
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Feb 15 07:55:44 PST 2011
svtools/source/dialogs/filedlg2.cxx | 30 ++++++++---------------
svtools/source/dialogs/filedlg2.hxx | 4 ---
tools/bootstrp/command.cxx | 3 +-
tools/inc/tools/inetdef.hxx | 4 +++
tools/inc/tools/prex.h | 4 ++-
tools/inc/tools/solar.h | 2 +
tools/source/fsys/unx.cxx | 14 +++++-----
tools/source/stream/strmunx.cxx | 10 ++++---
vcl/inc/vcl/settings.hxx | 2 -
vcl/inc/vcl/unohelp.hxx | 8 +++++-
vcl/source/app/settings.cxx | 34 --------------------------
vcl/source/app/unohelp.cxx | 17 -------------
vcl/source/control/ilstbox.cxx | 46 ++++++++++++++++++++++--------------
vcl/unx/inc/saldata.hxx | 2 -
vcl/unx/inc/salunx.h | 2 -
vcl/unx/source/app/i18n_ic.cxx | 4 +--
vcl/unx/source/app/saldisp.cxx | 6 +++-
vcl/util/makefile.mk | 2 -
18 files changed, 80 insertions(+), 114 deletions(-)
New commits:
commit 78bba90d9c0f9bad6140764b37001908e1a0c747
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 15 12:57:54 2011 +0000
remove Collator headers
diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx
index c79e7e6..03754ec 100644
--- a/vcl/source/app/unohelp.cxx
+++ b/vcl/source/app/unohelp.cxx
@@ -39,7 +39,6 @@
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/i18n/XCharacterClassification.hpp>
-#include <com/sun/star/i18n/XCollator.hpp>
#include <com/sun/star/awt/XExtendedToolkit.hpp>
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 7d13273..458099a 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -40,7 +40,6 @@
#include <vcl/i18nhelp.hxx>
#include <vcl/controldata.hxx>
#include <vcl/unohelp.hxx>
-#include <com/sun/star/i18n/XCollator.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
commit 156372046376f5b8346b844df08ccd0668136333
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 15 12:42:34 2011 +0000
these fairly heavy weight Collator Wrappers aren't used
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx
index aebfd64..e7d39cc 100644
--- a/vcl/inc/vcl/settings.hxx
+++ b/vcl/inc/vcl/settings.hxx
@@ -1179,8 +1179,6 @@ private:
LanguageType meUILanguage;
LocaleDataWrapper* mpLocaleDataWrapper;
LocaleDataWrapper* mpUILocaleDataWrapper;
- CollatorWrapper* mpCollatorWrapper;
- CollatorWrapper* mpUICollatorWrapper;
vcl::I18nHelper* mpI18nHelper;
vcl::I18nHelper* mpUII18nHelper;
LocaleConfigurationListener* mpLocaleCfgListener;
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 74c2c9a..c6cbfbc 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -1584,8 +1584,6 @@ ImplAllSettingsData::ImplAllSettingsData()
meUILanguage = LANGUAGE_SYSTEM;
mpLocaleDataWrapper = NULL;
mpUILocaleDataWrapper = NULL;
- mpCollatorWrapper = NULL;
- mpUICollatorWrapper = NULL;
mpI18nHelper = NULL;
mpUII18nHelper = NULL;
maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
@@ -1611,8 +1609,6 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
// called
mpLocaleDataWrapper = NULL;
mpUILocaleDataWrapper = NULL;
- mpCollatorWrapper = NULL;
- mpUICollatorWrapper = NULL;
mpI18nHelper = NULL;
mpUII18nHelper = NULL;
}
@@ -1625,10 +1621,6 @@ ImplAllSettingsData::~ImplAllSettingsData()
delete mpLocaleDataWrapper;
if ( mpUILocaleDataWrapper )
delete mpUILocaleDataWrapper;
- if ( mpCollatorWrapper )
- delete mpCollatorWrapper;
- if ( mpUICollatorWrapper )
- delete mpUICollatorWrapper;
if ( mpI18nHelper )
delete mpI18nHelper;
if ( mpUII18nHelper )
@@ -2056,32 +2048,6 @@ const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
return *mpData->mpUII18nHelper;
}
-
-// -----------------------------------------------------------------------
-/*
-const CollatorWrapper& AllSettings::GetCollatorWrapper() const
-{
- if ( !mpData->mpCollatorWrapper )
- {
- ((AllSettings*)this)->mpData->mpCollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() );
- ((AllSettings*)this)->mpData->mpCollatorWrapper->loadDefaultCollator( GetLocale(), 0 );
- }
- return *mpData->mpCollatorWrapper;
-}
-*/
-// -----------------------------------------------------------------------
-/*
-const CollatorWrapper& AllSettings::GetUICollatorWrapper() const
-{
- if ( !mpData->mpUICollatorWrapper )
- {
- ((AllSettings*)this)->mpData->mpUICollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() );
- ((AllSettings*)this)->mpData->mpUICollatorWrapper->loadDefaultCollator( GetUILocale(), 0 );
- }
- return *mpData->mpUICollatorWrapper;
-}
-*/
-
void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint )
{
AllSettings aAllSettings( Application::GetSettings() );
commit 05c77c0d10fb43ff4987278fde7b720469a57e03
Author: Francois Tigeot <ftigeot at wolfpond.org>
Date: Tue Feb 15 12:12:14 2011 +0000
dragonfly stuff
diff --git a/tools/bootstrp/command.cxx b/tools/bootstrp/command.cxx
index 08321c4..2d705dd 100644
--- a/tools/bootstrp/command.cxx
+++ b/tools/bootstrp/command.cxx
@@ -73,7 +73,8 @@
#include <sys/types.h>
#include <unistd.h>
#if ( defined NETBSD ) || defined (FREEBSD) || defined (AIX) \
- || defined (HPUX) || defined (MACOSX) || defined (OPENBSD)
+ || defined (HPUX) || defined (MACOSX) || defined (OPENBSD) \
+ || defined(DRAGONFLY)
#include <sys/wait.h>
#else
#include <wait.h>
diff --git a/tools/inc/tools/inetdef.hxx b/tools/inc/tools/inetdef.hxx
index ac2f8bc..89345f4 100644
--- a/tools/inc/tools/inetdef.hxx
+++ b/tools/inc/tools/inetdef.hxx
@@ -63,6 +63,10 @@
#define TOOLS_INETDEF_OS "OpenBSD/i386"
#elif defined OPENBSD && defined X86_64
#define TOOLS_INETDEF_OS "OpenBSD/amd64"
+#elif defined DRAGONFLY && defined X86
+#define TOOLS_INETDEF_OS "DragonFly/i386"
+#elif defined DRAGONFLY && defined X86_64
+#define TOOLS_INETDEF_OS "DragonFly/amd64"
#elif defined SINIX
#define TOOLS_INETDEF_OS "SINIX"
#else // AIX, HPUX, SOLARIS, ...
diff --git a/tools/inc/tools/prex.h b/tools/inc/tools/prex.h
index 3cc8f32..2a5dfd6 100644
--- a/tools/inc/tools/prex.h
+++ b/tools/inc/tools/prex.h
@@ -48,7 +48,9 @@
extern "C" {
#endif
-#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(NETBSD) || defined(OPENBSD) // should really check for xfree86 or for X11R6.1 and higher
+// FIXME: should really check for xfree86 or for X11R6.1 and higher
+#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(NETBSD) || \
+ defined(OPENBSD) || defined(DRAGONFLY)
#define __XKeyboardExtension__ 1
#else
#define __XKeyboardExtension__ 0
diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h
index 4d8d087..389dbc6 100644
--- a/tools/inc/tools/solar.h
+++ b/tools/inc/tools/solar.h
@@ -339,6 +339,8 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); }
#define __DLLEXTENSION "mxi.dylib"
#elif defined OPENBSD
#define __DLLEXTENSION "ob.so"
+#elif defined DRAGONFLY
+ #define __DLLEXTENSION "df.so"
#else
#error unknown plattform
#endif
diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx
index 989fe24..956faf8 100644
--- a/tools/source/fsys/unx.cxx
+++ b/tools/source/fsys/unx.cxx
@@ -45,8 +45,8 @@
extern "C" int mntctl( int cmd, size_t size, char* buf );
#elif defined(NETBSD)
#include <sys/mount.h>
-#elif defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD)
-#elif defined DECUNIX
+#elif defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \
+ defined(DECUNIX) || defined(DRAGONFLY)
struct mnttab
{
char *mnt_dir;
@@ -92,7 +92,7 @@ struct mymnttab
#if defined(NETBSD) || defined(FREEBSD) || defined(MACOSX) || \
- defined(OPENBSD)
+ defined(OPENBSD) || defined(DRAGONFLY)
BOOL GetMountEntry(dev_t /* dev */, struct mymnttab * /* mytab */ )
{
DBG_WARNING( "Sorry, not implemented: GetMountEntry" );
@@ -179,13 +179,13 @@ static BOOL GetMountEntry(dev_t dev, struct mymnttab *mytab)
if ((stat (mnt->MOUNTPOINT, &buf) == -1) || (buf.st_dev != dev))
continue;
}
-# ifdef LINUX
+# ifdef LINUX
/* #61624# File mit setmntent oeffnen und mit fclose schliessen stoesst
bei der glibc-2.1 auf wenig Gegenliebe */
endmntent( fp );
-# else
+# else
fclose (fp);
-# endif
+# endif
mytab->mountspecial = mnt->MOUNTSPECIAL;
mytab->mountpoint = mnt->MOUNTPOINT;
mytab->mountdevice = dev;
@@ -218,7 +218,7 @@ BOOL DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const
if (eFormatter==FSYS_STYLE_HOST)
{
-#ifdef NETBSD
+#if defined(NETBSD) || defined(DRAGONFLY)
return TRUE;
#else
struct stat buf;
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 462bd9a..7f65a36 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -210,8 +210,9 @@ static sal_uInt32 GetSvError( int nErrno )
{ 0, SVSTREAM_OK },
{ EACCES, SVSTREAM_ACCESS_DENIED },
{ EBADF, SVSTREAM_INVALID_HANDLE },
-#if defined( RS6000 ) || defined( ALPHA ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) || \
- defined(OPENBSD) || defined(__FreeBSD_kernel__) || defined ( AIX )
+#if defined(RS6000) || defined(ALPHA) || defined(NETBSD) || \
+ defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \
+ defined(__FreeBSD_kernel__) || defined (AIX) || defined(DRAGONFLY)
{ EDEADLK, SVSTREAM_LOCKING_VIOLATION },
#else
{ EDEADLOCK, SVSTREAM_LOCKING_VIOLATION },
@@ -225,8 +226,9 @@ static sal_uInt32 GetSvError( int nErrno )
{ EAGAIN, SVSTREAM_LOCKING_VIOLATION },
{ EISDIR, SVSTREAM_PATH_NOT_FOUND },
{ ELOOP, SVSTREAM_PATH_NOT_FOUND },
-#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) && \
- !defined(OPENBSD) && ! defined(__FreeBSD_kernel__)
+#if !defined(RS6000) && !defined(ALPHA) && !defined(NETBSD) && !defined (FREEBSD) && \
+ !defined(MACOSX) && !defined(OPENBSD) && !defined(__FreeBSD_kernel__) && \
+ !defined(DRAGONFLY)
{ EMULTIHOP, SVSTREAM_PATH_NOT_FOUND },
{ ENOLINK, SVSTREAM_PATH_NOT_FOUND },
#endif
diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx
index 4164a0f..a6be9a5 100644
--- a/vcl/unx/inc/saldata.hxx
+++ b/vcl/unx/inc/saldata.hxx
@@ -48,7 +48,7 @@ class SalPrinter;
DECLARE_LIST( SalDisplays, SalDisplay* )
#if defined SCO || defined LINUX || defined NETBSD || defined AIX || \
- defined HPUX || defined FREEBSD || defined OPENBSD
+ defined HPUX || defined FREEBSD || defined OPENBSD || defined DRAGONFLY
#include <pthread.h>
#else
typedef unsigned int pthread_t;
diff --git a/vcl/unx/inc/salunx.h b/vcl/unx/inc/salunx.h
index 5946492..0837801 100644
--- a/vcl/unx/inc/salunx.h
+++ b/vcl/unx/inc/salunx.h
@@ -31,7 +31,7 @@
// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#if defined SCO || defined LINUX || defined HPUX || defined FREEBSD || \
- defined NETBSD || defined OPENBSD
+ defined NETBSD || defined OPENBSD || defined DRAGONFLY
#include <sys/time.h>
#elif defined AIX
#include <time.h>
diff --git a/vcl/unx/source/app/i18n_ic.cxx b/vcl/unx/source/app/i18n_ic.cxx
index 22f7b1e..df7e545 100644
--- a/vcl/unx/source/app/i18n_ic.cxx
+++ b/vcl/unx/source/app/i18n_ic.cxx
@@ -334,7 +334,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
if ( mnPreeditStyle != XIMPreeditNone )
{
-#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD
+#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || defined DRAGONFLY
if ( mpPreeditAttributes != NULL )
#endif
mpAttributes = XVaAddToNestedList( mpAttributes,
@@ -342,7 +342,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
}
if ( mnStatusStyle != XIMStatusNone )
{
-#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD
+#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || defined DRAGONFLY
if ( mpStatusAttributes != NULL )
#endif
mpAttributes = XVaAddToNestedList( mpAttributes,
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index b5f9aaa..ab7aad1 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -893,7 +893,8 @@ void SalDisplay::Init()
sscanf( pProperties, "%li", &nProperties_ );
else
{
-#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD
+#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || \
+ defined NETBSD || defined OPENBSD || defined DRAGONFLY
nProperties_ |= PROPERTY_FEATURE_Maximize;
#endif
// Server Bugs & Properties
@@ -919,7 +920,8 @@ void SalDisplay::Init()
if( GetServerVendor() == vendor_xfree )
{
nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor;
-#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD
+#if defined LINUX || defined FREEBSD || defined NETBSD || defined OPENBSD || \
+ defined DRAGONFLY
// otherwm and olwm are a kind of default, which are not detected
// carefully. if we are running linux (i.e. not netbsd) on an xfree
// display, fvwm is most probable the wm to choose, confusing with mwm
diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
index 20be25d..7f80738 100755
--- a/vcl/util/makefile.mk
+++ b/vcl/util/makefile.mk
@@ -328,7 +328,7 @@ SHL2STDLIBS+=`pkg-config --libs xrender`
SHL2STDLIBS += -lXext -lSM -lICE -lX11
.IF "$(OS)"!="MACOSX" && "$(OS)"!="FREEBSD" && "$(OS)"!="NETBSD" && \
- && "$(OS)"!="OPENBSD"
+ && "$(OS)"!="OPENBSD" "$(OS)"!="DRAGONFLY"
# needed by salprnpsp.cxx
SHL2STDLIBS+= -ldl
.ENDIF
commit 6b0b9c1f9bf382a503c0fc34591eb5ab2103a26c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Feb 14 20:56:28 2011 +0000
use Natural sort as default sort for listboxes, etc.
diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx
index 676defa..7dcae4f 100644
--- a/svtools/source/dialogs/filedlg2.cxx
+++ b/svtools/source/dialogs/filedlg2.cxx
@@ -40,7 +40,7 @@
#include <filedlg2.hrc>
#include <vcl/msgbox.hxx>
#include <osl/security.hxx>
-#include <com/sun/star/i18n/XCollator.hpp>
+#include <comphelper/string.hxx>
#include <svtools/stdctrl.hxx>
@@ -131,12 +131,6 @@ ImpPathDialog::ImpPathDialog( PathDialog* pDlg, RESOURCE_TYPE nType, BOOL bCreat
}
pDlg->SetHelpId( HID_FILEDLG_PATHDLG );
-
- lang::Locale aLocale = Application::GetSettings().GetLocale();
- xCollator = ::vcl::unohelper::CreateCollator();
- if( xCollator.is() )
- xCollator->loadDefaultCollator( aLocale, 1 );
- DBG_ASSERT( xCollator.is(), "not collator service for path dialog" );
}
ImpPathDialog::~ImpPathDialog()
@@ -454,6 +448,8 @@ void ImpPathDialog::UpdateEntries( const BOOL )
if( nEntries )
{
UniStringList aSortDirList;
+ const comphelper::string::NaturalStringSorter& rSorter =
+ ::vcl::unohelper::getNaturalStringSorterForAppLocale();
for ( USHORT n = 0; n < nEntries; n++ )
{
DirEntry& rEntry = aDir[n];
@@ -463,12 +459,9 @@ void ImpPathDialog::UpdateEntries( const BOOL )
if( FileStat( rEntry ).GetKind() & FSYS_KIND_DIR )
{
size_t l = 0;
- if( xCollator.is() )
- {
- for( l = 0; l < aSortDirList.size(); l++ )
- if( xCollator->compareString( *aSortDirList[ l ], aName ) > 0 )
- break;
- }
+ for( l = 0; l < aSortDirList.size(); l++ )
+ if( rSorter.compare( *aSortDirList[ l ], aName ) > 0 )
+ break;
if ( l < aSortDirList.size() ) {
UniStringList::iterator it = aSortDirList.begin();
::std::advance( it, l );
@@ -1018,6 +1011,8 @@ void ImpFileDialog::UpdateEntries( const BOOL bWithDirs )
if ( nEntries )
{
UniStringList aSortDirList;
+ const comphelper::string::NaturalStringSorter& rSorter =
+ ::vcl::unohelper::getNaturalStringSorterForAppLocale();
for ( USHORT n = 0; n < nEntries; n++ )
{
DirEntry& rEntry = aDir[n];
@@ -1048,12 +1043,9 @@ void ImpFileDialog::UpdateEntries( const BOOL bWithDirs )
else
{
size_t l = 0;
- if( xCollator.is() )
- {
- for( l = 0; l < aSortDirList.size(); l++ )
- if( xCollator->compareString( *aSortDirList[ l ], aName ) > 0 )
- break;
- }
+ for( l = 0; l < aSortDirList.size(); l++ )
+ if( rSorter.compare( *aSortDirList[ l ], aName ) > 0 )
+ break;
if ( l < aSortDirList.size() ) {
UniStringList::iterator it = aSortDirList.begin();
::std::advance( it, l );
diff --git a/svtools/source/dialogs/filedlg2.hxx b/svtools/source/dialogs/filedlg2.hxx
index 7e19335..fb44fcd 100644
--- a/svtools/source/dialogs/filedlg2.hxx
+++ b/svtools/source/dialogs/filedlg2.hxx
@@ -96,10 +96,6 @@ private:
DirEntry aPath; // aktuell angewaehlter Pfad
USHORT nDirCount; // Anzahl der Verzeichnis-
// Verschachtelungen
-
- ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator >
- xCollator;
-
protected:
virtual void UpdateEntries( const BOOL bWithDirs );
commit 5cee52c4e132bc83d3840213ef303b53f7212989
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Feb 14 20:56:14 2011 +0000
use Natural sort as default sort for listboxes, etc.
diff --git a/vcl/inc/vcl/unohelp.hxx b/vcl/inc/vcl/unohelp.hxx
index a24633d..401021e 100644
--- a/vcl/inc/vcl/unohelp.hxx
+++ b/vcl/inc/vcl/unohelp.hxx
@@ -54,6 +54,11 @@ namespace accessibility {
}
}}}
+namespace comphelper {
+ namespace string {
+ class NaturalStringSorter;
+}}
+
namespace vcl
{
namespace unohelper
@@ -61,7 +66,8 @@ namespace unohelper
VCL_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetMultiServiceFactory();
VCL_DLLPUBLIC ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > CreateBreakIterator();
VCL_DLLPUBLIC ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification> CreateCharacterClassification();
-VCL_DLLPUBLIC ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCollator > CreateCollator();
+//Get access to singleton Natural String Sorter collating for Application::GetLocale
+VCL_DLLPUBLIC const comphelper::string::NaturalStringSorter& getNaturalStringSorterForAppLocale();
VCL_DLLPUBLIC ::rtl::OUString CreateLibraryName( const sal_Char* pModName, sal_Bool bSUPD );
VCL_DLLPUBLIC void NotifyAccessibleStateEventGlobally( const ::com::sun::star::accessibility::AccessibleEventObject& rEventObject );
}} // namespace vcl::unohelper
diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx
index f9d6923..c79e7e6 100644
--- a/vcl/source/app/unohelp.cxx
+++ b/vcl/source/app/unohelp.cxx
@@ -171,22 +171,6 @@ uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacte
return xB;
}
-uno::Reference < i18n::XCollator > vcl::unohelper::CreateCollator()
-{
- uno::Reference < i18n::XCollator > xB;
- uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory();
- if ( xMSF.is() )
- {
- uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.Collator")) );
- if ( xI.is() )
- {
- uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XCollator >*)0) );
- x >>= xB;
- }
- }
- return xB;
-}
-
::rtl::OUString vcl::unohelper::CreateLibraryName( const sal_Char* pModName, sal_Bool bSUPD )
{
// create variable library name suffixes
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index ae2cc47..7d13273 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -46,6 +46,10 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <rtl/instance.hxx>
+#include <comphelper/string.hxx>
+#include <comphelper/processfactory.hxx>
+
#define MULTILINE_ENTRY_DRAW_FLAGS ( TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE | TEXT_DRAW_VCENTER )
using namespace ::com::sun::star;
@@ -144,17 +148,29 @@ void ImplEntryList::SelectEntry( USHORT nPos, BOOL bSelect )
}
}
-// -----------------------------------------------------------------------
-
-uno::Reference< i18n::XCollator > ImplGetCollator (lang::Locale &rLocale)
+namespace
{
- static uno::Reference< i18n::XCollator > xCollator;
- if ( !xCollator.is() )
- xCollator = vcl::unohelper::CreateCollator();
- if( xCollator.is() )
- xCollator->loadDefaultCollator (rLocale, 0);
+ struct theSorter
+ : public rtl::StaticWithInit< comphelper::string::NaturalStringSorter, theSorter >
+ {
+ comphelper::string::NaturalStringSorter operator () ()
+ {
+ return comphelper::string::NaturalStringSorter(
+ ::comphelper::getProcessComponentContext(),
+ Application::GetSettings().GetLocale());
+ }
+ };
+}
- return xCollator;
+namespace vcl
+{
+ namespace unohelper
+ {
+ const comphelper::string::NaturalStringSorter& getNaturalStringSorterForAppLocale()
+ {
+ return theSorter::get();
+ }
+ }
}
USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL bSort )
@@ -168,8 +184,7 @@ USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL b
}
else
{
- lang::Locale aLocale = Application::GetSettings().GetLocale();
- uno::Reference< i18n::XCollator > xCollator = ImplGetCollator(aLocale);
+ const comphelper::string::NaturalStringSorter &rSorter = theSorter::get();
const XubString& rStr = pNewEntry->maStr;
ULONG nLow, nHigh, nMid;
@@ -182,9 +197,7 @@ USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL b
{
// XXX even though XCollator::compareString returns a sal_Int32 the only
// defined values are {-1, 0, 1} which is compatible with StringCompare
- StringCompare eComp = xCollator.is() ?
- (StringCompare)xCollator->compareString (rStr, pTemp->maStr)
- : COMPARE_EQUAL;
+ StringCompare eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
// Schnelles Einfuegen bei sortierten Daten
if ( eComp != COMPARE_LESS )
@@ -196,7 +209,7 @@ USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL b
nLow = mnMRUCount;
pTemp = (ImplEntryType*)GetEntry( (USHORT)nLow );
- eComp = (StringCompare)xCollator->compareString (rStr, pTemp->maStr);
+ eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
if ( eComp != COMPARE_GREATER )
{
Insert( pNewEntry, (ULONG)0 );
@@ -210,7 +223,7 @@ USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL b
nMid = (nLow + nHigh) / 2;
pTemp = (ImplEntryType*)GetObject( nMid );
- eComp = (StringCompare)xCollator->compareString (rStr, pTemp->maStr);
+ eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
if ( eComp == COMPARE_LESS )
nHigh = nMid-1;
More information about the Libreoffice-commits
mailing list