1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef INCLUDED_I18NUTIL_CASEFOLDING_HXX 28 #define INCLUDED_I18NUTIL_CASEFOLDING_HXX 29 30 #include <sal/types.h> 31 #include <com/sun/star/i18n/TransliterationModules.hpp> 32 #include <com/sun/star/lang/Locale.hpp> 33 #include <com/sun/star/uno/RuntimeException.hpp> 34 35 namespace com { namespace sun { namespace star { namespace i18n { 36 37 #define MappingTypeLowerToUpper (1 << 0) // Upper to Lower mapping 38 #define MappingTypeUpperToLower (1 << 1) // Lower to Upper mapping 39 #define MappingTypeToUpper (1 << 2) // to Upper mapping 40 #define MappingTypeToLower (1 << 3) // to Lower mapping 41 #define MappingTypeToTitle (1 << 4) // to Title mapping 42 #define MappingTypeSimpleFolding (1 << 5) // Simple Case Folding 43 #define MappingTypeFullFolding (1 << 6) // Full Case Folding 44 #define MappingTypeMask (MappingTypeLowerToUpper|MappingTypeUpperToLower|\ 45 MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\ 46 MappingTypeSimpleFolding|MappingTypeFullFolding) 47 48 #define ValueTypeNotValue (1 << 7) // Value field is an address 49 50 #define CasedLetter (MappingTypeMask) // for final sigmar 51 52 struct Value 53 { 54 sal_uInt8 type; 55 sal_uInt16 value; // value or address, depend on the type 56 }; 57 58 struct Mapping 59 { 60 sal_uInt8 type; 61 sal_Int8 nmap; 62 #define NMAPPINGMAX 3 63 sal_Unicode map[NMAPPINGMAX]; 64 }; // for Unconditional mapping 65 66 struct MappingElement 67 { 68 MappingElement() {element.nmap = current = 0;} 69 Mapping element; 70 sal_Int8 current; 71 }; 72 73 class casefolding 74 { 75 public: 76 static Mapping& getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, com::sun::star::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (com::sun::star::uno::RuntimeException); 77 static Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, com::sun::star::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (com::sun::star::uno::RuntimeException); 78 static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, com::sun::star::lang::Locale& aLocale,sal_uInt8 nMappingtype, TransliterationModules moduleLoaded) throw (com::sun::star::uno::RuntimeException); 79 80 }; 81 82 } } } } 83 84 #endif 85