From b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Thu, 18 Apr 2013 18:26:28 +0200 Subject: execute move of global headers see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a --- include/i18nutil/casefolding.hxx | 79 +++++++++++++++++ include/i18nutil/i18nutildllapi.h | 34 ++++++++ include/i18nutil/oneToOneMapping.hxx | 85 ++++++++++++++++++ include/i18nutil/paper.hxx | 148 ++++++++++++++++++++++++++++++++ include/i18nutil/scripttypedetector.hxx | 38 ++++++++ include/i18nutil/unicode.hxx | 63 ++++++++++++++ include/i18nutil/widthfolding.hxx | 54 ++++++++++++ 7 files changed, 501 insertions(+) create mode 100644 include/i18nutil/casefolding.hxx create mode 100644 include/i18nutil/i18nutildllapi.h create mode 100644 include/i18nutil/oneToOneMapping.hxx create mode 100644 include/i18nutil/paper.hxx create mode 100644 include/i18nutil/scripttypedetector.hxx create mode 100644 include/i18nutil/unicode.hxx create mode 100644 include/i18nutil/widthfolding.hxx (limited to 'include/i18nutil') diff --git a/include/i18nutil/casefolding.hxx b/include/i18nutil/casefolding.hxx new file mode 100644 index 000000000000..a0867d1e687c --- /dev/null +++ b/include/i18nutil/casefolding.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_I18NUTIL_CASEFOLDING_HXX +#define INCLUDED_I18NUTIL_CASEFOLDING_HXX + +#include +#include +#include +#include +#include "i18nutildllapi.h" + +namespace com { namespace sun { namespace star { namespace i18n { + +#define MappingTypeLowerToUpper (1 << 0) // Upper to Lower mapping +#define MappingTypeUpperToLower (1 << 1) // Lower to Upper mapping +#define MappingTypeToUpper (1 << 2) // to Upper mapping +#define MappingTypeToLower (1 << 3) // to Lower mapping +#define MappingTypeToTitle (1 << 4) // to Title mapping +#define MappingTypeSimpleFolding (1 << 5) // Simple Case Folding +#define MappingTypeFullFolding (1 << 6) // Full Case Folding +#define MappingTypeMask (MappingTypeLowerToUpper|MappingTypeUpperToLower|\ + MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\ + MappingTypeSimpleFolding|MappingTypeFullFolding) + +#define ValueTypeNotValue (1 << 7) // Value field is an address + +#define CasedLetter (MappingTypeMask) // for final sigmar + +struct Value +{ + sal_uInt8 type; + sal_uInt16 value; // value or address, depend on the type +}; + +struct Mapping +{ + sal_uInt8 type; + sal_Int8 nmap; +#define NMAPPINGMAX 3 + sal_Unicode map[NMAPPINGMAX]; +}; // for Unconditional mapping + +struct MappingElement +{ + MappingElement() {element.nmap = current = 0;} + Mapping element; + sal_Int8 current; +}; + +class I18NUTIL_DLLPUBLIC casefolding +{ +public: + 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); + 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); + 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); + +}; + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/i18nutil/i18nutildllapi.h b/include/i18nutil/i18nutildllapi.h new file mode 100644 index 000000000000..b208b51e9ee0 --- /dev/null +++ b/include/i18nutil/i18nutildllapi.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_I18NUTILDLLAPI_H +#define INCLUDED_I18NUTILDLLAPI_H + +#include "sal/types.h" + +#if defined(I18NUTIL_DLLIMPLEMENTATION) +#define I18NUTIL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define I18NUTIL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define I18NUTIL_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_I18NUTILDLLAPI_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/i18nutil/oneToOneMapping.hxx b/include/i18nutil/oneToOneMapping.hxx new file mode 100644 index 000000000000..533e4ad52c59 --- /dev/null +++ b/include/i18nutil/oneToOneMapping.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_I18NUTIL_TRANSLITERATION_ONETOONEMAPPING_HXX +#define INCLUDED_I18NUTIL_TRANSLITERATION_ONETOONEMAPPING_HXX + +#include +#include +#include "i18nutildllapi.h" + +namespace com { namespace sun { namespace star { namespace i18n { + +class widthfolding; + +struct OneToOneMappingTable_t +{ + sal_Unicode first; + sal_Unicode second; +}; + +typedef sal_Int8 UnicodePairFlag; +struct UnicodePairWithFlag +{ + sal_Unicode first; + sal_Unicode second; + UnicodePairFlag flag; +}; + +class I18NUTIL_DLLPUBLIC oneToOneMapping : private boost::noncopyable +{ +public: + oneToOneMapping( OneToOneMappingTable_t *rpTable, const size_t rnSize, const size_t rnUnitSize = sizeof(OneToOneMappingTable_t) ); + virtual ~oneToOneMapping(); + + // binary search + virtual sal_Unicode find( const sal_Unicode nKey ) const; + + // translator + sal_Unicode operator[] ( const sal_Unicode nKey ) const { return find( nKey ); }; + +protected: + OneToOneMappingTable_t *mpTable; + size_t mnSize; +}; + +class I18NUTIL_DLLPUBLIC oneToOneMappingWithFlag : public oneToOneMapping +{ + friend class widthfolding; + +public: + oneToOneMappingWithFlag( UnicodePairWithFlag *rpTableWF, const size_t rnSize, const UnicodePairFlag rnFlag ); + virtual ~oneToOneMappingWithFlag(); + + // make index for fast search + void makeIndex(); + + // index search + virtual sal_Unicode find( const sal_Unicode nKey ) const; +protected: + UnicodePairWithFlag *mpTableWF; + UnicodePairFlag mnFlag; + UnicodePairWithFlag **mpIndex[256]; + bool mbHasIndex; +}; + +} } } } + +#endif // _I18N_TRANSLITERATION_ONETOONEMAPPING_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/i18nutil/paper.hxx b/include/i18nutil/paper.hxx new file mode 100644 index 000000000000..8847b294fbdb --- /dev/null +++ b/include/i18nutil/paper.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_I18NUTIL_PAPER_HXX +#define INCLUDED_I18NUTIL_PAPER_HXX + +#include "i18nutildllapi.h" +#include +#include + +//!! 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_4_3, + 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, + PAPER_SCREEN_16_9, + PAPER_SCREEN_16_10 +}; + +// defined for 'equal size' test with the implementation array +#define NUM_PAPER_ENTRIES (PAPER_SCREEN_16_10 - PAPER_A0 + 1) + +// --------- +// - Paper - +// --------- + +class I18NUTIL_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 OString &rName); + static OString toPSName(Paper eType); + + static long sloppyFitPageDimension(long nDimension); +}; + +#endif // INCLUDED_I18NUTIL_PAPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/i18nutil/scripttypedetector.hxx b/include/i18nutil/scripttypedetector.hxx new file mode 100644 index 000000000000..cf3b9b71e11b --- /dev/null +++ b/include/i18nutil/scripttypedetector.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _I18N_SCRIPTTYPEDETECTOR_HXX_ +#define _I18N_SCRIPTTYPEDETECTOR_HXX_ + +#include "i18nutildllapi.h" +#include + +class I18NUTIL_DLLPUBLIC ScriptTypeDetector +{ +public: + static sal_Int32 beginOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ); + static sal_Int32 endOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ); + static sal_Int16 getScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ); + static sal_Int32 beginOfCTLScriptType( const OUString& Text, sal_Int32 nPos ); + static sal_Int32 endOfCTLScriptType( const OUString& Text, sal_Int32 nPos ); + static sal_Int16 getCTLScriptType( const OUString& Text, sal_Int32 nPos ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/i18nutil/unicode.hxx b/include/i18nutil/unicode.hxx new file mode 100644 index 000000000000..7da0f5329803 --- /dev/null +++ b/include/i18nutil/unicode.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_I18NUTIL_UNICODE_HXX +#define INCLUDED_I18NUTIL_UNICODE_HXX + +#include +#include +#include +#include "i18nutildllapi.h" + +typedef struct _ScriptTypeList { + sal_Int16 from; + sal_Int16 to; + sal_Int16 value; +} ScriptTypeList; + +class I18NUTIL_DLLPUBLIC unicode +{ +public: + + static sal_Int16 SAL_CALL getUnicodeType( const sal_Unicode ch ); + static sal_Int16 SAL_CALL getUnicodeScriptType( const sal_Unicode ch, ScriptTypeList *typeList = NULL, sal_Int16 unknownType = 0 ); + static sal_Unicode SAL_CALL getUnicodeScriptStart(com::sun::star::i18n::UnicodeScript type); + static sal_Unicode SAL_CALL getUnicodeScriptEnd(com::sun::star::i18n::UnicodeScript type); + static sal_uInt8 SAL_CALL getUnicodeDirection( const sal_Unicode ch ); + static sal_Bool SAL_CALL isUpper( const sal_Unicode ch); + static sal_Bool SAL_CALL isLower( const sal_Unicode ch); + static sal_Bool SAL_CALL isDigit( const sal_Unicode ch); + static sal_Bool SAL_CALL isControl( const sal_Unicode ch); + static sal_Bool SAL_CALL isPrint( const sal_Unicode ch); + static sal_Bool SAL_CALL isAlpha( const sal_Unicode ch); + static sal_Bool SAL_CALL isSpace( const sal_Unicode ch); + static sal_Bool SAL_CALL isWhiteSpace( const sal_Unicode ch); + static sal_Bool SAL_CALL isAlphaDigit( const sal_Unicode ch); + + //Map an ISO 15924 script code to Latin/Asian/Complex/Weak + static sal_Int16 SAL_CALL getScriptClassFromUScriptCode(UScriptCode eScript); + + //Return a language that can be written in a given ISO 15924 script code + static OString SAL_CALL getExemplerLanguageForUScriptCode(UScriptCode eScript); +}; + +#endif + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/i18nutil/widthfolding.hxx b/include/i18nutil/widthfolding.hxx new file mode 100644 index 000000000000..481239deca88 --- /dev/null +++ b/include/i18nutil/widthfolding.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_I18NUTIL_WIDTHFOLDING_HXX +#define INCLUDED_I18NUTIL_WIDTHFOLDING_HXX + +#include +#include +#include +#include "i18nutildllapi.h" + +namespace com { namespace sun { namespace star { namespace i18n { + +#define WIDTHFOLDNIG_DONT_USE_COMBINED_VU 0x01 + +class I18NUTIL_DLLPUBLIC widthfolding +{ +public: + static oneToOneMapping& getfull2halfTable(); + static oneToOneMapping& gethalf2fullTable(); + + static oneToOneMapping& getfull2halfTableForASC(); + static oneToOneMapping& gethalf2fullTableForJIS(); + + static oneToOneMapping& getfullKana2halfKanaTable(); + static oneToOneMapping& gethalfKana2fullKanaTable(); + + static OUString decompose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, sal_Bool useOffset); + static sal_Unicode decompose_ja_voiced_sound_marksChar2Char (sal_Unicode inChar); + static OUString compose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, sal_Bool useOffset, sal_Int32 nFlags = 0 ); + static sal_Unicode getCompositionChar(sal_Unicode c1, sal_Unicode c2); +}; + + +} } } } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit