summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorFrank Meies <fme@openoffice.org>2002-08-23 07:17:26 +0000
committerFrank Meies <fme@openoffice.org>2002-08-23 07:17:26 +0000
commit6871f00aacc4974cfb4f558f5c2e021b8ce9e43d (patch)
treef668bd2d9b2c1fcbc835ea47f32c640fb9271057 /sw
parentd2b6006c8504e408f6a82b26290be50a035a0cf2 (diff)
#99877# Index sorting should use the locales and algorithms of the IndexEntrySupplier
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/toxwrap.hxx122
-rw-r--r--sw/source/core/tox/toxhlp.cxx36
-rw-r--r--sw/source/core/tox/txmsrt.cxx27
-rw-r--r--sw/source/ui/inc/cnttab.hxx12
4 files changed, 166 insertions, 31 deletions
diff --git a/sw/inc/toxwrap.hxx b/sw/inc/toxwrap.hxx
new file mode 100644
index 000000000000..65b5f4993ad0
--- /dev/null
+++ b/sw/inc/toxwrap.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: toxwrap.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: fme $ $Date: 2002-08-23 08:10:20 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOXWRAP_HXX
+#define _TOXWRAP_HXX
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+
+#ifndef _SWUNODEF_HXX
+#include <swunodef.hxx>
+#endif
+
+namespace drafts { namespace com { namespace sun { namespace star {
+namespace i18n {
+ class XExtendedIndexEntrySupplier;
+}
+namespace lang {
+ class XMultiServiceFactory;
+}
+}}}};
+
+
+class String;
+
+class IndexEntrySupplierWrapper
+{
+ STAR_NMSPC::lang::Locale aLcl;
+ STAR_NMSPC::uno::Reference < drafts::com::sun::star::i18n::XExtendedIndexEntrySupplier > xIES;
+
+public:
+ IndexEntrySupplierWrapper();
+ ~IndexEntrySupplierWrapper();
+
+ void SetLocale( const STAR_NMSPC::lang::Locale& rLocale ) { aLcl = rLocale; }
+
+ String GetIndexKey( const String& rTxt, const String& rTxtReading,
+ const STAR_NMSPC::lang::Locale& rLocale ) const;
+
+ String GetFollowingText( BOOL bMorePages ) const;
+
+ STAR_NMSPC::uno::Sequence< ::rtl::OUString >
+ GetAlgorithmList( const STAR_NMSPC::lang::Locale& rLcl ) const;
+
+ STAR_NMSPC::uno::Sequence < com::sun::star::lang::Locale >
+ GetLocaleList() const;
+
+ sal_Bool LoadAlgorithm( const STAR_NMSPC::lang::Locale& rLcl,
+ const String& sSortAlgorithm, long nOptions ) const;
+
+ sal_Int16 CompareIndexEntry( const String& rTxt1, const String& rTxtReading1,
+ const STAR_NMSPC::lang::Locale& rLcl1,
+ const String& rTxt2, const String& rTxtReading2,
+ const STAR_NMSPC::lang::Locale& rLcl2 ) const;
+};
+
+#endif
diff --git a/sw/source/core/tox/toxhlp.cxx b/sw/source/core/tox/toxhlp.cxx
index 5b9c09c9ec39..45a6642ffd12 100644
--- a/sw/source/core/tox/toxhlp.cxx
+++ b/sw/source/core/tox/toxhlp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: toxhlp.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: fme $ $Date: 2002-06-26 09:32:38 $
+ * last change: $Author: fme $ $Date: 2002-08-23 08:13:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,16 +81,17 @@
#include <tools/debug.hxx>
#endif
-#ifndef _TOXHLP_HXX
-#include <toxhlp.hxx>
+#ifndef _TOXWRAP_HXX
+#include <toxwrap.hxx>
#endif
-IndexEntrySupplierWrapper::IndexEntrySupplierWrapper(
- const STAR_NMSPC::lang::Locale& rLcl,
- STAR_REFERENCE( lang::XMultiServiceFactory )& rxMSF )
- : aLcl( rLcl )
+IndexEntrySupplierWrapper::IndexEntrySupplierWrapper()
{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > rxMSF =
+ ::comphelper::getProcessServiceFactory();
+
try {
STAR_REFERENCE( uno::XInterface ) xI =
rxMSF->createInstance( ::rtl::OUString::createFromAscii(
@@ -171,6 +172,25 @@ IndexEntrySupplierWrapper::GetAlgorithmList( const STAR_NMSPC::lang::Locale& rLc
return sRet;
}
+STAR_NMSPC::uno::Sequence < com::sun::star::lang::Locale >
+IndexEntrySupplierWrapper::GetLocaleList() const
+{
+ ::com::sun::star::uno::Sequence< com::sun::star::lang::Locale > sRet;
+
+ try {
+ sRet = xIES->getLocaleList();
+ }
+ catch ( UNO_NMSPC::Exception& e )
+ {
+#ifndef PRODUCT
+ ByteString aMsg( "getLocaleList: Exception caught\n" );
+ aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
+ DBG_ERRORFILE( aMsg.GetBuffer() );
+#endif
+ }
+ return sRet;
+}
+
sal_Bool IndexEntrySupplierWrapper::LoadAlgorithm(
const STAR_NMSPC::lang::Locale& rLcl,
const String& sSortAlgorithm, long nOptions ) const
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 850a253fba93..f11917a4b672 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txmsrt.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: fme $ $Date: 2002-08-22 07:29:46 $
+ * last change: $Author: fme $ $Date: 2002-08-23 08:14:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,15 +71,6 @@
#ifndef _UNOTOOLS_CHARCLASS_HXX
#include <unotools/charclass.hxx>
#endif
-#ifndef _UNOTOOLS_COLLATORWRAPPER_HXX
-#include <unotools/collatorwrapper.hxx>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif
-#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
-#include <comphelper/processfactory.hxx>
-#endif
#ifndef _COM_SUN_STAR_I18N_COLLATOROPTIONS_HPP_
#include <com/sun/star/i18n/CollatorOptions.hpp>
#endif
@@ -141,8 +132,8 @@
#ifndef _AUTHFLD_HXX
#include <authfld.hxx>
#endif
-#ifndef _TOXHLP_HXX
-#include <toxhlp.hxx>
+#ifndef _TOXWRAP_HXX
+#include <toxwrap.hxx>
#endif
#ifndef _COMCORE_HRC
@@ -177,17 +168,15 @@ SwTOXInternational::SwTOXInternational( const SwTOXInternational& rIntl ) :
sSortAlgorithm(rIntl.sSortAlgorithm),
nOptions( rIntl.nOptions )
{
- Init();
+ Init();
}
void SwTOXInternational::Init()
{
- ::com::sun::star::lang::Locale aLcl( SvxCreateLocale( eLang ));
- ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory > xMSF =
- ::comphelper::getProcessServiceFactory();
+ pIndexWrapper = new IndexEntrySupplierWrapper();
- pIndexWrapper = new IndexEntrySupplierWrapper( aLcl, xMSF );
+ const ::com::sun::star::lang::Locale aLcl( SvxCreateLocale( eLang ) );
+ pIndexWrapper->SetLocale( aLcl );
if(!sSortAlgorithm.Len())
{
diff --git a/sw/source/ui/inc/cnttab.hxx b/sw/source/ui/inc/cnttab.hxx
index 22bfde73fd1d..a0fd5d81ef58 100644
--- a/sw/source/ui/inc/cnttab.hxx
+++ b/sw/source/ui/inc/cnttab.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cnttab.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: os $ $Date: 2002-03-05 08:04:38 $
+ * last change: $Author: fme $ $Date: 2002-08-23 08:17:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -229,7 +229,9 @@ public:
/* -----------------14.07.99 12:17-------------------
--------------------------------------------------*/
-class CollatorRessource;
+class IndexEntryRessource;
+class IndexEntrySupplierWrapper;
+
class SwTOXSelectTabPage : public SfxTabPage
{
FixedLine aTypeTitleFL;
@@ -301,7 +303,7 @@ class SwTOXSelectTabPage : public SfxTabPage
FixedText aSortAlgorithmFT;
ListBox aSortAlgorithmLB;
- CollatorRessource* pColRes;
+ IndexEntryRessource* pIndexRes;
Point aCBLeftPos1;
Point aCBLeftPos2;
@@ -313,6 +315,8 @@ class SwTOXSelectTabPage : public SfxTabPage
String sAddStyleUser;
String sAddStyleContent;
+ const IndexEntrySupplierWrapper* pIndexEntryWrapper;
+
BOOL bFirstCall;
DECL_LINK(TOXTypeHdl, ListBox* );