From 1395c46dcc16501335aa67ce9c0799cf05ff7eea Mon Sep 17 00:00:00 2001 From: Bustamam Harun Date: Thu, 30 Aug 2001 22:33:17 +0000 Subject: Add localedata, registerservices, numberformatcode, defaultnumberingprovider --- i18npool/inc/defaultnumberingprovider.hxx | 150 ++++ i18npool/inc/indexentrysupplier.hxx | 106 +++ i18npool/inc/localedata.hxx | 114 +++ i18npool/inc/numberformatcode.hxx | 66 ++ i18npool/prj/build.lst | 18 +- i18npool/prj/d.lst | 8 + .../defaultnumberingprovider.cxx | 571 ++++++++++++ .../source/defaultnumberingprovider/makefile.mk | 86 ++ i18npool/source/localedata/localedata.cxx | 986 +++++++++++++++++++++ i18npool/source/localedata/makefile.mk | 42 + i18npool/source/numberformatcode/makefile.mk | 42 + .../source/numberformatcode/numberformatcode.cxx | 278 ++++++ i18npool/source/registerservices/makefile.mk | 44 + .../source/registerservices/registerservices.cxx | 167 ++++ i18npool/util/makefile.mk | 38 +- 15 files changed, 2705 insertions(+), 11 deletions(-) create mode 100644 i18npool/inc/defaultnumberingprovider.hxx create mode 100644 i18npool/inc/indexentrysupplier.hxx create mode 100644 i18npool/inc/localedata.hxx create mode 100644 i18npool/inc/numberformatcode.hxx create mode 100644 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx create mode 100644 i18npool/source/defaultnumberingprovider/makefile.mk create mode 100644 i18npool/source/localedata/localedata.cxx create mode 100644 i18npool/source/localedata/makefile.mk create mode 100644 i18npool/source/numberformatcode/makefile.mk create mode 100644 i18npool/source/numberformatcode/numberformatcode.cxx create mode 100644 i18npool/source/registerservices/makefile.mk create mode 100644 i18npool/source/registerservices/registerservices.cxx (limited to 'i18npool') diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx new file mode 100644 index 000000000000..76235ba1a1c5 --- /dev/null +++ b/i18npool/inc/defaultnumberingprovider.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * $RCSfile: defaultnumberingprovider.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2001-08-30 23:33:16 $ + * + * 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 _I18N_DEFAULT_NUMBERING_PROVIDER_HXX_ +#define _I18N_DEFAULT_NUMBERING_PROVIDER_HXX_ + +#ifndef _COM_SUN_STAR_TEXT_XDEFAULTNUMBERINGPROVIDER_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_TEXT_XNUMBERINGFORMATTER_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_TEXT_XNUMBERINGTYPEINFO_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include +#endif +#ifndef _CPPUHELPER_IMPLBASE4_HXX_ +#include +#endif +#ifndef _COM_SUN_STAR_I18N_XTRANSLITERATION_HPP_ +#include +#endif + +class DefaultNumberingProvider : public cppu::WeakImplHelper4 + < + com::sun::star::text::XDefaultNumberingProvider, + com::sun::star::text::XNumberingFormatter, + com::sun::star::text::XNumberingTypeInfo, + com::sun::star::lang::XServiceInfo + > +{ + void GetCharStrN( + sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const; + + void GetCharStr( + sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const; + + void GetRomanString( + sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const; + +public: + DefaultNumberingProvider( + const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xMSF ); + ~DefaultNumberingProvider(); + + //XDefaultNumberingProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexAccess > > SAL_CALL + getDefaultOutlineNumberings( const ::com::sun::star::lang::Locale& aLocale ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > > SAL_CALL + getDefaultContinuousNumberingLevels( const ::com::sun::star::lang::Locale& aLocale ) + throw(::com::sun::star::uno::RuntimeException); + + //XNumberingFormatter + virtual ::rtl::OUString SAL_CALL makeNumberingString( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& aProperties, + const ::com::sun::star::lang::Locale& aLocale ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + //XNumberingTypeInfo + virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedNumberingTypes( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getNumberingType( const ::rtl::OUString& NumberingIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasNumberingType( const ::rtl::OUString& NumberingIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumberingIdentifier( sal_Int16 NumberingType ) + throw(::com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName(void) + throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) + throw( ::com::sun::star::uno::RuntimeException ); +private: + void getTransliteration(); + + ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + ::com::sun::star::uno::Reference< + ::com::sun::star::i18n::XTransliteration > translit; + +}; + +#endif diff --git a/i18npool/inc/indexentrysupplier.hxx b/i18npool/inc/indexentrysupplier.hxx new file mode 100644 index 000000000000..3462e8425cc8 --- /dev/null +++ b/i18npool/inc/indexentrysupplier.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: indexentrysupplier.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2001-08-30 23:33:16 $ + * + * 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 _I18N_INDEXENTRYSUPPLIER_HXX_ +#define _I18N_INDEXENTRYSUPPLIER_HXX_ + +#ifndef _COM_SUN_STAR_I18N_XINDEXENTRYSUPPLIER_HPP_ +#include +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include // helper for implementations +#endif +#ifndef _COM_SUN_STAR_I18N_XCHARACTERCLASSIFICATION_HPP_ +#include +#endif + + +// ---------------------------------------------------- +// class BreakIterator +// ---------------------------------------------------- +class IndexEntrySupplier : public cppu::WeakImplHelper1 +< + ::com::sun::star::i18n::XIndexEntrySupplier +> +{ + ::com::sun::star::uno::Reference < + ::com::sun::star::lang::XMultiServiceFactory > xMSF; + ::com::sun::star::uno::Reference < + ::com::sun::star::i18n::XCharacterClassification > xCC; + +public: + IndexEntrySupplier( const ::com::sun::star::uno::Reference < + ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + virtual ~IndexEntrySupplier(); + + // Methods + virtual ::rtl::OUString SAL_CALL + getIndexCharacter( const ::rtl::OUString& IndexEntry, + const ::com::sun::star::lang::Locale& aLocale, + const ::rtl::OUString& SortAlgorithm ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL + getIndexFollowPageWord( sal_Bool MorePages, + const ::com::sun::star::lang::Locale& aLocale ) + throw (::com::sun::star::uno::RuntimeException); +}; + +#endif diff --git a/i18npool/inc/localedata.hxx b/i18npool/inc/localedata.hxx new file mode 100644 index 000000000000..479aa6891ac2 --- /dev/null +++ b/i18npool/inc/localedata.hxx @@ -0,0 +1,114 @@ +/************************************************************************* +#* +#* $RCSfile: localedata.hxx,v $ +#* +#* Localedata +#* +#* Ersterstellung SSE 06/07/2000 +#* +#* Letzte Aenderung $Author: bustamam $ $Date: 2001-08-30 23:33:16 $ +#* +#* $Revision: 1.1 $ +#* +#* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/inc/localedata.hxx,v $ +#* +#* Copyright (c) 2000 Sun Microsystems Inc. +#* +#*************************************************************************/ +#ifndef _I18N_LOCALEDATA_HXX_ +#define _I18N_LOCALEDATA_HXX_ + +#include + +#include + +#include + + +#include // helper for implementations +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// +#ifndef _I18N_DEFAULT_NUMBERING_PROVIDER_HXX_ +#include +#endif +#ifndef _COM_SUN_STAR_STYLE_NUMBERINGTYPE_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HPP_ +#include +#endif +// + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ +#include +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include +#endif + +class LocaleData : public cppu::WeakImplHelper1< ::com::sun::star::i18n::XLocaleData> +{ + + +public: + LocaleData(){ + } + ~LocaleData(); + + virtual ::com::sun::star::i18n::LanguageCountryInfo SAL_CALL getLanguageCountryInfo( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::i18n::LocaleDataItem SAL_CALL getLocaleItem( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar > SAL_CALL getAllCalendars( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency > SAL_CALL getAllCurrencies( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > SAL_CALL getAllFormats( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Implementation > SAL_CALL getCollatorImplementations( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTransliterations( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getReservedWord( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getAllInstalledLocaleNames() throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSearchOptions( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCollationOptions( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > SAL_CALL getContinuousNumberingLevels( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > > SAL_CALL getOutlineNumberingLevels( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); +private : + struct lookupTableItem { + ::rtl::OUString adllName; + oslModule dllHandle; + }; + + List lookupTable; + + static const TableElement dllsTable[]; + static const sal_Int16 nbOfLocales; + void* getFunctionSymbol( const ::com::sun::star::lang::Locale& rLocale, + const sal_Char* pFunction, sal_Bool bFallBack = sal_True ); + void setFunctionName( const ::com::sun::star::lang::Locale& rLocale, + const ::rtl::OUString& function, ::rtl::OUString& dllName, + ::rtl::OUString& functionName, sal_Bool bFallBack ); + sal_Bool SAL_CALL lookupDLLName(const ::rtl::OUString& localeName, TableElement& element); + TableElement SAL_CALL getDLLName( const ::com::sun::star::lang::Locale& rLocale, + sal_Bool bFallBack ); + oslModule getModuleHandle(const ::rtl::OUString& dllName); +}; + +#endif // _I18N_LOCALEDATA_HXX_ diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx new file mode 100644 index 000000000000..2c1871318ea5 --- /dev/null +++ b/i18npool/inc/numberformatcode.hxx @@ -0,0 +1,66 @@ +/************************************************************************* +#* +#* $RCSfile: numberformatcode.hxx,v $ +#* +#* NumberFormatCodeMapper +#* +#* Creation: SSE 08/12/2000 +#* +#* Last change: $Author: bustamam $ $Date: 2001-08-30 23:33:16 $ +#* +#* $Revision: 1.1 $ +#* +#* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/inc/numberformatcode.hxx,v $ +#* +#* Copyright (c) 2000 Sun Microsystems Inc. +#* +#*************************************************************************/ + +#ifndef _I18N_NUMBERFORMATCODE_HXX_ +#define _I18N_NUMBERFORMATCODE_HXX_ + +#include +#include +#include // helper for implementations + +#include +#include + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include +#endif + + +class NumberFormatCodeMapper : public cppu::WeakImplHelper1 +< + ::com::sun::star::i18n::XNumberFormatCode +> +{ +public: + NumberFormatCodeMapper( const ::com::sun::star::uno::Reference < + ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + ~NumberFormatCodeMapper(); + + virtual ::com::sun::star::i18n::NumberFormatCode SAL_CALL getDefault( sal_Int16 nFormatType, sal_Int16 nFormatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::i18n::NumberFormatCode SAL_CALL getFormatCode( sal_Int16 nFormatIndex, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL getAllFormatCode( sal_Int16 nFormatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL getAllFormatCodes( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + +private: + ::com::sun::star::lang::Locale aLocale; + ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > xMSF; + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > aFormatSeq; + ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XLocaleData > xlocaleData; + sal_Bool bFormatsValid; + + void setupLocale( const ::com::sun::star::lang::Locale& rLocale ); + void getFormats( const ::com::sun::star::lang::Locale& rLocale ); + ::rtl::OUString mapElementTypeShortToString(sal_Int16 formatType); + sal_Int16 mapElementTypeStringToShort(const ::rtl::OUString& formatType); + ::rtl::OUString mapElementUsageShortToString(sal_Int16 formatUsage); + sal_Int16 mapElementUsageStringToShort(const ::rtl::OUString& formatUsage); + void createLocaleDataObject(); +}; + + +#endif // _I18N_NUMBERFORMATCODE_HXX_ diff --git a/i18npool/prj/build.lst b/i18npool/prj/build.lst index f1d241b3ee5e..b28ed98d9ed7 100644 --- a/i18npool/prj/build.lst +++ b/i18npool/prj/build.lst @@ -1,7 +1,11 @@ -in i18npool : bridges sax stoc svtools unotools NULL -in i18npool usr1 - all in_mkout NULL -in i18npool\source\unotypes nmake - all in_utypes NULL -in i18npool\source\localedata_ascii nmake - all in_locdata_ascii in_xmlparser NULL -in i18npool\source\localedata_CJK nmake - all in_locdata_cjk in_xmlparser NULL -in i18npool\source\xmlparser nmake - all in_xmlparser in_utypes NULL -in i18npool\util nmake - all in_util in_locdata_ascii in_locdata_cjk in_xmlparser NULL +inp i18npool : bridges sax stoc svtools unotools i18npool NULL +inp i18npool usr1 - all in_mkout NULL +inp i18npool\source\unotypes nmake - all in_utypes NULL +inp i18npool\source\registerservices nmake - all in_rserv in_utypes NULL +inp i18npool\source\localedata nmake - all in_localedata in_utypes NULL +inp i18npool\source\localedata_ascii nmake - all in_locdata_ascii in_localedata in_xmlparser NULL +inp i18npool\source\localedata_CJK nmake - all in_locdata_cjk in_locdata_ascii in_xmlparser NULL +inp i18npool\source\numberformatcode nmake - all in_numformat in_utypes NULL +inp i18npool\source\xmlparser nmake - all in_xmlparser in_utypes NULL +inp i18npool\source\defaultnumberingprovider nmake - all in_dnum in_utypes NULL +inp i18npool\util nmake - all in_util in_dnum in_localedata in_locdata_ascii in_locdata_cjk in_numformat in_rserv in_xmlparser NULL diff --git a/i18npool/prj/d.lst b/i18npool/prj/d.lst index 11c87f73d085..a33a7ae0db37 100644 --- a/i18npool/prj/d.lst +++ b/i18npool/prj/d.lst @@ -3,9 +3,17 @@ mkdir: %_DEST%\xml mkdir: %_DEST%\inc%_EXT%\i18npool +..\%__SRC%\bin\i18npool?????.dll %_DEST%\bin%_EXT%\i18npool?????.dll +..\%__SRC%\lib\libi18npool?????.so %_DEST%\lib%_EXT%\libi18npool?????.so +..\%__SRC%\lib\libi18npool??????.dylib %_DEST%\lib%_EXT%\libi18npool??????.dylib + ..\%__SRC%\bin\localedata_*.dll %_DEST%\bin%_EXT%\localedata_*.dll ..\%__SRC%\lib\liblocaledata_*.so %_DEST%\lib%_EXT%\liblocaledata_*.so ..\%__SRC%\lib\liblocaledata_*.dylib %_DEST%\lib%_EXT%\liblocaledata_*.dylib +..\%__SRC%\lib\lib*static*.dylib %_DEST%\lib%_EXT%\lib*static*.dylib +..\%__SRC%\misc\*staticdatamembers.cxx %_DEST%\inc%_EXT%\*staticdatamembers.cxx +..\%__SRC%\misc\*staticdatamembers.h* %_DEST%\inc%_EXT%\*staticdatamembers.h* + dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" dos: sh -c "if test %OS% = MACOSX; then create-libstatic-link %_DEST%\lib%_EXT%; fi" diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx new file mode 100644 index 000000000000..c0cfd9b1434a --- /dev/null +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -0,0 +1,571 @@ +/************************************************************************* + * + * $RCSfile: defaultnumberingprovider.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2001-08-30 23:33:16 $ + * + * 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 _I18N_DEFAULT_NUMBERING_PROVIDER_HXX_ +#include +#endif +#ifndef _COM_SUN_STAR_STYLE_NUMBERINGTYPE_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HPP_ +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::style; +using namespace ::com::sun::star::text; +using namespace ::rtl; + +inline +rtl::OUString C2U( const char* s ) +{ + return OUString::createFromAscii(s); +} + +static +void printf_String( const char* fmt, ::rtl::OUString str ) +{ + const int max = 1024; + char buf[ max+1 ]; + + for(int i=0; i& xMSF ) + : xSMgr(xMSF) +{ +} + +DefaultNumberingProvider::~DefaultNumberingProvider() +{ +} + +Sequence< Reference > +DefaultNumberingProvider::getDefaultOutlineNumberings(const Locale& rLocale ) throw(RuntimeException) +{ + return LocaleData().getOutlineNumberingLevels( rLocale ); +} + +Sequence< Sequence > +DefaultNumberingProvider::getDefaultContinuousNumberingLevels( const Locale& rLocale ) throw(RuntimeException) +{ + return LocaleData().getContinuousNumberingLevels( rLocale ); +} + + +struct Level +{ + Level( ::rtl::OUString i0, ::rtl::OUString v0, ::rtl::OUString x0 ) : i( i0 ), v( v0 ), x( x0 ) {} + ::rtl::OUString i, v, x; +}; +struct Level level[] = { + Level(::rtl::OUString::createFromAscii("I"), ::rtl::OUString::createFromAscii("V"), ::rtl::OUString::createFromAscii("X")), + Level(::rtl::OUString::createFromAscii("X"), ::rtl::OUString::createFromAscii("L"), ::rtl::OUString::createFromAscii("C")), + Level(::rtl::OUString::createFromAscii("C"), ::rtl::OUString::createFromAscii("D"), ::rtl::OUString::createFromAscii("M")), +}; + +::rtl::OUString calcDigit( int d, int l ) +{ + ::rtl::OUString str; + if (l > 2) + { + for (int m=1; m <= d*pow(10, l-3); m++) + str += ::rtl::OUString::createFromAscii("M"); + return str; + } + else + { + switch( d ) + { + case 0: return rtl::OUString::createFromAscii(""); + case 1: return level[l].i; + case 2: return level[l].i + level[l].i; + case 3: return level[l].i + level[l].i + level[l].i; + case 4: return level[l].i + level[l].v; + case 5: return level[l].v; + case 6: return level[l].v + level[l].i; + case 7: return level[l].v + level[l].i + level[l].i; + case 8: return level[l].v + level[l].i + level[l].i + level[l].i; + case 9: return level[l].i + level[l].x; + default: + assert(0); + return ::rtl::OUString::createFromAscii(""); + } + } +} + +::rtl::OUString toRoman( sal_Int32 n ) +{ + ::rtl::OUString result; + + OUString tmp = OUString::valueOf( n ); + ::rtl::OUString buf = tmp; + int length = buf.getLength(); + + for( int i=0; iA, 1=>B, ..., 25=>Z, 26=>AA, 27=>AB, ... + // if A=='a' then 0=>a, 1=>b, ..., 25=>z, 26=>aa, 27=>ab, ... + + if( n>=26 ) lcl_formatChars( A, (n-26)/26, s ); + + s += ::rtl::OUString::valueOf( (sal_Unicode) (( n%26 ) + A) ); +} + +static +should_ignore( ::rtl::OUString s ) +{ + // return true if blank or null + return s.compareToAscii(" ")==0 || (s.getLength()>0 && s[0]==0); +} + +static +uno::Any getPropertyByName( const uno::Sequence& aProperties, + const char* name, sal_Bool bRequired ) +{ + for( int i=0; i xI = xSMgr->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.i18n.Transliteration") ); + + if ( xI.is() ) { + Any x = xI->queryInterface( + ::getCppuType( (const Reference< XTransliteration >*)0) ); + x >>= translit; + } +} + +//XNumberingFormatter +::rtl::OUString +DefaultNumberingProvider::makeNumberingString( const uno::Sequence& aProperties, + const lang::Locale& aLocale ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + // the Sequence of PropertyValues is expected to have at least 4 elements: + // elt Name Type purpose + // ----------------------------------------------------------------- + // + // 0. "Prefix" ::rtl::OUString + // 1. "NumberingType" sal_Int16 type of formatting from style::NumberingType (roman, arabic, etc) + // 2. "Suffix" ::rtl::OUString + // ... ... ... + // n. "Value" sal_Int32 the number to be formatted + // example: + // given the Sequence { '(', NumberingType::ROMAN_UPPER, ')', ..., 7 } + // makeNumberingString() returns the string "(VII)". + + // Q: why is the type of numType sal_Int16 instead of style::NumberingType? + // A: an Any can't hold a style::NumberingType for some reason. + // add.: style::NumberingType holds constants of type sal_Int16, it's not an enum type + + ::rtl::OUString prefix; + sal_Int16 numType; // type of formatting from style::NumberingType (roman, arabic, etc) + ::rtl::OUString suffix; + sal_Int32 number = -12345; // the number that needs to be formatted. + + int nProperties = aProperties.getLength(); + int last = nProperties-1; + + try + { + ::getPropertyByName(aProperties, "Prefix", sal_False) >>=prefix; + } + catch (Exception&) + { + //prefix _must_ be empty here! + } + try + { + ::getPropertyByName(aProperties, "Suffix", sal_False) >>=suffix; + } + catch (Exception&) + { + //suffix _must_ be empty here! + } + try + { + ::getPropertyByName(aProperties, "NumberingType", sal_True) >>=numType; + } + catch (Exception& ) + { + numType = -1; + } + try + { + ::getPropertyByName(aProperties, "Value", sal_True) >>=number; + } + catch (Exception& ) + { + number = -1; + } + + if( number <= 0 ) + { + throw lang::IllegalArgumentException(); + } + + // start empty + ::rtl::OUString result; + + // this should be locale dependent. + // for now, assume en_US + + // en_US + { + // append prefix + if( !should_ignore(prefix) ) result += prefix; + + // append formatted number + using namespace ::com::sun::star::style::NumberingType; + switch( numType ) + { + case CHARS_UPPER_LETTER: + lcl_formatChars( 'A', number-1, result ); // 1=>A, 2=>B, ..., 26=>Z, 27=>AA, 28=>AB, ... + break; + case CHARS_LOWER_LETTER: + lcl_formatChars( 'a', number-1, result ); + break; + case ROMAN_UPPER: + result += toRoman( number ); + break; + case ROMAN_LOWER: + result += toRoman( number ).toAsciiLowerCase(); + break; + case ARABIC: + result += ::rtl::OUString::valueOf( number ); + break; + case NUMBER_NONE: + return ::rtl::OUString::createFromAscii(""); // ignore prefix and suffix + break; + case CHAR_SPECIAL: + // apparently, we're supposed to return an empty string in this case... + return ::rtl::OUString::createFromAscii(""); // ignore prefix and suffix + break; + case PAGE_DESCRIPTOR: + case BITMAP: + assert(0); + throw lang::IllegalArgumentException(); + break; + case CHARS_UPPER_LETTER_N: + { + sal_Unicode c = ((--number)%26) + 'A'; + int repeat_count = number / 26 + 1; + for( int i=0; i= 0 && number <= 5) + { + static const sal_Char* aTestNumbers[] = + { + "None","First","Second","Third","Fourth","Fifth" + }; + result = OUString::createFromAscii(aTestNumbers[number]); + } + else + result = OUString::createFromAscii("too big!"); + } + break; + +#endif + + case TRANSLITERATION: + { + ::rtl::OUString &tmp = ::rtl::OUString::valueOf( number ); + ::rtl::OUString transliteration; + try { + ::getPropertyByName(aProperties, "Transliteration", sal_True) >>= transliteration; + } catch (Exception& ) { + transliteration = ::rtl::OUString::createFromAscii(""); + } + getTransliteration(); + if ( ! translit.is() ) { + throw lang::IllegalArgumentException(); + } + + Sequence < i18n::TransliterationModulesNew > module(1); + if( !transliteration.compareToAscii("NumToTextLower_zh_CN") ) { + module[0]=i18n::TransliterationModulesNew_NumToTextLower_zh_CN; + } else if( !transliteration.compareToAscii("NumToTextUpper_zh_CN") ) { + module[0]=i18n::TransliterationModulesNew_NumToTextUpper_zh_CN; + } else if( !transliteration.compareToAscii("NumToTextLower_zh_TW") ) { + module[0]=i18n::TransliterationModulesNew_NumToTextLower_zh_TW; + } else if( !transliteration.compareToAscii("NumToTextUpper_zh_TW") ) { + module[0]=i18n::TransliterationModulesNew_NumToTextUpper_zh_TW; + } else if( !transliteration.compareToAscii("NumToTextFormalHangul_ko") ) { + module[0]=i18n::TransliterationModulesNew_NumToTextFormalHangul_ko; + } else if( !transliteration.compareToAscii("NumToTextFormalLower_ko") ) { + module[0]=i18n::TransliterationModulesNew_NumToTextFormalLower_ko; + } else if( !transliteration.compareToAscii("NumToTextFormalUpper_ko") ) { + module[0]=i18n::TransliterationModulesNew_NumToTextFormalUpper_ko; + } else + { + assert(0); + throw lang::IllegalArgumentException(); + } + translit->loadModuleNew( module, aLocale); + uno::Sequence< long > offset( tmp.getLength()*2 ); + ::rtl::OUString& res = translit->transliterate(tmp, 0, tmp.getLength(), offset); + result += res; + result += C2U("~"); + } + break; + + default: + assert(0); + throw lang::IllegalArgumentException(); + break; + } + + // append suffix + if( !should_ignore(suffix) ) result += suffix; + } + // en_US + + + return result; +} +/* -----------------------------21.02.01 15:57-------------------------------- + + ---------------------------------------------------------------------------*/ +struct Supported_NumberingType +{ + sal_Int16 nType; + const sal_Char* cSymbol; +}; +static const Supported_NumberingType aSupportedTypes[] = +{ + {NumberingType::CHARS_UPPER_LETTER, "A"}, + {NumberingType::CHARS_LOWER_LETTER, "a"}, + {NumberingType::ROMAN_UPPER, "I"}, + {NumberingType::ROMAN_LOWER, "i"}, + {NumberingType::ARABIC, "1"}, + {NumberingType::NUMBER_NONE, "''"}, + {NumberingType::CHAR_SPECIAL, "Bullet"}, + {NumberingType::PAGE_DESCRIPTOR, "Page"}, + {NumberingType::BITMAP, "Bitmap"}, + {NumberingType::CHARS_UPPER_LETTER_N, "AAA"}, + {NumberingType::CHARS_LOWER_LETTER_N, "aaa"} +#ifdef DEBUG + ,{20, "First"} +#endif +}; + static const sal_Int32 nSupported_NumberingTypes = sizeof(aSupportedTypes) / sizeof(Supported_NumberingType); +/* -----------------------------21.02.01 15:57-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence< sal_Int16 > DefaultNumberingProvider::getSupportedNumberingTypes( ) + throw(RuntimeException) +{ + Sequence< sal_Int16 > aRet(nSupported_NumberingTypes ); + sal_Int16* pArray = aRet.getArray(); + for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) + pArray[i] = aSupportedTypes[i].nType; + return aRet; +} +/* -----------------------------21.02.01 15:57-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Int16 DefaultNumberingProvider::getNumberingType( const OUString& rNumberingIdentifier ) + throw(RuntimeException) +{ + for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) + if(!rNumberingIdentifier.compareToAscii(aSupportedTypes[i].cSymbol)) + return aSupportedTypes[i].nType; + throw RuntimeException(); + return -1; +} +/* -----------------------------21.02.01 15:57-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Bool DefaultNumberingProvider::hasNumberingType( const OUString& rNumberingIdentifier ) + throw(RuntimeException) +{ + for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) + if(!rNumberingIdentifier.compareToAscii(aSupportedTypes[i].cSymbol)) + return sal_True; + return sal_False; +} +/* -----------------------------21.02.01 15:57-------------------------------- + + ---------------------------------------------------------------------------*/ +OUString DefaultNumberingProvider::getNumberingIdentifier( sal_Int16 nNumberingType ) + throw(RuntimeException) +{ + for(sal_Int16 i = 0; i < nSupported_NumberingTypes; i++) + if(nNumberingType == aSupportedTypes[i].nType) + return C2U(aSupportedTypes[i].cSymbol); + return OUString(); +} +/* -----------------------------05.07.01 13:34-------------------------------- + + ---------------------------------------------------------------------------*/ +OUString DefaultNumberingProvider::getImplementationName(void) + throw( RuntimeException ) +{ + return C2U("i18n::DefaultNumberingProvider"); +} +/* -----------------------------05.07.01 13:34-------------------------------- + + ---------------------------------------------------------------------------*/ +const sal_Char cDefaultNumberingProvider[] = "com.sun.star.text.DefaultNumberingProvider"; +sal_Bool DefaultNumberingProvider::supportsService(const rtl::OUString& rServiceName) + throw( RuntimeException ) +{ + return !rServiceName.compareToAscii(cDefaultNumberingProvider); +} +/* -----------------------------05.07.01 13:34-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence< OUString > DefaultNumberingProvider::getSupportedServiceNames(void) + throw( RuntimeException ) +{ + Sequence< OUString > aRet(1); + aRet[0] = C2U(cDefaultNumberingProvider); + return aRet; +} + + diff --git a/i18npool/source/defaultnumberingprovider/makefile.mk b/i18npool/source/defaultnumberingprovider/makefile.mk new file mode 100644 index 000000000000..ca1f882cf4b2 --- /dev/null +++ b/i18npool/source/defaultnumberingprovider/makefile.mk @@ -0,0 +1,86 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: bustamam $ $Date: 2001-08-30 23:33:16 $ +# +# 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): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=i18npool +TARGET=defaultnumberingprovider + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/defaultnumberingprovider.obj \ + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx new file mode 100644 index 000000000000..0e34251c80ab --- /dev/null +++ b/i18npool/source/localedata/localedata.cxx @@ -0,0 +1,986 @@ +/************************************************************************* +#* +#* $RCSfile: localedata.cxx,v $ +#* +#* LocaleData +#* +#* Ersterstellung SSE 04/07/2000 +#* +#* Letzte Aenderung $Author: bustamam $ $Date: 2001-08-30 23:33:16 $ +#* +#* $Revision: 1.1 $ +#* +#* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/source/localedata/localedata.cxx,v $ +#* +#* Copyright (c) 2000 Sun Microsystems Inc. +#* +#*************************************************************************/ + +#include + +#ifndef _RTL_USTRBUF_HXX_ +#include +#endif + + + +typedef sal_Unicode ** (SAL_CALL * MyFunc_Type)( sal_Int16&); +typedef sal_Unicode *** (SAL_CALL * MyFunc_Type2)( sal_Int16&, sal_Int16& ); +typedef sal_Unicode **** (SAL_CALL * MyFunc_Type3)( sal_Int16&, sal_Int16&, sal_Int16& ); + + +static const ::rtl::OUString + lcl_ASCII( ::rtl::OUString::createFromAscii("localedata_ascii" )), + lcl_CJK( ::rtl::OUString::createFromAscii("localedata_CJK" )), + lcl_CTL( ::rtl::OUString::createFromAscii("localedata_ctl" )); + +const TableElement +LocaleData::dllsTable[] = { + TableElement(::rtl::OUString::createFromAscii("en_US"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("de_DE"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("fr_FR"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("sv_SE"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_ES"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("it_IT"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("af_ZA"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("be_BY"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("bg_BG"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("br_AE"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("ca_ES"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("cs_CZ"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("da_DK"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("de_AT"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("de_CH"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("de_LI"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("de_LU"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("el_GR"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_AU"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_BZ"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_CA"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_GB"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_IE"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_JM"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_NZ"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_PH"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_TT"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_ZA"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("en_ZW"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_AR"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_BO"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_CL"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_CO"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_CR"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_DO"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_EC"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_GT"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_HN"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_MX"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_NI"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_PA"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_PE"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_PR"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_PY"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_SV"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_UY"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("es_VE"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("fi_FI"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("fr_BE"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("fr_CA"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("fr_CH"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("fr_LU"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("fr_MC"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("hu_HU"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("id_ID"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("is_IS"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("it_CH"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("nb_NO"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("nl_BE"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("nl_NL"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("no_NO"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("nn_NO"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("pl_PL"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("pt_BR"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("pt_PT"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("ru_RU"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("sv_FI"), lcl_ASCII), + TableElement(::rtl::OUString::createFromAscii("tr_TR"), lcl_ASCII), + + TableElement(::rtl::OUString::createFromAscii("ja_JP"), lcl_CJK), + TableElement(::rtl::OUString::createFromAscii("ko_KR"), lcl_CJK), + TableElement(::rtl::OUString::createFromAscii("zh_CN"), lcl_CJK), + TableElement(::rtl::OUString::createFromAscii("zh_HK"), lcl_CJK), + TableElement(::rtl::OUString::createFromAscii("zh_SG"), lcl_CJK), + TableElement(::rtl::OUString::createFromAscii("zh_TW"), lcl_CJK), + TableElement(::rtl::OUString::createFromAscii("zh_MO"), lcl_CJK), + + TableElement(::rtl::OUString::createFromAscii("ar"), lcl_CTL), + TableElement(::rtl::OUString::createFromAscii("th"), lcl_CTL), + TableElement(::rtl::OUString::createFromAscii("he"), lcl_CTL), + +}; + +const sal_Int16 +LocaleData::nbOfLocales = sizeof(dllsTable) / sizeof(TableElement); + + + +LocaleData::~LocaleData(){ + lookupTableItem *listItem = (lookupTableItem*)lookupTable.First(); + while ( listItem ) + { + if ( listItem->dllHandle ) + osl_unloadModule(listItem->dllHandle); + delete listItem; + listItem = (lookupTableItem*)lookupTable.Next(); + } + + lookupTable.Clear(); +} + + +::com::sun::star::i18n::LocaleDataItem SAL_CALL +LocaleData::getLocaleItem( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 dataItemCount = 0; + sal_Unicode **dataItem = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getLocaleItem" ); + + if ( func ) { + dataItem = func(dataItemCount); + + ::com::sun::star::i18n::LocaleDataItem item( + dataItem[0], + dataItem[1], + dataItem[2], + dataItem[3], + dataItem[4], + dataItem[5], + dataItem[6], + dataItem[7], + dataItem[8], + dataItem[9], + dataItem[10], + dataItem[11], + dataItem[12], + dataItem[13], + dataItem[14], + dataItem[15], + dataItem[16], + dataItem[17] + ); + return item; + } + else { + ::com::sun::star::i18n::LocaleDataItem item1; + return item1; + } +} + + + +::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar > SAL_CALL +LocaleData::getAllCalendars( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + + sal_Int16 calendarsCount = 0; + sal_Unicode **allCalendars = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getAllCalendars" ); + + if ( func ) { + allCalendars = func(calendarsCount); + + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar > calendarsSeq(calendarsCount); + sal_Int16 offset = 3; + sal_Int16 i, j; + for(i = 0; i < calendarsCount; i++) { + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > days(allCalendars[0][i]); + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > months(allCalendars[1][i]); + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > eras(allCalendars[2][i]); + ::rtl::OUString calendarID(allCalendars[offset]); + offset++; + sal_Bool defaultCalendar = allCalendars[offset][0]; + offset++; + for(j = 0; j < allCalendars[0][i]; j++) { + ::com::sun::star::i18n::CalendarItem day(allCalendars[offset], allCalendars[offset+1], allCalendars[offset+2]); + days[j] = day; + offset += 3; + } + for(j = 0; j < allCalendars[1][i]; j++) { + ::com::sun::star::i18n::CalendarItem month(allCalendars[offset], allCalendars[offset+1], allCalendars[offset+2]); + months[j] = month; + offset += 3; + } + for(j = 0; j < allCalendars[2][i]; j++) { + ::com::sun::star::i18n::CalendarItem era(allCalendars[offset], allCalendars[offset+1], allCalendars[offset+2]); + eras[j] = era; + offset += 3; + } + ::rtl::OUString startOfWeekDay(allCalendars[offset]); + offset++; + sal_Int16 minimalDaysInFirstWeek = allCalendars[offset][0]; + offset++; + ::com::sun::star::i18n::Calendar aCalendar(days, months, eras, startOfWeekDay, minimalDaysInFirstWeek, defaultCalendar, calendarID); + calendarsSeq[i] = aCalendar; + } + return calendarsSeq; + } + else { + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Calendar > seq1(0); + return seq1; + } +} + + +::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency > SAL_CALL +LocaleData::getAllCurrencies( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + + sal_Int16 currencyCount = 0; + sal_Unicode **allCurrencies = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getAllCurrencies" ); + + if ( func ) { + allCurrencies = func(currencyCount); + + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency > seq(currencyCount); + for(int i = 0, nOff = 0; i < currencyCount; i++, nOff += 7 ) + { + ::com::sun::star::i18n::Currency cur( + allCurrencies[nOff], // string ID + allCurrencies[nOff+1], // string Symbol + allCurrencies[nOff+2], // string BankSymbol + allCurrencies[nOff+3], // string Name + allCurrencies[nOff+4][0], // boolean Default + allCurrencies[nOff+5][0], // boolean UsedInCompatibleFormatCodes + allCurrencies[nOff+6][0] // short DecimalPlaces + ); + seq[i] = cur; + } + return seq; + } + else { + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency > seq1(0); + return seq1; + } +} + + +::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > SAL_CALL +LocaleData::getAllFormats( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 formatCount = 0; + sal_Unicode **formatArray = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getAllFormats" ); + + if ( func ) { + formatArray = func(formatCount); + + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > seq(formatCount); + for(int i = 0, nOff = 0; i < formatCount; i++, nOff += 7 ) + { + ::com::sun::star::i18n::FormatElement elem(formatArray[nOff], + formatArray[nOff+ 1], + formatArray[nOff + 2], + formatArray[nOff + 3], + formatArray[nOff + 4], + formatArray[nOff + 5][0], + formatArray[nOff + 6][0]); + + seq[i] = elem; + } + return seq; + } + else { + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > seq1(0); + return seq1; + } + +} + +::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Implementation > SAL_CALL +LocaleData::getCollatorImplementations( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 collatorCount = 0; + sal_Unicode **collatorArray = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getCollatorImplementation" ); + + if ( func ) { + collatorArray = func(collatorCount); + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Implementation > seq(collatorCount); + for(sal_Int16 i = 0; i < collatorCount; i++) { + ::com::sun::star::i18n::Implementation impl(collatorArray[i*2], collatorArray[i*2 + 1][0]); + seq[i] = impl; + } + return seq; + } + else { + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Implementation > seq1(0); + return seq1; + } +} + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL +LocaleData::getCollationOptions( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 optionsCount = 0; + sal_Unicode **optionsArray = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getCollationOptions" ); + + if ( func ) { + optionsArray = func(optionsCount); + ::com::sun::star::uno::Sequence< ::rtl::OUString > seq(optionsCount); + for(sal_Int16 i = 0; i < optionsCount; i++) { + seq[i] = ::rtl::OUString( optionsArray[i] ); + } + return seq; + } + else { + ::com::sun::star::uno::Sequence< ::rtl::OUString > seq1(0); + return seq1; + } +} + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL +LocaleData::getSearchOptions( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 optionsCount = 0; + sal_Unicode **optionsArray = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getSearchOptions" ); + + if ( func ) { + optionsArray = func(optionsCount); + ::com::sun::star::uno::Sequence< ::rtl::OUString > seq(optionsCount); + for(sal_Int16 i = 0; i < optionsCount; i++) { + seq[i] = ::rtl::OUString( optionsArray[i] ); + } + return seq; + } + else { + ::com::sun::star::uno::Sequence< ::rtl::OUString > seq1(0); + return seq1; + } +} + + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL +LocaleData::getTransliterations( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + + sal_Int16 transliterationsCount = 0; + sal_Unicode **transliterationsArray = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getTransliterations" ); + + if ( func ) { + transliterationsArray = func(transliterationsCount); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > seq(transliterationsCount); + for(int i = 0; i < transliterationsCount; i++) { + ::rtl::OUString elem(transliterationsArray[i]); + seq[i] = elem; + } + return seq; + } + else { + ::com::sun::star::uno::Sequence< ::rtl::OUString > seq1(0); + return seq1; + } + + +} + + +::com::sun::star::i18n::LanguageCountryInfo SAL_CALL +LocaleData::getLanguageCountryInfo( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 LCInfoCount = 0; + sal_Unicode **LCInfoArray = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getLCInfo" ); + + if ( func ) { + LCInfoArray = func(LCInfoCount); + ::com::sun::star::i18n::LanguageCountryInfo info(LCInfoArray[0], + LCInfoArray[1], + LCInfoArray[2], + LCInfoArray[3], + LCInfoArray[4]); + return info; + } + else { + ::com::sun::star::i18n::LanguageCountryInfo info1; + return info1; + } + +} + + +::com::sun::star::i18n::ForbiddenCharacters SAL_CALL +LocaleData::getForbiddenCharacters( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int16 LCForbiddenCharactersCount = 0; + sal_Unicode **LCForbiddenCharactersArray = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getForbiddenCharacters" ); + + if ( func ) { + LCForbiddenCharactersArray = func(LCForbiddenCharactersCount); + ::com::sun::star::i18n::ForbiddenCharacters chars(LCForbiddenCharactersArray[0], + LCForbiddenCharactersArray[1]); + return chars; + } + else { + ::com::sun::star::i18n::ForbiddenCharacters chars1; + return chars1; + } +} + + + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + LocaleData::getReservedWord( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) + { + sal_Int16 LCReservedWordsCount = 0; + sal_Unicode **LCReservedWordsArray = NULL; + + MyFunc_Type func = (MyFunc_Type) getFunctionSymbol( rLocale, "getReservedWords" ); + + if ( func ) { + LCReservedWordsArray = func(LCReservedWordsCount); + ::com::sun::star::uno::Sequence< ::rtl::OUString > seq(LCReservedWordsCount); + for(int i = 0; i < (LCReservedWordsCount); i++) { + ::rtl::OUString elem(LCReservedWordsArray[i]); + seq[i] = elem; + } + return seq; + } + else { + ::com::sun::star::uno::Sequence< ::rtl::OUString > seq1(0); + return seq1; + } + } + + +#include +#include +using namespace ::com::sun::star; + +inline +::rtl::OUString C2U( const char* s ) +{ + return ::rtl::OUString::createFromAscii( s ); +} + +uno::Sequence< uno::Sequence > SAL_CALL +LocaleData::getContinuousNumberingLevels( const lang::Locale& rLocale ) throw(uno::RuntimeException) +{ + int i; + + // load symbol + MyFunc_Type2 func = (MyFunc_Type2) getFunctionSymbol( rLocale, "getContinuousNumberingLevels" ); + + if ( func ) + { + // invoke function + sal_Int16 nStyles; + sal_Int16 nAttributes; + sal_Unicode*** p0 = func( nStyles, nAttributes ); + + // allocate memory for nAttributes attributes for each of the nStyles styles. + uno::Sequence< uno::Sequence > pv( nStyles ); + for( i=0; i( nAttributes ); + } + + sal_Unicode*** pStyle = p0; + for( i=0; i > seq1(0); + return seq1; +} + +// ============================================================================ +// \/ OutlineNumbering helper class \/ +// +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include +#endif + +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include +#endif + +namespace com{ namespace sun{ namespace star{ namespace lang { + struct Locale; +}}}} +//----------------------------------------------------------------------------- +struct OutlineNumberingLevel_Impl +{ + sal_Unicode cPrefix; + sal_Int16 nNumType; //com::sun::star::style::NumberingType + sal_Unicode cSuffix; + sal_Unicode cBulletChar; + const sal_Char* sBulletFontName; + sal_Int16 nParentNumbering; + sal_Int32 nLeftMargin; + sal_Int32 nSymbolTextDistance; + sal_Int32 nFirstLineOffset; + ::rtl::OUString sTransliteration; +}; +//----------------------------------------------------------------------------- +class OutlineNumbering : public cppu::WeakImplHelper1 + < com::sun::star::container::XIndexAccess > +{ + const OutlineNumberingLevel_Impl* m_pOutlineLevels; + sal_Int16 m_nCount; +public: +// OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlineLevels); + OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlineLevels, int nLevels); + ~OutlineNumbering(); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + //XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); + +}; + +// +// /\ OutlineNumbering helper class /\ +// ============================================================================ + +static +sal_Char* U2C( ::rtl::OUString str ) +{ + sal_Char* s = new sal_Char[ str.getLength()+1 ]; + for(int i=0; i > SAL_CALL +LocaleData::getOutlineNumberingLevels( const lang::Locale& rLocale ) throw(uno::RuntimeException) +{ + int i; + + // load symbol + MyFunc_Type3 func = (MyFunc_Type3) getFunctionSymbol( rLocale, "getOutlineNumberingLevels" ); + + if ( func ) + { + // invoke function + sal_Int16 nStyles; + sal_Int16 nLevels; + sal_Int16 nAttributes; + sal_Unicode**** p0 = func( nStyles, nLevels, nAttributes ); + + uno::Sequence< uno::Reference > aRet( nStyles ); + + rtl::OUString aEmptyStr; + + sal_Unicode**** pStyle = p0; + for( i=0; i > seq1(0); + return seq1; + } +} + +///////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////helper functions/////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////// + +void* LocaleData::getFunctionSymbol( const ::com::sun::star::lang::Locale& rLocale, + const sal_Char* pFunction, sal_Bool bFallBack ) +{ + void* pSymbol = 0; + ::rtl::OUString dllName, functionName; + ::rtl::OUString aFunction( ::rtl::OUString::createFromAscii( pFunction ) ); + setFunctionName( rLocale, aFunction, dllName, functionName, bFallBack ); + oslModule hModule = getModuleHandle( dllName ); + if ( hModule ) + pSymbol = osl_getSymbol( hModule, functionName.pData ); + if ( !pSymbol && bFallBack ) + { + ::com::sun::star::lang::Locale aLoc( rLocale ); + sal_Bool bLoop = sal_True; + do + { + if ( hModule ) + { // setFunctionName did find an entry in dllsTable but it's not + // available in the library, try with locale fallback first + if ( aLoc.Variant.getLength() ) + aLoc.Variant = ::rtl::OUString(); + else if ( aLoc.Country.getLength() ) + aLoc.Country = ::rtl::OUString(); + else + hModule = 0; // last try with en_US + } + if ( !hModule ) + { // not even the library was found, last resort + aLoc.Language = ::rtl::OUString::createFromAscii( "en" ); + aLoc.Country = ::rtl::OUString::createFromAscii( "US" ); + bLoop = sal_False; + } + setFunctionName( aLoc, aFunction, dllName, functionName, bFallBack ); + oslModule hModule = getModuleHandle( dllName ); + if ( hModule ) + pSymbol = osl_getSymbol( hModule, functionName.pData ); + } while ( !pSymbol && bLoop ); + } + return pSymbol; +} + + +oslModule +LocaleData::getModuleHandle(const ::rtl::OUString& dllName) { + + oslModule hModule = NULL; + lookupTableItem *listItem = (lookupTableItem*)lookupTable.First(); + if(listItem) { + do { + if(dllName.equals(listItem->adllName)) { + hModule = listItem->dllHandle; + break; + } + } while((listItem = (lookupTableItem*)lookupTable.Next())); + } + if(!hModule) { //dll not loaded, load it and add it to the list + hModule = osl_loadModule(dllName.pData, SAL_LOADMODULE_DEFAULT ); + lookupTableItem *newTableItem = new lookupTableItem(); + newTableItem->adllName = dllName; + newTableItem->dllHandle = hModule; + lookupTable.Insert(newTableItem); + } + return hModule; + +} + + +void +LocaleData::setFunctionName( const ::com::sun::star::lang::Locale& rLocale, + const ::rtl::OUString& function, ::rtl::OUString& dllName, + ::rtl::OUString& functionName, sal_Bool bFallBack ) +{ + TableElement dllEntry = getDLLName( rLocale, bFallBack ); + dllName = dllEntry.value; + + ::rtl::OUStringBuffer aBuf( function.getLength() + 1 + dllEntry.name.getLength() ); + aBuf.append( function ); + aBuf.append( sal_Unicode('_') ); + aBuf.append( dllEntry.name ); + functionName = aBuf.makeStringAndClear(); + + ::rtl::OUString platformSuffix; + #ifdef SAL_W32 + platformSuffix = ::rtl::OUString::createFromAscii(".dll"); + #else + ::rtl::OUString platformPrefix = ::rtl::OUString::createFromAscii("lib"); + dllName = platformPrefix; + dllName += dllEntry.value; + platformSuffix = ::rtl::OUString::createFromAscii(".so"); + #endif + dllName += platformSuffix; + +} + + +TableElement SAL_CALL +LocaleData::getDLLName( const ::com::sun::star::lang::Locale& rLocale, + sal_Bool bFallBack ) +{ + + ::rtl::OUString localeName2; + TableElement dllEntry; + sal_Bool found = sal_False; + + // for most used cases + if( rLocale.Country.getLength() > 0 ) + { + ::rtl::OUStringBuffer aBuf( rLocale.Language.getLength() + 1 + + rLocale.Country.getLength() ); + aBuf.append( rLocale.Language ); + aBuf.append( sal_Unicode('_') ); + aBuf.append( rLocale.Country ); + localeName2 = aBuf.makeStringAndClear(); + } + // First look for object corresponding to Language_Country_Variant. + // Since this is a rare case, string is not prebuild. + if( rLocale.Variant.getLength() > 0 ) + { + ::rtl::OUStringBuffer aBuf( localeName2.getLength() + 1 + + rLocale.Variant.getLength() ); + aBuf.append( localeName2 ); + aBuf.append( sal_Unicode('_') ); + aBuf.append( rLocale.Variant ); + found = lookupDLLName( aBuf.makeStringAndClear(), dllEntry); + if ( found || !bFallBack ) + return dllEntry; + } + // then look for object corresponding to Language_Country + if(!found && localeName2.getLength() > 0) + { + found = lookupDLLName(localeName2, dllEntry); + if ( found || !bFallBack ) + return dllEntry; + } + // then look for object corresponding to Language + if(!found) + { + found = lookupDLLName( rLocale.Language, dllEntry ); + if ( found || !bFallBack ) + return dllEntry; + } + + //could not find a match, return the default one (en_US) + if(!found) + return TableElement(::rtl::OUString::createFromAscii("en_US"), lcl_ASCII); + return dllEntry; +} + +sal_Bool SAL_CALL +LocaleData::lookupDLLName(const ::rtl::OUString& localeName, TableElement& element) { + + for(sal_Int16 i = 0; i < nbOfLocales; i++) { + if(dllsTable[i].name.equals(localeName)) { + element = dllsTable[i]; + return true; + } + } + return false; +} + +::com::sun::star::uno::Sequence< com::sun::star::lang::Locale > SAL_CALL +LocaleData::getAllInstalledLocaleNames() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< com::sun::star::lang::Locale > seq( nbOfLocales ); + + sal_Int16 nInstalled = 0; + rtl::OUString aEmptyStr; + + for( sal_Int16 i=0; icPrefix) +// m_nCount++; +// } + +OutlineNumbering::OutlineNumbering(const OutlineNumberingLevel_Impl* pOutlnLevels, int nLevels) : + m_pOutlineLevels(pOutlnLevels), + m_nCount(nLevels) +{ +} + +OutlineNumbering::~OutlineNumbering() +{ +} + +sal_Int32 OutlineNumbering::getCount( ) throw(RuntimeException) +{ + return m_nCount; +} + +Any OutlineNumbering::getByIndex( sal_Int32 nIndex ) + throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) +{ + if(nIndex < 0 || nIndex >= m_nCount) + throw IndexOutOfBoundsException(); + const OutlineNumberingLevel_Impl* pTemp = m_pOutlineLevels; + pTemp += nIndex; + Any aRet; + + Sequence aOutlineNumbering(11); + PropertyValue* pValues = aOutlineNumbering.getArray(); + pValues[0].Name = C2U( "Prefix"); + pValues[0].Value <<= OUString(&pTemp->cPrefix, 1); + pValues[1].Name = C2U("NumberingType"); + pValues[1].Value <<= pTemp->nNumType; + pValues[2].Name = C2U("Suffix"); + pValues[2].Value <<= OUString(&pTemp->cSuffix, 1); + pValues[3].Name = C2U("BulletChar"); + pValues[3].Value <<= OUString(&pTemp->cBulletChar, 1); + pValues[4].Name = C2U("BulletFontName"); + pValues[4].Value <<= C2U(pTemp->sBulletFontName); + pValues[5].Name = C2U("ParentNumbering"); + pValues[5].Value <<= pTemp->nParentNumbering; + pValues[6].Name = C2U("LeftMargin"); + pValues[6].Value <<= pTemp->nLeftMargin; + pValues[7].Name = C2U("SymbolTextDistance"); + pValues[7].Value <<= pTemp->nSymbolTextDistance; + pValues[8].Name = C2U("FirstLineOffset"); + pValues[8].Value <<= pTemp->nFirstLineOffset; + pValues[9].Name = C2U("Adjust"); + pValues[9].Value <<= (sal_Int16)HoriOrientation::LEFT; + pValues[10].Name = C2U("Transliteration"); + pValues[10].Value <<= pTemp->sTransliteration; + aRet <<= aOutlineNumbering; + return aRet; +} + +Type OutlineNumbering::getElementType( ) throw(RuntimeException) +{ + return ::getCppuType((Sequence*)0); +} + +sal_Bool OutlineNumbering::hasElements( ) throw(RuntimeException) +{ + return m_nCount > 0; +} diff --git a/i18npool/source/localedata/makefile.mk b/i18npool/source/localedata/makefile.mk new file mode 100644 index 000000000000..153ab16b8ab5 --- /dev/null +++ b/i18npool/source/localedata/makefile.mk @@ -0,0 +1,42 @@ +#************************************************************************* +#* +#* $RCSfile: makefile.mk,v $ +#* +#* makefile +#* +#* Erstellung MT 25.6.98 +#* +#* Letzte Aenderung $Author: bustamam $ $Date: 2001-08-30 23:33:16 $ +#* +#* $Revision: 1.1 $ +#* +#* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/source/localedata/makefile.mk,v $ +#* +#* Copyright (c) 1998, Star Division Corp. +#* +#************************************************************************* + +PRJ=..$/.. + + +PRJNAME=i18npool +TARGET=localedata + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/localedata.obj \ + $(SLO)$/indexentrysupplier.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/i18npool/source/numberformatcode/makefile.mk b/i18npool/source/numberformatcode/makefile.mk new file mode 100644 index 000000000000..65680552ad69 --- /dev/null +++ b/i18npool/source/numberformatcode/makefile.mk @@ -0,0 +1,42 @@ +#************************************************************************* +#* +#* $RCSfile: makefile.mk,v $ +#* +#* makefile +#* +#* Erstellung MT 25.6.98 +#* +#* Letzte Aenderung $Author: bustamam $ $Date: 2001-08-30 23:33:17 $ +#* +#* $Revision: 1.1 $ +#* +#* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/source/numberformatcode/makefile.mk,v $ +#* +#* Copyright (c) 1998, Star Division Corp. +#* +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=i18npool +TARGET=numberformatcode + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/numberformatcode.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx new file mode 100644 index 000000000000..c8cd24f3299c --- /dev/null +++ b/i18npool/source/numberformatcode/numberformatcode.cxx @@ -0,0 +1,278 @@ +/************************************************************************* +#* +#* $RCSfile: numberformatcode.cxx,v $ +#* +#* NumberFormatCodeMapper +#* +#* Creation: SSE 08/12/2000 +#* +#* Last change: $Author: bustamam $ $Date: 2001-08-30 23:33:17 $ +#* +#* $Revision: 1.1 $ +#* +#* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/source/numberformatcode/numberformatcode.cxx,v $ +#* +#* Copyright (c) 2000 Sun Microsystems Inc. +#* +#*************************************************************************/ + +#include +#include +#include + + + +NumberFormatCodeMapper::NumberFormatCodeMapper( + const ::com::sun::star::uno::Reference < + ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ) + : + xMSF( rxMSF ), + bFormatsValid( sal_False ) +{ +} + + +NumberFormatCodeMapper::~NumberFormatCodeMapper() +{ +} + + +::com::sun::star::i18n::NumberFormatCode SAL_CALL +NumberFormatCodeMapper::getDefault( sal_Int16 formatType, sal_Int16 formatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + + ::rtl::OUString elementType = mapElementTypeShortToString(formatType); + ::rtl::OUString elementUsage = mapElementUsageShortToString(formatUsage); + + getFormats( rLocale ); + + for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) { + if(aFormatSeq[i].isDefault && aFormatSeq[i].formatType == elementType && + aFormatSeq[i].formatUsage == elementUsage) { + com::sun::star::i18n::NumberFormatCode anumberFormatCode(formatType, + formatUsage, + aFormatSeq[i].formatCode, + aFormatSeq[i].formatName, + aFormatSeq[i].formatKey, + aFormatSeq[i].formatIndex, + sal_True); + return anumberFormatCode; + } + } + com::sun::star::i18n::NumberFormatCode defaultNumberFormatCode; + return defaultNumberFormatCode; +} + + + +::com::sun::star::i18n::NumberFormatCode SAL_CALL +NumberFormatCodeMapper::getFormatCode( sal_Int16 formatIndex, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + getFormats( rLocale ); + + for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) { + if(aFormatSeq[i].formatIndex == formatIndex) { + com::sun::star::i18n::NumberFormatCode anumberFormatCode(mapElementTypeStringToShort(aFormatSeq[i].formatType), + mapElementUsageStringToShort(aFormatSeq[i].formatUsage), + aFormatSeq[i].formatCode, + aFormatSeq[i].formatName, + aFormatSeq[i].formatKey, + aFormatSeq[i].formatIndex, + aFormatSeq[i].isDefault); + return anumberFormatCode; + } + } + com::sun::star::i18n::NumberFormatCode defaultNumberFormatCode; + return defaultNumberFormatCode; + +} + + + +::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL +NumberFormatCodeMapper::getAllFormatCode( sal_Int16 formatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + getFormats( rLocale ); + + sal_Int32 i, count; + count = 0; + for(i = 0; i < aFormatSeq.getLength(); i++) { + sal_Int16 elementUsage = mapElementUsageStringToShort(aFormatSeq[i].formatUsage); + if( elementUsage == formatUsage) + count++; + } + + ::com::sun::star::uno::Sequence seq(count); + sal_Int32 j = 0; + for(i = 0; i < aFormatSeq.getLength(); i++) { + sal_Int16 elementUsage = mapElementUsageStringToShort(aFormatSeq[i].formatUsage); + if( elementUsage == formatUsage) { + seq[j] = com::sun::star::i18n::NumberFormatCode(mapElementTypeStringToShort(aFormatSeq[i].formatType), + formatUsage, + aFormatSeq[i].formatCode, + aFormatSeq[i].formatName, + aFormatSeq[i].formatKey, + aFormatSeq[i].formatIndex, + aFormatSeq[i].isDefault); + j++; + } + } + return seq; + +} + + +::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL +NumberFormatCodeMapper::getAllFormatCodes( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException) +{ + getFormats( rLocale ); + + ::com::sun::star::uno::Sequence seq(aFormatSeq.getLength()); + for(sal_Int32 i = 0; i < aFormatSeq.getLength(); i++) + { + seq[i] = com::sun::star::i18n::NumberFormatCode(mapElementTypeStringToShort(aFormatSeq[i].formatType), + mapElementUsageStringToShort(aFormatSeq[i].formatUsage), + aFormatSeq[i].formatCode, + aFormatSeq[i].formatName, + aFormatSeq[i].formatKey, + aFormatSeq[i].formatIndex, + aFormatSeq[i].isDefault); + } + return seq; +} + + +// --- private implementation ----------------------------------------- + +void NumberFormatCodeMapper::setupLocale( const ::com::sun::star::lang::Locale& rLocale ) +{ + if ( aLocale.Country != rLocale.Country + || aLocale.Language != rLocale.Language + || aLocale.Variant != rLocale.Variant ) + { + bFormatsValid = sal_False; + aLocale = rLocale; + } +} + + +void NumberFormatCodeMapper::getFormats( const ::com::sun::star::lang::Locale& rLocale ) +{ + setupLocale( rLocale ); + if ( !bFormatsValid ) + { + createLocaleDataObject(); + if( !xlocaleData.is() ) + aFormatSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > (0); + else + aFormatSeq = xlocaleData->getAllFormats( aLocale ); + bFormatsValid = sal_True; + } +} + + +::rtl::OUString +NumberFormatCodeMapper::mapElementTypeShortToString(sal_Int16 formatType) +{ + + switch ( formatType ) + { + case com::sun::star::i18n::KNumberFormatType::SHORT : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "short" ) ); + break; + case com::sun::star::i18n::KNumberFormatType::MEDIUM : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "medium" ) ); + break; + case com::sun::star::i18n::KNumberFormatType::LONG : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "long" ) ); + break; + } + return ::rtl::OUString(); +} + +sal_Int16 +NumberFormatCodeMapper::mapElementTypeStringToShort(const ::rtl::OUString& formatType) +{ + if(formatType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "short" ) )) + return com::sun::star::i18n::KNumberFormatType::SHORT; + if(formatType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "medium" ) )) + return com::sun::star::i18n::KNumberFormatType::MEDIUM; + if(formatType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "long" ) )) + return com::sun::star::i18n::KNumberFormatType::LONG; + + return com::sun::star::i18n::KNumberFormatType::SHORT; +} + +::rtl::OUString +NumberFormatCodeMapper::mapElementUsageShortToString(sal_Int16 formatUsage) +{ + switch ( formatUsage ) + { + case com::sun::star::i18n::KNumberFormatUsage::DATE : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DATE" ) ); + break; + case com::sun::star::i18n::KNumberFormatUsage::TIME : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TIME" ) ); + break; + case com::sun::star::i18n::KNumberFormatUsage::DATE_TIME : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DATE_TIME" ) ); + break; + case com::sun::star::i18n::KNumberFormatUsage::FIXED_NUMBER : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FIXED_NUMBER" ) ); + break; + case com::sun::star::i18n::KNumberFormatUsage::FRACTION_NUMBER : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FRACTION_NUMBER" ) ); + break; + case com::sun::star::i18n::KNumberFormatUsage::PERCENT_NUMBER : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PERCENT_NUMBER" ) ); + break; + case com::sun::star::i18n::KNumberFormatUsage::CURRENCY : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CURRENCY" ) ); + break; + case com::sun::star::i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER : + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SCIENTIFIC_NUMBER" ) ); + break; + } + return ::rtl::OUString(); +} + + +sal_Int16 +NumberFormatCodeMapper::mapElementUsageStringToShort(const ::rtl::OUString& formatUsage) +{ + if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DATE" ) )) + return com::sun::star::i18n::KNumberFormatUsage::DATE; + if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TIME" ) )) + return com::sun::star::i18n::KNumberFormatUsage::TIME; + if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DATE_TIME" ) )) + return com::sun::star::i18n::KNumberFormatUsage::DATE_TIME; + if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FIXED_NUMBER" ) )) + return com::sun::star::i18n::KNumberFormatUsage::FIXED_NUMBER; + if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FRACTION_NUMBER" ) )) + return com::sun::star::i18n::KNumberFormatUsage::FRACTION_NUMBER; + if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PERCENT_NUMBER" ) )) + return com::sun::star::i18n::KNumberFormatUsage::PERCENT_NUMBER; + if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CURRENCY" ) )) + return com::sun::star::i18n::KNumberFormatUsage::CURRENCY; + if(formatUsage.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SCIENTIFIC_NUMBER" ) )) + return com::sun::star::i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER; + + return 0; +} + + +void +NumberFormatCodeMapper::createLocaleDataObject() { + + if(xlocaleData.is()) + return; + + ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > + xI = xMSF->createInstance( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleData" ) )); + + if ( xI.is() ) { + ::com::sun::star::uno::Any x = xI->queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData >*)0) ); + x >>= xlocaleData; + } +} diff --git a/i18npool/source/registerservices/makefile.mk b/i18npool/source/registerservices/makefile.mk new file mode 100644 index 000000000000..a031ff19bf79 --- /dev/null +++ b/i18npool/source/registerservices/makefile.mk @@ -0,0 +1,44 @@ +#************************************************************************* +#* +#* $RCSfile: makefile.mk,v $ +#* +#* makefile +#* +#* Erstellung MT 25.6.98 +#* +#* Letzte Aenderung $Author: bustamam $ $Date: 2001-08-30 23:33:17 $ +#* +#* $Revision: 1.1 $ +#* +#* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/source/registerservices/makefile.mk,v $ +#* +#* Copyright (c) 1998, Star Division Corp. +#* +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=i18npool +TARGET=registerservices + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/registerservices.obj + +# Make symbol renaming match library name for Mac OS X +.IF "$(OS)"=="MACOSX" +SYMBOLPREFIX=i18n$(UPD)$(DLLPOSTFIX) +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx new file mode 100644 index 000000000000..4196f157901a --- /dev/null +++ b/i18npool/source/registerservices/registerservices.cxx @@ -0,0 +1,167 @@ +/************************************************************************* +#* +#* $RCSfile: registerservices.cxx,v $ +#* +#* Register Services +#* +#* Ersterstellung MT 15.3.2000 +#* +#* Letzte Aenderung $Author: bustamam $ $Date: 2001-08-30 23:33:17 $ +#* +#* $Revision: 1.1 $ +#* +#* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/source/registerservices/registerservices.cxx,v $ +#* +#* Copyright (c) 2000 Sun Microsystems Inc. +#* +#*************************************************************************/ + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include +#endif + +#include + +#ifndef _CPPUHELPER_WEAK_HXX_ +#include +#endif +#ifndef _OSL_MUTEX_HXX_ +#include +#endif + +#include +#include +#include +#include + + +#define IMPL_CREATEINSTANCE( ImplName ) \ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > \ + SAL_CALL ImplName##_CreateInstance( \ + const ::com::sun::star::uno::Reference< \ + ::com::sun::star::lang::XMultiServiceFactory >& ) \ +{ \ + return ::com::sun::star::uno::Reference < \ + ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) \ + new ImplName ); \ +} + +#define IMPL_CREATEINSTANCE_MSF( ImplName ) \ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > \ + SAL_CALL ImplName##_CreateInstance( \ + const ::com::sun::star::uno::Reference< \ + ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ) \ +{ \ + return ::com::sun::star::uno::Reference < \ + ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) \ + new ImplName( rxMSF ) ); \ +} + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > (SAL_CALL *FN_CreateInstance)( + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& ); + +// ------------------------------------------------------------------------------------- + +using namespace ::com::sun::star::i18n; + +IMPL_CREATEINSTANCE_MSF( NumberFormatCodeMapper ) +IMPL_CREATEINSTANCE( LocaleData ) +IMPL_CREATEINSTANCE_MSF( DefaultNumberingProvider ) +IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier ) + +static const struct InstancesArray { + const sal_Char* pServiceNm; + const sal_Char* pImplementationNm; + FN_CreateInstance pFn; +} aInstances[] = { + { "com.sun.star.i18n.LocaleData", + "com.sun.star.i18n.LocaleData", + & LocaleData_CreateInstance }, + { "com.sun.star.i18n.NumberFormatMapper", + "com.sun.star.i18n.NumberFormatCodeMapper", + & NumberFormatCodeMapper_CreateInstance }, + { "com.sun.star.text.DefaultNumberingProvider", + "com.sun.star.text.DefaultNumberingProvider", + &DefaultNumberingProvider_CreateInstance }, + { "com.sun.star.i18n.IndexEntrySupplier", + "com.sun.star.i18n.IndexEntrySupplier", + &IndexEntrySupplier_CreateInstance }, + +// add here new services !! + { 0, 0, 0 } +}; + + +extern "C" +{ + +void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ppEnv ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, void* _pRegistryKey ) +{ + if (_pRegistryKey) + { + ::com::sun::star::registry::XRegistryKey * pRegistryKey = + reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( + _pRegistryKey ); + ::com::sun::star::uno::Reference< + ::com::sun::star::registry::XRegistryKey > xNewKey; + + for( const InstancesArray* pArr = aInstances; pArr->pServiceNm; ++pArr ) + { + xNewKey = pRegistryKey->createKey( + ::rtl::OUString::createFromAscii( pArr->pImplementationNm ) ); + xNewKey = xNewKey->createKey( + ::rtl::OUString::createFromAscii( "/UNO/SERVICES" ) ); + xNewKey->createKey( + ::rtl::OUString::createFromAscii( pArr->pServiceNm ) ); + } + } + return sal_True; +} + +void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey ) +{ + void* pRet = NULL; + + ::com::sun::star::lang::XMultiServiceFactory* pServiceManager = + reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* > + ( _pServiceManager ); + ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XSingleServiceFactory > xFactory; + + for( const InstancesArray* pArr = aInstances; pArr->pServiceNm; ++pArr ) + { + if( 0 == rtl_str_compare( sImplementationName, pArr->pImplementationNm ) ) + { + ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + ::rtl::OUString::createFromAscii( pArr->pServiceNm ); + xFactory = ::cppu::createSingleFactory( + pServiceManager, aServiceNames.getArray()[0], + *pArr->pFn, aServiceNames ); + break; + } + } + + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} + +} // "C" diff --git a/i18npool/util/makefile.mk b/i18npool/util/makefile.mk index de0554d81ac1..8e21649c8949 100644 --- a/i18npool/util/makefile.mk +++ b/i18npool/util/makefile.mk @@ -6,9 +6,9 @@ #* #* Erstellung HJS 17.07.00 #* -#* Letzte Aenderung $Author: bustamam $ $Date: 2001-08-29 21:25:22 $ +#* Letzte Aenderung $Author: bustamam $ $Date: 2001-08-30 23:33:17 $ #* -#* $Revision: 1.1 $ +#* $Revision: 1.2 $ #* #* $Source: /zpool/svn/migration/cvs_rep_09_09_08/code/i18npool/util/makefile.mk,v $ #* @@ -23,6 +23,11 @@ TARGET=i18npool VERSION=$(UPD) USE_LDUMP2=TRUE +# Make symbol renaming match library name for Mac OS X +.IF "$(OS)"=="MACOSX" +SYMBOLPREFIX=i18n$(UPD)$(DLLPOSTFIX) +.ENDIF + # --- Settings ----------------------------------------------------------- .INCLUDE : settings.mk @@ -37,7 +42,6 @@ DEF1NAME= $(SHL1TARGET) DEFLIB1NAME= $(SHL1TARGET) DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt - SHL2TARGET= localedata_CJK SHL2IMPLIB= i$(SHL2TARGET) SHL2LIBS= $(SLB)$/$(SHL2TARGET).lib @@ -46,10 +50,31 @@ DEF2NAME= $(SHL2TARGET) DEFLIB2NAME= $(SHL2TARGET) DEF2DEPN= $(MISC)$/$(SHL2TARGET).flt +LIB3TARGET= $(SLB)$/$(TARGET).lib +LIB3FILES= $(SLB)$/defaultnumberingprovider.lib \ + $(SLB)$/registerservices.lib \ + $(SLB)$/numberformatcode.lib \ + $(SLB)$/localedata.lib + +SHL3TARGET= $(TARGET)$(VERSION)$(DLLPOSTFIX) +SHL3IMPLIB= i$(TARGET) + +SHL3STDLIBS=\ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(CPPULIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) + +SHL3LIBS= $(LIB3TARGET) +SHL3DEF= $(MISC)$/$(SHL3TARGET).def +DEF3NAME= $(SHL3TARGET) +DEF3EXPORTFILE= $(TARGET).dxp .IF "$(GUI)"=="UNX" .IF "$(OS)"!="MACOSX" -SHL1STDLIBS +=\ +SHL3STDLIBS +=\ -lX11 -lXt -lXmu .ENDIF .ENDIF @@ -67,3 +92,8 @@ $(MISC)$/$(SHL2TARGET).flt: makefile.mk @echo ------------------------------ @echo Making: $@ @echo Provider>> $@ + +$(MISC)$/$(SHL3TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo Provider>> $@ -- cgit v1.2.3