diff options
author | Bustamam Harun <bustamam@openoffice.org> | 2002-03-26 12:36:40 +0000 |
---|---|---|
committer | Bustamam Harun <bustamam@openoffice.org> | 2002-03-26 12:36:40 +0000 |
commit | 84321fa5fce83018173a116730a71da0e5d55a7e (patch) | |
tree | 95fa80861471cbc88094d6868f725073e524b6ee | |
parent | e52b9330d9a804369547d2ac80160664355df977 (diff) |
#97583# add Include files
33 files changed, 3525 insertions, 106 deletions
diff --git a/i18npool/inc/breakiteratorImpl.hxx b/i18npool/inc/breakiteratorImpl.hxx new file mode 100644 index 000000000000..2a932fc7a2f4 --- /dev/null +++ b/i18npool/inc/breakiteratorImpl.hxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * $RCSfile: breakiteratorImpl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_BREAKITERATOR_HXX_ +#define _I18N_BREAKITERATOR_HXX_ + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/BreakType.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/i18n/CharacterIteratorMode.hpp> +#include <com/sun/star/i18n/CharType.hpp> +#include <com/sun/star/i18n/XLocaleData.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations + +#include <tools/string.hxx> +#include <tools/list.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class BreakIterator +// ---------------------------------------------------- +class BreakIteratorImpl : public cppu::WeakImplHelper2 +< + XBreakIterator, + com::sun::star::lang::XServiceInfo +> +{ +public: + BreakIteratorImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + BreakIteratorImpl(); + ~BreakIteratorImpl(); + + virtual sal_Int32 SAL_CALL nextCharacters( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount, + sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL previousCharacters( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount, + sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException); + + virtual Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException); + virtual Boundary SAL_CALL nextWord( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException); + virtual Boundary SAL_CALL getWordBoundary( const rtl::OUString& Text, sal_Int32 nPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection ) + throw(com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isBeginWord( const rtl::OUString& Text, sal_Int32 nPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isEndWord( const rtl::OUString& Text, sal_Int32 nPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getWordType( const rtl::OUString& Text, sal_Int32 nPos, + const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL beginOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL endOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException); + + virtual LineBreakResults SAL_CALL getLineBreak( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int32 nMinBreakPos, + const LineBreakHyphenationOptions& hOptions, const LineBreakUserOptions& bOptions ) + throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL getScriptType( const rtl::OUString& Text, sal_Int32 nPos ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL beginOfScript( const rtl::OUString& Text, sal_Int32 nStartPos, + sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL endOfScript( const rtl::OUString& Text, sal_Int32 nStartPos, + sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL previousScript( const rtl::OUString& Text, sal_Int32 nStartPos, + sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL nextScript( const rtl::OUString& Text, sal_Int32 nStartPos, + sal_Int16 ScriptType ) throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL beginOfCharBlock( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL endOfCharBlock( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL previousCharBlock( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL nextCharBlock( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 CharType ) throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() + throw( com::sun::star::uno::RuntimeException ); + +protected: + sal_Int16 SAL_CALL getScriptClass(sal_Unicode cChar ); + Boundary result; // for word break iterator + +private : + + struct lookupTableItem { + lookupTableItem(const com::sun::star::lang::Locale& _aLocale, com::sun::star::uno::Reference < XBreakIterator >& _xBI) : aLocale(_aLocale), xBI(_xBI) {}; + com::sun::star::lang::Locale aLocale; + com::sun::star::uno::Reference < XBreakIterator > xBI; + }; + List lookupTable; + com::sun::star::lang::Locale aLocale; + com::sun::star::uno::Reference < XBreakIterator > xBI; + + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + sal_Bool SAL_CALL createLocaleSpecificBreakIterator( const rtl::OUString& aLocaleName ) + throw( com::sun::star::uno::RuntimeException ); + com::sun::star::uno::Reference < XBreakIterator > SAL_CALL getLocaleSpecificBreakIterator( const com::sun::star::lang::Locale& rLocale ) + throw( com::sun::star::uno::RuntimeException ); + const com::sun::star::lang::Locale& SAL_CALL getLocaleByScriptType(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& Text, + sal_Int32 nStartPos, sal_Bool forward, sal_Bool skipWhiteSpace) + throw(com::sun::star::uno::RuntimeException); + +}; + +} // i18n +} // star +} // sun +} // com + + + /******************************************************************** + + Source Code Control System - Updates + + $Log: not supported by cvs2svn $ + Revision 1.22 2001/11/12 19:34:11 er + #94609# del: numberformatcode.hxx + + Revision 1.21 2001/10/19 21:16:43 bustamam.harun + #84725# Add XServiceInfo implementation + + Revision 1.20 2001/09/24 14:59:50 jp + script of character 0x1 and 0x2 are WEAK - this are our fields + + Revision 1.19 2001/04/12 23:53:54 bustamam.harun + Fix compile problem on Solaris: change String to rtl::OUString + + Revision 1.18 2001/03/28 09:24:12 tl + #84966 aEmptyPropValSeq member removed + + Revision 1.17 2000/12/05 15:22:58 jp + Bug #81298#: CTOR with MultiServiceFactory + + Revision 1.16 2000/11/18 22:57:37 bustamam.harun + change to ::i18n + + Revision 1.15 2000/10/29 17:01:45 er + i18n API moved from com.sun.star.lang to com.sun.star.i18n + + Revision 1.14 2000/10/25 14:02:21 tl + linguistic => linguistic2 : member of type PropertyValues as argument for hyphenate added + + Revision 1.13 2000/10/22 19:07:03 er + SRC610 MUST: ::comphelper::getProcessServiceFactory + + Revision 1.12 2000/08/18 00:37:30 gmu + new files for cjk breakiterators + + Revision 1.11 2000/08/11 12:41:46 jp + Bug #77428#: change int to sal_Int32, change size of some static array + + Revision 1.10 2000/08/10 15:18:58 jp + remove the not used methods queryInterface/acquire/release - because it's handled by the base class correct! + + Revision 1.9 2000/07/03 10:13:11 gmu + added getScriptClass() + + Revision 1.8 2000/06/30 10:38:06 jp + change the OWeak base class to the WeakImpHelper class + + Revision 1.7 2000/06/23 11:36:47 gmu + changed API to reflect changes in IDL file + + Revision 1.6 2000/06/20 16:02:56 hr + #includes with lowercase letters + + Revision 1.5 2000/06/14 13:32:28 sse + Merged Begin and End word breaking + + Revision 1.4 2000/06/14 08:25:06 sse + Updated hyphenator interface + + Revision 1.3 2000/06/13 08:13:00 sse + new breakiterator API + + Revision 1.2 2000/06/09 10:10:59 sse + Initial version of unicode breakiterator + + Revision 1.1 2000/06/07 12:22:43 mt + BreakIterator + + + *********************************************************************/ + + +#endif // _I18N_BREAKITERATOR_HXX_ diff --git a/i18npool/inc/breakiterator_cjk.hxx b/i18npool/inc/breakiterator_cjk.hxx new file mode 100644 index 000000000000..11b22d8da594 --- /dev/null +++ b/i18npool/inc/breakiterator_cjk.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: breakiterator_cjk.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_BREAKITERATOR_CJK_HXX_ +#define _I18N_BREAKITERATOR_CJK_HXX_ + +#include <breakiterator_unicode.hxx> +#include <xdictionary.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { +// ---------------------------------------------------- +// class BreakIterator_CJK +// ---------------------------------------------------- +class BreakIterator_CJK : public BreakIterator_Unicode +{ +public: + BreakIterator_CJK(); + + Boundary SAL_CALL nextWord( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) + throw(com::sun::star::uno::RuntimeException); + Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) + throw(com::sun::star::uno::RuntimeException); + Boundary SAL_CALL getWordBoundary( const rtl::OUString& Text, sal_Int32 nPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection ) + throw(com::sun::star::uno::RuntimeException); + +protected: + xdictionary *dict; +}; + +#define BREAKITERATOR_CJK( lang ) \ +class BreakIterator_##lang : public BreakIterator_CJK {\ +public:\ + BreakIterator_##lang (); \ + ~BreakIterator_##lang (); \ +}; + +#ifdef BREAKITERATOR_ALL +BREAKITERATOR_CJK( zh ) +BREAKITERATOR_CJK( ja ) +#endif +#undef BREAKITERATOR__CJK + +} } } } + +#endif // _I18N_BREAKITERATOR_CJK_HXX_ diff --git a/i18npool/inc/breakiterator_ctl.hxx b/i18npool/inc/breakiterator_ctl.hxx new file mode 100644 index 000000000000..463837421966 --- /dev/null +++ b/i18npool/inc/breakiterator_ctl.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * $RCSfile: breakiterator_ctl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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 __BREAKITERATOR_CTL_HXX__ +#define __BREAKITERATOR_CTL_HXX__ + +#include <breakiterator_unicode.hxx> +#include <xdictionary.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class BreakIterator_CTL +// ---------------------------------------------------- +class BreakIterator_CTL : public BreakIterator_Unicode +{ +public: + BreakIterator_CTL(); + ~BreakIterator_CTL(); + virtual sal_Int32 SAL_CALL previousCharacters(const rtl::OUString& text, sal_Int32 start, + const lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 count, + sal_Int32& nDone) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL nextCharacters(const rtl::OUString& text, sal_Int32 start, + const lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 count, + sal_Int32& nDone) throw(com::sun::star::uno::RuntimeException); + +protected: + rtl::OUString cachedText; // for cell index + sal_Int32* nextCellIndex; + sal_Int32* previousCellIndex; + sal_Int32 cellIndexSize; + virtual void SAL_CALL makeIndex(const rtl::OUString& text, sal_Int32 pos) throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif diff --git a/i18npool/inc/breakiterator_th.hxx b/i18npool/inc/breakiterator_th.hxx new file mode 100644 index 000000000000..462e1abdc649 --- /dev/null +++ b/i18npool/inc/breakiterator_th.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * $RCSfile: breakiterator_th.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_BREAKITERATOR_TH_HXX_ +#define _I18N_BREAKITERATOR_TH_HXX_ + +#include <breakiterator_ctl.hxx> +#include <xdictionary.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class BreakIterator_th +// ---------------------------------------------------- +class BreakIterator_th : public BreakIterator_CTL +{ +public: + BreakIterator_th(); + ~BreakIterator_th(); + + Boundary SAL_CALL nextWord( const rtl::OUString& Text, sal_Int32 nStartPos, + const lang::Locale& nLocale, sal_Int16 WordType) + throw(com::sun::star::uno::RuntimeException); + Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos, + const lang::Locale& nLocale, sal_Int16 WordType) + throw(com::sun::star::uno::RuntimeException); + Boundary SAL_CALL getWordBoundary( const rtl::OUString& Text, sal_Int32 nPos, + const lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection ) + throw(com::sun::star::uno::RuntimeException); +protected: + void SAL_CALL makeIndex(const rtl::OUString& text, sal_Int32 pos) throw(com::sun::star::uno::RuntimeException); +private: + xdictionary *dict; +}; + +} } } } + +#endif // _I18N_BREAKITERATOR_TH_HXX_ diff --git a/i18npool/inc/breakiterator_unicode.hxx b/i18npool/inc/breakiterator_unicode.hxx new file mode 100644 index 000000000000..50c092a49897 --- /dev/null +++ b/i18npool/inc/breakiterator_unicode.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: breakiterator_unicode.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_BREAKITERATOR_UNICODE_HXX_ +#define _I18N_BREAKITERATOR_UNICODE_HXX_ + +#include <breakiteratorImpl.hxx> +#include <unicode/brkiter.h> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class BreakIterator_Unicode +// ---------------------------------------------------- +class BreakIterator_Unicode : public BreakIteratorImpl +{ +public: + BreakIterator_Unicode(); + ~BreakIterator_Unicode(); + + virtual sal_Int32 SAL_CALL previousCharacters( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount, + sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL nextCharacters( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& rLocale, sal_Int16 nCharacterIteratorMode, sal_Int32 nCount, + sal_Int32& nDone ) throw(com::sun::star::uno::RuntimeException); + + virtual Boundary SAL_CALL previousWord( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException); + virtual Boundary SAL_CALL nextWord( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType) throw(com::sun::star::uno::RuntimeException); + virtual Boundary SAL_CALL getWordBoundary( const rtl::OUString& Text, sal_Int32 nPos, + const com::sun::star::lang::Locale& nLocale, sal_Int16 WordType, sal_Bool bDirection ) + throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL beginOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL endOfSentence( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale ) throw(com::sun::star::uno::RuntimeException); + + virtual LineBreakResults SAL_CALL getLineBreak( const rtl::OUString& Text, sal_Int32 nStartPos, + const com::sun::star::lang::Locale& nLocale, sal_Int32 nMinBreakPos, + const LineBreakHyphenationOptions& hOptions, const LineBreakUserOptions& bOptions ) + throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() + throw( com::sun::star::uno::RuntimeException ); + +protected: + sal_Char *cBreakIterator; + Boundary result; // for word break iterator + +private: + rtl::OUString cachedText; // for script boundary + sal_Int32 scriptStart, scriptLength; + icu::BreakIterator *characterBreak, *wordBreak, *sentenceBreak, *lineBreak; + sal_Int32 SAL_CALL setTextByScriptBoundary(const rtl::OUString& Text, sal_Int32 nPos); +}; + +} } } } + +#endif diff --git a/i18npool/inc/calendarImpl.hxx b/i18npool/inc/calendarImpl.hxx new file mode 100644 index 000000000000..613cfcbc3e77 --- /dev/null +++ b/i18npool/inc/calendarImpl.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * $RCSfile: calendarImpl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_CALENDARIMPL_HXX_ +#define _I18N_CALENDARIMPL_HXX_ + +#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XCalendar.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <tools/list.hxx> + +// ---------------------------------------------------- +// class CalendarImpl +// ---------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace i18n { + +class CalendarImpl : public cppu::WeakImplHelper2 +< + XCalendar, + com::sun::star::lang::XServiceInfo +> +{ +public: + + // Constructors + CalendarImpl() {}; + CalendarImpl(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF); + + /** + * Destructor + */ + ~CalendarImpl(); + + + // Methods + virtual void SAL_CALL loadDefaultCalendar(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL loadCalendar(const rtl::OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); + virtual Calendar SAL_CALL getLoadedCalendar() throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getAllCalendars(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getUniqueID() throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid() throw (com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getFirstDayOfWeek() throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFirstDayOfWeek(sal_Int16 nDay) throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMinimumNumberOfDaysForFirstWeek(sal_Int16 nDays) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getMinimumNumberOfDaysForFirstWeek() throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getNumberOfMonthsInYear() throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getNumberOfDaysInWeek() throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getMonths() throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence < CalendarItem > SAL_CALL getDays() throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getDisplayName(sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType) throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() throw(com::sun::star::uno::RuntimeException); + +private: + struct lookupTableItem { + lookupTableItem(rtl::OUString& _uniqueID, com::sun::star::uno::Reference < XCalendar >& _xCalendar) : + uniqueID(_uniqueID), xCalendar(_xCalendar) {} + rtl::OUString uniqueID; + com::sun::star::uno::Reference < XCalendar > xCalendar; + }; + List lookupTable; + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + com::sun::star::uno::Reference < XLocaleData > xLocaleData; + com::sun::star::uno::Reference < XCalendar > xCalendar; + Calendar aCalendar; + sal_Int16 aStartOfWeek; + rtl::OUString timeAM, timePM; + virtual void SAL_CALL loadCachedCalendar(rtl::OUString& uniqueID) throw (com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx new file mode 100644 index 000000000000..21f54c378721 --- /dev/null +++ b/i18npool/inc/calendar_gregorian.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * $RCSfile: calendar_gregorian.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_CALENDAR_GREGORIAN_HXX_ +#define _I18N_CALENDAR_GREGORIAN_HXX_ + +#include "calendarImpl.hxx" +#include "unicode/calendar.h" +#include <com/sun/star/i18n/CalendarFieldIndex.hpp> + +// ---------------------------------------------------- +// class Calendar_gregorian +// ---------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace i18n { + +class Calendar_gregorian : public CalendarImpl +{ +public: + + // Constructors + Calendar_gregorian(); + + /** + * Destructor + */ + ~Calendar_gregorian(); + + // Methods + virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getValue(sal_Int16 nFieldIndex) throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addValue(sal_Int16 nFieldIndex, sal_Int32 nAmount) throw(com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid() throw (com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() throw(com::sun::star::uno::RuntimeException); + +protected: + icu::Calendar *body; + struct Era { + sal_Int32 year; + sal_Int32 month; + sal_Int32 day; + }; + Era *eraArray; + sal_Char* cCalendar; + virtual sal_Bool SAL_CALL convertValue( sal_Int16 fieldIndex ) throw(com::sun::star::uno::RuntimeException); + sal_uInt32 fieldGet; + sal_Int16 fieldGetValue[CalendarFieldIndex::FIELD_COUNT]; + sal_uInt32 fieldSet; + sal_Int16 fieldSetValue[CalendarFieldIndex::FIELD_COUNT]; + +private: + friend sal_Bool operator < (const Era& era1, const Era& era2) { + return (era1.year != era2.year) ? era1.year < era2.year : + (era1.month != era2.month) ? era1.month < era2.month : era1.day < era2.day; + }; +}; + +// ---------------------------------------------------- +// class Calendar_hanja_yoil +// ---------------------------------------------------- +class Calendar_hanja_yoil : public Calendar_gregorian +{ +public: + // Constructors + Calendar_hanja_yoil(); +}; + +// ---------------------------------------------------- +// class Calendar_gengou +// ---------------------------------------------------- +class Calendar_gengou : public Calendar_gregorian +{ +public: + // Constructors + Calendar_gengou(); +}; + +// ---------------------------------------------------- +// class Calendar_ROC +// ---------------------------------------------------- +class Calendar_ROC : public Calendar_gregorian +{ +public: + // Constructors + Calendar_ROC(); +}; + +// ---------------------------------------------------- +// class Calendar_buddhist +// ---------------------------------------------------- +class Calendar_buddhist : public Calendar_gregorian +{ +public: + // Constructors + Calendar_buddhist(); +}; + +} } } } + +#endif diff --git a/i18npool/inc/calendar_hijri.hxx b/i18npool/inc/calendar_hijri.hxx new file mode 100644 index 000000000000..1546306d67ee --- /dev/null +++ b/i18npool/inc/calendar_hijri.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * $RCSfile: calendar_hijri.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_CALENDAR_HIJRI_HXX_ +#define _I18N_CALENDAR_HIJRI_HXX_ + +#include "calendar_gregorian.hxx" + + +// ---------------------------------------------------- +// class Calendar_hijri +// ---------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace i18n { + +class Calendar_hijri : public Calendar_gregorian +{ +public: + + // Constructors + Calendar_hijri(); + +protected: + sal_Bool SAL_CALL convertValue( sal_Int16 fieldIndex ) throw(com::sun::star::uno::RuntimeException); + + // radians per degree (pi/180) + static const double RadPerDeg; + + // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec + static const double SynPeriod; + + static const double SynMonth; // Solar days in a year/SynPeriod + + // Julian day on Jan 1, 1900 + static const double jd1900; + + // Reference point: September 1984 25d 3h 10m UT. == 1405 Hijri == 1048 Synodial month from 1900 + static const sal_Int32 SynRef; + static const sal_Int32 GregRef; + + // Local time (Saudi Arabia) + static const double SA_TimeZone; // Time Zone + + // Period between 1.30pm - 6:30pm + static const double EveningPeriod; + + // "Leap" years + static const sal_Int32 LeapYear[]; + +private: + double NewMoon(sal_Int32 n); + void getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year); + double getJulianDay(); +}; + +} } } } + +#endif diff --git a/i18npool/inc/calendar_jewish.hxx b/i18npool/inc/calendar_jewish.hxx new file mode 100644 index 000000000000..609553459373 --- /dev/null +++ b/i18npool/inc/calendar_jewish.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * $RCSfile: calendar_jewish.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_CALENDAR_JEWISH_HXX_ +#define _I18N_CALENDAR_JEWISH_HXX_ + +#include "calendar_gregorian.hxx" + +// ---------------------------------------------------- +// class Calendar_jewish +// ---------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace i18n { + +class Calendar_jewish : public Calendar_gregorian +{ +public: + // Constructors + Calendar_jewish(); + +protected: + sal_Bool SAL_CALL convertValue( sal_Int16 fieldIndex ) throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif diff --git a/i18npool/inc/cclass_cjk.hxx b/i18npool/inc/cclass_cjk.hxx new file mode 100644 index 000000000000..53f2cb039833 --- /dev/null +++ b/i18npool/inc/cclass_cjk.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * $RCSfile: cclass_cjk.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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 _CCLASS_CJK_H_ +#define _CCLASS_CJK_H_ + +#include <cclass_unicode.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +#define MAXLEN 31 // Define max length for CJK number + +#define ZERO 0x0030 // Define unicode zero +#define ONE 0x0031 // Define unicode one + +class cclass_CJK : public cclass_Unicode { +public: + cclass_CJK( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + ~cclass_CJK(); + i18n::ParseResult SAL_CALL parsePredefinedToken( + sal_Int32 nTokenType, + const rtl::OUString& Text, + sal_Int32 nPos, + const com::sun::star::lang::Locale& rLocale, + sal_Int32 nStartCharFlags, + const rtl::OUString& userDefinedCharactersStart, + sal_Int32 nContCharFlags, + const rtl::OUString& userDefinedCharactersCont ) + throw(com::sun::star::uno::RuntimeException); + +protected: + sal_Int32 size; + rtl::OUString number; + sal_Unicode *text; + sal_Int32 textPos; + + sal_Unicode *Upper; + sal_Unicode *Base; + sal_Unicode *Plus; + + static sal_Int32 cclass_CJK::upperVal[]; + static sal_Int32 cclass_CJK::baseVal[]; + static sal_Int32 cclass_CJK::plusVal[]; + +private: + sal_Int32 ToNum(); + sal_Int32 ToNum(sal_Unicode *n, sal_Int32 s); + void Init(sal_Unicode *n, sal_Int32 s); + void NumberCopy(sal_Unicode *s, sal_Unicode *t, sal_Int32 n); + void NumberReverse(sal_Unicode *s, sal_Int32 n); + sal_Int32 oneDigit(sal_Unicode s); + sal_Int32 baseDigit(sal_Unicode s); + sal_Int32 plusDigit(sal_Unicode s); +}; + +#define CCLASS_CJK( name ) \ +class name : public cclass_CJK \ +{ \ +public: \ + name ( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); \ +}; + +#ifdef CCLASS_ALL +CCLASS_CJK(cclass_zh) +CCLASS_CJK(cclass_zh_TW) +CCLASS_CJK(cclass_ko) +#endif +#undef CCLASS_CJK + +} } } } + +#endif diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx new file mode 100644 index 000000000000..16068e216cf1 --- /dev/null +++ b/i18npool/inc/cclass_unicode.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * $RCSfile: cclass_unicode.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_CCLASS_UNICODE_HXX_ +#define _I18N_CCLASS_UNICODE_HXX_ + +#include <com/sun/star/i18n/XCharacterClassification.hpp> +#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hdl> +#include <cppuhelper/implbase1.hxx> // helper for implementations +#include <com/sun/star/lang/XServiceInfo.hpp> + +#define TRANSLITERATION_casemapping +#include <transliteration_body.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +typedef sal_uInt32 UPT_FLAG_TYPE; + +class cclass_Unicode : public cppu::WeakImplHelper1 < XCharacterClassification > +{ +public: + cclass_Unicode(com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xSMgr ); + ~cclass_Unicode(); + + virtual rtl::OUString SAL_CALL toUpper( const rtl::OUString& Text, sal_Int32 nPos, sal_Int32 nCount, + const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL toLower( const rtl::OUString& Text, sal_Int32 nPos, sal_Int32 nCount, + const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL toTitle( const rtl::OUString& Text, sal_Int32 nPos, sal_Int32 nCount, + const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getType( const rtl::OUString& Text, sal_Int32 nPos ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getCharacterDirection( const rtl::OUString& Text, sal_Int32 nPos ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getScript( const rtl::OUString& Text, sal_Int32 nPos ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterType( const rtl::OUString& text, sal_Int32 nPos, + const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getStringType( const rtl::OUString& text, sal_Int32 nPos, sal_Int32 nCount, + const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual ParseResult SAL_CALL parseAnyToken( const rtl::OUString& Text, sal_Int32 nPos, + const com::sun::star::lang::Locale& rLocale, sal_Int32 nStartCharFlags, const rtl::OUString& userDefinedCharactersStart, + sal_Int32 nContCharFlags, const rtl::OUString& userDefinedCharactersCont ) throw(com::sun::star::uno::RuntimeException); + virtual ParseResult SAL_CALL parsePredefinedToken( sal_Int32 nTokenType, const rtl::OUString& Text, + sal_Int32 nPos, const com::sun::star::lang::Locale& rLocale, sal_Int32 nStartCharFlags, + const rtl::OUString& userDefinedCharactersStart, sal_Int32 nContCharFlags, + const rtl::OUString& userDefinedCharactersCont ) throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() throw( com::sun::star::uno::RuntimeException ); + +protected: + sal_Char *cClass; + +private: + Transliteration_casemapping *trans; + +// --- parser specific (implemented in cclass_unicode_parser.cxx) --- + + enum ScanState + { + ssGetChar, + ssGetValue, + ssGetWord, + ssGetWordFirstChar, + ssGetString, + ssGetBool, + ssStopBack, + ssBounce, + ssStop + }; + + static const sal_uInt8 nDefCnt; + static const UPT_FLAG_TYPE pDefaultParserTable[]; + static const sal_Int32 pParseTokensType[]; + + /// Flag values of table. + static const UPT_FLAG_TYPE TOKEN_ILLEGAL; + static const UPT_FLAG_TYPE TOKEN_CHAR; + static const UPT_FLAG_TYPE TOKEN_CHAR_BOOL; + static const UPT_FLAG_TYPE TOKEN_CHAR_WORD; + static const UPT_FLAG_TYPE TOKEN_CHAR_VALUE; + static const UPT_FLAG_TYPE TOKEN_CHAR_STRING; + static const UPT_FLAG_TYPE TOKEN_CHAR_DONTCARE; + static const UPT_FLAG_TYPE TOKEN_BOOL; + static const UPT_FLAG_TYPE TOKEN_WORD; + static const UPT_FLAG_TYPE TOKEN_WORD_SEP; + static const UPT_FLAG_TYPE TOKEN_VALUE; + static const UPT_FLAG_TYPE TOKEN_VALUE_SEP; + static const UPT_FLAG_TYPE TOKEN_VALUE_EXP; + static const UPT_FLAG_TYPE TOKEN_VALUE_SIGN; + static const UPT_FLAG_TYPE TOKEN_VALUE_EXP_VALUE; + static const UPT_FLAG_TYPE TOKEN_VALUE_DIGIT; + static const UPT_FLAG_TYPE TOKEN_NAME_SEP; + static const UPT_FLAG_TYPE TOKEN_STRING_SEP; + static const UPT_FLAG_TYPE TOKEN_EXCLUDED; + + /// If and where c occurs in pStr + static const sal_Unicode* StrChr( const sal_Unicode* pStr, sal_Unicode c ); + + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + + /// used for parser only + com::sun::star::lang::Locale aParserLocale; + com::sun::star::uno::Reference < XLocaleData > xLocaleData; + rtl::OUString aStartChars; + rtl::OUString aContChars; + UPT_FLAG_TYPE* pTable; + UPT_FLAG_TYPE* pStart; + UPT_FLAG_TYPE* pCont; + sal_Int32 nStartTypes; + sal_Int32 nContTypes; + ScanState eState; + sal_Unicode cGroupSep; + sal_Unicode cDecimalSep; + + /// Get corresponding KParseTokens flag for a character + sal_Int32 getParseTokensType( sal_Unicode c ); + + /// Access parser table flags. + UPT_FLAG_TYPE getFlags( sal_Unicode c ); + + /// Access parser flags via International and special definitions. + UPT_FLAG_TYPE getFlagsExtended( sal_Unicode c ); + + /// Access parser table flags for user defined start characters. + UPT_FLAG_TYPE getStartCharsFlags( sal_Unicode c ); + + /// Access parser table flags for user defined continuation characters. + UPT_FLAG_TYPE getContCharsFlags( sal_Unicode c ); + + /// Setup parser table. Calls initParserTable() only if needed. + void setupParserTable( const com::sun::star::lang::Locale& rLocale, sal_Int32 startCharTokenType, + const rtl::OUString& userDefinedCharactersStart, sal_Int32 contCharTokenType, + const rtl::OUString& userDefinedCharactersCont ); + + /// Init parser table. + void initParserTable( const com::sun::star::lang::Locale& rLocale, sal_Int32 startCharTokenType, + const rtl::OUString& userDefinedCharactersStart, sal_Int32 contCharTokenType, + const rtl::OUString& userDefinedCharactersCont ); + + /// Destroy parser table. + void destroyParserTable(); + + /// Parse a text. + void parseText( ParseResult& r, const rtl::OUString& rText, sal_Int32 nPos, + sal_Int32 nTokenType = 0xffffffff ); + + /// Setup International class, new'ed only if different from existing. + sal_Bool setupInternational( const com::sun::star::lang::Locale& rLocale ); + + /// Implementation of getCharacterType() for one single character + sal_Int32 getCharType( sal_Unicode c ); + +}; + +} } } } + +/************************************************************************** + + Source Code Control System - Updates + + $Log: not supported by cvs2svn $ + Revision 1.3 2001/10/19 21:16:45 bustamam.harun + #84725# Add XServiceInfo implementation + + Revision 1.2 2001/05/18 17:57:33 er + #79771# optimize: disentangled: cclass_unicode not derived from CharacterClassificationImpl; reuse instance if locale didn't change; rtl::OUString instead of String + + Revision 1.1 2001/03/27 21:13:45 bustamam.harun + rename characterclassification to cclass_unicode + + Revision 1.6 2001/01/29 17:05:55 er + CharacterClassification with service manager + + Revision 1.5 2000/10/29 17:01:45 er + i18n API moved from com.sun.star.lang to com.sun.star.i18n + + Revision 1.4 2000/08/11 14:51:29 er + removed queryInterface/aquire/release, using WeakImplHelper instead + + Revision 1.3 2000/07/06 15:49:21 gmu + changed parsing functions + + Revision 1.2 2000/07/06 15:21:04 er + define USE_I18N_DEFAULT_IMPLEMENTATION and Locale dependent source + + Revision 1.1 2000/07/06 08:51:54 er + new: CharacterClassification with parser + + +**************************************************************************/ + +#endif diff --git a/i18npool/inc/chaptercollator.hxx b/i18npool/inc/chaptercollator.hxx new file mode 100644 index 000000000000..155303592930 --- /dev/null +++ b/i18npool/inc/chaptercollator.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * $RCSfile: chaptercollator.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_CHAPTERCOLLATOR_HXX_ +#define _I18N_CHAPTERCOLLATOR_HXX_ + +#include <collatorImpl.hxx> +#include <com/sun/star/i18n/XCharacterClassification.hpp> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class ChapterCollator +// ---------------------------------------------------- +class ChapterCollator : public CollatorImpl +{ +public: + // Constructors + ChapterCollator( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + // Destructor + ~ChapterCollator(); + + sal_Int32 SAL_CALL compareSubstring( const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, + const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) throw(com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL compareString( const rtl::OUString& s1, const rtl::OUString& s2) throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() throw( com::sun::star::uno::RuntimeException ); + +private : + // CharacterClassification Implementation + com::sun::star::uno::Reference< XCharacterClassification > cclass; +}; + +} } } } + +#endif diff --git a/i18npool/inc/characterclassificationImpl.hxx b/i18npool/inc/characterclassificationImpl.hxx new file mode 100644 index 000000000000..4ba2f51112a8 --- /dev/null +++ b/i18npool/inc/characterclassificationImpl.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * $RCSfile: characterclassificationImpl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_CHARACTERCLASSIFICATIONIMPL_HXX_ +#define _I18N_CHARACTERCLASSIFICATIONIMPL_HXX_ + +#include <com/sun/star/i18n/XCharacterClassification.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <tools/list.hxx> +#include <com/sun/star/i18n/KCharacterType.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace com { namespace sun { namespace star { namespace i18n { + +class CharacterClassificationImpl : public cppu::WeakImplHelper2 +< + XCharacterClassification, + com::sun::star::lang::XServiceInfo +> +{ +public: + + CharacterClassificationImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + virtual ~CharacterClassificationImpl(); + + virtual rtl::OUString SAL_CALL toUpper( const rtl::OUString& Text, + sal_Int32 nPos, sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL toLower( const rtl::OUString& Text, + sal_Int32 nPos, sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL toTitle( const rtl::OUString& Text, sal_Int32 nPos, + sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getType( const rtl::OUString& Text, sal_Int32 nPos ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getCharacterDirection( const rtl::OUString& Text, sal_Int32 nPos ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getScript( const rtl::OUString& Text, sal_Int32 nPos ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterType( const rtl::OUString& text, sal_Int32 nPos, + const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getStringType( const rtl::OUString& text, sal_Int32 nPos, + sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + virtual ParseResult SAL_CALL parseAnyToken( const rtl::OUString& Text, sal_Int32 nPos, + const com::sun::star::lang::Locale& rLocale, sal_Int32 nStartCharFlags, + const rtl::OUString& userDefinedCharactersStart, sal_Int32 nContCharFlags, + const rtl::OUString& userDefinedCharactersCont ) + throw(com::sun::star::uno::RuntimeException); + virtual ParseResult SAL_CALL parsePredefinedToken( sal_Int32 nTokenType, + const rtl::OUString& Text, sal_Int32 nPos, const com::sun::star::lang::Locale& rLocale, + sal_Int32 nStartCharFlags, const rtl::OUString& userDefinedCharactersStart, + sal_Int32 nContCharFlags, const rtl::OUString& userDefinedCharactersCont ) + 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: + struct lookupTableItem { + lookupTableItem(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rName, + com::sun::star::uno::Reference < XCharacterClassification >& rxCI) : + aLocale(rLocale), aName(rName), xCI(rxCI) {}; + com::sun::star::lang::Locale aLocale; + rtl::OUString aName; + com::sun::star::uno::Reference < XCharacterClassification > xCI; + sal_Bool SAL_CALL equals(const com::sun::star::lang::Locale& rLocale) { + return aLocale.Language == rLocale.Language && + aLocale.Country == rLocale.Country && + aLocale.Variant == rLocale.Variant; + }; + }; + List lookupTable; + lookupTableItem *cachedItem; + + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + com::sun::star::uno::Reference < XCharacterClassification > xUCI; + + com::sun::star::uno::Reference < XCharacterClassification > SAL_CALL + getLocaleSpecificCharacterClassification(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL + createLocaleSpecificCharacterClassification(const rtl::OUString& serviceName, const com::sun::star::lang::Locale& rLocale); + +}; + +} } } } + +/************************************************************************** + + Source Code Control System - Updates + + $Log: not supported by cvs2svn $ + Revision 1.4 2001/10/19 21:16:45 bustamam.harun + #84725# Add XServiceInfo implementation + + Revision 1.3 2001/05/18 17:57:33 er + #79771# optimize: disentangled: cclass_unicode not derived from CharacterClassificationImpl; reuse instance if locale didn't change; rtl::OUString instead of String + + Revision 1.2 2001/04/12 23:53:54 bustamam.harun + Fix compile problem on Solaris: change String to rtl::OUString + + Revision 1.1 2001/03/27 21:18:55 bustamam.harun + Add locale sensitive character classification + + Revision 1.6 2001/01/29 17:05:55 er + CharacterClassification with service manager + + Revision 1.5 2000/10/29 17:01:45 er + i18n API moved from com.sun.star.lang to com.sun.star.i18n + + Revision 1.4 2000/08/11 14:51:29 er + removed queryInterface/aquire/release, using WeakImplHelper instead + + Revision 1.3 2000/07/06 15:49:21 gmu + changed parsing functions + + Revision 1.2 2000/07/06 15:21:04 er + define USE_I18N_DEFAULT_IMPLEMENTATION and Locale dependent source + + Revision 1.1 2000/07/06 08:51:54 er + new: CharacterClassification with parser + + +**************************************************************************/ + +#endif diff --git a/i18npool/inc/collatorImpl.hxx b/i18npool/inc/collatorImpl.hxx new file mode 100644 index 000000000000..1d81b32cdc9c --- /dev/null +++ b/i18npool/inc/collatorImpl.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: collatorImpl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_COLLATORIMPL_HXX_ +#define _I18N_COLLATORIMPL_HXX_ + +#include <comphelper/processfactory.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XCollator.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase2.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#if !defined( WIN32 ) && !defined( MACOSX ) +#include <alloca.h> +#endif +#include <tools/list.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { +// ---------------------------------------------------- +// class CollatorImpl +// ---------------------------------------------------- +class CollatorImpl : public cppu::WeakImplHelper2 +< + XCollator, + com::sun::star::lang::XServiceInfo +> +{ +public: + + // Constructors + CollatorImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + // Destructor + ~CollatorImpl(); + + virtual sal_Int32 SAL_CALL compareSubstring(const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, + const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL compareString( const rtl::OUString& s1, + const rtl::OUString& s2) throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL loadDefaultCollator( const lang::Locale& rLocale, sal_Int32 collatorOptions) + throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL loadCollatorAlgorithm( const rtl::OUString& impl, const lang::Locale& rLocale, + sal_Int32 collatorOptions) throw(com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL loadCollatorAlgorithmWithEndUserOption( const rtl::OUString& impl, const lang::Locale& rLocale, + const com::sun::star::uno::Sequence< sal_Int32 >& collatorOptions) throw(com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL listCollatorAlgorithms( const lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL listCollatorOptions( const rtl::OUString& collatorAlgorithmName ) + throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() throw( com::sun::star::uno::RuntimeException ); + +protected: + lang::Locale nLocale; +private : + struct lookupTableItem { + lang::Locale aLocale; + rtl::OUString algorithm; + rtl::OUString service; + com::sun::star::uno::Reference < XCollator > xC; + lookupTableItem(const lang::Locale& rLocale, const rtl::OUString& _algorithm, const rtl::OUString& _service, + com::sun::star::uno::Reference < XCollator >& _xC) : aLocale(rLocale), algorithm(_algorithm), service(_service), xC(_xC) {} + sal_Bool SAL_CALL equals(const lang::Locale& rLocale, const rtl::OUString& _algorithm) { + return aLocale.Language == rLocale.Language && + aLocale.Country == rLocale.Country && + aLocale.Variant == rLocale.Variant && + algorithm == _algorithm; + } + }; + List lookupTable; + lookupTableItem *cachedItem; + + // Service Factory + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + // lang::Locale Data + com::sun::star::uno::Reference < XLocaleData > localedata; + + sal_Bool SAL_CALL createCollator(const lang::Locale& rLocale, const rtl::OUString& serviceName, + const rtl::OUString& rSortAlgorithm) throw(com::sun::star::uno::RuntimeException); + void SAL_CALL loadCachedCollator(const lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm) + throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif diff --git a/i18npool/inc/collator_unicode.hxx b/i18npool/inc/collator_unicode.hxx new file mode 100644 index 000000000000..50989e342dbb --- /dev/null +++ b/i18npool/inc/collator_unicode.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * $RCSfile: collator_unicode.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_COLLATOR_UNICODE_HXX_ +#define _I18N_COLLATOR_UNICODE_HXX_ + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/i18n/XCollator.hpp> +#include <transliteration_commonclass.hxx> +#include <cppuhelper/implbase2.hxx> + +// ---------------------------------------------------- +// class Collator_Unicode +// ---------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace i18n { + +class Collator_Unicode : public cppu::WeakImplHelper1 < XCollator > +{ +public: + // Constructors + Collator_Unicode(); + // Destructor + ~Collator_Unicode(); + + virtual sal_Int32 SAL_CALL compareSubstring( const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, + const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL compareString( const rtl::OUString& s1, const rtl::OUString& s2) + throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL loadCollatorAlgorithm( const rtl::OUString& impl, const lang::Locale& rLocale, + sal_Int32 collatorOptions) throw(com::sun::star::uno::RuntimeException); + + + // following 4 methods are implemented in collatorImpl. + sal_Int32 SAL_CALL loadDefaultCollator( const lang::Locale& rLocale, sal_Int32 collatorOptions) + throw(com::sun::star::uno::RuntimeException) {throw com::sun::star::uno::RuntimeException();} + void SAL_CALL loadCollatorAlgorithmWithEndUserOption( const rtl::OUString& impl, const lang::Locale& rLocale, + const com::sun::star::uno::Sequence< sal_Int32 >& collatorOptions) throw(com::sun::star::uno::RuntimeException) {throw com::sun::star::uno::RuntimeException();} + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL listCollatorAlgorithms( const lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException) {throw com::sun::star::uno::RuntimeException();} + com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL listCollatorOptions( const rtl::OUString& collatorAlgorithmName ) + throw(com::sun::star::uno::RuntimeException) {throw com::sun::star::uno::RuntimeException();} + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() throw( com::sun::star::uno::RuntimeException ); + +protected: + sal_Char *implementationName; + transliteration_commonclass* ignore; + TransliterationModules tranModules; +}; + +} } } } + +#endif diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx index 4105718b6bac..c441fd198a17 100644 --- a/i18npool/inc/defaultnumberingprovider.hxx +++ b/i18npool/inc/defaultnumberingprovider.hxx @@ -2,9 +2,9 @@ * * $RCSfile: defaultnumberingprovider.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: bustamam $ $Date: 2001-09-16 15:22:59 $ + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,71 +80,68 @@ #include <com/sun/star/i18n/XTransliteration.hpp> #endif +namespace com { namespace sun { namespace star { namespace i18n { + 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 - > +< + 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; - + 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 ); + 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::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); + 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); + 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); + 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 ); + 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 ); + 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; + 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 index 89e423788c43..3748576e5ff3 100644 --- a/i18npool/inc/indexentrysupplier.hxx +++ b/i18npool/inc/indexentrysupplier.hxx @@ -2,38 +2,17 @@ * * $RCSfile: indexentrysupplier.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: bustamam $ $Date: 2001-12-14 16:26:08 $ + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ * * 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 @@ -58,66 +37,55 @@ * * ************************************************************************/ - #ifndef _I18N_INDEXENTRYSUPPLIER_HXX_ #define _I18N_INDEXENTRYSUPPLIER_HXX_ -#ifndef _COM_SUN_STAR_I18N_XINDEXENTRYSUPPLIER_HPP_ #include <com/sun/star/i18n/XIndexEntrySupplier.hpp> -#endif -#ifndef _CPPUHELPER_IMPLBASE2_HXX_ #include <cppuhelper/implbase2.hxx> // helper for implementations -#endif -#ifndef _COM_SUN_STAR_I18N_XCHARACTERCLASSIFICATION_HPP_ #include <com/sun/star/i18n/XCharacterClassification.hpp> -#endif - -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> -#endif +#include <tools/list.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { // ---------------------------------------------------- // class IndexEntrySupplier // ---------------------------------------------------- class IndexEntrySupplier : public cppu::WeakImplHelper2 < - ::com::sun::star::i18n::XIndexEntrySupplier, - ::com::sun::star::lang::XServiceInfo + XIndexEntrySupplier, + com::sun::star::lang::XServiceInfo > { - ::rtl::OUString aServiceName; - ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > xMSF; - ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XIndexEntrySupplier > xIES; + rtl::OUString aServiceName; + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + com::sun::star::uno::Reference < XIndexEntrySupplier > xIES; + + com::sun::star::lang::Locale aLocale; + rtl::OUString aSortAlgorithm; + sal_Bool SAL_CALL createLocaleSpecificIndexEntrySupplier(const rtl::OUString& name) throw( com::sun::star::uno::RuntimeException ); + com::sun::star::uno::Reference < XIndexEntrySupplier > SAL_CALL getLocaleSpecificIndexEntrySupplier( + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm) throw (com::sun::star::uno::RuntimeException); protected: sal_Char *implementationName; public: - IndexEntrySupplier( const ::com::sun::star::uno::Reference < - ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ) - : xMSF( rxMSF ) { - implementationName = "com.sun.star.i18n.IndexEntrySupplier"; - }; - ~IndexEntrySupplier() {}; + IndexEntrySupplier( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + 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); + 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); //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 ); + virtual rtl::OUString SAL_CALL getImplementationName() 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() throw( com::sun::star::uno::RuntimeException ); }; +} } } } + #endif diff --git a/i18npool/inc/inputsequencechecker.hxx b/i18npool/inc/inputsequencechecker.hxx new file mode 100644 index 000000000000..0d940e7a8ac0 --- /dev/null +++ b/i18npool/inc/inputsequencechecker.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * $RCSfile: inputsequencechecker.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_INPUTCHECKER_HXX_ +#define _I18N_INPUTCHECKER_HXX_ + +#include <comphelper/processfactory.hxx> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <drafts/com/sun/star/i18n/XInputSequenceChecker.hpp> + +#include <tools/list.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class InputSequenceCheckerImpl +// ---------------------------------------------------- +class InputSequenceCheckerImpl : public cppu::WeakImplHelper2 +< + drafts::com::sun::star::i18n::XInputSequenceChecker, + com::sun::star::lang::XServiceInfo +> +{ +public: + InputSequenceCheckerImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + InputSequenceCheckerImpl(); + ~InputSequenceCheckerImpl(); + + virtual sal_Bool SAL_CALL checkInputSequence(const rtl::OUString& Text, sal_Int32 nStartPos, + sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() 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() + throw( com::sun::star::uno::RuntimeException ); + +protected: + sal_Int16 checkMode; + sal_Char *serviceName; + +private : + struct lookupTableItem { + lookupTableItem(const sal_Char* rLanguage, const com::sun::star::uno::Reference < drafts::com::sun::star::i18n::XInputSequenceChecker >& rxISC) : + aLanguage(rLanguage), xISC(rxISC) {} + const sal_Char* aLanguage; + com::sun::star::uno::Reference < drafts::com::sun::star::i18n::XInputSequenceChecker > xISC; + }; + List lookupTable; + lookupTableItem *cachedItem; + + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + + com::sun::star::uno::Reference< drafts::com::sun::star::i18n::XInputSequenceChecker >& SAL_CALL getInputSequenceChecker(sal_Char* rLanguage) + throw (com::sun::star::uno::RuntimeException); + sal_Char* SAL_CALL getLanguageByScripType(sal_Unicode cChar, sal_Unicode nChar); +}; + +} } } } + +#endif // _I18N_BREAKITERATOR_HXX_ diff --git a/i18npool/inc/inputsequencechecker_th.hxx b/i18npool/inc/inputsequencechecker_th.hxx new file mode 100644 index 000000000000..ffb7dad52950 --- /dev/null +++ b/i18npool/inc/inputsequencechecker_th.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * $RCSfile: inputsequencechecker_th.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_INPUTSEQUENCECHECKER_TH_HXX_ +#define _I18N_INPUTSEQUENCECHECKER_TH_HXX_ + +#include <inputsequencechecker.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class InputSequenceChecker_th +// ---------------------------------------------------- +class InputSequenceChecker_th : public InputSequenceCheckerImpl +{ +public: + InputSequenceChecker_th(); + ~InputSequenceChecker_th(); + + virtual sal_Bool SAL_CALL checkInputSequence(const rtl::OUString& Text, sal_Int32 nStartPos, + sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif // _I18N_BREAKITERATOR_HXX_ diff --git a/i18npool/inc/numtochar.hxx b/i18npool/inc/numtochar.hxx new file mode 100644 index 000000000000..918bb1346d60 --- /dev/null +++ b/i18npool/inc/numtochar.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * $RCSfile: numtochar.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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 _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ +#define _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ + +#include <transliteration_OneToOne.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +class NumToChar : public transliteration_OneToOne { +public: + NumToChar(); + + rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); + +protected: + const sal_Unicode *num2char; +}; + +#define TRANSLITERATION_NUMTOCHAR( name ) \ +class NumToChar##name : public NumToChar \ +{ \ +public: \ + NumToChar##name (); \ +}; + +#ifdef TRANSLITERATION_ALL +TRANSLITERATION_NUMTOCHAR(Lower_zh_CN) +TRANSLITERATION_NUMTOCHAR(Upper_zh_CN) +TRANSLITERATION_NUMTOCHAR(Lower_zh_TW) +TRANSLITERATION_NUMTOCHAR(Upper_zh_TW) +TRANSLITERATION_NUMTOCHAR(Upper_ko) +TRANSLITERATION_NUMTOCHAR(Hangul_ko) +TRANSLITERATION_NUMTOCHAR(Lower_ko) +TRANSLITERATION_NUMTOCHAR(KanjiShort_ja_JP) +TRANSLITERATION_NUMTOCHAR(Fullwidth) +TRANSLITERATION_NUMTOCHAR(Indic_ar) +TRANSLITERATION_NUMTOCHAR(EastIndic_ar) +TRANSLITERATION_NUMTOCHAR(Indic_hi) +TRANSLITERATION_NUMTOCHAR(_th) +#endif +#undef TRANSLITERATION_NUMTOCHAR + +} } } } + +#endif // _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ diff --git a/i18npool/inc/numtotext_cjk.hxx b/i18npool/inc/numtotext_cjk.hxx new file mode 100644 index 000000000000..17ac925647a0 --- /dev/null +++ b/i18npool/inc/numtotext_cjk.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * $RCSfile: numtotext_cjk.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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 _L10N_TRANSLITERATION_NUMTOTEXT_CJK_HXX_ +#define _L10N_TRANSLITERATION_NUMTOTEXT_CJK_HXX_ + +#include <transliteration_Numeric.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +struct NumberMultiplier { + sal_Int16 power; + sal_Unicode multiplierChar; +}; + +class NumToText_CJK : public transliteration_Numeric { +public: + NumToText_CJK(); + + virtual rtl::OUString SAL_CALL transliterate( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); + +protected: + const NumberMultiplier *numberMultiplier; + const sal_Unicode *numberChar; + sal_Int16 numberFlag; + +private: + sal_Bool SAL_CALL numberMaker(const sal_Unicode *str, sal_Int32 begin, sal_Int32 len, + sal_Unicode *dst, sal_Int32& count, sal_Unicode numberChar, sal_Int32** offset); +}; + +#define TRANSLITERATION_NUMTOTEXT_CJK( name ) \ +class name : public NumToText_CJK \ +{ \ +public: \ + name (); \ +}; + +#ifdef TRANSLITERATION_ALL +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextLower_zh_CN) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextUpper_zh_CN) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextLower_zh_TW) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextUpper_zh_TW) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextInformalLower_ko) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextInformalUpper_ko) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextInformalHangul_ko) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextFormalLower_ko) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextFormalUpper_ko) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextFormalHangul_ko) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextKanjiLongModern_ja_JP) +TRANSLITERATION_NUMTOTEXT_CJK(NumToTextKanjiLongTraditional_ja_JP) +#endif +#undef TRANSLITERATION_NUMTOTEXT + +} } } } + +#endif // _L10N_TRANSLITERATION_NUMTOTEXT_HXX_ diff --git a/i18npool/inc/scripttypedetector.hxx b/i18npool/inc/scripttypedetector.hxx new file mode 100644 index 000000000000..2d0172d083fb --- /dev/null +++ b/i18npool/inc/scripttypedetector.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: scripttypedetector.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_SCRIPTTYPEDETECTOR_HXX_ +#define _I18N_SCRIPTTYPEDETECTOR_HXX_ + +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif + +#include <drafts/com/sun/star/i18n/XScriptTypeDetector.hpp> + +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include <cppuhelper/implbase2.hxx> // helper for implementations +#endif + +// ---------------------------------------------------- +// class ScriptTypeDetector +// ---------------------------------------------------- +class ScriptTypeDetector : public cppu::WeakImplHelper2 +< + ::drafts::com::sun::star::i18n::XScriptTypeDetector, + ::com::sun::star::lang::XServiceInfo +> +{ +public: + ScriptTypeDetector(); + virtual ~ScriptTypeDetector(); + + // Methods + virtual sal_Int32 SAL_CALL beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL beginOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL endOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) 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 ); +}; + +#endif diff --git a/i18npool/inc/servicename.hxx b/i18npool/inc/servicename.hxx new file mode 100644 index 000000000000..9a92267e753e --- /dev/null +++ b/i18npool/inc/servicename.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * $RCSfile: servicename.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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): _______________________________________ + * + * + ************************************************************************/ +/* +Service Name + com.sun.star.i18n.Transliteration ... dispatching UNO object and generic methods + com.sun.star.i18n.Transliteration.u2l ... upper to lower + com.sun.star.i18n.Transliteration.l2u ... lower to upper + com.sun.star.i18n.Transliteration.caseignore ... case ignore + com.sun.star.i18n.Transliteration.l10n ... other + + We have to adopt different service name for internal UNO objects. + Case realted functionality vary depending on Locale. + + +Implementation Name + For geneic service: com.sun.star.i18n.Transliteration, + com.sun.star.i18n.Transliteration + + com.sun.star.i18n.Transliteration.u2l + com.sun.star.i18n.Transliteration.l2u + com.sun.star.i18n.Transliteration.caseignore + For these there services above, + + com.sun.star.i18n.Transliteration.ja_JP + ^^^^^ + Locale name + + For com.sun.star.i18n.l10n.Transliteration service, + com.sun.star.i18n.Transliteration.HALFWIDTH_FULLWIDTH, + com.sun.star.i18n.Transliteration.FULLWIDTH_HALFWIDTH, + com.sun.star.i18n.Transliteration.IGNORE_WIDTH, + com.sun.star.i18n.Transliteration.KATAKANA_HIRAGANA, + com.sun.star.i18n.Transliteration.HIRAGANA_KATAKANA, + com.sun.star.i18n.Transliteration.IGNORE_KANA, + + ... These objects above can be used in every Locale context. + +*/ + + +#ifndef _I18N_SERVICENAME_HXX_ +#define _I18N_SERVICENAME_HXX_ + + + +#define TRLT_SERVICELNAME "com.sun.star.i18n.Transliteration" +#define TRLT_SERVICELNAME_PREFIX TRLT_SERVICELNAME "." +#define TRLT_SERVICELNAME_U2L TRLT_SERVICELNAME_PREFIX "u2l" +#define TRLT_SERVICELNAME_L2U TRLT_SERVICELNAME_PREFIX "l2u" +#define TRLT_SERVICELNAME_CASEIGNORE TRLT_SERVICELNAME_PREFIX "caseignore" +#define TRLT_SERVICELNAME_L10N TRLT_SERVICELNAME_PREFIX "l10n" + +#define TRLT_IMPLNAME "com.sun.star.i18n.Transliteration" +#define TRLT_IMPLNAME_PREFIX_LEN 34 +#define TRLT_IMPLNAME_PREFIX "com.sun.star.i18n.Transliteration." +// 1...5...901...5...901...5...901..4 --> 34 + +#define TRLT_IMPLNAME_L10N TRLT_IMPLNAME_PREFIX "l10n" +#define TRLT_IMPLNAME_FH TRLT_IMPLNAME_PREFIX "FULLWIDTH_HALFWIDTH" // for test +#define TRLT_IMPLNAME_Ja_JP TRLT_IMPLNAME_PREFIX "ja_JP" + +#endif diff --git a/i18npool/inc/textToPronounce_zh.hxx b/i18npool/inc/textToPronounce_zh.hxx new file mode 100644 index 000000000000..54ac9b4537e8 --- /dev/null +++ b/i18npool/inc/textToPronounce_zh.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * $RCSfile: textToPronounce_zh.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_TRANSLITERATION_TEXTTOPRONOUNCE_ZH_HXX_ +#define _I18N_TRANSLITERATION_TEXTTOPRONOUNCE_ZH_HXX_ + +#include <transliteration_Ignore.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +class TextToPronounce_zh : public transliteration_Ignore +{ +protected: + sal_Unicode * pronList; + sal_Int32 * pronIdx; + sal_Int32 * pronTab; + +public: + rtl::OUString SAL_CALL + folding(const rtl::OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 > & offset) + throw (com::sun::star::uno::RuntimeException); + + sal_Int16 SAL_CALL getType() throw(com::sun::star::uno::RuntimeException); + + sal_Bool SAL_CALL + equals( const rtl::OUString & str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32 & nMatch1, const rtl::OUString & str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32 & nMatch2) + throw (com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL + transliterate( const rtl::OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 > & offset) + throw (com::sun::star::uno::RuntimeException); +}; + +#define TRANSLITERATION_TextToPronounce_zh( name ) \ +class name : public TextToPronounce_zh \ +{ \ +public: \ + name (); \ +}; + +#ifdef TRANSLITERATION_ALL +TRANSLITERATION_TextToPronounce_zh( TextToPinyin_zh_CN ) +TRANSLITERATION_TextToPronounce_zh( TextToChuyin_zh_TW ) +#endif +#undef TRANSLITERATION_TextToPronounce_zh + +} } } } + +#endif diff --git a/i18npool/inc/transliterationImpl.hxx b/i18npool/inc/transliterationImpl.hxx new file mode 100644 index 000000000000..b01e18b33b92 --- /dev/null +++ b/i18npool/inc/transliterationImpl.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * $RCSfile: transliterationImpl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_TRANSLITERATIONIMPL_HXX_ +#define _I18N_TRANSLITERATIONIMPL_HXX_ + +#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XTransliteration.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <sal/types.h> + +namespace com { namespace sun { namespace star { namespace i18n { + +#ifdef DEBUG +#define RETURN_DEBUG_STRING (rtl::OUString::createFromAscii("return from transliterationImpl")); +#define RETURN_DEBUG_NUMBER 'TRAN' +#else +#define RETURN_DEBUG_STRING +#define RETURN_DEBUG_NUMBER +#endif + +class TransliterationImpl : public cppu::WeakImplHelper2 +< + XTransliteration, + com::sun::star::lang::XServiceInfo +> +{ +public: + // Constructors + TransliterationImpl(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF); + // Destructor + ~TransliterationImpl(); + + // Methods + virtual rtl::OUString SAL_CALL getName( ) throw(com::sun::star::uno::RuntimeException) ; + virtual sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException) ; + + virtual void SAL_CALL loadModule( TransliterationModules modName, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException) ; + virtual void SAL_CALL loadModuleNew( const com::sun::star::uno::Sequence< TransliterationModulesNew >& modName, + const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ; + virtual void SAL_CALL loadModuleByImplName( const rtl::OUString& implName, + const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual void SAL_CALL loadModulesByImplNames(const com::sun::star::uno::Sequence< rtl::OUString >& modNamelist, + const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getAvailableModules( + const com::sun::star::lang::Locale& rLocale, sal_Int16 sType ) + throw(com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException) ; + + virtual rtl::OUString SAL_CALL folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); +/* + virtual void SAL_CALL createCascadeInstance( const com::sun::star::uno::Sequence< rtl::OUString >& modNamelist, + const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ; + virtual rtl::OUString SAL_CALL folding_reverse( const rtl::OUString& inStr, sal_Int32 startPos, + sal_Int32 nCount ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL transliterateMatch( const rtl::OUString& content, sal_Int32 pos1, sal_Int32 nCount1, + const rtl::OUString& pattern, sal_Int32 pos2, sal_Int32 nCount2 ) + throw(com::sun::star::uno::RuntimeException); +*/ + virtual sal_Bool SAL_CALL equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, + sal_Int32& nMatch1, const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) + throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL transliterateRange( const rtl::OUString& str1, + const rtl::OUString& str2 ) throw(com::sun::star::uno::RuntimeException) ; + + virtual sal_Int32 SAL_CALL compareSubstring( const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, + const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL compareString( const rtl::OUString& s1, const rtl::OUString& s2) + 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: +#define maxCascade 27 + com::sun::star::uno::Reference< XTransliteration > bodyCascade[maxCascade]; + sal_Int16 numCascade; + sal_Bool caseignoreOnly; + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xSMgr; + com::sun::star::uno::Reference< XLocaleData > localedata; + com::sun::star::uno::Reference< XTransliteration > caseignore; + + virtual sal_Bool SAL_CALL loadModuleByName( const rtl::OUString& implName, + com::sun::star::uno::Reference<XTransliteration> & body, const com::sun::star::lang::Locale& rLocale) + throw(com::sun::star::uno::RuntimeException); + + void clear(); + + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getRange( + const com::sun::star::uno::Sequence< rtl::OUString > &inStrs, + sal_Int32 length, const sal_Int16 _nCascade) + throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx new file mode 100644 index 000000000000..835997b54713 --- /dev/null +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * $RCSfile: transliteration_Ignore.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_TRANSLITERATION_TRANSLITERATION_IGNORE_H_ +#define _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_ + +#include <transliteration_commonclass.hxx> +#include <oneToOneMapping.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +class transliteration_Ignore : public transliteration_commonclass +{ +public: + virtual rtl::OUString SAL_CALL + folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset) + throw(com::sun::star::uno::RuntimeException) = 0; + + // This method is shared. + sal_Bool SAL_CALL + equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, + const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) + throw(com::sun::star::uno::RuntimeException); + + // This method is implemented in sub class if needed. Otherwise, the method implemented in this class will be used. + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 ) + throw(com::sun::star::uno::RuntimeException); + + + // Methods which are shared. + sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(com::sun::star::uno::RuntimeException); + + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2, XTransliteration& t1, XTransliteration& t2 ) + throw(com::sun::star::uno::RuntimeException); + + + // + rtl::OUString SAL_CALL + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, oneToOneMapping& table ) + throw(com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, sal_Unicode (*func)(const sal_Unicode) ) + throw(com::sun::star::uno::RuntimeException); +}; + +#define TRANSLITERATION_IGNORE( name ) \ +class ignore##name : public transliteration_Ignore {\ +public:\ + ignore##name () {\ + transliterationName = "ignore##name";\ + implementationName = "com.sun.star.i18n.Transliteration.ignore##name";\ + };\ + rtl::OUString SAL_CALL folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \ + com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException); \ +};\ + +#if defined( TRANSLITERATION_BaFa_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(BaFa_ja_JP) +#endif +#if defined( TRANSLITERATION_HyuByu_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(HyuByu_ja_JP) +#endif +#if defined( TRANSLITERATION_IandEfollowedByYa_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP) +#endif +#if defined( TRANSLITERATION_IterationMark_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(IterationMark_ja_JP) +#endif +#if defined( TRANSLITERATION_KiKuFollowedBySa_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP) +#endif +#if defined( TRANSLITERATION_MiddleDot_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(MiddleDot_ja_JP) +#endif +#if defined( TRANSLITERATION_MinusSign_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(MinusSign_ja_JP) +#endif +#if defined( TRANSLITERATION_ProlongedSoundMark_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP) +#endif +#if defined( TRANSLITERATION_SeZe_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(SeZe_ja_JP) +#endif +#if defined( TRANSLITERATION_Separator_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(Separator_ja_JP) +#endif +#if defined( TRANSLITERATION_Space_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(Space_ja_JP) +#endif +#if defined( TRANSLITERATION_TiJi_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(TiJi_ja_JP) +#endif +#if defined( TRANSLITERATION_TraditionalKana_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(TraditionalKana_ja_JP) +#endif +#if defined( TRANSLITERATION_TraditionalKanji_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP) +#endif +#if defined( TRANSLITERATION_ZiZu_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(ZiZu_ja_JP) +#endif +#undef TRANSLITERATION_IGNORE + +#define TRANSLITERATION_IGNORE( name ) \ +class ignore##name : public transliteration_Ignore {\ +public:\ + ignore##name () {\ + transliterationName = "ignore##name";\ + implementationName = "com.sun.star.i18n.Transliteration.ignore##name";\ + };\ + rtl::OUString SAL_CALL folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \ + com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException); \ + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL transliterateRange( const rtl::OUString& str1, \ + const rtl::OUString& str2 ) throw(com::sun::star::uno::RuntimeException); \ +}; + +#if defined( TRANSLITERATION_Kana ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(Kana) +#endif +#if defined( TRANSLITERATION_Width ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(Width) +#endif +#if defined( TRANSLITERATION_Size_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(Size_ja_JP) +#endif +#undef TRANSLITERATION_IGNORE + +} } } } + +#endif // _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_ diff --git a/i18npool/inc/transliteration_Numeric.hxx b/i18npool/inc/transliteration_Numeric.hxx new file mode 100644 index 000000000000..1cd650a69294 --- /dev/null +++ b/i18npool/inc/transliteration_Numeric.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * $RCSfile: transliteration_Numeric.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_TRANSLITERATION_TRANSLITERATION_NUMERIC_H_ +#define _I18N_TRANSLITERATION_TRANSLITERATION_NUMERIC_H_ + +#include <transliteration_commonclass.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +class transliteration_Numeric : public transliteration_commonclass { +public: + virtual ::rtl::OUString SAL_CALL + transliterate( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(::com::sun::star::uno::RuntimeException) = 0; + + // Methods which are shared. + virtual sal_Int16 SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL + folding( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL + equals( const ::rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const ::rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + transliterateRange( const ::rtl::OUString& str1, const ::rtl::OUString& str2 ) + throw(::com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif // _I18N_TRANSLITERATION_TRANSLITERATION_NUMERIC_H_ diff --git a/i18npool/inc/transliteration_OneToOne.hxx b/i18npool/inc/transliteration_OneToOne.hxx new file mode 100644 index 000000000000..9059d3f1b692 --- /dev/null +++ b/i18npool/inc/transliteration_OneToOne.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: transliteration_OneToOne.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_ +#define _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_ + +#include <transliteration_commonclass.hxx> +#include <oneToOneMapping.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +typedef sal_Unicode (*TransFunc)(const sal_Unicode); + +class transliteration_OneToOne : public transliteration_commonclass +{ +public: + virtual rtl::OUString SAL_CALL + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(com::sun::star::uno::RuntimeException) = 0; + + // Methods which are shared. + sal_Int16 SAL_CALL getType() throw(com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL + folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset) + throw(com::sun::star::uno::RuntimeException); + + sal_Bool SAL_CALL + equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, + const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) + throw(com::sun::star::uno::RuntimeException); + + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 ) + throw(com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, oneToOneMapping& table ) + throw(com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, oneToOneMapping& table ) + throw(com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, TransFunc func ) + throw(com::sun::star::uno::RuntimeException); +}; + +#define TRANSLITERATION_ONETOONE( name ) \ +class name : public transliteration_OneToOne \ +{ \ +public: \ + name (); \ + rtl::OUString SAL_CALL \ + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) \ + throw(com::sun::star::uno::RuntimeException); \ +}; + +#if defined( TRANSLITERATION_fullwidthToHalfwidth ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE( fullwidthToHalfwidth ) +#endif +#if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE(halfwidthToFullwidth) +#endif +#if defined( TRANSLITERATION_hiraganaToKatakana ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE(hiraganaToKatakana) +#endif +#if defined( TRANSLITERATION_katakanaToHiragana ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE(katakanaToHiragana) +#endif +#if defined( TRANSLITERATION_largeToSmall_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE(largeToSmall_ja_JP) +#endif +#if defined( TRANSLITERATION_smallToLarge_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE(smallToLarge_ja_JP) +#endif +#undef TRANSLITERATION_ONETOONE + +} } } } + +#endif // _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_ diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx new file mode 100644 index 000000000000..2bba910439d1 --- /dev/null +++ b/i18npool/inc/transliteration_body.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: transliteration_body.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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 TRANSLITERATION_BODY_H +#define TRANSLITERATION_BODY_H + +#include <transliteration_commonclass.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +#define MappingTypeLowerToUpper 1 << 0 // Upper to Lower mapping +#define MappingTypeUpperToLower 1 << 1 // Lower to Upper mapping +#define MappingTypeToUpper 1 << 2 // to Upper mapping +#define MappingTypeToLower 1 << 3 // to Lower mapping +#define MappingTypeToTitle 1 << 4 // to Title mapping +#define MappingTypeSimpleFolding 1 << 5 // Simple Case Folding +#define MappingTypeFullFolding 1 << 6 // Full Case Folding +#define MappingTypeMask MappingTypeLowerToUpper|MappingTypeUpperToLower|\ + MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\ + MappingTypeSimpleFolding|MappingTypeFullFolding + +#define ValueTypeNotValue 1 << 7 // Value field is an address + +#define CasedLetter MappingTypeMask // for final sigmar + +typedef struct _Value{ + sal_uInt8 type; + sal_uInt16 value; // value or address, depend on the type +} Value; + +typedef struct _Mapping{ + sal_uInt8 type; + sal_Int8 nmap; +#define NMAPPINGMAX 3 + sal_Unicode map[NMAPPINGMAX]; +} Mapping; // for Unconditional mapping + +typedef class _MappingElement { +public: + _MappingElement() {element.nmap = current = 0;}; + Mapping element; + sal_Int8 current; +} MappingElement; + +class Transliteration_body : public transliteration_commonclass +{ +public: + Transliteration_body(); + + // Methods which are shared. + sal_Int16 SAL_CALL getType() throw(com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL transliterate(const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException); + + rtl::OUString SAL_CALL folding(const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException); + + sal_Bool SAL_CALL equals( + const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, + const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) + throw(com::sun::star::uno::RuntimeException); + + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL transliterateRange( const rtl::OUString& str1, + const rtl::OUString& str2 ) throw(com::sun::star::uno::RuntimeException); + +protected: + sal_uInt8 aMappingType; + Mapping& getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len) throw(com::sun::star::uno::RuntimeException); + Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len) throw(com::sun::star::uno::RuntimeException); +}; + +#if defined( TRANSLITERATION_UPPER_LOWER ) || defined( TRANSLITERATION_ALL ) +class Transliteration_u2l : public Transliteration_body +{ +public: + Transliteration_u2l(); +}; + +class Transliteration_l2u : public Transliteration_body +{ +public: + Transliteration_l2u(); +}; +#endif + +#if defined( TRANSLITERATION_casemapping ) || defined( TRANSLITERATION_ALL ) +class Transliteration_casemapping : public Transliteration_body +{ +public: + Transliteration_casemapping(); + void SAL_CALL setMappingType(const sal_uInt8 rMappingType, const com::sun::star::lang::Locale& rLocale ); +}; +#endif + +} } } } + +#endif diff --git a/i18npool/inc/transliteration_caseignore.hxx b/i18npool/inc/transliteration_caseignore.hxx new file mode 100644 index 000000000000..123404625d1b --- /dev/null +++ b/i18npool/inc/transliteration_caseignore.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * $RCSfile: transliteration_caseignore.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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 TRANSLITERATION_CASE_IGNORE_H +#define TRANSLITERATION_CASE_IGNORE_H + +#define TRANSLITERATION_UPPER_LOWER +#include "transliteration_body.hxx" + +namespace com { namespace sun { namespace star { namespace i18n { + +class Transliteration_caseignore: public Transliteration_body +{ +public: + Transliteration_caseignore(); + + // Methods which are shared. + sal_Int16 SAL_CALL getType() throw(com::sun::star::uno::RuntimeException); + + void SAL_CALL loadModule( TransliterationModules modName, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL transliterateRange( + const rtl::OUString& str1, const rtl::OUString& str2 ) + throw(com::sun::star::uno::RuntimeException); + + sal_Bool SAL_CALL equals( + const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, + const rtl::OUString& src2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2) + throw(com::sun::star::uno::RuntimeException); + + sal_Int32 SAL_CALL compareSubstring( + const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, + const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) + throw(com::sun::star::uno::RuntimeException); + + sal_Int32 SAL_CALL compareString( + const rtl::OUString& s1, + const rtl::OUString& s2) + throw(com::sun::star::uno::RuntimeException); + + sal_Unicode SAL_CALL getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e) + throw(com::sun::star::uno::RuntimeException); + +protected: + TransliterationModules moduleLoaded; +private: + sal_Int32 SAL_CALL compare( + const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, + const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2) + throw(com::sun::star::uno::RuntimeException); +}; + +class Transliteration_simplecaseignore: public Transliteration_caseignore +{ +public: + Transliteration_simplecaseignore(); +}; + +} } } } + +#endif diff --git a/i18npool/inc/transliteration_commonclass.hxx b/i18npool/inc/transliteration_commonclass.hxx new file mode 100644 index 000000000000..9c52a99f5924 --- /dev/null +++ b/i18npool/inc/transliteration_commonclass.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * $RCSfile: transliteration_commonclass.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ +#define _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ + +#include <com/sun/star/i18n/XTransliteration.hpp> +#include <com/sun/star/i18n/TransliterationType.hpp> +#include <cppuhelper/implbase1.hxx> +#include <rtl/ustrbuf.h> +#include <rtl/ustring.hxx> +#include <x_rtl_ustring.h> + +namespace com { namespace sun { namespace star { namespace i18n { + +class transliteration_commonclass : public cppu::WeakImplHelper1< XTransliteration > +{ +public: + transliteration_commonclass(); + + // Methods which are shared. + void SAL_CALL + loadModule( TransliterationModules modName, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + + void SAL_CALL + loadModuleNew( const com::sun::star::uno::Sequence< TransliterationModulesNew >& modName, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + + void SAL_CALL + loadModuleByImplName( const rtl::OUString& implName, const com::sun::star::lang::Locale& rLocale ) + throw(com::sun::star::uno::RuntimeException); + + void SAL_CALL + loadModulesByImplNames(const com::sun::star::uno::Sequence< rtl::OUString >& modNamelist, const com::sun::star::lang::Locale& rLocale) + throw(com::sun::star::uno::RuntimeException); + + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + getAvailableModules( const com::sun::star::lang::Locale& rLocale, sal_Int16 sType ) + throw(com::sun::star::uno::RuntimeException); + + // Methods which should be implemented in each transliteration module. + virtual rtl::OUString SAL_CALL getName() throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException) = 0; + + virtual rtl::OUString SAL_CALL + transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(com::sun::star::uno::RuntimeException) = 0; + + virtual rtl::OUString SAL_CALL + folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset) + throw(com::sun::star::uno::RuntimeException) = 0; + + virtual sal_Bool SAL_CALL + equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) + throw(com::sun::star::uno::RuntimeException) = 0; + + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 ) + throw(com::sun::star::uno::RuntimeException) = 0; + + virtual sal_Int32 SAL_CALL + compareSubstring( const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) + throw(com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL + compareString( const rtl::OUString& s1, const rtl::OUString& s2) + throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName() + 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() + throw( com::sun::star::uno::RuntimeException ); +protected: + com::sun::star::lang::Locale aLocale; + sal_Char* transliterationName; + sal_Char* implementationName; +}; + +} } } } + +#endif // _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ diff --git a/i18npool/inc/wtt.h b/i18npool/inc/wtt.h new file mode 100644 index 000000000000..3fcae2a5d36f --- /dev/null +++ b/i18npool/inc/wtt.h @@ -0,0 +1,87 @@ +/************************************************************************* + * + * $RCSfile: wtt.h,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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_WTT_H_ +#define _I18N_WTT_H_ + +namespace com { namespace sun { namespace star { namespace i18n { + +/* + * Thai character type definition. + */ + +#define CT_CTRL 0 // Control character +#define CT_NON 1 // Non-composible +#define CT_CONS 2 // Consonant +#define CT_LV 3 // Leading vowel +#define CT_FV1 4 // Following vowel +#define CT_FV2 5 // Following vowel +#define CT_FV3 6 +#define CT_BV1 7 // Below vowel +#define CT_BV2 8 +#define CT_BD 9 // Below diacritic +#define CT_TONE 10 // Tone +#define CT_AD1 11 // Above diacritic +#define CT_AD2 12 +#define CT_AD3 13 +#define CT_AV1 14 // Above vowel +#define CT_AV2 15 +#define CT_AV3 16 + +#define MAX_CT 17 + +static const sal_uInt16 thaiCT[128] = { // Thai character type + CT_NON, CT_CONS, CT_CONS, CT_CONS, CT_CONS,CT_CONS, CT_CONS, CT_CONS, //0E00 + CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, + CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, //0E10 + CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, + CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_FV3, CT_CONS, CT_FV3, CT_CONS, //0E20 + CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_NON, + CT_FV1, CT_AV2, CT_FV1, CT_FV1, CT_AV1, CT_AV3, CT_AV2, CT_AV3, //0E30 + CT_BV1, CT_BV2, CT_BD, CT_NON, CT_NON, CT_NON, CT_NON, CT_NON, + CT_LV, CT_LV, CT_LV, CT_LV, CT_LV, CT_FV2, CT_NON, CT_AD2, //0E40 + CT_TONE, CT_TONE, CT_TONE, CT_TONE, CT_AD1, CT_AD1, CT_AD3, CT_NON, + CT_NON, CT_NON, CT_NON, CT_NON, CT_NON, CT_NON, CT_NON, CT_NON, //0E50 + CT_NON, CT_NON, CT_NON, CT_NON, CT_NON, CT_NON, CT_NON, CT_CTRL }; + +#define getCharType(x) ((x >= 0x0E00 && x < 0x0E60) ? thaiCT[x - 0x0E00] : CT_NON) + +} } } } + +#endif // _I18N_WTT_H_ diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx new file mode 100644 index 000000000000..869f98a23d05 --- /dev/null +++ b/i18npool/inc/xdictionary.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: xdictionary.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: bustamam $ $Date: 2002-03-26 13:36:40 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * 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 _XDICTIONARY_H_ +#define _XDICTIONARY_H_ + +#include <sal/types.h> +#include <osl/module.h> + +#include <com/sun/star/i18n/Boundary.hpp> + +namespace com { namespace sun { namespace star { namespace i18n { + +#define CACHE_MAX 32 // max cache structure number +#define DEFAULT_SIZE 256 // for boundary size, to avoid alloc and release memory + +// cache structure. +typedef struct _WrodBreakCache { + sal_Bool SAL_CALL equals(const sal_Unicode *str, Boundary& boundary); // checking cached string + sal_Int32 length; // contents length saved here. + sal_Unicode *contents; // seperated segment contents. + sal_Int32* wordboundary; // word boundaries in segments. + sal_Int32 size; // size of wordboundary +} WordBreakCache; + +class xdictionary +{ +private: + const sal_uInt8 * existMark; + const sal_Int16 * index1; + const sal_Int32 * index2; + const sal_Int32 * lenArray; + const sal_Unicode* dataArea; + oslModule hModule; + Boundary boundary; + sal_Bool useCellBoundary; + sal_Int32* cellBoundary; + +public: + xdictionary(sal_Char *lang); + ~xdictionary(); + Boundary SAL_CALL nextWord( const sal_Unicode *text, sal_Int32 nPos, sal_Int32 len); + Boundary SAL_CALL previousWord( const sal_Unicode *text, sal_Int32 nPos, sal_Int32 len); + Boundary SAL_CALL getWordBoundary( const sal_Unicode *text, sal_Int32 nPos, sal_Int32 len, + sal_Bool bDirection ); + void SAL_CALL setCellBoundary(sal_Int32* cellBondary); + +private: + WordBreakCache cache[CACHE_MAX]; + + sal_Bool SAL_CALL seekSegment(const sal_Unicode *text, sal_Int32 pos, sal_Int32 len, Boundary& boundary); + WordBreakCache& SAL_CALL getCache(const sal_Unicode *text, Boundary& boundary); + sal_Bool SAL_CALL exists(const sal_Unicode u); + sal_Int32 SAL_CALL getLongestMatch(const sal_Unicode *text, sal_Int32 len); +}; + +} } } } + +#endif + |