diff options
Diffstat (limited to 'i18npool/inc')
56 files changed, 6214 insertions, 0 deletions
diff --git a/i18npool/inc/breakiteratorImpl.hxx b/i18npool/inc/breakiteratorImpl.hxx new file mode 100644 index 000000000000..5e701d0bd2d2 --- /dev/null +++ b/i18npool/inc/breakiteratorImpl.hxx @@ -0,0 +1,155 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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 <vector> + +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 ); + + static sal_Int16 SAL_CALL getScriptClass(sal_uInt32 currentChar); +protected: + 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; + }; + std::vector<lookupTableItem*> 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 + + +#endif // _I18N_BREAKITERATOR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/breakiterator_cjk.hxx b/i18npool/inc/breakiterator_cjk.hxx new file mode 100644 index 000000000000..fa0726ac1c53 --- /dev/null +++ b/i18npool/inc/breakiterator_cjk.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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); + 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); + +protected: + xdictionary *dict; + rtl::OUString hangingCharacters; +}; + +#define BREAKITERATOR_CJK( lang ) \ +class BreakIterator_##lang : public BreakIterator_CJK {\ +public:\ + BreakIterator_##lang (); \ + ~BreakIterator_##lang (); \ +}; + +#ifdef BREAKITERATOR_ALL +BREAKITERATOR_CJK( zh ) +BREAKITERATOR_CJK( zh_TW ) +BREAKITERATOR_CJK( ja ) +BREAKITERATOR_CJK( ko ) +#endif +#undef BREAKITERATOR__CJK + +} } } } + +#endif // _I18N_BREAKITERATOR_CJK_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/breakiterator_ctl.hxx b/i18npool/inc/breakiterator_ctl.hxx new file mode 100644 index 000000000000..47a1c9f6c3f3 --- /dev/null +++ b/i18npool/inc/breakiterator_ctl.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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); + 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); +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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/breakiterator_th.hxx b/i18npool/inc/breakiterator_th.hxx new file mode 100644 index 000000000000..0909d97a0df6 --- /dev/null +++ b/i18npool/inc/breakiterator_th.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_BREAKITERATOR_TH_HXX_ +#define _I18N_BREAKITERATOR_TH_HXX_ +#include <breakiterator_ctl.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class BreakIterator_th +// ---------------------------------------------------- +class BreakIterator_th : public BreakIterator_CTL +{ +public: + BreakIterator_th(); + ~BreakIterator_th(); + +protected: + void SAL_CALL makeIndex(const rtl::OUString& text, sal_Int32 pos) throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif // _I18N_BREAKITERATOR_TH_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/breakiterator_unicode.hxx b/i18npool/inc/breakiterator_unicode.hxx new file mode 100644 index 000000000000..57e0aadc7fc4 --- /dev/null +++ b/i18npool/inc/breakiterator_unicode.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_BREAKITERATOR_UNICODE_HXX_ +#define _I18N_BREAKITERATOR_UNICODE_HXX_ + +#include <breakiteratorImpl.hxx> + +#include "warnings_guard_unicode_brkiter.h" + +namespace com { namespace sun { namespace star { namespace i18n { + +#define LOAD_CHARACTER_BREAKITERATOR 0 +#define LOAD_WORD_BREAKITERATOR 1 +#define LOAD_SENTENCE_BREAKITERATOR 2 +#define LOAD_LINE_BREAKITERATOR 3 + +// ---------------------------------------------------- +// 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: + const sal_Char *cBreakIterator, *wordRule, *lineRule; + Boundary result; // for word break iterator + + struct BI_Data { + UnicodeString aICUText; + icu::BreakIterator *aBreakIterator; + + BI_Data() : aICUText(), aBreakIterator(NULL) {} + } character, word, sentence, line, *icuBI; + + com::sun::star::lang::Locale aLocale; + sal_Int16 aBreakType, aWordType; + + void SAL_CALL loadICUBreakIterator(const com::sun::star::lang::Locale& rLocale, + sal_Int16 rBreakType, sal_Int16 rWordType, const sal_Char* name, const rtl::OUString& rText) throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/bullet.h b/i18npool/inc/bullet.h new file mode 100644 index 000000000000..42dea9cfcb17 --- /dev/null +++ b/i18npool/inc/bullet.h @@ -0,0 +1,334 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +namespace com { namespace sun { namespace star { namespace i18n { + +static sal_Unicode table_AIUFullWidth_ja_JP[] = { + 0x30A2, // KATAKANA LETTER A + 0x30A4, // KATAKANA LETTER I + 0x30A6, // KATAKANA LETTER U + 0x30A8, // KATAKANA LETTER E + 0x30AA, // KATAKANA LETTER O + 0x30AB, // KATAKANA LETTER KA + 0x30AD, // KATAKANA LETTER KI + 0x30AF, // KATAKANA LETTER KU + 0x30B1, // KATAKANA LETTER KE + 0x30B3, // KATAKANA LETTER KO + 0x30B5, // KATAKANA LETTER SA + 0x30B7, // KATAKANA LETTER SI + 0x30B9, // KATAKANA LETTER SU + 0x30BB, // KATAKANA LETTER SE + 0x30BD, // KATAKANA LETTER SO + 0x30BF, // KATAKANA LETTER TA + 0x30C1, // KATAKANA LETTER TI + 0x30C4, // KATAKANA LETTER TU + 0x30C6, // KATAKANA LETTER TE + 0x30C8, // KATAKANA LETTER TO + 0x30CA, // KATAKANA LETTER NA + 0x30CB, // KATAKANA LETTER NI + 0x30CC, // KATAKANA LETTER NU + 0x30CD, // KATAKANA LETTER NE + 0x30CE, // KATAKANA LETTER NO + 0x30CF, // KATAKANA LETTER HA + 0x30D2, // KATAKANA LETTER HI + 0x30D5, // KATAKANA LETTER HU + 0x30D8, // KATAKANA LETTER HE + 0x30DB, // KATAKANA LETTER HO + 0x30DE, // KATAKANA LETTER MA + 0x30DF, // KATAKANA LETTER MI + 0x30E0, // KATAKANA LETTER MU + 0x30E1, // KATAKANA LETTER ME + 0x30E2, // KATAKANA LETTER MO + 0x30E4, // KATAKANA LETTER YA + 0x30E6, // KATAKANA LETTER YU + 0x30E8, // KATAKANA LETTER YO + 0x30E9, // KATAKANA LETTER RA + 0x30EA, // KATAKANA LETTER RI + 0x30EB, // KATAKANA LETTER RU + 0x30EC, // KATAKANA LETTER RE + 0x30ED, // KATAKANA LETTER RO + 0x30EF, // KATAKANA LETTER WA + 0x30F2, // KATAKANA LETTER WO + 0x30F3 // KATAKANA LETTER N +}; + +static sal_Unicode table_AIUHalfWidth_ja_JP[] = { + 0xFF71, // HALFWIDTH KATAKANA LETTER A + 0xFF72, // HALFWIDTH KATAKANA LETTER I + 0xFF73, // HALFWIDTH KATAKANA LETTER U + 0xFF74, // HALFWIDTH KATAKANA LETTER E + 0xFF75, // HALFWIDTH KATAKANA LETTER O + 0xFF76, // HALFWIDTH KATAKANA LETTER KA + 0xFF77, // HALFWIDTH KATAKANA LETTER KI + 0xFF78, // HALFWIDTH KATAKANA LETTER KU + 0xFF79, // HALFWIDTH KATAKANA LETTER KE + 0xFF7A, // HALFWIDTH KATAKANA LETTER KO + 0xFF7B, // HALFWIDTH KATAKANA LETTER SA + 0xFF7C, // HALFWIDTH KATAKANA LETTER SI + 0xFF7D, // HALFWIDTH KATAKANA LETTER SU + 0xFF7E, // HALFWIDTH KATAKANA LETTER SE + 0xFF7F, // HALFWIDTH KATAKANA LETTER SO + 0xFF80, // HALFWIDTH KATAKANA LETTER TA + 0xFF81, // HALFWIDTH KATAKANA LETTER TI + 0xFF82, // HALFWIDTH KATAKANA LETTER TU + 0xFF83, // HALFWIDTH KATAKANA LETTER TE + 0xFF84, // HALFWIDTH KATAKANA LETTER TO + 0xFF85, // HALFWIDTH KATAKANA LETTER NA + 0xFF86, // HALFWIDTH KATAKANA LETTER NI + 0xFF87, // HALFWIDTH KATAKANA LETTER NU + 0xFF88, // HALFWIDTH KATAKANA LETTER NE + 0xFF89, // HALFWIDTH KATAKANA LETTER NO + 0xFF8A, // HALFWIDTH KATAKANA LETTER HA + 0xFF8B, // HALFWIDTH KATAKANA LETTER HI + 0xFF8C, // HALFWIDTH KATAKANA LETTER HU + 0xFF8D, // HALFWIDTH KATAKANA LETTER HE + 0xFF8E, // HALFWIDTH KATAKANA LETTER HO + 0xFF8F, // HALFWIDTH KATAKANA LETTER MA + 0xFF90, // HALFWIDTH KATAKANA LETTER MI + 0xFF91, // HALFWIDTH KATAKANA LETTER MU + 0xFF92, // HALFWIDTH KATAKANA LETTER ME + 0xFF93, // HALFWIDTH KATAKANA LETTER MO + 0xFF94, // HALFWIDTH KATAKANA LETTER YA + 0xFF95, // HALFWIDTH KATAKANA LETTER YU + 0xFF96, // HALFWIDTH KATAKANA LETTER YO + 0xFF97, // HALFWIDTH KATAKANA LETTER RA + 0xFF98, // HALFWIDTH KATAKANA LETTER RI + 0xFF99, // HALFWIDTH KATAKANA LETTER RU + 0xFF9A, // HALFWIDTH KATAKANA LETTER RE + 0xFF9B, // HALFWIDTH KATAKANA LETTER RO + 0xFF9C, // HALFWIDTH KATAKANA LETTER WA + 0xFF66, // HALFWIDTH KATAKANA LETTER WO + 0xFF9D // HALFWIDTH KATAKANA LETTER N +}; + +static sal_Unicode table_IROHAFullWidth_ja_JP[] = { + 0x30A4, // KATAKANA LETTER I + 0x30ED, // KATAKANA LETTER RO + 0x30CF, // KATAKANA LETTER HA + 0x30CB, // KATAKANA LETTER NI + 0x30DB, // KATAKANA LETTER HO + 0x30D8, // KATAKANA LETTER HE + 0x30C8, // KATAKANA LETTER TO + 0x30C1, // KATAKANA LETTER TI + 0x30EA, // KATAKANA LETTER RI + 0x30CC, // KATAKANA LETTER NU + 0x30EB, // KATAKANA LETTER RU + 0x30F2, // KATAKANA LETTER WO + 0x30EF, // KATAKANA LETTER WA + 0x30AB, // KATAKANA LETTER KA + 0x30E8, // KATAKANA LETTER YO + 0x30BF, // KATAKANA LETTER TA + 0x30EC, // KATAKANA LETTER RE + 0x30BD, // KATAKANA LETTER SO + 0x30C4, // KATAKANA LETTER TU + 0x30CD, // KATAKANA LETTER NE + 0x30CA, // KATAKANA LETTER NA + 0x30E9, // KATAKANA LETTER RA + 0x30E0, // KATAKANA LETTER MU + 0x30A6, // KATAKANA LETTER U + 0x30F0, // KATAKANA LETTER WI + 0x30CE, // KATAKANA LETTER NO + 0x30AA, // KATAKANA LETTER O + 0x30AF, // KATAKANA LETTER KU + 0x30E4, // KATAKANA LETTER YA + 0x30DE, // KATAKANA LETTER MA + 0x30B1, // KATAKANA LETTER KE + 0x30D5, // KATAKANA LETTER HU + 0x30B3, // KATAKANA LETTER KO + 0x30A8, // KATAKANA LETTER E + 0x30C6, // KATAKANA LETTER TE + 0x30A2, // KATAKANA LETTER A + 0x30B5, // KATAKANA LETTER SA + 0x30AD, // KATAKANA LETTER KI + 0x30E6, // KATAKANA LETTER YU + 0x30E1, // KATAKANA LETTER ME + 0x30DF, // KATAKANA LETTER MI + 0x30B7, // KATAKANA LETTER SI + 0x30F1, // KATAKANA LETTER WE + 0x30D2, // KATAKANA LETTER HI + 0x30E2, // KATAKANA LETTER MO + 0x30BB, // KATAKANA LETTER SE + 0x30B9, // KATAKANA LETTER SU + 0x30F3 // KATAKANA LETTER N +}; + +static sal_Unicode table_IROHAHalfWidth_ja_JP[] = { + 0xFF72, // HALFWIDTH KATAKANA LETTER I + 0xFF9B, // HALFWIDTH KATAKANA LETTER RO + 0xFF8A, // HALFWIDTH KATAKANA LETTER HA + 0xFF86, // HALFWIDTH KATAKANA LETTER NI + 0xFF8E, // HALFWIDTH KATAKANA LETTER HO + 0xFF8D, // HALFWIDTH KATAKANA LETTER HE + 0xFF84, // HALFWIDTH KATAKANA LETTER TO + 0xFF81, // HALFWIDTH KATAKANA LETTER TI + 0xFF98, // HALFWIDTH KATAKANA LETTER RI + 0xFF87, // HALFWIDTH KATAKANA LETTER NU + 0xFF99, // HALFWIDTH KATAKANA LETTER RU + 0xFF66, // HALFWIDTH KATAKANA LETTER WO + 0xFF9C, // HALFWIDTH KATAKANA LETTER WA + 0xFF76, // HALFWIDTH KATAKANA LETTER KA + 0xFF96, // HALFWIDTH KATAKANA LETTER YO + 0xFF80, // HALFWIDTH KATAKANA LETTER TA + 0xFF9A, // HALFWIDTH KATAKANA LETTER RE + 0xFF7F, // HALFWIDTH KATAKANA LETTER SO + 0xFF82, // HALFWIDTH KATAKANA LETTER TU + 0xFF88, // HALFWIDTH KATAKANA LETTER NE + 0xFF85, // HALFWIDTH KATAKANA LETTER NA + 0xFF97, // HALFWIDTH KATAKANA LETTER RA + 0xFF91, // HALFWIDTH KATAKANA LETTER MU + 0xFF73, // HALFWIDTH KATAKANA LETTER U + 0x30F0, // KATAKANA LETTER WI + 0xFF89, // HALFWIDTH KATAKANA LETTER NO + 0xFF75, // HALFWIDTH KATAKANA LETTER O + 0xFF78, // HALFWIDTH KATAKANA LETTER KU + 0xFF94, // HALFWIDTH KATAKANA LETTER YA + 0xFF8F, // HALFWIDTH KATAKANA LETTER MA + 0xFF79, // HALFWIDTH KATAKANA LETTER KE + 0xFF8C, // HALFWIDTH KATAKANA LETTER HU + 0xFF7A, // HALFWIDTH KATAKANA LETTER KO + 0xFF74, // HALFWIDTH KATAKANA LETTER E + 0xFF83, // HALFWIDTH KATAKANA LETTER TE + 0xFF71, // HALFWIDTH KATAKANA LETTER A + 0xFF7B, // HALFWIDTH KATAKANA LETTER SA + 0xFF77, // HALFWIDTH KATAKANA LETTER KI + 0xFF95, // HALFWIDTH KATAKANA LETTER YU + 0xFF92, // HALFWIDTH KATAKANA LETTER ME + 0xFF90, // HALFWIDTH KATAKANA LETTER MI + 0xFF7C, // HALFWIDTH KATAKANA LETTER SI + 0x30F1, // KATAKANA LETTER WE + 0xFF8B, // HALFWIDTH KATAKANA LETTER HI + 0xFF93, // HALFWIDTH KATAKANA LETTER MO + 0xFF7E, // HALFWIDTH KATAKANA LETTER SE + 0xFF7D, // HALFWIDTH KATAKANA LETTER SU + 0xFF9D // HALFWIDTH KATAKANA LETTER N +}; + +static sal_Unicode table_CircledNumber[] = { + 0x2460, // CIRCLED DIGIT ONE + 0x2461, // CIRCLED DIGIT TWO + 0x2462, // CIRCLED DIGIT THREE + 0x2463, // CIRCLED DIGIT FOUR + 0x2464, // CIRCLED DIGIT FIVE + 0x2465, // CIRCLED DIGIT SIX + 0x2466, // CIRCLED DIGIT SEVEN + 0x2467, // CIRCLED DIGIT EIGHT + 0x2468, // CIRCLED DIGIT NINE + 0x2469, // CIRCLED NUMBER TEN + 0x246A, // CIRCLED NUMBER ELEVEN + 0x246B, // CIRCLED NUMBER TWELVE + 0x246C, // CIRCLED NUMBER THIRTEEN + 0x246D, // CIRCLED NUMBER FOURTEEN + 0x246E, // CIRCLED NUMBER FIFTEEN + 0x246F, // CIRCLED NUMBER SIXTEEN + 0x2470, // CIRCLED NUMBER SEVENTEEN + 0x2471, // CIRCLED NUMBER EIGHTEEN + 0x2472, // CIRCLED NUMBER NINETEEN + 0x2473 // CIRCLED NUMBER TWENTY +}; + +static sal_Unicode table_HangulJamo_ko[] = { + 0x3131, // HANGUL LETTER KIYEOK + 0x3134, // HANGUL LETTER NIEUN + 0x3137, // HANGUL LETTER TIKEUT + 0x3139, // HANGUL LETTER RIEUL + 0x3141, // HANGUL LETTER MIEUM + 0x3142, // HANGUL LETTER PIEUP + 0x3145, // HANGUL LETTER SIOS + 0x3147, // HANGUL LETTER IEUNG + 0x3148, // HANGUL LETTER CIEUC + 0x314A, // HANGUL LETTER CHIEUCH + 0x314B, // HANGUL LETTER KHIEUKH + 0x314C, // HANGUL LETTER THIEUTH + 0x314D, // HANGUL LETTER PHIEUPH + 0x314E // HANGUL LETTER HIEUH +}; + +static sal_Unicode table_HangulSyllable_ko[] = { + 0xAC00, // HANGUL SYLLABLE GA + 0xB098, // HANGUL SYLLABLE NA + 0xB2E4, // HANGUL SYLLABLE DA + 0xB77C, // HANGUL SYLLABLE LA + 0xB9C8, // HANGUL SYLLABLE MA + 0xBC14, // HANGUL SYLLABLE BA + 0xC0AC, // HANGUL SYLLABLE SA + 0xC544, // HANGUL SYLLABLE A + 0xC790, // HANGUL SYLLABLE JA + 0xCC28, // HANGUL SYLLABLE CA + 0xCE74, // HANGUL SYLLABLE KA + 0xD0C0, // HANGUL SYLLABLE TA + 0xD30C, // HANGUL SYLLABLE PA + 0xD558 // HANGUL SYLLABLE HA + +}; + +static sal_Unicode table_HangulCircledJamo_ko[] = { + 0x3260, // CIRCLED HANGUL LETTER KIYEOK + 0x3261, // CIRCLED HANGUL LETTER NIEUN + 0x3262, // CIRCLED HANGUL LETTER TIKEUT + 0x3263, // CIRCLED HANGUL LETTER RIEUL + 0x3264, // CIRCLED HANGUL LETTER MIEUM + 0x3265, // CIRCLED HANGUL LETTER PIEUP + 0x3266, // CIRCLED HANGUL LETTER SIOS + 0x3267, // CIRCLED HANGUL LETTER IEUNG + 0x3268, // CIRCLED HANGUL LETTER CIEUC + 0x3269, // CIRCLED HANGUL LETTER CHIEUCH + 0x326A, // CIRCLED HANGUL LETTER KHIEUKH + 0x326B, // CIRCLED HANGUL LETTER THIEUTH + 0x326C, // CIRCLED HANGUL LETTER PHIEUPH + 0x326D // CIRCLED HANGUL LETTER HIEUH +}; + + +static sal_Unicode table_HangulCircledSyllable_ko[] = { + 0x326E, // CIRCLED HANGUL SYLLABLE GA + 0x326F, // CIRCLED HANGUL SYLLABLE NA + 0x3270, // CIRCLED HANGUL SYLLABLE DA + 0x3271, // CIRCLED HANGUL SYLLABLE LA + 0x3272, // CIRCLED HANGUL SYLLABLE MA + 0x3273, // CIRCLED HANGUL SYLLABLE BA + 0x3274, // CIRCLED HANGUL SYLLABLE SA + 0x3275, // CIRCLED HANGUL SYLLABLE A + 0x3276, // CIRCLED HANGUL SYLLABLE JA + 0x3277, // CIRCLED HANGUL SYLLABLE CA + 0x3278, // CIRCLED HANGUL SYLLABLE KA + 0x3279, // CIRCLED HANGUL SYLLABLE TA + 0x327A, // CIRCLED HANGUL SYLLABLE PA + 0x327B // CIRCLED HANGUL SYLLABLE HA +}; + +static sal_Unicode table_TianGan_zh[] = { + 0x7532,0x4e59,0x4e19,0x4e01,0x620a,0x5df1,0x5e9a,0x8f9b,0x58ec,0x7678 +}; + +static sal_Unicode table_DiZi_zh[] = { + 0x5b50,0x4e11,0x5bc5,0x536f,0x8fb0,0x5df3,0x5348,0x672a,0x7533,0x9149,0x620c,0x4ea5 +}; + +} } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/calendarImpl.hxx b/i18npool/inc/calendarImpl.hxx new file mode 100644 index 000000000000..7923faed556f --- /dev/null +++ b/i18npool/inc/calendarImpl.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_CALENDARIMPL_HXX_ +#define _I18N_CALENDARIMPL_HXX_ + +#include <com/sun/star/i18n/XExtendedCalendar.hpp> +#include <com/sun/star/i18n/CalendarDisplayCode.hpp> +#include <com/sun/star/i18n/CalendarFieldIndex.hpp> +#include <com/sun/star/i18n/CalendarDisplayIndex.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <vector> + +// ---------------------------------------------------- +// class CalendarImpl +// ---------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace i18n { + +class CalendarImpl : public cppu::WeakImplHelper2 +< + com::sun::star::i18n::XExtendedCalendar, + 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); + + // Methods in XExtendedCalendar + virtual rtl::OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) 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(const rtl::OUString& _uniqueID, com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedCalendar >& _xCalendar) : + uniqueID(_uniqueID), xCalendar(_xCalendar) {} + rtl::OUString uniqueID; + com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedCalendar > xCalendar; + }; + std::vector<lookupTableItem*> lookupTable; + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedCalendar > xCalendar; +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx new file mode 100644 index 000000000000..1f9cdc8388cb --- /dev/null +++ b/i18npool/inc/calendar_gregorian.hxx @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_CALENDAR_GREGORIAN_HXX_ +#define _I18N_CALENDAR_GREGORIAN_HXX_ + +#include "calendarImpl.hxx" +#include "nativenumbersupplier.hxx" + +#include "warnings_guard_unicode_calendar.h" + +// ---------------------------------------------------- +// class Calendar_gregorian +// ---------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace i18n { + +struct Era { + sal_Int32 year; + sal_Int32 month; + sal_Int32 day; +}; + +const sal_Int16 FIELD_INDEX_COUNT = CalendarFieldIndex::FIELD_COUNT2; + +class Calendar_gregorian : public CalendarImpl +{ +public: + + // Constructors + Calendar_gregorian(); + Calendar_gregorian(Era *_eraArray); + void SAL_CALL init(Era *_eraArray); + + /** + * Destructor + */ + ~Calendar_gregorian(); + + // Methods in XCalendar + virtual void SAL_CALL loadCalendar(const rtl::OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) 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 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); + virtual Calendar SAL_CALL getLoadedCalendar() throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getUniqueID() 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); + + // Methods in XExtendedCalendar + virtual rtl::OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) 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: + Era *eraArray; + icu::Calendar *body; + NativeNumberSupplier aNatNum; + const sal_Char* cCalendar; + com::sun::star::lang::Locale aLocale; + sal_uInt32 fieldSet; + sal_Int16 fieldValue[FIELD_INDEX_COUNT]; + sal_Int16 fieldSetValue[FIELD_INDEX_COUNT]; + + virtual void mapToGregorian() throw(com::sun::star::uno::RuntimeException); + virtual void mapFromGregorian() throw(com::sun::star::uno::RuntimeException); + void getValue() throw(com::sun::star::uno::RuntimeException); + +private: + Calendar aCalendar; + + /** Submit fieldSetValue array according to fieldSet. */ + void submitFields() throw(com::sun::star::uno::RuntimeException); + /** Submit fieldSetValue array according to fieldSet, plus YMDhms if >=0, + plus zone and DST if != 0 */ + void submitValues( sal_Int32 nYear, sal_Int32 nMonth, sal_Int32 nDay, sal_Int32 nHour, sal_Int32 nMinute, sal_Int32 nSecond, sal_Int32 nMilliSecond, sal_Int32 nZone, sal_Int32 nDST) throw(com::sun::star::uno::RuntimeException); + /** Set fields internally. */ + void setValue() throw(com::sun::star::uno::RuntimeException); + /** Obtain combined field values for timezone offset (minutes+secondmillis) + in milliseconds and whether fields were set. */ + bool getZoneOffset( sal_Int32 & o_nOffset ) const; + /** Obtain combined field values for DST offset (minutes+secondmillis) in + milliseconds and whether fields were set. */ + bool getDSTOffset( sal_Int32 & o_nOffset ) const; + /** Used by getZoneOffset() and getDSTOffset(). Parent is + CalendarFieldIndex for offset in minutes, child is CalendarFieldIndex + for offset in milliseconds. */ + bool getCombinedOffset( sal_Int32 & o_nOffset, sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const; +}; + +// ---------------------------------------------------- +// class Calendar_hanja +// ---------------------------------------------------- +class Calendar_hanja : public Calendar_gregorian +{ +public: + // Constructors + Calendar_hanja(); + virtual void SAL_CALL loadCalendar(const rtl::OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) 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); +}; + +// ---------------------------------------------------- +// 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(); + + // Methods in XExtendedCalendar + virtual rtl::OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/calendar_hijri.hxx b/i18npool/inc/calendar_hijri.hxx new file mode 100644 index 000000000000..f59713f36d7d --- /dev/null +++ b/i18npool/inc/calendar_hijri.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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: + void mapToGregorian() throw(com::sun::star::uno::RuntimeException); + void mapFromGregorian() 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); + void ToGregorian(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year); + void getGregorianDay(sal_Int32 jd, sal_Int32 *pnDay, sal_Int32 *pnMonth, sal_Int32 *pnYear); + double getJulianDay(sal_Int32 day, sal_Int32 month, sal_Int32 year); +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/calendar_jewish.hxx b/i18npool/inc/calendar_jewish.hxx new file mode 100644 index 000000000000..d5962e0041db --- /dev/null +++ b/i18npool/inc/calendar_jewish.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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(); + + // Methods in XExtendedCalendar + virtual rtl::OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException); + +protected: + void mapToGregorian() throw(com::sun::star::uno::RuntimeException); + void mapFromGregorian() throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/cclass_cjk.hxx b/i18npool/inc/cclass_cjk.hxx new file mode 100644 index 000000000000..0afa6a511d3c --- /dev/null +++ b/i18npool/inc/cclass_cjk.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx new file mode 100644 index 000000000000..61d8f14573c4 --- /dev/null +++ b/i18npool/inc/cclass_unicode.hxx @@ -0,0 +1,191 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_CCLASS_UNICODE_HXX_ +#define _I18N_CCLASS_UNICODE_HXX_ + +#include <com/sun/star/i18n/XNativeNumberSupplier.hpp> +#include <com/sun/star/i18n/XCharacterClassification.hpp> +#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#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: + const sal_Char *cClass; + +private: + Transliteration_casemapping *trans; + +// --- parser specific (implemented in cclass_unicode_parser.cxx) --- + + enum ScanState + { + ssGetChar, + ssGetValue, + ssGetWord, + ssGetWordFirstChar, + ssGetString, + ssGetBool, + ssRewindFromValue, + ssIgnoreLeadingInRewind, + 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; + com::sun::star::uno::Reference < com::sun::star::i18n::XNativeNumberSupplier > xNatNumSup; + 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( const sal_Unicode* aStr, sal_Int32 nPos ); + + /// Access parser table flags. + UPT_FLAG_TYPE getFlags( const sal_Unicode* aStr, sal_Int32 nPos ); + + /// Access parser flags via International and special definitions. + UPT_FLAG_TYPE getFlagsExtended( const sal_Unicode* aStr, sal_Int32 nPos ); + + /// 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 SAL_CALL getCharType( const rtl::OUString& Text, sal_Int32 *nPos, sal_Int32 increment); + +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/chaptercollator.hxx b/i18npool/inc/chaptercollator.hxx new file mode 100644 index 000000000000..21d3b0098faf --- /dev/null +++ b/i18npool/inc/chaptercollator.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/characterclassificationImpl.hxx b/i18npool/inc/characterclassificationImpl.hxx new file mode 100644 index 000000000000..e30f64bcb006 --- /dev/null +++ b/i18npool/inc/characterclassificationImpl.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_CHARACTERCLASSIFICATIONIMPL_HXX_ +#define _I18N_CHARACTERCLASSIFICATIONIMPL_HXX_ + +#include <com/sun/star/i18n/XCharacterClassification.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <vector> +#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; + }; + }; + std::vector<lookupTableItem*> 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); + +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/chartonum.hxx b/i18npool/inc/chartonum.hxx new file mode 100644 index 000000000000..0e975f0c0416 --- /dev/null +++ b/i18npool/inc/chartonum.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _L10N_TRANSLITERATION_CHARTONUM_HXX_ +#define _L10N_TRANSLITERATION_CHARTONUM_HXX_ + +#include <transliteration_Numeric.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +#define TRANSLITERATION_CHARTONUM( name ) \ +class CharToNum##name : public transliteration_Numeric \ +{ \ +public: \ + CharToNum##name (); \ +}; + +#ifdef TRANSLITERATION_ALL +TRANSLITERATION_CHARTONUM(Lower_zh_CN) +TRANSLITERATION_CHARTONUM(Upper_zh_CN) +TRANSLITERATION_CHARTONUM(Lower_zh_TW) +TRANSLITERATION_CHARTONUM(Upper_zh_TW) +TRANSLITERATION_CHARTONUM(Upper_ko) +TRANSLITERATION_CHARTONUM(Hangul_ko) +TRANSLITERATION_CHARTONUM(Lower_ko) +TRANSLITERATION_CHARTONUM(KanjiShort_ja_JP) +TRANSLITERATION_CHARTONUM(KanjiTraditional_ja_JP) +TRANSLITERATION_CHARTONUM(Fullwidth) +TRANSLITERATION_CHARTONUM(Indic_ar) +TRANSLITERATION_CHARTONUM(EastIndic_ar) +TRANSLITERATION_CHARTONUM(Indic_hi) +TRANSLITERATION_CHARTONUM(_th) +#endif +#undef TRANSLITERATION_CHARTONUM + +} } } } + +#endif // _L10N_TRANSLITERATION_CHARTONUM_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/collatorImpl.hxx b/i18npool/inc/collatorImpl.hxx new file mode 100644 index 000000000000..4098989389cc --- /dev/null +++ b/i18npool/inc/collatorImpl.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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> +#include <sal/alloca.h> +#include <vector> + +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; + } + }; + std::vector<lookupTableItem*> 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/collator_unicode.hxx b/i18npool/inc/collator_unicode.hxx new file mode 100644 index 000000000000..5cf481d5b5c3 --- /dev/null +++ b/i18npool/inc/collator_unicode.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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 <cppuhelper/implbase1.hxx> +#include <osl/module.h> + +#include "warnings_guard_unicode_tblcoll.h" + +// ---------------------------------------------------- +// 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(); + + 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_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&, sal_Int32) + throw(com::sun::star::uno::RuntimeException) {throw com::sun::star::uno::RuntimeException();} + void SAL_CALL loadCollatorAlgorithmWithEndUserOption( const rtl::OUString&, const lang::Locale&, + const com::sun::star::uno::Sequence< sal_Int32 >&) 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&) + 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& ) + 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: + const sal_Char *implementationName; +private: + RuleBasedCollator *uca_base, *collator; + oslModule hModule; +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx new file mode 100644 index 000000000000..d4ca9f5f49ab --- /dev/null +++ b/i18npool/inc/defaultnumberingprovider.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_DEFAULT_NUMBERING_PROVIDER_HXX_ +#define _I18N_DEFAULT_NUMBERING_PROVIDER_HXX_ + +#include <com/sun/star/text/XDefaultNumberingProvider.hpp> +#include <com/sun/star/text/XNumberingFormatter.hpp> +#include <com/sun/star/text/XNumberingTypeInfo.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase4.hxx> +#include <com/sun/star/i18n/XTransliteration.hpp> +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> + +#include <transliterationImpl.hxx> + +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 +> +{ + 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 impl_loadTranslit(); +public: + DefaultNumberingProvider( + const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF ); + ~DefaultNumberingProvider(); + + //XDefaultNumberingProvider + virtual com::sun::star::uno::Sequence< com::sun::star::uno::Reference< + com::sun::star::container::XIndexAccess > > SAL_CALL + getDefaultOutlineNumberings( const com::sun::star::lang::Locale& aLocale ) + throw(com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue > > SAL_CALL + getDefaultContinuousNumberingLevels( const com::sun::star::lang::Locale& aLocale ) + throw(com::sun::star::uno::RuntimeException); + + //XNumberingFormatter + virtual rtl::OUString SAL_CALL makeNumberingString( + const com::sun::star::uno::Sequence< + com::sun::star::beans::PropertyValue >& aProperties, + const com::sun::star::lang::Locale& aLocale ) + throw(com::sun::star::lang::IllegalArgumentException, + com::sun::star::uno::RuntimeException); + + //XNumberingTypeInfo + virtual com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedNumberingTypes( ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getNumberingType( const rtl::OUString& NumberingIdentifier ) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasNumberingType( const rtl::OUString& NumberingIdentifier ) + throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getNumberingIdentifier( sal_Int16 NumberingType ) + throw(com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName(void) + throw( com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) + throw( com::sun::star::uno::RuntimeException ); + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) + throw( com::sun::star::uno::RuntimeException ); +private: + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xSMgr; + com::sun::star::uno::Reference < com::sun::star::container::XHierarchicalNameAccess > xHierarchicalNameAccess; + TransliterationImpl* translit; + rtl::OUString SAL_CALL makeNumberingIdentifier( sal_Int16 index ) + throw(com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isScriptFlagEnabled(const rtl::OUString& aName ) + throw(com::sun::star::uno::RuntimeException); +}; +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/i18npool/i18npooldllapi.h b/i18npool/inc/i18npool/i18npooldllapi.h new file mode 100644 index 000000000000..eb38e89b8744 --- /dev/null +++ b/i18npool/inc/i18npool/i18npooldllapi.h @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_I18NPOOL_I18NPOOLDLLAPI_H +#define INCLUDED_I18NPOOL_I18NPOOLDLLAPI_H + +#include "sal/types.h" + +#if defined(I18NPAPER_DLLIMPLEMENTATION) +#define I18NPAPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define I18NPAPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define I18NPAPER_DLLPRIVATE SAL_DLLPRIVATE + +#if defined(I18NISOLANG_DLLIMPLEMENTATION) +#define I18NISOLANG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define I18NISOLANG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define I18NISOLANG_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_I18NPOOL_I18NPOOLDLLAPI_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h new file mode 100644 index 000000000000..0b6e891896dc --- /dev/null +++ b/i18npool/inc/i18npool/lang.h @@ -0,0 +1,540 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_I18NPOOL_LANG_H +#define INCLUDED_I18NPOOL_LANG_H + +/** + These are MS LANGIDs, the lower 10 bits (mask 0x03ff, values below 0x0400 + aren't real locale IDs) represent the primary language ID, the upper 6 bits + represent the sublanguage ID, which in most cases together with the primary + language simply designates a country. A LANGID is constructed by + UINT16 nLangID = ((((UINT16)(SubLangId)) << 10) | (UINT16)(PriLangId)); + + A user-defined primary language ID is a value in the range 0x0200 to 0x03ff. + All other values are reserved for Windows system use. + + A user-defined sublanguage identifier is a value in the range 0x20 to 0x3f. + All other values are reserved for Windows system use. + If there is no sublanguage ID for a primary language ID, use SUBLANG_DEFAULT + (0x01, which shifted to the left by 10 bits results in the frequently seen + 0x0400). OR'ed with a 0x0200 primary results in 0x0600. + + Values added as of 2006-04-18, a helper script: ../../source/isolang/lcid.awk + Utility to compare MS-LANGID definitions with those defined in this file. + + For further information about MS-LANGIDs please see include/winnt.h of a + recent MSDEV version and the following web pages. + + + The once complete list, not necessarily supported by Windows: + List of Locale ID (LCID) Values as Assigned by Microsoft + http://www.microsoft.com/globaldev/reference/lcid-all.mspx + + As a complete list is never complete, some more that came with WinXP SP2: + Windows XP/Server 2003 - List of Locale IDs, Input Locale, and Language Collection + http://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx + + And of course 2 lists aren't enough, so Windows Vista needs an extra one. + Which at least seems to include values of other versions of Windows. + Language Identifier Constants and Strings + http://msdn2.microsoft.com/en-us/library/ms776294.aspx + + Hey, yet another list, maybe this one will not move around? It seems to be + quite complete.. + Language Identifier Constants and Strings (Windows) + http://msdn.microsoft.com/en-us/library/dd318693(VS.85).aspx + + List of supported locale identifiers in Word + http://support.microsoft.com/default.aspx?scid=KB;en-us;q221435 + */ + + +/* It must be safe to include this file in plain C code, so only C style + * comments are used. Do NOT use // C++ style comments. */ + +/* disable typedef for usage in svtools/source/misc/langtab.src */ +#ifndef RSC_RESOURCE_USAGE +typedef unsigned short LanguageType; +#endif + +#define LANGUAGE_MASK_PRIMARY 0x03ff + +#ifdef __cplusplus +/* Please use the methods provided in mslangid.hxx for type-safety! */ +#else +#define MSLANGID_MAKELANGID( nSubLangId, nPriLangId ) \ + (((nSubLangId) << 10) | (nPriLangId)) +#define MSLANGID_GETPRIMARYLANGUAGE( nLangID ) \ + ((nLangID) & LANGUAGE_MASK_PRIMARY) +#define MSLANGID_GETSUBLANGUAGE( nLangID ) \ + (((nLangID) & ~LANGUAGE_MASK_PRIMARY) >> 10) +#endif + + +#define LANGUAGE_DONTKNOW 0x03FF /* yes, the mask */ +#define LANGUAGE_NONE 0x00FF +#define LANGUAGE_HID_HUMAN_INTERFACE_DEVICE 0x04FF +#define LANGUAGE_SYSTEM 0x0000 /* OOo/SO definition */ + +/* The Invariant Locale (Locale ID = 0x007f) is a locale that can be used by + * applications when a consistent and locale-independent result is required. + * The invariant locale can be used, for example, when comparing character + * strings using the CompareString() API and a consistent result regardless of + * the User Locale is expected. + * The settings of the Invariant Locale are similar to US-English international + * standards, but should not be used to display formatted data. */ +/* NOTE: this is taken from the MS documentation! Not supported by OOo/SO! */ +#define LANGUAGE_INVARIANT 0x007F + +#define LANGUAGE_AFRIKAANS 0x0436 +#define LANGUAGE_ALBANIAN 0x041C +#define LANGUAGE_ALSATIAN_FRANCE 0x0484 +#define LANGUAGE_AMHARIC_ETHIOPIA 0x045E +#define LANGUAGE_ARABIC_ALGERIA 0x1401 +#define LANGUAGE_ARABIC_BAHRAIN 0x3C01 +#define LANGUAGE_ARABIC_EGYPT 0x0C01 +#define LANGUAGE_ARABIC_IRAQ 0x0801 +#define LANGUAGE_ARABIC_JORDAN 0x2C01 +#define LANGUAGE_ARABIC_KUWAIT 0x3401 +#define LANGUAGE_ARABIC_LEBANON 0x3001 +#define LANGUAGE_ARABIC_LIBYA 0x1001 +#define LANGUAGE_ARABIC_MOROCCO 0x1801 +#define LANGUAGE_ARABIC_OMAN 0x2001 +#define LANGUAGE_ARABIC_QATAR 0x4001 +#define LANGUAGE_ARABIC_SAUDI_ARABIA 0x0401 +#define LANGUAGE_ARABIC_SYRIA 0x2801 +#define LANGUAGE_ARABIC_TUNISIA 0x1C01 +#define LANGUAGE_ARABIC_UAE 0x3801 +#define LANGUAGE_ARABIC_YEMEN 0x2401 +#define LANGUAGE_ARABIC_PRIMARY_ONLY 0x0001 /* primary only, not a locale! */ +#define LANGUAGE_ARMENIAN 0x042B +#define LANGUAGE_ASSAMESE 0x044D +#define LANGUAGE_AZERI 0x002C /* primary only, not a locale! */ +#define LANGUAGE_AZERI_CYRILLIC 0x082C +#define LANGUAGE_AZERI_LATIN 0x042C +#define LANGUAGE_BASHKIR_RUSSIA 0x046D +#define LANGUAGE_BASQUE 0x042D +#define LANGUAGE_BELARUSIAN 0x0423 +#define LANGUAGE_BENGALI 0x0445 /* in India */ +#define LANGUAGE_BENGALI_BANGLADESH 0x0845 +#define LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA 0x141A +#define LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA 0x201A +#define LANGUAGE_BOSNIAN_BOSNIA_HERZEGOVINA LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA /* TODO: remove, only for langtab.src & localize.sdf compatibility */ +#define LANGUAGE_BRETON_FRANCE 0x047E /* obsoletes LANGUAGE_USER_BRETON 0x0629 */ +#define LANGUAGE_BULGARIAN 0x0402 +#define LANGUAGE_BURMESE 0x0455 +#define LANGUAGE_CATALAN 0x0403 +#define LANGUAGE_CHEROKEE_UNITED_STATES 0x045C +#define LANGUAGE_CHINESE 0x0004 /* primary only, not a locale! */ +#define LANGUAGE_CHINESE_HONGKONG 0x0C04 +#define LANGUAGE_CHINESE_MACAU 0x1404 +#define LANGUAGE_CHINESE_SIMPLIFIED 0x0804 +#define LANGUAGE_CHINESE_SINGAPORE 0x1004 +#define LANGUAGE_CHINESE_TRADITIONAL 0x0404 +/* #define LANGUAGE_CHINESE_SIMPLIFIED 0x0004 */ /* artificial political? Defined as 'zh-CHS' by MS. Primary only! */ +/* #define LANGUAGE_CHINESE_TRADITIONAL 0x7C04 */ /* artificial political? Defined as 'zh-CHT' by MS. */ +#define LANGUAGE_CORSICAN_FRANCE 0x0483 +#define LANGUAGE_CROATIAN 0x041A +#define LANGUAGE_CROATIAN_BOSNIA_HERZEGOVINA 0x101A +#define LANGUAGE_CZECH 0x0405 +#define LANGUAGE_DANISH 0x0406 +#define LANGUAGE_DARI_AFGHANISTAN 0x048C /* AKA Zoroastrian Dari */ +#define LANGUAGE_DHIVEHI 0x0465 /* AKA Divehi */ +#define LANGUAGE_DUTCH 0x0413 +#define LANGUAGE_DUTCH_BELGIAN 0x0813 +#define LANGUAGE_EDO 0x0466 +#define LANGUAGE_ENGLISH 0x0009 /* primary only, not a locale! */ +#define LANGUAGE_ENGLISH_AUS 0x0C09 +#define LANGUAGE_ENGLISH_BELIZE 0x2809 +#define LANGUAGE_ENGLISH_CAN 0x1009 +#define LANGUAGE_ENGLISH_CARRIBEAN 0x2409 +#define LANGUAGE_ENGLISH_EIRE 0x1809 +#define LANGUAGE_ENGLISH_HONG_KONG_SAR 0x3C09 +#define LANGUAGE_ENGLISH_INDIA 0x4009 +#define LANGUAGE_ENGLISH_INDONESIA 0x3809 +#define LANGUAGE_ENGLISH_JAMAICA 0x2009 +#define LANGUAGE_ENGLISH_MALAYSIA 0x4409 +#define LANGUAGE_ENGLISH_NZ 0x1409 +#define LANGUAGE_ENGLISH_PHILIPPINES 0x3409 +#define LANGUAGE_ENGLISH_SAFRICA 0x1C09 +#define LANGUAGE_ENGLISH_SINGAPORE 0x4809 +#define LANGUAGE_ENGLISH_TRINIDAD 0x2C09 +#define LANGUAGE_ENGLISH_UK 0x0809 +#define LANGUAGE_ENGLISH_US 0x0409 +#define LANGUAGE_ENGLISH_ZIMBABWE 0x3009 +#define LANGUAGE_ESTONIAN 0x0425 +#define LANGUAGE_FAEROESE 0x0438 +#define LANGUAGE_FARSI 0x0429 +#define LANGUAGE_FILIPINO 0x0464 +#define LANGUAGE_FINNISH 0x040B +#define LANGUAGE_FRENCH 0x040C +#define LANGUAGE_FRENCH_BELGIAN 0x080C +#define LANGUAGE_FRENCH_CAMEROON 0x2C0C +#define LANGUAGE_FRENCH_CANADIAN 0x0C0C +#define LANGUAGE_FRENCH_COTE_D_IVOIRE 0x300C + +#define LANGUAGE_FRENCH_HAITI 0x3C0C +#define LANGUAGE_FRENCH_LUXEMBOURG 0x140C +#define LANGUAGE_FRENCH_MALI 0x340C +#define LANGUAGE_FRENCH_MONACO 0x180C +#define LANGUAGE_FRENCH_MOROCCO 0x380C +#define LANGUAGE_FRENCH_NORTH_AFRICA 0xE40C +#define LANGUAGE_FRENCH_REUNION 0x200C +#define LANGUAGE_FRENCH_SENEGAL 0x280C +#define LANGUAGE_FRENCH_SWISS 0x100C +#define LANGUAGE_FRENCH_WEST_INDIES 0x1C0C +#define LANGUAGE_FRENCH_ZAIRE 0x240C +#define LANGUAGE_FRISIAN_NETHERLANDS 0x0462 +#define LANGUAGE_FULFULDE_NIGERIA 0x0467 +#define LANGUAGE_GAELIC_IRELAND 0x083C +#define LANGUAGE_GAELIC_SCOTLAND 0x043C +#define LANGUAGE_GALICIAN 0x0456 +#define LANGUAGE_GEORGIAN 0x0437 +#define LANGUAGE_GERMAN 0x0407 +#define LANGUAGE_GERMAN_AUSTRIAN 0x0C07 +#define LANGUAGE_GERMAN_LIECHTENSTEIN 0x1407 +#define LANGUAGE_GERMAN_LUXEMBOURG 0x1007 +#define LANGUAGE_GERMAN_SWISS 0x0807 +#define LANGUAGE_GREEK 0x0408 +#define LANGUAGE_GUARANI_PARAGUAY 0x0474 +#define LANGUAGE_GUJARATI 0x0447 +#define LANGUAGE_HAUSA_NIGERIA 0x0468 +#define LANGUAGE_HAWAIIAN_UNITED_STATES 0x0475 +#define LANGUAGE_HEBREW 0x040D +#define LANGUAGE_HINDI 0x0439 +#define LANGUAGE_HUNGARIAN 0x040E +#define LANGUAGE_IBIBIO_NIGERIA 0x0469 +#define LANGUAGE_ICELANDIC 0x040F +#define LANGUAGE_IGBO_NIGERIA 0x0470 +#define LANGUAGE_INDONESIAN 0x0421 +#define LANGUAGE_INUKTITUT_SYLLABICS_CANADA 0x045D +#define LANGUAGE_INUKTITUT_LATIN_CANADA 0x085D +#define LANGUAGE_ITALIAN 0x0410 +#define LANGUAGE_ITALIAN_SWISS 0x0810 +#define LANGUAGE_JAPANESE 0x0411 +#define LANGUAGE_KALAALLISUT_GREENLAND 0x046F /* obsoletes LANGUAGE_USER_KALAALLISUT 0x062A */ +#define LANGUAGE_KANNADA 0x044B +#define LANGUAGE_KANURI_NIGERIA 0x0471 +#define LANGUAGE_KASHMIRI 0x0460 +#define LANGUAGE_KASHMIRI_INDIA 0x0860 +#define LANGUAGE_KAZAK 0x043F +#define LANGUAGE_KHMER 0x0453 +#define LANGUAGE_KICHE_GUATEMALA 0x0486 /* AKA K'iche', West Central Quiche, */ +#define LANGUAGE_KINYARWANDA_RWANDA 0x0487 /* obsoletes LANGUAGE_USER_KINYARWANDA 0x0621 */ +#define LANGUAGE_KIRGHIZ 0x0440 /* AKA Kyrgyz */ +#define LANGUAGE_KONKANI 0x0457 +#define LANGUAGE_KOREAN 0x0412 +#define LANGUAGE_KOREAN_JOHAB 0x0812 +#define LANGUAGE_LAO 0x0454 +#define LANGUAGE_LATIN 0x0476 /* obsoletes LANGUAGE_USER_LATIN 0x0610 */ +#define LANGUAGE_LATVIAN 0x0426 +#define LANGUAGE_LITHUANIAN 0x0427 +#define LANGUAGE_LITHUANIAN_CLASSIC 0x0827 +#define LANGUAGE_LUXEMBOURGISH_LUXEMBOURG 0x046E /* obsoletes LANGUAGE_USER_LUXEMBOURGISH 0x0630 */ +#define LANGUAGE_MACEDONIAN 0x042F +#define LANGUAGE_MALAY 0x003E /* primary only, not a locale! */ +#define LANGUAGE_MALAYALAM 0x044C /* in India */ +#define LANGUAGE_MALAY_BRUNEI_DARUSSALAM 0x083E +#define LANGUAGE_MALAY_MALAYSIA 0x043E +#define LANGUAGE_MALTESE 0x043A +#define LANGUAGE_MANIPURI 0x0458 +#define LANGUAGE_MAORI_NEW_ZEALAND 0x0481 /* obsoletes LANGUAGE_USER_MAORI 0x0620 */ +#define LANGUAGE_MAPUDUNGUN_CHILE 0x047A /* AKA Araucanian */ +#define LANGUAGE_MARATHI 0x044E +#define LANGUAGE_MOHAWK_CANADA 0x047C +#define LANGUAGE_MONGOLIAN 0x0450 /* Cyrillic script */ +#define LANGUAGE_MONGOLIAN_MONGOLIAN 0x0850 +#define LANGUAGE_NEPALI 0x0461 +#define LANGUAGE_NEPALI_INDIA 0x0861 +#define LANGUAGE_NORWEGIAN 0x0014 /* primary only, not a locale! */ +#define LANGUAGE_NORWEGIAN_BOKMAL 0x0414 +#define LANGUAGE_NORWEGIAN_NYNORSK 0x0814 +#define LANGUAGE_OCCITAN_FRANCE 0x0482 /* obsoletes LANGUAGE_USER_OCCITAN 0x0625 */ +#define LANGUAGE_ORIYA 0x0448 +#define LANGUAGE_OROMO 0x0472 +#define LANGUAGE_PAPIAMENTU 0x0479 +#define LANGUAGE_PASHTO 0x0463 +#define LANGUAGE_POLISH 0x0415 +#define LANGUAGE_PORTUGUESE 0x0816 +#define LANGUAGE_PORTUGUESE_BRAZILIAN 0x0416 +#define LANGUAGE_PUNJABI 0x0446 +#define LANGUAGE_PUNJABI_PAKISTAN 0x0846 +#define LANGUAGE_QUECHUA_BOLIVIA 0x046B +#define LANGUAGE_QUECHUA_ECUADOR 0x086B +#define LANGUAGE_QUECHUA_PERU 0x0C6B +#define LANGUAGE_RHAETO_ROMAN 0x0417 +#define LANGUAGE_ROMANIAN 0x0418 +#define LANGUAGE_ROMANIAN_MOLDOVA 0x0818 +#define LANGUAGE_RUSSIAN 0x0419 +#define LANGUAGE_RUSSIAN_MOLDOVA 0x0819 +#define LANGUAGE_SAMI_NORTHERN_NORWAY 0x043B +#define LANGUAGE_SAMI_LAPPISH LANGUAGE_SAMI_NORTHERN_NORWAY /* the old MS definition */ +#define LANGUAGE_SAMI_INARI 0x243B +#define LANGUAGE_SAMI_LULE_NORWAY 0x103B +#define LANGUAGE_SAMI_LULE_SWEDEN 0x143B +#define LANGUAGE_SAMI_NORTHERN_FINLAND 0x0C3B +#define LANGUAGE_SAMI_NORTHERN_SWEDEN 0x083B +#define LANGUAGE_SAMI_SKOLT 0x203B +#define LANGUAGE_SAMI_SOUTHERN_NORWAY 0x183B +#define LANGUAGE_SAMI_SOUTHERN_SWEDEN 0x1C3B +#define LANGUAGE_SANSKRIT 0x044F +#define LANGUAGE_SEPEDI 0x046C +#define LANGUAGE_NORTHERNSOTHO LANGUAGE_SEPEDI /* just an alias for the already existing localization */ +#define LANGUAGE_SERBIAN 0x001A /* primary only, not a locale! */ +#define LANGUAGE_SERBIAN_CYRILLIC 0x0C1A /* MS lists this as Serbian (Cyrillic, Serbia) 'sr-Cyrl-SP', but they use 'SP' since at least Windows2003 where it was Serbia and Montenegro! */ +#define LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA 0x1C1A +#define LANGUAGE_SERBIAN_LATIN 0x081A /* MS lists this as Serbian (Latin, Serbia) 'sr-Latn-SP', but they use 'SP' since at least Windows2003 where it was Serbia and Montenegro! */ +#define LANGUAGE_SERBIAN_LATIN_BOSNIA_HERZEGOVINA 0x181A +#define LANGUAGE_SERBIAN_LATIN_NEUTRAL 0x7C1A /* MS lists this as 'sr' only. What a mess. */ +#define LANGUAGE_SESOTHO 0x0430 /* also called Sutu now by MS */ +#define LANGUAGE_SINDHI 0x0459 +#define LANGUAGE_SINDHI_PAKISTAN 0x0859 +#define LANGUAGE_SINHALESE_SRI_LANKA 0x045B +#define LANGUAGE_SLOVAK 0x041B +#define LANGUAGE_SLOVENIAN 0x0424 +#define LANGUAGE_SOMALI 0x0477 +#define LANGUAGE_UPPER_SORBIAN_GERMANY 0x042E /* obsoletes LANGUAGE_USER_UPPER_SORBIAN 0x0623 */ +#define LANGUAGE_LOWER_SORBIAN_GERMANY 0x082E /* obsoletes LANGUAGE_USER_LOWER_SORBIAN 0x0624. NOTE: the primary ID is identical to Upper Sorbian, which is not quite correct because they're distinct languages */ +#define LANGUAGE_SORBIAN LANGUAGE_USER_UPPER_SORBIAN /* a strange MS definition */ +#define LANGUAGE_SPANISH_DATED 0x040A /* old collation, not supported, see #i94435# */ +#define LANGUAGE_SPANISH_ARGENTINA 0x2C0A +#define LANGUAGE_SPANISH_BOLIVIA 0x400A +#define LANGUAGE_SPANISH_CHILE 0x340A +#define LANGUAGE_SPANISH_COLOMBIA 0x240A +#define LANGUAGE_SPANISH_COSTARICA 0x140A +#define LANGUAGE_SPANISH_DOMINICAN_REPUBLIC 0x1C0A +#define LANGUAGE_SPANISH_ECUADOR 0x300A +#define LANGUAGE_SPANISH_EL_SALVADOR 0x440A +#define LANGUAGE_SPANISH_GUATEMALA 0x100A +#define LANGUAGE_SPANISH_HONDURAS 0x480A +#define LANGUAGE_SPANISH_LATIN_AMERICA 0xE40A /* no locale possible */ +#define LANGUAGE_SPANISH_MEXICAN 0x080A +#define LANGUAGE_SPANISH_MODERN 0x0C0A +#define LANGUAGE_SPANISH_NICARAGUA 0x4C0A +#define LANGUAGE_SPANISH_PANAMA 0x180A +#define LANGUAGE_SPANISH_PARAGUAY 0x3C0A +#define LANGUAGE_SPANISH_PERU 0x280A +#define LANGUAGE_SPANISH_PUERTO_RICO 0x500A +#define LANGUAGE_SPANISH_UNITED_STATES 0x540A +#define LANGUAGE_SPANISH_URUGUAY 0x380A +#define LANGUAGE_SPANISH_VENEZUELA 0x200A +#define LANGUAGE_SPANISH LANGUAGE_SPANISH_MODERN /* modern collation, see #i94435# */ +#define LANGUAGE_SWAHILI 0x0441 /* Kenya */ +#define LANGUAGE_SWEDISH 0x041D +#define LANGUAGE_SWEDISH_FINLAND 0x081D +#define LANGUAGE_SYRIAC 0x045A +#define LANGUAGE_TAJIK 0x0428 +#define LANGUAGE_TAMAZIGHT_ARABIC 0x045F +#define LANGUAGE_TAMAZIGHT_LATIN 0x085F +#define LANGUAGE_TAMAZIGHT_TIFINAGH 0x0C5F +#define LANGUAGE_TAMIL 0x0449 +#define LANGUAGE_TATAR 0x0444 +#define LANGUAGE_TELUGU 0x044A +#define LANGUAGE_THAI 0x041E +#define LANGUAGE_TIBETAN 0x0451 +#define LANGUAGE_DZONGKHA 0x0851 +#define LANGUAGE_TIBETAN_BHUTAN LANGUAGE_DZONGKHA /* a MS error, see #i53497# */ +#define LANGUAGE_TIGRIGNA_ERITREA 0x0873 +#define LANGUAGE_TIGRIGNA_ETHIOPIA 0x0473 +#define LANGUAGE_TSONGA 0x0431 +#define LANGUAGE_TSWANA 0x0432 /* AKA Setsuana, for South Africa */ +#define LANGUAGE_TURKISH 0x041F +#define LANGUAGE_TURKMEN 0x0442 +#define LANGUAGE_UIGHUR_CHINA 0x0480 +#define LANGUAGE_UKRAINIAN 0x0422 +#define LANGUAGE_URDU 0x0020 /* primary only, not a locale! */ +#define LANGUAGE_URDU_INDIA 0x0820 +#define LANGUAGE_URDU_PAKISTAN 0x0420 +#define LANGUAGE_UZBEK_CYRILLIC 0x0843 +#define LANGUAGE_UZBEK_LATIN 0x0443 +#define LANGUAGE_VENDA 0x0433 +#define LANGUAGE_VIETNAMESE 0x042A +#define LANGUAGE_WELSH 0x0452 +#define LANGUAGE_WOLOF_SENEGAL 0x0488 +#define LANGUAGE_XHOSA 0x0434 /* AKA isiZhosa */ +#define LANGUAGE_YAKUT_RUSSIA 0x0485 +#define LANGUAGE_YI 0x0478 /* Sichuan Yi */ +#define LANGUAGE_YIDDISH 0x043D +#define LANGUAGE_YORUBA 0x046A +#define LANGUAGE_ZULU 0x0435 + +/* Not real, but used for legacy. */ +#define LANGUAGE_USER1 0x0201 +#define LANGUAGE_USER2 0x0202 +#define LANGUAGE_USER3 0x0203 +#define LANGUAGE_USER4 0x0204 +#define LANGUAGE_USER5 0x0205 +#define LANGUAGE_USER6 0x0206 +#define LANGUAGE_USER7 0x0207 +#define LANGUAGE_USER8 0x0208 +#define LANGUAGE_USER9 0x0209 +/* Don't use higher USER values here, we reserve them for extension. */ + +/*! use only for import/export of MS documents, number formatter maps it to + *! LANGUAGE_SYSTEM and then to effective system language */ +#define LANGUAGE_SYSTEM_DEFAULT 0x0800 + +/*! use only for import/export of MS documents, number formatter maps it to + *! LANGUAGE_SYSTEM and then to effective system language */ +#define LANGUAGE_PROCESS_OR_USER_DEFAULT 0x0400 + +/* And now the extensions we define, valid from + * 0x0610 to 0x07FF with sublanguage ID 0x01 (default) + * 0x0A00 to 0x0BFF with sublanguage ID 0x02 + * ... + * 0x8200 to 0x83FF with sublanguage ID 0x20 + * 0x8600 to 0x87FF with sublanguage ID 0x21 + * ... + * 0xFA00 to 0xFBFF with sublanguage ID 0x3E + * 0xFE00 to 0xFFFF with sublanguage ID 0x3F + * + * Obsolete OOo user defines now have other values assigned by MS, and + * different name. Mapping an obsolete value to ISO code should work provided + * that such a mapping exists in i18npool/source/isolang/isolang.cxx, but + * mapping ISO back to LANGID will return the new value. + */ +#define LANGUAGE_OBSOLETE_USER_LATIN 0x0610 +#define LANGUAGE_USER_LATIN LANGUAGE_LATIN +#define LANGUAGE_USER_ESPERANTO 0x0611 /* no locale possible */ +#define LANGUAGE_USER_INTERLINGUA 0x0612 /* no locale, but conventions */ +#define LANGUAGE_OBSOLETE_USER_MAORI 0x0620 +#define LANGUAGE_USER_MAORI LANGUAGE_MAORI_NEW_ZEALAND +#define LANGUAGE_OBSOLETE_USER_KINYARWANDA 0x0621 +#define LANGUAGE_USER_KINYARWANDA LANGUAGE_KINYARWANDA_RWANDA +/* was reserved for Northern Sotho but never used: 0x0622 */ /* obsoleted by LANGUAGE_SEPEDI */ +#define LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN 0x0623 +#define LANGUAGE_USER_UPPER_SORBIAN LANGUAGE_UPPER_SORBIAN_GERMANY +#define LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN 0x0624 +#define LANGUAGE_USER_LOWER_SORBIAN LANGUAGE_LOWER_SORBIAN_GERMANY +#define LANGUAGE_OBSOLETE_USER_OCCITAN 0x0625 +#define LANGUAGE_USER_OCCITAN LANGUAGE_OCCITAN_FRANCE /* reserved to languedocian */ + +#define LANGUAGE_USER_KOREAN_NORTH 0x8012 /* North Korean as opposed to South Korean, makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_KOREAN)) */ +#define LANGUAGE_USER_KURDISH_TURKEY 0x0626 /* sublang 0x01, Latin script */ +#define LANGUAGE_USER_KURDISH_SYRIA 0x0A26 /* sublang 0x02, Latin script */ +#define LANGUAGE_USER_KURDISH_IRAQ 0x0E26 /* sublang 0x03, Arabic script */ +#define LANGUAGE_USER_KURDISH_IRAN 0x1226 /* sublang 0x04, Arabic script */ +#define LANGUAGE_USER_SARDINIAN 0x0627 +/* was reserved for Dzongkha but turned down with #i53497#: 0x0628 */ /* obsoleted by LANGUAGE_DZONGKHA */ +#define LANGUAGE_USER_SWAHILI_TANZANIA 0x8041 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SWAHILI)) */ +#define LANGUAGE_OBSOLETE_USER_BRETON 0x0629 +#define LANGUAGE_USER_BRETON LANGUAGE_BRETON_FRANCE +#define LANGUAGE_OBSOLETE_USER_KALAALLISUT 0x062A +#define LANGUAGE_USER_KALAALLISUT LANGUAGE_KALAALLISUT_GREENLAND +#define LANGUAGE_USER_SWAZI 0x062B +#define LANGUAGE_USER_NDEBELE_SOUTH 0x062C +#define LANGUAGE_USER_TSWANA_BOTSWANA 0x8032 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_TSWANA)) */ +#define LANGUAGE_USER_MOORE 0x062D +#define LANGUAGE_USER_BAMBARA 0x062E +#define LANGUAGE_USER_AKAN 0x062F +#define LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH 0x0630 +#define LANGUAGE_USER_LUXEMBOURGISH LANGUAGE_LUXEMBOURGISH_LUXEMBOURG +#define LANGUAGE_USER_FRIULIAN 0x0631 +#define LANGUAGE_USER_FIJIAN 0x0632 +#define LANGUAGE_USER_AFRIKAANS_NAMIBIA 0x8036 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_AFRIKAANS)) */ +#define LANGUAGE_USER_ENGLISH_NAMIBIA 0x8009 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */ +#define LANGUAGE_USER_WALLOON 0x0633 +#define LANGUAGE_USER_COPTIC 0x0634 +#define LANGUAGE_USER_CHUVASH 0x0635 +#define LANGUAGE_USER_GASCON 0x0636 /* Gascon France */ +#define LANGUAGE_USER_GERMAN_BELGIUM 0x8007 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_GERMAN)) */ +#define LANGUAGE_USER_CATALAN_VALENCIAN 0x8003 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_CATALAN)) */ +#define LANGUAGE_USER_HAUSA_GHANA 0x8068 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_HAUSA_NIGERIA)) */ +#define LANGUAGE_USER_EWE_GHANA 0x0637 +#define LANGUAGE_USER_ENGLISH_GHANA 0x8409 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */ +#define LANGUAGE_USER_TAGALOG 0x0638 +#define LANGUAGE_USER_LINGALA_DRCONGO 0x0639 +#define LANGUAGE_USER_SANGO 0x063A +#define LANGUAGE_USER_GANDA 0x063B +#define LANGUAGE_USER_LOW_GERMAN 0x063C +#define LANGUAGE_USER_HILIGAYNON 0x063D +#define LANGUAGE_USER_NYANJA 0x063E +#define LANGUAGE_USER_KASHUBIAN 0x063F +#define LANGUAGE_USER_SPANISH_CUBA 0x800A /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SPANISH)) */ +#define LANGUAGE_USER_TETUN 0x0640 +#define LANGUAGE_USER_QUECHUA_NORTH_BOLIVIA 0x0641 +#define LANGUAGE_USER_QUECHUA_SOUTH_BOLIVIA 0x0642 +#define LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA 0x8C1A /* makeLangID( 0x20+0x03, getPrimaryLanguage( LANGUAGE_SERBIAN_CYRILLIC)) */ +#define LANGUAGE_USER_SERBIAN_LATIN_SERBIA 0x881A /* makeLangID( 0x20+0x02, getPrimaryLanguage( LANGUAGE_SERBIAN_LATIN)) */ +#define LANGUAGE_USER_SERBIAN_CYRILLIC_MONTENEGRO 0xCC1A /* makeLangID( 0x20+0x13, getPrimaryLanguage( LANGUAGE_SERBIAN_CYRILLIC)) */ +#define LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO 0xC81A /* makeLangID( 0x20+0x12, getPrimaryLanguage( LANGUAGE_SERBIAN_LATIN)) */ +#define LANGUAGE_USER_SAMI_KILDIN_RUSSIA 0x803B /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SAMI_NORTHERN_NORWAY)) */ +#define LANGUAGE_USER_BODO_INDIA 0x0643 +#define LANGUAGE_USER_DOGRI_INDIA 0x0644 +#define LANGUAGE_USER_MAITHILI_INDIA 0x0645 +#define LANGUAGE_USER_SANTALI_INDIA 0x0646 +#define LANGUAGE_USER_TETUN_TIMOR_LESTE 0x0A40 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_TETUN)) */ +#define LANGUAGE_USER_TOK_PISIN 0x0647 +#define LANGUAGE_USER_SHUSWAP 0x0648 +#define LANGUAGE_USER_ARABIC_CHAD 0x8001 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_COMOROS 0x8401 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_DJIBOUTI 0x8801 /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_ERITREA 0x8C01 /* makeLangID( 0x23, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_ISRAEL 0x9001 /* makeLangID( 0x24, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_MAURITANIA 0x9401 /* makeLangID( 0x25, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_PALESTINE 0x9801 /* makeLangID( 0x26, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_SOMALIA 0x9C01 /* makeLangID( 0x27, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_SUDAN 0xA001 /* makeLangID( 0x28, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ANCIENT_GREEK 0x0649 +#define LANGUAGE_USER_ASTURIAN 0x064A +#define LANGUAGE_USER_LATGALIAN 0x064B +#define LANGUAGE_USER_MAORE 0x064C +#define LANGUAGE_USER_BUSHI 0x064D +#define LANGUAGE_USER_TAHITIAN 0x064E +#define LANGUAGE_USER_MALAGASY_PLATEAU 0x064F +#define LANGUAGE_USER_PAPIAMENTU_ARUBA 0x8079 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */ +#define LANGUAGE_USER_SARDINIAN_CAMPIDANESE 0x0650 +#define LANGUAGE_USER_SARDINIAN_GALLURESE 0x0651 +#define LANGUAGE_USER_SARDINIAN_LOGUDORESE 0x0652 +#define LANGUAGE_USER_SARDINIAN_SASSARESE 0x0653 +#define LANGUAGE_USER_BAFIA 0x0654 +#define LANGUAGE_USER_GIKUYU 0x0655 +#define LANGUAGE_USER_RUSYN_UKRAINE 0x0656 +#define LANGUAGE_USER_RUSYN_SLOVAKIA 0x8256 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_RUSYN_UKRAINE)) */ +#define LANGUAGE_USER_YIDDISH_US 0x083D /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_YIDDISH)) */ +#define LANGUAGE_USER_LIMBU 0x0657 +#define LANGUAGE_USER_LOJBAN 0x0658 /* no locale */ +#define LANGUAGE_OBSOLETE_USER_KABYLE 0x0659 +#define LANGUAGE_USER_KABYLE LANGUAGE_TAMAZIGHT_LATIN +#define LANGUAGE_USER_HAITIAN 0x065A +#define LANGUAGE_USER_BEEMBE 0x065B +#define LANGUAGE_USER_BEKWEL 0x065C +#define LANGUAGE_USER_KITUBA 0x065D +#define LANGUAGE_USER_LARI 0x065E +#define LANGUAGE_USER_MBOCHI 0x065F +#define LANGUAGE_USER_TEKE_IBALI 0x0660 +#define LANGUAGE_USER_TEKE_TYEE 0x0661 +#define LANGUAGE_USER_VILI 0x0662 +#define LANGUAGE_USER_PORTUGUESE_ANGOLA 0x8016 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PORTUGUESE)) */ +#define LANGUAGE_USER_MANX 0x0663 +#define LANGUAGE_USER_TEKE_EBOO 0x0664 + +#endif /* INCLUDED_I18NPOOL_LANG_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/i18npool/mslangid.hxx b/i18npool/inc/i18npool/mslangid.hxx new file mode 100644 index 000000000000..717a5bb52c74 --- /dev/null +++ b/i18npool/inc/i18npool/mslangid.hxx @@ -0,0 +1,281 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_I18NISOLANG_MSLANGID_HXX +#define INCLUDED_I18NISOLANG_MSLANGID_HXX + +#include <sal/config.h> + +#include "i18npool/i18npooldllapi.h" +#include "i18npool/lang.h" +#include <com/sun/star/lang/Locale.hpp> + + +/** Methods related to Microsoft language IDs. For details about MS-LANGIDs + please see lang.h */ +class I18NISOLANG_DLLPUBLIC MsLangId +{ +public: + + /// Create a LangID from a primary and a sublanguage. + static inline LanguageType makeLangID( LanguageType nSubLangId, LanguageType nPriLangId) + { + return (nSubLangId << 10) | nPriLangId; + } + + /// Get the primary language of a LangID. + static inline LanguageType getPrimaryLanguage( LanguageType nLangID) + { + return nLangID & LANGUAGE_MASK_PRIMARY; + } + + /// Get the sublanguage of a LangID. + static inline LanguageType getSubLanguage( LanguageType nLangID) + { + return (nLangID & ~LANGUAGE_MASK_PRIMARY) >> 10; + } + + /** Language/locale of category LC_CTYPE (on Unix, else the system + language). + Evaluation order: LC_ALL, LC_CTYPE, LANG */ + static LanguageType getSystemLanguage(); + + /** Language/locale of category LC_MESSAGES (on Unix, else same as + GetSystemLanguage()). + Evaluation order: LANGUAGE, LC_ALL, LC_MESSAGES, LANG */ + static LanguageType getSystemUILanguage(); + + + /** @short: A proper language/locale if the nLang parameter designates some + special value. + + @descr: NOTE: The "system" values may be overridden by the + application's configuration. + + @returns + case LANGUAGE_PROCESS_OR_USER_DEFAULT : configured or system language + case LANGUAGE_SYSTEM_DEFAULT : configured or system language + case LANGUAGE_SYSTEM : configured or system language + case LANGUAGE_NONE : configured or system UI language + case LANGUAGE_DONTKNOW : LANGUAGE_ENGLISH_US + else: nLang + + In case the configured language is LANGUAGE_SYSTEM, which is also + the initial default, the system language is obtained. In case the + configured or resulting system language is LANGUAGE_DONTKNOW, + LANGUAGE_ENGLISH_US is returned instead. + */ + static LanguageType getRealLanguage( LanguageType nLang ); + + + /** @short: Convert a LanguageType to a Locale, resolving LANGUAGE_SYSTEM. + + @ATTENTION: A round trip convertLanguageToLocale( + convertLocaleToLanguage( ...)) is NOT possible because this + method substitutes LANGUAGE_SYSTEM and the like. If round-trip + is desired, you MUST use convertLanguageToLocale( ..., false) + instead. + */ + static void convertLanguageToLocale( LanguageType nLang, + ::com::sun::star::lang::Locale & rLocale ); + + + /** @short: Convert a LanguageType to a Locale with handling of + getRealLanguage(). + + @descr: If bResolveSystem==true don't use to convert a Language to a + Locale for file storage because it substitutes LANGUAGE_SYSTEM + and LANGUAGE_NONE and similar, use only at runtime! If + bResolveSystem==false a LANGUAGE_SYSTEM results in an empty + Locale. + + @ATTENTION: A round trip convertLanguageToLocale( + convertLocaleToLanguage( ...)) using the default parameter is + NOT possible because this method + substitutes LANGUAGE_SYSTEM and the like. If round-trip is + desired, you MUST use convertLanguageToLocale( ..., false) + instead. + */ + static ::com::sun::star::lang::Locale convertLanguageToLocale( + LanguageType nLang, bool bResolveSystem = true ); + + + /** Convert a Locale to a LanguageType with handling of an empty language + name designating the SYSTEM language. + */ + static LanguageType convertLocaleToLanguage( const ::com::sun::star::lang::Locale & rLocale ); + + + /** Convert a LanguageType to a Locale, resolving LANGUAGE_SYSTEM, falling + back to a default locale if no exact match was found. + */ + static ::com::sun::star::lang::Locale convertLanguageToLocaleWithFallback( LanguageType nLang ); + + + /** Convert a Locale to a LanguageType with handling of an empty language + name designating the SYSTEM language, falling back to a default locale + if no exact match was found. + */ + static LanguageType convertLocaleToLanguageWithFallback( + const ::com::sun::star::lang::Locale & rLocale ); + + + /** Get fall-back Locale for Locale with handling of an empty language name + designating the SYSTEM language. Returns the same Locale if an exact + match was found. + */ + static ::com::sun::star::lang::Locale getFallbackLocale( + const ::com::sun::star::lang::Locale & rLocale ); + + // ----------------------------- + // - ConvertLanguageToIsoNames - + // ----------------------------- + + static void convertLanguageToIsoNames( LanguageType nLang, + rtl::OUString& rLangStr, rtl::OUString& rCountry ); + static void convertLanguageToIsoNames( LanguageType nLang, + rtl::OString& rLangStr, rtl::OString& rCountry ); + static rtl::OUString convertLanguageToIsoString( LanguageType nLang, + sal_Unicode cSep = '-' ); + static rtl::OString convertLanguageToIsoByteString( LanguageType nLang, + sal_Char cSep = '-' ); + + // ----------------------------- + // - ConvertIsoNamesToLanguage - + // ----------------------------- + + static LanguageType convertIsoNamesToLanguage( const rtl::OUString& rLang, + const rtl::OUString& rCountry ); + static LanguageType convertIsoNamesToLanguage( const rtl::OString& rLang, + const rtl::OString& rCountry ); + static LanguageType convertIsoStringToLanguage( + const rtl::OUString& rString, sal_Unicode cSep = '-' ); + static LanguageType convertUnxByteStringToLanguage( + const rtl::OString& rString ); + + static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType ); + + + /** Whether locale has a Right-To-Left orientation. */ + static bool isRightToLeft( LanguageType nLang ); + + + /** Whether there are "forbidden characters at start or end of line" in + this locale. CJK locales. + + @see offapi/com/sun/star/i18n/ForbiddenCharacters.idl + */ + static bool hasForbiddenCharacters( LanguageType nLang ); + + + /** Whether locale needs input sequence checking. CTL locales. */ + static bool needsSequenceChecking( LanguageType nLang ); + + + /** Get ::com::sun::star::i18n::ScriptType of locale. */ + static sal_Int16 getScriptType( LanguageType nLang ); + + + /** Map an obsolete user defined LANGID (see lang.h + LANGUAGE_OBSOLETE_USER_...) to the new value defined by MS in the + meantime. */ + static LanguageType getReplacementForObsoleteLanguage( LanguageType nLang ); + + + /** @ATTENTION: these are _ONLY_ to be called by the application's + configuration! */ + static void setConfiguredSystemLanguage( LanguageType nLang ); + static void setConfiguredSystemUILanguage( LanguageType nLang ); + static void setConfiguredWesternFallback( LanguageType nLang ); + static void setConfiguredComplexFallback( LanguageType nLang ); + static void setConfiguredAsianFallback( LanguageType nLang ); + +// --------------------------------------------------------------------------- + + /** @internal - Access to fields of an element of the simple conversion table. + For resource compiler build environment usage only! */ + struct IsoLangEntry + { + LanguageType mnLang; + sal_Char maLangStr[4]; + sal_Char maCountry[3]; + }; + + /** @internal - Return a pointer to the IsoLangEntry of the underlying table, + matching the offset passed by nIndex. Only meaningful for the resource + compiler to build a list of known languages. + + @returns address of IsoLangEntry, or NULL pointer if nIndex exceeds the + table elements' count. + */ + static const IsoLangEntry* getIsoLangEntry( size_t nIndex ); + +// --------------------------------------------------------------------------- + +private: + + static LanguageType nConfiguredSystemLanguage; + static LanguageType nConfiguredSystemUILanguage; + + static LanguageType nConfiguredWesternFallback; + static LanguageType nConfiguredAsianFallback; + static LanguageType nConfiguredComplexFallback; + + static LanguageType getPlatformSystemLanguage(); + static LanguageType getPlatformSystemUILanguage(); + + // Substitute LANGUAGE_SYSTEM for LANGUAGE_SYSTEM_DEFAULT and + // LANGUAGE_PROCESS_OR_USER_DEFAULT, other values aren't touched. + I18NISOLANG_DLLPRIVATE static inline LanguageType simplifySystemLanguages( LanguageType nLang ); + + // Several locale lookups with fall-back + I18NISOLANG_DLLPRIVATE static LanguageType lookupFallbackLanguage( LanguageType nLang ); + I18NISOLANG_DLLPRIVATE static LanguageType lookupFallbackLanguage( + const ::com::sun::star::lang::Locale & rLocale ); + I18NISOLANG_DLLPRIVATE static ::com::sun::star::lang::Locale lookupFallbackLocale( LanguageType nLang ); + I18NISOLANG_DLLPRIVATE static ::com::sun::star::lang::Locale lookupFallbackLocale( + const ::com::sun::star::lang::Locale & rLocale ); +}; + + +// static +inline LanguageType MsLangId::getSystemLanguage() +{ + return getPlatformSystemLanguage(); +} + + +// static +inline LanguageType MsLangId::getSystemUILanguage() +{ + return getPlatformSystemUILanguage(); +} + +#endif // INCLUDED_I18NISOLANG_MSLANGID_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/i18npool/paper.hxx b/i18npool/inc/i18npool/paper.hxx new file mode 100644 index 000000000000..ed8396e1842c --- /dev/null +++ b/i18npool/inc/i18npool/paper.hxx @@ -0,0 +1,157 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_I18NPOOL_PAPER_HXX +#define INCLUDED_I18NPOOL_PAPER_HXX + +#include <sal/config.h> + +#include "i18npool/i18npooldllapi.h" +#include <rtl/string.hxx> +#include <com/sun/star/lang/Locale.hpp> + +//!! WARNING: be aware of cui/source/tabpages/page.h where someone had the broken idea +//!! of duplicating the values of this enum in order to use those defines within +//!! src files. +//!! Thus don't reorder the enum values here without changing the code there as well. +enum Paper +{ + PAPER_A0, + PAPER_A1, + PAPER_A2, + PAPER_A3, + PAPER_A4, + PAPER_A5, + PAPER_B4_ISO, + PAPER_B5_ISO, + PAPER_LETTER, + PAPER_LEGAL, + PAPER_TABLOID, + PAPER_USER, + PAPER_B6_ISO, + PAPER_ENV_C4, + PAPER_ENV_C5, + PAPER_ENV_C6, + PAPER_ENV_C65, + PAPER_ENV_DL, + PAPER_SLIDE_DIA, + PAPER_SCREEN, + PAPER_C, + PAPER_D, + PAPER_E, + PAPER_EXECUTIVE, + PAPER_FANFOLD_LEGAL_DE, + PAPER_ENV_MONARCH, + PAPER_ENV_PERSONAL, + PAPER_ENV_9, + PAPER_ENV_10, + PAPER_ENV_11, + PAPER_ENV_12, + PAPER_KAI16, + PAPER_KAI32, + PAPER_KAI32BIG, + PAPER_B4_JIS, + PAPER_B5_JIS, + PAPER_B6_JIS, + PAPER_LEDGER, + PAPER_STATEMENT, + PAPER_QUARTO, + PAPER_10x14, + PAPER_ENV_14, + PAPER_ENV_C3, + PAPER_ENV_ITALY, + PAPER_FANFOLD_US, + PAPER_FANFOLD_DE, + PAPER_POSTCARD_JP, + PAPER_9x11, + PAPER_10x11, + PAPER_15x11, + PAPER_ENV_INVITE, + PAPER_A_PLUS, + PAPER_B_PLUS, + PAPER_LETTER_PLUS, + PAPER_A4_PLUS, + PAPER_DOUBLEPOSTCARD_JP, + PAPER_A6, + PAPER_12x11, + PAPER_A7, + PAPER_A8, + PAPER_A9, + PAPER_A10, + PAPER_B0_ISO, + PAPER_B1_ISO, + PAPER_B2_ISO, + PAPER_B3_ISO, + PAPER_B7_ISO, + PAPER_B8_ISO, + PAPER_B9_ISO, + PAPER_B10_ISO, + PAPER_ENV_C2, + PAPER_ENV_C7, + PAPER_ENV_C8, + PAPER_ARCHA, + PAPER_ARCHB, + PAPER_ARCHC, + PAPER_ARCHD, + PAPER_ARCHE +}; + +// defined for 'equal size' test with the implementation array +#define NUM_PAPER_ENTRIES (PAPER_ARCHE - PAPER_A0 + 1) + +// --------- +// - Paper - +// --------- + +class I18NPAPER_DLLPUBLIC PaperInfo +{ + Paper m_eType; + long m_nPaperWidth; // width in 100thMM + long m_nPaperHeight; // height in 100thMM +public: + PaperInfo(Paper eType); + PaperInfo(long nPaperWidth, long nPaperHeight); + + Paper getPaper() const { return m_eType; } + long getWidth() const { return m_nPaperWidth; } + long getHeight() const { return m_nPaperHeight; } + bool sloppyEqual(const PaperInfo &rOther) const; + bool doSloppyFit(); + + static PaperInfo getSystemDefaultPaper(); + static PaperInfo getDefaultPaperForLocale(const ::com::sun::star::lang::Locale & rLocale); + + static Paper fromPSName(const rtl::OString &rName); + static rtl::OString toPSName(Paper eType); + + static long sloppyFitPageDimension(long nDimension); +}; + +#endif // INCLUDED_I18NPOOL_PAPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/indexentrysupplier.hxx b/i18npool/inc/indexentrysupplier.hxx new file mode 100644 index 000000000000..05a9813932d4 --- /dev/null +++ b/i18npool/inc/indexentrysupplier.hxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_INDEXENTRYSUPPLIER_HXX_ +#define _I18N_INDEXENTRYSUPPLIER_HXX_ + +#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class IndexEntrySupplier +// ---------------------------------------------------- +class IndexEntrySupplier : public cppu::WeakImplHelper2 +< + com::sun::star::i18n::XExtendedIndexEntrySupplier, + com::sun::star::lang::XServiceInfo +> +{ +public: + IndexEntrySupplier( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + + // Methods + virtual com::sun::star::uno::Sequence < com::sun::star::lang::Locale > SAL_CALL getLocaleList() + throw (com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getAlgorithmList( + const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL loadAlgorithm( + const com::sun::star::lang::Locale& rLocale, + const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions ) + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL usePhoneticEntry( + const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getPhoneticCandidate( const rtl::OUString& IndexEntry, + const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry, + const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1, + const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1, + const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2, + const com::sun::star::lang::Locale& rLocale2 ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& IndexEntry, + const com::sun::star::lang::Locale& rLocale, 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& rLocale ) + 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: + rtl::OUString aServiceName; + com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > xIES; + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + sal_Bool SAL_CALL createLocaleSpecificIndexEntrySupplier(const rtl::OUString& name) throw( com::sun::star::uno::RuntimeException ); + com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > SAL_CALL getLocaleSpecificIndexEntrySupplier( + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm) throw (com::sun::star::uno::RuntimeException); + +protected: + com::sun::star::lang::Locale aLocale; + rtl::OUString aSortAlgorithm; +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/indexentrysupplier_asian.hxx b/i18npool/inc/indexentrysupplier_asian.hxx new file mode 100644 index 000000000000..db6e174b7a31 --- /dev/null +++ b/i18npool/inc/indexentrysupplier_asian.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _I18N_INDEXENTRYSUPPLIER_ASIAN_HXX_ +#define _I18N_INDEXENTRYSUPPLIER_ASIAN_HXX_ + +#include <indexentrysupplier_common.hxx> +#include <osl/module.h> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class IndexEntrySupplier_asian +// ---------------------------------------------------- + +class IndexEntrySupplier_asian : public IndexEntrySupplier_Common { +public: + IndexEntrySupplier_asian( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + ~IndexEntrySupplier_asian(); + + rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry, + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rAlgorithm ) + throw (com::sun::star::uno::RuntimeException); + rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& rIndexEntry, + const rtl::OUString& rPhoneticEntry, const com::sun::star::lang::Locale& rLocale) + throw (com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL compareIndexEntry( + const rtl::OUString& rIndexEntry1, const rtl::OUString& rPhoneticEntry1, + const com::sun::star::lang::Locale& rLocale1, + const rtl::OUString& rIndexEntry2, const rtl::OUString& rPhoneticEntry2, + const com::sun::star::lang::Locale& rLocale2 ) + throw (com::sun::star::uno::RuntimeException); + rtl::OUString SAL_CALL getPhoneticCandidate( const rtl::OUString& rIndexEntry, + const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); +private: + oslModule hModule; +}; + +} } } } +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/indexentrysupplier_common.hxx b/i18npool/inc/indexentrysupplier_common.hxx new file mode 100644 index 000000000000..f92b8151ccfb --- /dev/null +++ b/i18npool/inc/indexentrysupplier_common.hxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _I18N_INDEXENTRYSUPPLIER_COMMON_HXX_ +#define _I18N_INDEXENTRYSUPPLIER_COMMON_HXX_ + +#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <collatorImpl.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class IndexEntrySupplier_Common +// ---------------------------------------------------- + +class IndexEntrySupplier_Common : public cppu::WeakImplHelper2 +< + com::sun::star::i18n::XExtendedIndexEntrySupplier, + com::sun::star::lang::XServiceInfo +> +{ +public: + IndexEntrySupplier_Common( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + ~IndexEntrySupplier_Common(); + + virtual com::sun::star::uno::Sequence < com::sun::star::lang::Locale > SAL_CALL getLocaleList() + throw (com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getAlgorithmList( + const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL usePhoneticEntry( + const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getPhoneticCandidate( const rtl::OUString& IndexEntry, + const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL loadAlgorithm( + const com::sun::star::lang::Locale& rLocale, + const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry, + const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1, + const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1, + const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2, + const com::sun::star::lang::Locale& rLocale2 ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry, + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getIndexFollowPageWord( sal_Bool MorePages, + const com::sun::star::lang::Locale& rLocale ) + 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: + const sal_Char *implementationName; + sal_Bool usePhonetic; + CollatorImpl *collator; + const rtl::OUString& SAL_CALL getEntry( const rtl::OUString& IndexEntry, + const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + com::sun::star::lang::Locale aLocale; + rtl::OUString aAlgorithm; +}; + +} } } } +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/indexentrysupplier_default.hxx b/i18npool/inc/indexentrysupplier_default.hxx new file mode 100644 index 000000000000..9958df85d0ce --- /dev/null +++ b/i18npool/inc/indexentrysupplier_default.hxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_ +#define _I18N_INDEXENTRYSUPPLIER_DEFAULT_HXX_ + +#include <indexentrysupplier_common.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +class Index; + +// ---------------------------------------------------- +// class IndexEntrySupplier_Unicode +// ---------------------------------------------------- +class IndexEntrySupplier_Unicode : public IndexEntrySupplier_Common { +public: + IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + ~IndexEntrySupplier_Unicode(); + + virtual sal_Bool SAL_CALL loadAlgorithm( + const com::sun::star::lang::Locale& rLocale, + const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry, + const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1, + const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1, + const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2, + const com::sun::star::lang::Locale& rLocale2 ) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry, + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm ) + throw (com::sun::star::uno::RuntimeException); + +private: + Index *index; +}; + +struct IndexKey { + sal_Unicode key; + rtl::OUString mkey; + rtl::OUString desc; +}; + +class IndexTable +{ +public: + IndexTable(); + ~IndexTable(); + + void init(sal_Unicode start_, sal_Unicode end_, IndexKey* keys, sal_Int16 key_count, Index *index); + + sal_Unicode start; + sal_Unicode end; + sal_uInt8 *table; +}; + +#define MAX_KEYS 0xff +#define MAX_TABLES 20 + +class Index +{ +public: + Index(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF); + ~Index(); + + void init(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm) throw (com::sun::star::uno::RuntimeException); + + void makeIndexKeys(const com::sun::star::lang::Locale &rLocale, const rtl::OUString &algorithm) throw (com::sun::star::uno::RuntimeException); + sal_Int16 getIndexWeight(const rtl::OUString& rIndexEntry); + rtl::OUString getIndexDescription(const rtl::OUString& rIndexEntry); + + IndexTable tables[MAX_TABLES]; + sal_Int16 table_count; + IndexKey keys[MAX_KEYS]; + sal_Int16 key_count; + sal_Int16 mkeys[MAX_KEYS]; + sal_Int16 mkey_count; + rtl::OUString skipping_chars; + CollatorImpl *collator; + sal_Int16 compare(sal_Unicode c1, sal_Unicode c2); +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/indexentrysupplier_ja_phonetic.hxx b/i18npool/inc/indexentrysupplier_ja_phonetic.hxx new file mode 100644 index 000000000000..c9156fdde988 --- /dev/null +++ b/i18npool/inc/indexentrysupplier_ja_phonetic.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _I18N_INDEXENTRYSUPPLIER_JA_PHONETIC_HXX_ +#define _I18N_INDEXENTRYSUPPLIER_JA_PHONETIC_HXX_ + +#include <indexentrysupplier_common.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class IndexEntrySupplier_ja_phonetic +// ---------------------------------------------------- + +class IndexEntrySupplier_ja_phonetic : public IndexEntrySupplier_Common { +public: + IndexEntrySupplier_ja_phonetic( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ) : IndexEntrySupplier_Common(rxMSF) { + implementationName = "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic"; + }; + virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry,\ + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm ) \ + throw (com::sun::star::uno::RuntimeException);\ + virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry, \ + const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )\ + throw (com::sun::star::uno::RuntimeException);\ + virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1,\ + const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,\ + const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,\ + const com::sun::star::lang::Locale& rLocale2 )\ + throw (com::sun::star::uno::RuntimeException);\ +}; + +#define INDEXENTRYSUPPLIER_JA_PHONETIC( algorithm ) \ +class IndexEntrySupplier_##algorithm : public IndexEntrySupplier_ja_phonetic {\ +public:\ + IndexEntrySupplier_##algorithm (const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF) : IndexEntrySupplier_ja_phonetic (rxMSF) {\ + implementationName = "com.sun.star.i18n.IndexEntrySupplier_"#algorithm;\ + };\ + virtual sal_Bool SAL_CALL loadAlgorithm(\ + const com::sun::star::lang::Locale& rLocale,\ + const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions ) \ + throw (com::sun::star::uno::RuntimeException);\ +}; + +INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_first_by_syllable ) +INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_first_by_consonant ) +INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_last_by_syllable ) +INDEXENTRYSUPPLIER_JA_PHONETIC( ja_phonetic_alphanumeric_last_by_consonant ) + +} } } } +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/inputsequencechecker.hxx b/i18npool/inc/inputsequencechecker.hxx new file mode 100644 index 000000000000..c738d78d3411 --- /dev/null +++ b/i18npool/inc/inputsequencechecker.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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 <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp> + +#include <vector> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class InputSequenceCheckerImpl +// ---------------------------------------------------- +class InputSequenceCheckerImpl : public cppu::WeakImplHelper2 +< + com::sun::star::i18n::XExtendedInputSequenceChecker, + 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); + + virtual sal_Int32 SAL_CALL correctInputSequence(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; + const sal_Char *serviceName; + +private : + struct lookupTableItem { + lookupTableItem(const sal_Char* rLanguage, const com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedInputSequenceChecker >& rxISC) : + aLanguage(rLanguage), xISC(rxISC) {} + const sal_Char* aLanguage; + com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedInputSequenceChecker > xISC; + }; + std::vector<lookupTableItem*> lookupTable; + lookupTableItem *cachedItem; + + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + + com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedInputSequenceChecker >& 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_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/inputsequencechecker_hi.hxx b/i18npool/inc/inputsequencechecker_hi.hxx new file mode 100644 index 000000000000..372b0398198d --- /dev/null +++ b/i18npool/inc/inputsequencechecker_hi.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_INPUTSEQUENCECHECKER_HI_HXX_ +#define _I18N_INPUTSEQUENCECHECKER_HI_HXX_ + +#include <inputsequencechecker.hxx> + +namespace com { +namespace sun { +namespace star { +namespace i18n { + +// ---------------------------------------------------- +// class InputSequenceChecker_hi +// ---------------------------------------------------- +class InputSequenceChecker_hi : public InputSequenceCheckerImpl +{ +public: + InputSequenceChecker_hi(); + ~InputSequenceChecker_hi(); + + sal_Bool SAL_CALL checkInputSequence(const rtl::OUString& Text, sal_Int32 nStartPos, + sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException); + + sal_Int32 SAL_CALL correctInputSequence(rtl::OUString& Text, sal_Int32 nStartPos, + sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/inputsequencechecker_th.hxx b/i18npool/inc/inputsequencechecker_th.hxx new file mode 100644 index 000000000000..f2fc2fbcafaf --- /dev/null +++ b/i18npool/inc/inputsequencechecker_th.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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(); + + sal_Bool SAL_CALL checkInputSequence(const rtl::OUString& Text, sal_Int32 nStartPos, + sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException); + + sal_Int32 SAL_CALL correctInputSequence(rtl::OUString& Text, sal_Int32 nStartPos, + sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif // _I18N_BREAKITERATOR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/localedata.hxx b/i18npool/inc/localedata.hxx new file mode 100644 index 000000000000..4cc240d3ebf9 --- /dev/null +++ b/i18npool/inc/localedata.hxx @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_LOCALEDATA_HXX_ +#define _I18N_LOCALEDATA_HXX_ + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <comphelper/processfactory.hxx> + +#include <com/sun/star/i18n/XLocaleData2.hpp> + + +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <cppu/macros.hxx> +#include <com/sun/star/uno/Reference.h> + +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/i18n/Calendar.hpp> +#include <com/sun/star/i18n/FormatElement.hpp> +#include <com/sun/star/i18n/Currency.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/i18n/LocaleDataItem.hpp> +#include <com/sun/star/i18n/UnicodeScript.hpp> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/XInterface.hpp> +#include <rtl/ustring.hxx> +#include <vector> +#include <memory> +#include <osl/module.hxx> + +// +#include <defaultnumberingprovider.hxx> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +// +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +struct LocaleDataLookupTableItem; + +namespace com { namespace sun { namespace star { namespace i18n { + +inline sal_Bool operator ==(const com::sun::star::lang::Locale& l1, const com::sun::star::lang::Locale& l2) { + return l1.Language == l2.Language && l1.Country == l2.Country && l1.Variant == l2.Variant; +}; + +class LocaleData : public cppu::WeakImplHelper2 +< + XLocaleData2, + com::sun::star::lang::XServiceInfo +> +{ +public: + LocaleData(); + ~LocaleData(); + + virtual LanguageCountryInfo SAL_CALL getLanguageCountryInfo( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual LocaleDataItem SAL_CALL getLocaleItem( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< Calendar > SAL_CALL getAllCalendars( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< Currency > SAL_CALL getAllCurrencies( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< Currency2 > SAL_CALL getAllCurrencies2( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< FormatElement > SAL_CALL getAllFormats( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< Implementation > SAL_CALL getCollatorImplementations( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getCollatorRuleByAlgorithm( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getTransliterations( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual ForbiddenCharacters SAL_CALL getForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getReservedWord( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ; + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getBreakIteratorRules( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ; + virtual com::sun::star::uno::Sequence< com::sun::star::lang::Locale > SAL_CALL getAllInstalledLocaleNames() throw(com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSearchOptions( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getCollationOptions( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< beans::PropertyValue > > SAL_CALL getContinuousNumberingLevels( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< com::sun::star::uno::Reference< container::XIndexAccess > > SAL_CALL getOutlineNumberingLevels( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + + // following methods are used by indexentry service + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getIndexAlgorithm( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getDefaultIndexAlgorithm( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getIndexKeysByAlgorithm( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm ) throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getIndexModuleByAlgorithm( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< UnicodeScript > SAL_CALL getUnicodeScripts( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getFollowPageWords( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasPhonetic( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isPhonetic( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm ) throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getHangingCharacters( const com::sun::star::lang::Locale& rLocale ) 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 : + friend sal_Bool operator ==(const com::sun::star::lang::Locale& l1, const com::sun::star::lang::Locale& l2); + + ::std::auto_ptr< LocaleDataLookupTableItem > cachedItem; + + oslGenericFunction SAL_CALL getFunctionSymbol( const com::sun::star::lang::Locale& rLocale, const sal_Char* pFunction ) throw( com::sun::star::uno::RuntimeException ); + oslGenericFunction SAL_CALL getFunctionSymbolByName( const rtl::OUString& localeName, const sal_Char* pFunction ); + sal_Unicode ** SAL_CALL getIndexArray(const com::sun::star::lang::Locale& rLocale, sal_Int16& indexCount); + sal_Unicode ** SAL_CALL getIndexArrayForAlgorithm(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rAlgorithm); + com::sun::star::i18n::Calendar ref_cal; + rtl::OUString ref_name; + com::sun::star::uno::Sequence< com::sun::star::i18n::CalendarItem > & + getCalendarItemByName(const rtl::OUString& name, + const com::sun::star::lang::Locale& rLocale, + const com::sun::star::uno::Sequence< com::sun::star::i18n::Calendar >& calendarsSeq, + sal_Int16 item) throw( com::sun::star::uno::RuntimeException ); +}; + +} } } } + +#endif // _I18N_LOCALEDATA_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/nativenumbersupplier.hxx b/i18npool/inc/nativenumbersupplier.hxx new file mode 100644 index 000000000000..c31c2141aab0 --- /dev/null +++ b/i18npool/inc/nativenumbersupplier.hxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_NATIVENUMBERSUPPLIER_HXX_ +#define _I18N_NATIVENUMBERSUPPLIER_HXX_ + +#include <com/sun/star/i18n/XNativeNumberSupplier.hpp> +#include <com/sun/star/i18n/NativeNumberMode.hpp> +#include <com/sun/star/i18n/NativeNumberXmlAttributes.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class NativeNumberSupplier +// ---------------------------------------------------- +class NativeNumberSupplier : public cppu::WeakImplHelper2 +< + com::sun::star::i18n::XNativeNumberSupplier, + com::sun::star::lang::XServiceInfo +> +{ +public: + NativeNumberSupplier(sal_Bool _useOffset = sal_False) : useOffset(_useOffset) {} + + // Methods + virtual ::rtl::OUString SAL_CALL getNativeNumberString( const ::rtl::OUString& aNumberString, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isValidNatNum( const ::com::sun::star::lang::Locale& aLocale, + sal_Int16 nNativeNumberMode ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::i18n::NativeNumberXmlAttributes SAL_CALL convertToXmlAttributes( + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int16 SAL_CALL convertFromXmlAttributes( + const ::com::sun::star::i18n::NativeNumberXmlAttributes& aAttr ) + 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 ); + + // following methods are not for XNativeNumberSupplier, they are for calling from transliterations + ::rtl::OUString SAL_CALL getNativeNumberString( const ::rtl::OUString& aNumberString, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode, + com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw (::com::sun::star::uno::RuntimeException); + sal_Unicode SAL_CALL getNativeNumberChar( const sal_Unicode inChar, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) + throw(com::sun::star::uno::RuntimeException) ; + +private: + ::com::sun::star::lang::Locale aLocale; + sal_Bool useOffset; +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx new file mode 100644 index 000000000000..9fb98ad54640 --- /dev/null +++ b/i18npool/inc/numberformatcode.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _I18N_NUMBERFORMATCODE_HXX_ +#define _I18N_NUMBERFORMATCODE_HXX_ + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> +#include <cppuhelper/implbase2.hxx> // helper for implementations + +#include <com/sun/star/i18n/XNumberFormatCode.hpp> +#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +class NumberFormatCodeMapper : public cppu::WeakImplHelper2 +< + ::com::sun::star::i18n::XNumberFormatCode, + ::com::sun::star::lang::XServiceInfo +> +{ +public: + NumberFormatCodeMapper( const ::com::sun::star::uno::Reference < + ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + ~NumberFormatCodeMapper(); + + virtual ::com::sun::star::i18n::NumberFormatCode SAL_CALL getDefault( sal_Int16 nFormatType, sal_Int16 nFormatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::i18n::NumberFormatCode SAL_CALL getFormatCode( sal_Int16 nFormatIndex, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL getAllFormatCode( sal_Int16 nFormatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode > SAL_CALL getAllFormatCodes( const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); + + //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: + ::com::sun::star::lang::Locale aLocale; + ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > xMSF; + ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > aFormatSeq; + ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XLocaleData > xlocaleData; + sal_Bool bFormatsValid; + + void setupLocale( const ::com::sun::star::lang::Locale& rLocale ); + void getFormats( const ::com::sun::star::lang::Locale& rLocale ); + ::rtl::OUString mapElementTypeShortToString(sal_Int16 formatType); + sal_Int16 mapElementTypeStringToShort(const ::rtl::OUString& formatType); + ::rtl::OUString mapElementUsageShortToString(sal_Int16 formatUsage); + sal_Int16 mapElementUsageStringToShort(const ::rtl::OUString& formatUsage); + void createLocaleDataObject(); +}; + + +#endif // _I18N_NUMBERFORMATCODE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/numtochar.hxx b/i18npool/inc/numtochar.hxx new file mode 100644 index 000000000000..774612032da7 --- /dev/null +++ b/i18npool/inc/numtochar.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ +#define _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ + +#include <transliteration_Numeric.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +#define TRANSLITERATION_NUMTOCHAR( name ) \ +class NumToChar##name : public transliteration_Numeric \ +{ \ +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(KanjiTraditional_ja_JP) +TRANSLITERATION_NUMTOCHAR(Fullwidth) +TRANSLITERATION_NUMTOCHAR(Indic_ar) +TRANSLITERATION_NUMTOCHAR(EastIndic_ar) +TRANSLITERATION_NUMTOCHAR(Indic_hi) +TRANSLITERATION_NUMTOCHAR(_th) +TRANSLITERATION_NUMTOCHAR(Halfwidth) +#endif +#undef TRANSLITERATION_NUMTOCHAR + +} } } } + +#endif // _L10N_TRANSLITERATION_NUMTOCHAR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/numtotext_cjk.hxx b/i18npool/inc/numtotext_cjk.hxx new file mode 100644 index 000000000000..c79d693c19e6 --- /dev/null +++ b/i18npool/inc/numtotext_cjk.hxx @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _L10N_TRANSLITERATION_NUMTOTEXT_CJK_HXX_ +#define _L10N_TRANSLITERATION_NUMTOTEXT_CJK_HXX_ + +#include <transliteration_Numeric.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +#define TRANSLITERATION_NUMTOTEXT_CJK( name ) \ +class NumToText##name : public transliteration_Numeric \ +{ \ +public: \ + NumToText##name (); \ +}; + +#ifdef TRANSLITERATION_ALL +TRANSLITERATION_NUMTOTEXT_CJK ( Lower_zh_CN ) +TRANSLITERATION_NUMTOTEXT_CJK ( Upper_zh_CN ) +TRANSLITERATION_NUMTOTEXT_CJK ( Lower_zh_TW ) +TRANSLITERATION_NUMTOTEXT_CJK ( Upper_zh_TW ) +TRANSLITERATION_NUMTOTEXT_CJK ( Fullwidth_zh_CN ) +TRANSLITERATION_NUMTOTEXT_CJK ( Fullwidth_zh_TW ) +TRANSLITERATION_NUMTOTEXT_CJK ( Fullwidth_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( Fullwidth_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( Date_zh ) +TRANSLITERATION_NUMTOTEXT_CJK ( InformalLower_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( InformalUpper_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( InformalHangul_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( FormalLower_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( FormalUpper_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( FormalHangul_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( KanjiLongModern_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( KanjiLongTraditional_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( KanjiShortModern_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( KanjiShortTraditional_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( AIUFullWidth_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( AIUHalfWidth_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( IROHAFullWidth_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( IROHAHalfWidth_ja_JP ) +TRANSLITERATION_NUMTOTEXT_CJK ( CircledNumber ) +TRANSLITERATION_NUMTOTEXT_CJK ( TianGan_zh ) +TRANSLITERATION_NUMTOTEXT_CJK ( DiZi_zh ) +TRANSLITERATION_NUMTOTEXT_CJK ( HangulJamo_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( HangulSyllable_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( HangulCircledJamo_ko ) +TRANSLITERATION_NUMTOTEXT_CJK ( HangulCircledSyllable_ko ) +#endif +#undef TRANSLITERATION_NUMTOTEXT + +} } } } + +#endif // _L10N_TRANSLITERATION_NUMTOTEXT_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/ordinalsuffix.hxx b/i18npool/inc/ordinalsuffix.hxx new file mode 100644 index 000000000000..6116047b0efd --- /dev/null +++ b/i18npool/inc/ordinalsuffix.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/i18n/XOrdinalSuffix.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/Locale.hpp> + + +namespace com { namespace sun { namespace star { namespace i18n { + +class OrdinalSuffix : public cppu::WeakImplHelper2 +< + XOrdinalSuffix, + com::sun::star::lang::XServiceInfo +> +{ + public: + OrdinalSuffix(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF); + virtual ~OrdinalSuffix(); + + // XOrdinalSuffix + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getOrdinalSuffix( sal_Int32 nNumber, const com::sun::star::lang::Locale &rLocale ) 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: + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > _xServiceManager; +}; +} } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/pch/precompiled_i18npool.cxx b/i18npool/inc/pch/precompiled_i18npool.cxx new file mode 100644 index 000000000000..f829eac8cab5 --- /dev/null +++ b/i18npool/inc/pch/precompiled_i18npool.cxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_i18npool.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/pch/precompiled_i18npool.hxx b/i18npool/inc/pch/precompiled_i18npool.hxx new file mode 100644 index 000000000000..b2d6ba960e2c --- /dev/null +++ b/i18npool/inc/pch/precompiled_i18npool.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:49.201981 + +#ifdef PRECOMPILED_HEADERS +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/scripttypedetector.hxx b/i18npool/inc/scripttypedetector.hxx new file mode 100644 index 000000000000..301dd6d51a6c --- /dev/null +++ b/i18npool/inc/scripttypedetector.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_SCRIPTTYPEDETECTOR_HXX_ +#define _I18N_SCRIPTTYPEDETECTOR_HXX_ + +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <com/sun/star/i18n/XScriptTypeDetector.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations + +// ---------------------------------------------------- +// class ScriptTypeDetector +// ---------------------------------------------------- +class ScriptTypeDetector : public cppu::WeakImplHelper2 +< + ::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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/servicename.hxx b/i18npool/inc/servicename.hxx new file mode 100644 index 000000000000..7eb7820ac647 --- /dev/null +++ b/i18npool/inc/servicename.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* +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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/textToPronounce_zh.hxx b/i18npool/inc/textToPronounce_zh.hxx new file mode 100644 index 000000000000..9543b267ef6a --- /dev/null +++ b/i18npool/inc/textToPronounce_zh.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_TRANSLITERATION_TEXTTOPRONOUNCE_ZH_HXX_ +#define _I18N_TRANSLITERATION_TEXTTOPRONOUNCE_ZH_HXX_ + +#include <transliteration_Ignore.hxx> +#include <indexentrysupplier_asian.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +class TextToPronounce_zh : public transliteration_Ignore +{ +protected: + oslModule hModule; + sal_uInt16 **idx; + const sal_Unicode* SAL_CALL getPronounce(const sal_Unicode ch); + +public: + TextToPronounce_zh(const sal_Char* func_name); + ~TextToPronounce_zh(); + + 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 + transliterateChar2String( sal_Unicode inChar) + throw(com::sun::star::uno::RuntimeException); + + sal_Unicode SAL_CALL + transliterateChar2Char( sal_Unicode inChar) + throw(com::sun::star::uno::RuntimeException, + com::sun::star::i18n::MultipleCharsOutputException); +}; + +#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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/textconversion.hxx b/i18npool/inc/textconversion.hxx new file mode 100644 index 000000000000..657a31d0a159 --- /dev/null +++ b/i18npool/inc/textconversion.hxx @@ -0,0 +1,214 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_TEXTCONVERSION_KO_HXX_ +#define _I18N_TEXTCONVERSION_KO_HXX_ + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/i18n/XExtendedTextConversion.hpp> +#include <com/sun/star/linguistic2/XConversionDictionary.hpp> +#include <com/sun/star/linguistic2/XConversionDictionaryList.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations +#include <osl/module.h> + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class TextConversion +// ---------------------------------------------------- +class TextConversion: public cppu::WeakImplHelper2 +< + com::sun::star::i18n::XExtendedTextConversion, + com::sun::star::lang::XServiceInfo +> +{ +public: + TextConversion(); + ~TextConversion(); + // Methods + virtual com::sun::star::i18n::TextConversionResult SAL_CALL + getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ) = 0; + virtual rtl::OUString SAL_CALL + getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ) = 0; + virtual rtl::OUString SAL_CALL + getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ) = 0; + virtual sal_Bool SAL_CALL + interactiveConversion(const ::com::sun::star::lang::Locale& aLocale, + sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ) = 0; + + //XServiceInfo + rtl::OUString SAL_CALL + getImplementationName() + throw( com::sun::star::uno::RuntimeException ); + sal_Bool SAL_CALL + supportsService(const rtl::OUString& ServiceName) + throw( com::sun::star::uno::RuntimeException ); + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() + throw( com::sun::star::uno::RuntimeException ); +protected : + const sal_Char* implementationName; + oslModule hModule; + oslGenericFunction SAL_CALL getFunctionBySymbol(const sal_Char* func); +}; + +// for Hangul2Hanja conversion +typedef struct { + sal_Unicode code; + sal_Int16 address; + sal_Int16 count; +} Hangul_Index; + +// ---------------------------------------------------- +// class TextConversion_ko +// ---------------------------------------------------- +class TextConversion_ko : public TextConversion +{ +public: + TextConversion_ko( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + + // Methods + com::sun::star::i18n::TextConversionResult SAL_CALL + getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + rtl::OUString SAL_CALL + getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + rtl::OUString SAL_CALL + getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + sal_Bool SAL_CALL + interactiveConversion(const ::com::sun::star::lang::Locale& aLocale, + sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + +private : + // Hangul/Hanja system dictionary + com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionary > xCD; + // Hangul/Hanja user defined dictionary list + com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL; + sal_Int32 maxLeftLength; + sal_Int32 maxRightLength; + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + getCharConversions(const rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toHanja); +}; + +// ---------------------------------------------------- +// class TextConversion_zh +// ---------------------------------------------------- + +// for SChines/TChinese word conversion +typedef struct { + sal_uInt16 start; + sal_Int16 count; +} STC_WordIndex; + +class TextConversion_zh : public TextConversion +{ +public: + TextConversion_zh( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + + // Methods + com::sun::star::i18n::TextConversionResult SAL_CALL + getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + rtl::OUString SAL_CALL + getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + rtl::OUString SAL_CALL + getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + sal_Bool SAL_CALL + interactiveConversion(const ::com::sun::star::lang::Locale& aLocale, + sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); +private : + // user defined dictionary list + com::sun::star::uno::Reference < com::sun::star::linguistic2::XConversionDictionaryList > xCDL; + rtl::OUString SAL_CALL getWordConversion(const ::rtl::OUString& aText, + sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions, com::sun::star::uno::Sequence <sal_Int32>& offset); + rtl:: OUString SAL_CALL getCharConversion(const rtl:: OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions); + com::sun::star::lang::Locale aLocale; +}; + +} // i18n +} // star +} // sun +} // com + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/textconversionImpl.hxx b/i18npool/inc/textconversionImpl.hxx new file mode 100644 index 000000000000..d798bf2ef14b --- /dev/null +++ b/i18npool/inc/textconversionImpl.hxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_TEXTCONERSION_HXX_ +#define _I18N_TEXTCONERSION_HXX_ + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/i18n/XExtendedTextConversion.hpp> +#include <cppuhelper/implbase2.hxx> // helper for implementations + +namespace com { namespace sun { namespace star { namespace i18n { + +// ---------------------------------------------------- +// class TextConversion +// ---------------------------------------------------- +class TextConversionImpl : public cppu::WeakImplHelper2 +< + com::sun::star::i18n::XExtendedTextConversion, + com::sun::star::lang::XServiceInfo +> +{ +public: + TextConversionImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ) : xMSF(rxMSF) {}; + + // Methods + com::sun::star::i18n::TextConversionResult SAL_CALL + getConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + rtl::OUString SAL_CALL + getConversion( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + rtl::OUString SAL_CALL + getConversionWithOffset( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, + const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nTextConversionType, + sal_Int32 nTextConversionOptions, com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + sal_Bool SAL_CALL + interactiveConversion( const ::com::sun::star::lang::Locale& aLocale, + sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions ) + throw( com::sun::star::uno::RuntimeException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::lang::NoSupportException ); + + //XServiceInfo + rtl::OUString SAL_CALL + getImplementationName() + throw( com::sun::star::uno::RuntimeException ); + sal_Bool SAL_CALL + supportsService(const rtl::OUString& ServiceName) + throw( com::sun::star::uno::RuntimeException ); + com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() + throw( com::sun::star::uno::RuntimeException ); +private : + com::sun::star::lang::Locale aLocale; + com::sun::star::uno::Reference < com::sun::star::i18n::XExtendedTextConversion > xTC; + com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + + void SAL_CALL getLocaleSpecificTextConversion( const com::sun::star::lang::Locale& rLocale ) + throw( com::sun::star::lang::NoSupportException ); +}; + +} // i18n +} // star +} // sun +} // com + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/texttonum.hxx b/i18npool/inc/texttonum.hxx new file mode 100644 index 000000000000..3eb06c7d5eae --- /dev/null +++ b/i18npool/inc/texttonum.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _L10N_TRANSLITERATION_TEXTTONUM_HXX_ +#define _L10N_TRANSLITERATION_TEXTTONUM_HXX_ + +#include <transliteration_Numeric.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +#define TRANSLITERATION_TEXTTONUM( name ) \ +class TextToNum##name : public transliteration_Numeric \ +{ \ +public: \ + TextToNum##name (); \ +}; + +#ifdef TRANSLITERATION_ALL +TRANSLITERATION_TEXTTONUM(Lower_zh_CN) +TRANSLITERATION_TEXTTONUM(Upper_zh_CN) +TRANSLITERATION_TEXTTONUM(Lower_zh_TW) +TRANSLITERATION_TEXTTONUM(Upper_zh_TW) +TRANSLITERATION_TEXTTONUM(InformalLower_ko) +TRANSLITERATION_TEXTTONUM(InformalUpper_ko) +TRANSLITERATION_TEXTTONUM(InformalHangul_ko) +TRANSLITERATION_TEXTTONUM(FormalLower_ko) +TRANSLITERATION_TEXTTONUM(FormalUpper_ko) +TRANSLITERATION_TEXTTONUM(FormalHangul_ko) +TRANSLITERATION_TEXTTONUM(KanjiLongModern_ja_JP) +TRANSLITERATION_TEXTTONUM(KanjiLongTraditional_ja_JP) +#endif +#undef TRANSLITERATION_TEXTTONUM + +} } } } + +#endif // _L10N_TRANSLITERATION_TEXTTONUM_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/transliterationImpl.hxx b/i18npool/inc/transliterationImpl.hxx new file mode 100644 index 000000000000..94fba9679009 --- /dev/null +++ b/i18npool/inc/transliterationImpl.hxx @@ -0,0 +1,158 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_TRANSLITERATIONIMPL_HXX_ +#define _I18N_TRANSLITERATIONIMPL_HXX_ + +#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XExtendedTransliteration.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 { + +#if OSL_DEBUG_LEVEL > 1 +#define RETURN_DEBUG_STRING (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("return from transliterationImpl"))); +#define RETURN_DEBUG_NUMBER 'TRAN' +#else +#define RETURN_DEBUG_STRING +#define RETURN_DEBUG_NUMBER +#endif + +class TransliterationImpl : public cppu::WeakImplHelper2 +< + com::sun::star::i18n::XExtendedTransliteration, + 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); + + // Methods in XExtendedTransliteration + virtual rtl::OUString SAL_CALL transliterateString2String( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) + throw(com::sun::star::uno::RuntimeException) ; + virtual rtl::OUString SAL_CALL transliterateChar2String( sal_Unicode inChar ) + throw(com::sun::star::uno::RuntimeException) ; + virtual sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar ) + throw(com::sun::star::i18n::MultipleCharsOutputException, + 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< com::sun::star::i18n::XExtendedTransliteration > 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< com::sun::star::i18n::XExtendedTransliteration > caseignore; + + /** structure to cache the last transliteration body used. */ + struct TransBody + { + ::osl::Mutex mutex; + ::rtl::OUString Name; + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XExtendedTransliteration > Body; + }; + static TransBody lastTransBody; + + virtual sal_Bool SAL_CALL loadModuleByName( const rtl::OUString& implName, + com::sun::star::uno::Reference<com::sun::star::i18n::XExtendedTransliteration> & body, const com::sun::star::lang::Locale& rLocale) + throw(com::sun::star::uno::RuntimeException); + + void clear(); + + void loadBody( ::rtl::OUString &implName, + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XExtendedTransliteration >& body ) + throw (::com::sun::star::uno::RuntimeException); + + 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx new file mode 100644 index 000000000000..3f16695bfaf9 --- /dev/null +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -0,0 +1,191 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_ +#define _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_ + +#include <transliteration_commonclass.hxx> +#include <i18nutil/oneToOneMapping.hxx> + +typedef sal_Unicode (*TransFunc)(const sal_Unicode); + +typedef struct { + sal_Unicode previousChar; + sal_Unicode currentChar; + sal_Unicode replaceChar; + sal_Bool two2one; +} Mapping; + +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); + + // 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); + + virtual sal_Unicode SAL_CALL + transliterateChar2Char( sal_Unicode inChar) + throw(com::sun::star::uno::RuntimeException, + com::sun::star::i18n::MultipleCharsOutputException); + + 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); + +protected: + TransFunc func; + oneToOneMapping *table; + Mapping *map; +}; + +#define TRANSLITERATION_IGNORE( name ) \ +class ignore##name : public transliteration_Ignore {\ +public:\ + ignore##name ();\ +}; + +#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_SeZe_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(SeZe_ja_JP) +#endif +#if defined( TRANSLITERATION_TiJi_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(TiJi_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_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_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 () {\ + func = (TransFunc) 0;\ + table = 0;\ + map = 0;\ + 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_KiKuFollowedBySa_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(KiKuFollowedBySa_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_ProlongedSoundMark_ja_JP ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP) +#endif +#undef TRANSLITERATION_IGNORE + +#define TRANSLITERATION_IGNORE( name ) \ +class ignore##name : public transliteration_Ignore {\ +public:\ + ignore##name () {\ + func = (TransFunc) 0;\ + table = 0;\ + map = 0;\ + 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); \ + using transliteration_Ignore::transliterateRange;\ + 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_Unicode SAL_CALL \ + transliterateChar2Char( sal_Unicode inChar) \ + throw(com::sun::star::uno::RuntimeException,\ + com::sun::star::i18n::MultipleCharsOutputException);\ +}; + +#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_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/transliteration_Numeric.hxx b/i18npool/inc/transliteration_Numeric.hxx new file mode 100644 index 000000000000..bd5b76cac499 --- /dev/null +++ b/i18npool/inc/transliteration_Numeric.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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); + + virtual sal_Unicode SAL_CALL + transliterateChar2Char( sal_Unicode inChar) + throw(com::sun::star::i18n::MultipleCharsOutputException, + com::sun::star::uno::RuntimeException); + + // 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); +protected: + sal_Int16 nNativeNumberMode; + sal_Int16 tableSize; + sal_Unicode* table; + sal_Bool recycleSymbol; +private: + rtl::OUString SAL_CALL + transliterateBullet( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif // _I18N_TRANSLITERATION_TRANSLITERATION_NUMERIC_H_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/transliteration_OneToOne.hxx b/i18npool/inc/transliteration_OneToOne.hxx new file mode 100644 index 000000000000..18596822e393 --- /dev/null +++ b/i18npool/inc/transliteration_OneToOne.hxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_ +#define _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_ + +#include <transliteration_commonclass.hxx> +#include <i18nutil/oneToOneMapping.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +typedef sal_Unicode (*TransFunc)(const sal_Unicode); + +class transliteration_OneToOne : public transliteration_commonclass +{ +public: + 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); + + sal_Unicode SAL_CALL + transliterateChar2Char( sal_Unicode inChar) + throw(com::sun::star::uno::RuntimeException, + com::sun::star::i18n::MultipleCharsOutputException); + + // 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); + +protected: + TransFunc func; + oneToOneMapping *table; +}; + +#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); \ + sal_Unicode SAL_CALL \ + transliterateChar2Char( sal_Unicode inChar) \ + throw(com::sun::star::uno::RuntimeException, \ + com::sun::star::i18n::MultipleCharsOutputException); \ +}; + +#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_fullwidthKatakanaToHalfwidthKatakana ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana ) +#endif +#if defined( TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana) +#endif +#if defined( TRANSLITERATION_fullwidthToHalfwidthLikeASC ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC ) +#endif +#if defined( TRANSLITERATION_halfwidthToFullwidthLikeJIS ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS ) +#endif +#undef TRANSLITERATION_ONETOONE + +#define TRANSLITERATION_ONETOONE( name ) \ +class name : public transliteration_OneToOne \ +{ \ +public: \ + name (); \ +}; + +#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_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx new file mode 100644 index 000000000000..c2985b58847c --- /dev/null +++ b/i18npool/inc/transliteration_body.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef TRANSLITERATION_BODY_H +#define TRANSLITERATION_BODY_H + +#include <transliteration_commonclass.hxx> +#include <i18nutil/casefolding.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +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 + transliterateChar2String( sal_Unicode inChar) + throw(com::sun::star::uno::RuntimeException); + + virtual sal_Unicode SAL_CALL + transliterateChar2Char( sal_Unicode inChar) + throw(com::sun::star::uno::RuntimeException, + com::sun::star::i18n::MultipleCharsOutputException); + + 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 nMappingType; +}; + +#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 + + +#if defined( TRANSLITERATION_ALL ) +class Transliteration_togglecase : public Transliteration_body +{ +public: + Transliteration_togglecase(); +}; + +class Transliteration_titlecase : public Transliteration_body +{ +public: + Transliteration_titlecase(); + + 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); +}; + +class Transliteration_sentencecase : public Transliteration_body +{ +public: + Transliteration_sentencecase(); + + 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); +}; +#endif + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/transliteration_caseignore.hxx b/i18npool/inc/transliteration_caseignore.hxx new file mode 100644 index 000000000000..09464e63e38c --- /dev/null +++ b/i18npool/inc/transliteration_caseignore.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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); + +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); +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/transliteration_commonclass.hxx b/i18npool/inc/transliteration_commonclass.hxx new file mode 100644 index 000000000000..af5d189e6038 --- /dev/null +++ b/i18npool/inc/transliteration_commonclass.hxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ +#define _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ + +#include <com/sun/star/i18n/XExtendedTransliteration.hpp> +#include <com/sun/star/i18n/TransliterationType.hpp> +#include <cppuhelper/implbase1.hxx> +#include <rtl/ustrbuf.h> +#include <rtl/ustring.hxx> +#include <i18nutil/x_rtl_ustring.h> + +namespace com { namespace sun { namespace star { namespace i18n { + +class transliteration_commonclass : public cppu::WeakImplHelper1< com::sun::star::i18n::XExtendedTransliteration > +{ +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; + + // Methods in XExtendedTransliteration + virtual rtl::OUString SAL_CALL + transliterateString2String( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) + throw(com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL + transliterateChar2String( sal_Unicode inChar) + throw(com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL + transliterateChar2Char( sal_Unicode inChar ) + throw(com::sun::star::i18n::MultipleCharsOutputException, + 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; + const sal_Char* transliterationName; + const sal_Char* implementationName; + sal_Bool useOffset; +}; + +} } } } + +#endif // _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/warnings_guard_unicode_brkiter.h b/i18npool/inc/warnings_guard_unicode_brkiter.h new file mode 100644 index 000000000000..76c407ede0c5 --- /dev/null +++ b/i18npool/inc/warnings_guard_unicode_brkiter.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_WARNINGS_GUARD_UNICODE_BRKITER_H +#define INCLUDED_WARNINGS_GUARD_UNICODE_BRKITER_H + +// Because the GCC system_header mechanism doesn't work in .c/.cxx compilation +// units and more important affects the rest of the current include file, the +// warnings guard is separated into this header file on its own. + +// External unicode includes (from icu) cause warning C4668 on Windows. +// We want to minimize the patches to external headers, so the warnings are +// disabled here instead of in the header file itself. +#ifdef _MSC_VER +#pragma warning(push, 1) +#elif defined __GNUC__ +#pragma GCC system_header +#endif +#include <unicode/brkiter.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif // INCLUDED_WARNINGS_GUARD_UNICODE_BRKITER_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/warnings_guard_unicode_calendar.h b/i18npool/inc/warnings_guard_unicode_calendar.h new file mode 100644 index 000000000000..d453731ba70a --- /dev/null +++ b/i18npool/inc/warnings_guard_unicode_calendar.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_WARNINGS_GUARD_UNICODE_CALENDAR_H +#define INCLUDED_WARNINGS_GUARD_UNICODE_CALENDAR_H + +// Because the GCC system_header mechanism doesn't work in .c/.cxx compilation +// units and more important affects the rest of the current include file, the +// warnings guard is separated into this header file on its own. + +// External unicode includes (from icu) cause warning C4668 on Windows. +// We want to minimize the patches to external headers, so the warnings are +// disabled here instead of in the header file itself. +#ifdef _MSC_VER +#pragma warning(push, 1) +#elif defined __GNUC__ +#pragma GCC system_header +#endif +#include <unicode/calendar.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif // INCLUDED_WARNINGS_GUARD_UNICODE_CALENDAR_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/warnings_guard_unicode_tblcoll.h b/i18npool/inc/warnings_guard_unicode_tblcoll.h new file mode 100644 index 000000000000..5e796e374fc5 --- /dev/null +++ b/i18npool/inc/warnings_guard_unicode_tblcoll.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_WARNINGS_GUARD_UNICODE_TBLCOLL_H +#define INCLUDED_WARNINGS_GUARD_UNICODE_TBLCOLL_H + +// Because the GCC system_header mechanism doesn't work in .c/.cxx compilation +// units and more important affects the rest of the current include file, the +// warnings guard is separated into this header file on its own. + +// External unicode includes (from icu) cause warning C4668 on Windows. +// We want to minimize the patches to external headers, so the warnings are +// disabled here instead of in the header file itself. +#ifdef _MSC_VER +#pragma warning(push, 1) +#elif defined __GNUC__ +#pragma GCC system_header +#endif +#include <unicode/tblcoll.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif // INCLUDED_WARNINGS_GUARD_UNICODE_TBLCOLL_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/wtt.h b/i18npool/inc/wtt.h new file mode 100644 index 000000000000..789dd29d28d1 --- /dev/null +++ b/i18npool/inc/wtt.h @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx new file mode 100644 index 000000000000..8ac931449636 --- /dev/null +++ b/i18npool/inc/xdictionary.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#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. +struct WordBreakCache { + 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(); + sal_Bool equals(const sal_Unicode *str, Boundary& boundary); // checking cached string +}; + +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 japaneseWordBreak; + +public: + xdictionary(const sal_Char *lang); + ~xdictionary(); + Boundary nextWord( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType); + Boundary previousWord( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType); + Boundary getWordBoundary( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType, sal_Bool bDirection ); + void setJapaneseWordBreak(); + +private: + WordBreakCache cache[CACHE_MAX]; + + sal_Bool seekSegment(const rtl::OUString& rText, sal_Int32 pos, Boundary& boundary); + WordBreakCache& getCache(const sal_Unicode *text, Boundary& boundary); + sal_Bool exists(const sal_uInt32 u); + sal_Int32 getLongestMatch(const sal_Unicode *text, sal_Int32 len); +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |