diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-23 16:15:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-01 07:28:03 +0000 |
commit | 4c09fc48e9fa9114f32f2973090cbe75177cdd37 (patch) | |
tree | 09d4ee3c2d75d038f45ba13a086a344d35aeadb6 /include | |
parent | d97380c66904328e9d706a0b03a6800dc048aa7d (diff) |
typesafe wrappers for css::i18nutil::TransliterationModules
and related css::util::SearchOptions2
The TransliterationModules enum has it's constants spread over multiple
UNO enum/constant-collections - TransliterationModules and
TransliterationModulesExtra, which means that most code simply uses
sal_Int32.
Wrap them up into a better bundle so that only the lowest layer needs to
deal directly with the UNO constants.
Change-Id: I1edeab79fcc7817a4a97c933ef84ab7015bb849b
Reviewed-on: https://gerrit.libreoffice.org/34582
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/editeng.hxx | 6 | ||||
-rw-r--r-- | include/editeng/editview.hxx | 3 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 16 | ||||
-rw-r--r-- | include/i18nutil/casefolding.hxx | 5 | ||||
-rw-r--r-- | include/i18nutil/searchopt.hxx | 142 | ||||
-rw-r--r-- | include/i18nutil/transliteration.hxx | 132 | ||||
-rw-r--r-- | include/svl/ondemand.hxx | 8 | ||||
-rw-r--r-- | include/svl/srchitem.hxx | 25 | ||||
-rw-r--r-- | include/svx/fmsrccfg.hxx | 9 | ||||
-rw-r--r-- | include/svx/fmsrcimp.hxx | 9 | ||||
-rw-r--r-- | include/svx/srchdlg.hxx | 9 | ||||
-rw-r--r-- | include/svx/svxdlg.hxx | 17 | ||||
-rw-r--r-- | include/unotools/caserotate.hxx | 5 | ||||
-rw-r--r-- | include/unotools/searchopt.hxx | 3 | ||||
-rw-r--r-- | include/unotools/textsearch.hxx | 18 | ||||
-rw-r--r-- | include/unotools/transliterationwrapper.hxx | 7 | ||||
-rw-r--r-- | include/vcl/textview.hxx | 7 | ||||
-rw-r--r-- | include/vcl/xtextedt.hxx | 2 |
18 files changed, 358 insertions, 65 deletions
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 921b60f2c954..b9ce5226543b 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -110,7 +110,7 @@ struct EPaM; class DeletedNodeInfo; class ParaPortionList; enum class CharCompressType; - +enum class TransliterationFlags; /** values for: SfxItemSet GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs::All ); @@ -253,8 +253,8 @@ public: LanguageType GetLanguage(const EditPaM& rPaM) const; LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const; - void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode ); - EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode ); + void TransliterateText( const ESelection& rSelection, TransliterationFlags nTransliterationMode ); + EditSelection TransliterateText( const EditSelection& rSelection, TransliterationFlags nTransliterationMode ); void SetAsianCompressionMode( CharCompressType nCompression ); diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index adabc65dbf1b..15e53a141eb6 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -58,6 +58,7 @@ class SfxStyleSheet; namespace vcl { class Font; } class FontList; class OutputDevice; +enum class TransliterationFlags; namespace com { namespace sun { @@ -224,7 +225,7 @@ public: // for text conversion void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc ); - void TransliterateText( sal_Int32 nTransliterationMode ); + void TransliterateText( TransliterationFlags nTransliterationMode ); bool IsCursorAtWrongSpelledWord(); bool IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWrong = false ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 2c1f7810e85e..034de4776bfc 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -47,7 +47,6 @@ #include <editeng/paragraphdata.hxx> #include <o3tl/typed_flags_set.hxx> - #include <functional> #include <vector> @@ -84,26 +83,25 @@ class OverflowingText; class NonOverflowingText; class OutlinerViewShell; enum class CharCompressType; +enum class TransliterationFlags; +class SvxFieldData; namespace svl { class IUndoManager; } - -class SvxFieldData; - - namespace com { namespace sun { namespace star { namespace linguistic2 { class XSpellChecker1; class XHyphenator; }}}} namespace svx{ -struct SpellPortion; -typedef std::vector<SpellPortion> SpellPortions; + struct SpellPortion; + typedef std::vector<SpellPortion> SpellPortions; } - namespace basegfx { class B2DPolyPolygon; } + + // internal use only! enum class ParaFlag { @@ -300,7 +298,7 @@ public: // for text conversion void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc ); - void TransliterateText( sal_Int32 nTransliterationMode ); + void TransliterateText( TransliterationFlags nTransliterationMode ); ESelection GetSelection(); diff --git a/include/i18nutil/casefolding.hxx b/include/i18nutil/casefolding.hxx index 31a6d4ffe586..493875a340a4 100644 --- a/include/i18nutil/casefolding.hxx +++ b/include/i18nutil/casefolding.hxx @@ -20,12 +20,13 @@ #define INCLUDED_I18NUTIL_CASEFOLDING_HXX #include <sal/types.h> -#include <com/sun/star/i18n/TransliterationModules.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/uno/RuntimeException.hpp> #include <i18nutil/i18nutildllapi.h> #include <o3tl/typed_flags_set.hxx> +enum class TransliterationFlags; + enum class MappingType { NONE = 0x00, LowerToUpper = 0x01, // Upper to Lower mapping @@ -77,7 +78,7 @@ public: /// @throws css::uno::RuntimeException static Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, css::lang::Locale& aLocale, MappingType nMappingType); /// @throws css::uno::RuntimeException - static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, css::lang::Locale& aLocale, MappingType nMappingtype, TransliterationModules moduleLoaded); + static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, css::lang::Locale& aLocale, MappingType nMappingtype, TransliterationFlags moduleLoaded); }; diff --git a/include/i18nutil/searchopt.hxx b/include/i18nutil/searchopt.hxx new file mode 100644 index 000000000000..5fc8b1a9afdf --- /dev/null +++ b/include/i18nutil/searchopt.hxx @@ -0,0 +1,142 @@ +/* -*- 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_SEARCHOPT_HXX +#define INCLUDED_I18NUTIL_SEARCHOPT_HXX + +#include <sal/types.h> +#include "com/sun/star/lang/Locale.hpp" +#include "com/sun/star/util/SearchAlgorithms.hpp" +#include "com/sun/star/util/SearchOptions2.hpp" +#include <i18nutil/i18nutildllapi.h> +#include <i18nutil/transliteration.hxx> + +namespace i18nutil +{ + +/** + * This is a wrapper around com::sun::star::util::SearchOptions + * but using the more type-safe TransliterationFlags enum. + */ +struct I18NUTIL_DLLPUBLIC SAL_WARN_UNUSED SearchOptions { + css::util::SearchAlgorithms algorithmType; + sal_Int32 searchFlag; + OUString searchString; + OUString replaceString; + css::lang::Locale Locale; + sal_Int32 changedChars; + sal_Int32 deletedChars; + sal_Int32 insertedChars; + TransliterationFlags transliterateFlags; + + SearchOptions& operator=(css::util::SearchOptions const & other) + { + algorithmType = other.algorithmType; + searchFlag = other.searchFlag; + searchString = other.searchString; + replaceString = other.replaceString; + Locale = other.Locale; + changedChars = other.changedChars; + deletedChars = other.deletedChars; + insertedChars = other.insertedChars; + transliterateFlags = (TransliterationFlags)other.transliterateFlags; + return *this; + } + + SearchOptions() + : algorithmType(::css::util::SearchAlgorithms_ABSOLUTE) + , searchFlag(0) + , searchString() + , replaceString() + , Locale() + , changedChars(0) + , deletedChars(0) + , insertedChars(0) + , transliterateFlags(TransliterationFlags::NONE) + { + } + + SearchOptions(const css::util::SearchAlgorithms& algorithmType_, const sal_Int32 searchFlag_, + const OUString& searchString_, const OUString& replaceString_, + const css::lang::Locale& Locale_, + const sal_Int32 changedChars_, const sal_Int32 deletedChars_, const sal_Int32 insertedChars_, + const TransliterationFlags& transliterateFlags_) + : algorithmType(algorithmType_) + , searchFlag(searchFlag_) + , searchString(searchString_) + , replaceString(replaceString_) + , Locale(Locale_) + , changedChars(changedChars_) + , deletedChars(deletedChars_) + , insertedChars(insertedChars_) + , transliterateFlags(transliterateFlags_) + { + } +}; + +/** + * This is a wrapper around com::sun::star::util::SearchOptions and SearchOptions2, + * but using the more type-safe TransliterationFlags enum. + */ +struct I18NUTIL_DLLPUBLIC SAL_WARN_UNUSED SearchOptions2 : public SearchOptions { + + sal_Int16 AlgorithmType2; + sal_Int32 WildcardEscapeCharacter; + + SearchOptions2& operator=(css::util::SearchOptions2 const & other) + { + SearchOptions::operator=(other); + AlgorithmType2 = other.AlgorithmType2; + WildcardEscapeCharacter = other.WildcardEscapeCharacter; + return *this; + } + + + css::util::SearchOptions2 toUnoSearchOptions2() const + { + return css::util::SearchOptions2(algorithmType, searchFlag, + searchString, replaceString, + Locale, + changedChars, deletedChars, insertedChars, + (sal_Int32)transliterateFlags, + AlgorithmType2, WildcardEscapeCharacter); + } + + SearchOptions2() + : SearchOptions() + , AlgorithmType2(0) + , WildcardEscapeCharacter(0) + {} + + SearchOptions2(const css::util::SearchAlgorithms& algorithmType_, const sal_Int32 searchFlag_, + const OUString& searchString_, const OUString& replaceString_, + const css::lang::Locale& Locale_, + const sal_Int32 changedChars_, const sal_Int32 deletedChars_, const sal_Int32 insertedChars_, + const TransliterationFlags& transliterateFlags_, + const sal_Int16 AlgorithmType2_, const sal_Int32 WildcardEscapeCharacter_) + : SearchOptions(algorithmType_, searchFlag_, searchString_, replaceString_, Locale_, changedChars_, deletedChars_, insertedChars_, transliterateFlags_) + , AlgorithmType2(AlgorithmType2_) + , WildcardEscapeCharacter(WildcardEscapeCharacter_) + {} +}; + +}; // namespace + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/i18nutil/transliteration.hxx b/include/i18nutil/transliteration.hxx new file mode 100644 index 000000000000..b8cafa68f14f --- /dev/null +++ b/include/i18nutil/transliteration.hxx @@ -0,0 +1,132 @@ +/* -*- 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_HXX +#define INCLUDED_I18NUTIL_TRANSLITERATION_HXX + +#include <sal/types.h> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> +#include <o3tl/typed_flags_set.hxx> + +/** + * This is a superset type of the com::sun::star::i18n::TransliterationModules and TransliterationModulesExtra, + * with some extra type checking + */ +enum class TransliterationFlags { + NONE = 0, + /// Transliterate a string from upper case to lower case + UPPERCASE_LOWERCASE = css::i18n::TransliterationModules_UPPERCASE_LOWERCASE, + /// Transliterate a string from lower case to upper case + LOWERCASE_UPPERCASE = css::i18n::TransliterationModules_LOWERCASE_UPPERCASE, + /// Transliterate a string from half width character to full width character + HALFWIDTH_FULLWIDTH = css::i18n::TransliterationModules_HALFWIDTH_FULLWIDTH, + /// Transliterate a string from full width character to half width character + FULLWIDTH_HALFWIDTH = css::i18n::TransliterationModules_FULLWIDTH_HALFWIDTH, + /// Transliterate a Japanese string from Katakana to Hiragana + KATAKANA_HIRAGANA = css::i18n::TransliterationModules_KATAKANA_HIRAGANA, + /// Transliterate a Japanese string from Hiragana to Katakana + HIRAGANA_KATAKANA = css::i18n::TransliterationModules_HIRAGANA_KATAKANA, + /// Transliterate an ASCII number string to Simplified Chinese lower case number string in spellout format + NumToTextLower_zh_CN = css::i18n::TransliterationModules_NumToTextLower_zh_CN, + /// Transliterate an ASCII number string to Simplified Chinese upper case number string in spellout format + NumToTextUpper_zh_CN = css::i18n::TransliterationModules_NumToTextUpper_zh_CN, + /// Transliterate an ASCII number string to Traditional Chinese lower case number string in spellout format + NumToTextLower_zh_TW = css::i18n::TransliterationModules_NumToTextLower_zh_TW, + /// Transliterate an ASCII number string to Traditional Chinese upper case number string in spellout format + NumToTextUpper_zh_TW = css::i18n::TransliterationModules_NumToTextUpper_zh_TW, + /// Transliterate an ASCII number string to formal Korean Hangul number string in spellout format + NumToTextFormalHangul_ko = css::i18n::TransliterationModules_NumToTextFormalHangul_ko, + /// Transliterate an ASCII number string to formal Korean Hanja lower case number string in spellout format + NumToTextFormalLower_ko = css::i18n::TransliterationModules_NumToTextFormalLower_ko, + /// Transliterate an ASCII number string to formal Korean Hanja upper case number string in spellout format + NumToTextFormalUpper_ko = css::i18n::TransliterationModules_NumToTextFormalUpper_ko, + + /** The first character of the sentence is put in upper case + */ + SENTENCE_CASE = css::i18n::TransliterationModulesExtra::SENTENCE_CASE, + + + /** The first character of the word is put in upper case. + * This one is part + */ + TITLE_CASE = css::i18n::TransliterationModulesExtra::TITLE_CASE, + + + /** All characters of the word are to change their case from small letters + * to capital letters and vice versa. + */ + TOGGLE_CASE = css::i18n::TransliterationModulesExtra::TOGGLE_CASE, + + NON_IGNORE_MASK = css::i18n::TransliterationModules_NON_IGNORE_MASK, + IGNORE_MASK = 0x7fffff00, + + /// Ignore case when comparing strings by transliteration service + IGNORE_CASE = css::i18n::TransliterationModules_IGNORE_CASE, + /// Ignore Hiragana and Katakana when comparing strings by transliteration service + IGNORE_KANA = css::i18n::TransliterationModules_IGNORE_KANA, // ja_JP + /// Ignore full width and half width character when comparing strings by transliteration service + IGNORE_WIDTH = css::i18n::TransliterationModules_IGNORE_WIDTH, // ja_JP + /// Ignore Japanese traditional Kanji character in Japanese fuzzy search + ignoreTraditionalKanji_ja_JP = css::i18n::TransliterationModules_ignoreTraditionalKanji_ja_JP, + /// Ignore Japanese traditional Katakana and Hiragana character in Japanese fuzzy search + ignoreTraditionalKana_ja_JP = css::i18n::TransliterationModules_ignoreTraditionalKana_ja_JP, + /// Ignore dash or minus sign in Japanese fuzzy search + ignoreMinusSign_ja_JP = css::i18n::TransliterationModules_ignoreMinusSign_ja_JP, + /// Ignore Hiragana and Katakana iteration mark in Japanese fuzzy search + ignoreIterationMark_ja_JP = css::i18n::TransliterationModules_ignoreIterationMark_ja_JP, + /// Ignore separator punctuations in Japanese fuzzy search + ignoreSeparator_ja_JP = css::i18n::TransliterationModules_ignoreSeparator_ja_JP, + /// Ignore Katakana and Hiragana Zi/Zi and Zu/Zu in Japanese fuzzy search + ignoreZiZu_ja_JP = css::i18n::TransliterationModules_ignoreZiZu_ja_JP, + /// Ignore Katakana and Hiragana Ba/Gua and Ha/Fa in Japanese fuzzy search + ignoreBaFa_ja_JP = css::i18n::TransliterationModules_ignoreBaFa_ja_JP, + /// Ignore Katakana and Hiragana Tsui/Tea/Ti and Dyi/Ji in Japanese fuzzy search + ignoreTiJi_ja_JP = css::i18n::TransliterationModules_ignoreTiJi_ja_JP, + /// Ignore Katakana and Hiragana Hyu/Fyu and Byu/Gyu in Japanese fuzzy search + ignoreHyuByu_ja_JP = css::i18n::TransliterationModules_ignoreHyuByu_ja_JP, + /// Ignore Katakana and Hiragana Se/Sye and Ze/Je in Japanese fuzzy search + ignoreSeZe_ja_JP = css::i18n::TransliterationModules_ignoreSeZe_ja_JP, + /// Ignore Katakana YA/A which follows the character in either I or E row in Japanese fuzzy search + ignoreIandEfollowedByYa_ja_JP = css::i18n::TransliterationModules_ignoreIandEfollowedByYa_ja_JP, + /// Ignore Katakana KI/KU which follows the character in SA column in Japanese fuzzy search + ignoreKiKuFollowedBySa_ja_JP = css::i18n::TransliterationModules_ignoreKiKuFollowedBySa_ja_JP, + /// Ignore Japanese normal and small sized character in Japanese fuzzy search + ignoreSize_ja_JP = css::i18n::TransliterationModules_ignoreSize_ja_JP, + /// Ignore Japanese prolonged sound mark in Japanese fuzzy search + ignoreProlongedSoundMark_ja_JP = css::i18n::TransliterationModules_ignoreProlongedSoundMark_ja_JP, + /// Ignore middle dot in Japanese fuzzy search + ignoreMiddleDot_ja_JP = css::i18n::TransliterationModules_ignoreMiddleDot_ja_JP, + /// Ignore white space characters, include space, TAB, return, etc. in Japanese fuzzy search + ignoreSpace_ja_JP = css::i18n::TransliterationModules_ignoreSpace_ja_JP, + /// transliterate Japanese small sized character to normal sized character + smallToLarge_ja_JP = css::i18n::TransliterationModules_smallToLarge_ja_JP, + /// transliterate Japanese normal sized character to small sized character + largeToSmall_ja_JP = css::i18n::TransliterationModules_largeToSmall_ja_JP, + + IGNORE_DIACRITICS_CTL = css::i18n::TransliterationModulesExtra::IGNORE_DIACRITICS_CTL, + IGNORE_KASHIDA_CTL = css::i18n::TransliterationModulesExtra::IGNORE_KASHIDA_CTL +}; +namespace o3tl { + template<> struct typed_flags<TransliterationFlags> : is_typed_flags<TransliterationFlags, 0x7fffffff> {}; +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svl/ondemand.hxx b/include/svl/ondemand.hxx index 69139b9cb119..2eeebdad2137 100644 --- a/include/svl/ondemand.hxx +++ b/include/svl/ondemand.hxx @@ -27,11 +27,11 @@ #include <unotools/collatorwrapper.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> #include <unotools/transliterationwrapper.hxx> -#include <com/sun/star/i18n/TransliterationModules.hpp> #include <unotools/nativenumberwrapper.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <i18nutil/transliteration.hxx> /* On demand instantiation and initialization of several i18n wrappers, @@ -190,7 +190,7 @@ class OnDemandTransliterationWrapper { css::uno::Reference< css::uno::XComponentContext > m_xContext; LanguageType eLanguage; - css::i18n::TransliterationModules nType; + TransliterationFlags nType; mutable std::unique_ptr<::utl::TransliterationWrapper> pPtr; mutable bool bValid; @@ -199,7 +199,7 @@ class OnDemandTransliterationWrapper public: OnDemandTransliterationWrapper() : eLanguage( LANGUAGE_SYSTEM ) - , nType(css::i18n::TransliterationModules_END_OF_MODULE) + , nType(TransliterationFlags::NONE) , pPtr(nullptr) , bValid(false) , bInitialized(false) @@ -213,7 +213,7 @@ public: ) { m_xContext = rxContext; - nType = css::i18n::TransliterationModules_IGNORE_CASE; + nType = TransliterationFlags::IGNORE_CASE; changeLocale( eLang ); pPtr.reset(); bInitialized = true; diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx index 2be6271dc8a2..1f6d5553d336 100644 --- a/include/svl/srchitem.hxx +++ b/include/svl/srchitem.hxx @@ -22,10 +22,10 @@ #include <sal/config.h> #include <svl/svldllapi.h> #include <com/sun/star/util/XSearchDescriptor.hpp> -#include <com/sun/star/util/SearchOptions2.hpp> #include <com/sun/star/util/SearchAlgorithms2.hpp> #include <com/sun/star/util/SearchFlags.hpp> -#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <i18nutil/transliteration.hxx> +#include <i18nutil/searchopt.hxx> #include <unotools/configitem.hxx> #include <rsc/rscsfx.hxx> #include <svl/poolitem.hxx> @@ -63,7 +63,7 @@ class SVL_DLLPUBLIC SvxSearchItem : public SfxPoolItem, public utl::ConfigItem { - css::util::SearchOptions2 m_aSearchOpt; + i18nutil::SearchOptions2 m_aSearchOpt; SfxStyleFamily m_eFamily; // style family @@ -180,12 +180,13 @@ public: inline sal_uInt16 GetLEVLonger() const; inline void SetLEVLonger(sal_uInt16 nSet); - inline const css::util::SearchOptions2 & + inline const i18nutil::SearchOptions2 & GetSearchOptions() const; - inline void SetSearchOptions( const css::util::SearchOptions2 &rOpt ); + inline void SetSearchOptions( const i18nutil::SearchOptions2 &rOpt ); - inline sal_Int32 GetTransliterationFlags() const; - void SetTransliterationFlags( sal_Int32 nFlags ); + inline TransliterationFlags + GetTransliterationFlags() const; + void SetTransliterationFlags( TransliterationFlags nFlags ); inline bool IsMatchFullHalfWidthForms() const; void SetMatchFullHalfWidthForms( bool bVal ); @@ -227,7 +228,7 @@ bool SvxSearchItem::GetWordOnly() const bool SvxSearchItem::GetExact() const { - return 0 == (m_aSearchOpt.transliterateFlags & css::i18n::TransliterationModules_IGNORE_CASE); + return !(m_aSearchOpt.transliterateFlags & TransliterationFlags::IGNORE_CASE); } bool SvxSearchItem::GetSelection() const @@ -298,24 +299,24 @@ bool SvxSearchItem::IsLevenshtein() const return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::APPROXIMATE; } -const css::util::SearchOptions2 & SvxSearchItem::GetSearchOptions() const +const i18nutil::SearchOptions2 & SvxSearchItem::GetSearchOptions() const { return m_aSearchOpt; } -void SvxSearchItem::SetSearchOptions( const css::util::SearchOptions2 &rOpt ) +void SvxSearchItem::SetSearchOptions( const i18nutil::SearchOptions2 &rOpt ) { m_aSearchOpt = rOpt; } -sal_Int32 SvxSearchItem::GetTransliterationFlags() const +TransliterationFlags SvxSearchItem::GetTransliterationFlags() const { return m_aSearchOpt.transliterateFlags; } bool SvxSearchItem::IsMatchFullHalfWidthForms() const { - return 0 != (m_aSearchOpt.transliterateFlags & css::i18n::TransliterationModules_IGNORE_WIDTH); + return bool(m_aSearchOpt.transliterateFlags & TransliterationFlags::IGNORE_WIDTH); } #endif diff --git a/include/svx/fmsrccfg.hxx b/include/svx/fmsrccfg.hxx index 55dbdf9f7b6e..2366d5b34ca2 100644 --- a/include/svx/fmsrccfg.hxx +++ b/include/svx/fmsrccfg.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <svx/svxdllapi.h> +enum class TransliterationFlags; #define MATCHING_ANYWHERE 0 #define MATCHING_BEGINNING 1 @@ -46,7 +47,8 @@ namespace svxform struct SVX_DLLPUBLIC FmSearchParams { protected: - sal_Int32 nTransliterationFlags; + TransliterationFlags + nTransliterationFlags; // they're way too sensitive for direct access .... public: @@ -77,8 +79,9 @@ namespace svxform bool isIgnoreWidthCJK( ) const; - sal_Int32 getTransliterationFlags( ) const { return nTransliterationFlags; } - void setTransliterationFlags( sal_Int32 _nFlags ) { nTransliterationFlags = _nFlags; } + TransliterationFlags + getTransliterationFlags( ) const { return nTransliterationFlags; } + void setTransliterationFlags( TransliterationFlags _nFlags ) { nTransliterationFlags = _nFlags; } bool isCaseSensitive( ) const; void setCaseSensitive( bool _bCase ); diff --git a/include/svx/fmsrcimp.hxx b/include/svx/fmsrcimp.hxx index 5eaaf4eff01d..a56933533b63 100644 --- a/include/svx/fmsrcimp.hxx +++ b/include/svx/fmsrcimp.hxx @@ -38,6 +38,8 @@ #include <deque> #include <vector> +enum class TransliterationFlags; + /** * struct FmSearchProgress - the owner of SearchEngine receives this structure for status updates * (at the end of the search) @@ -211,7 +213,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FmSearchEngine final sal_uInt16 m_nPosition; // if not regular or levenshtein, then one of the MATCHING_... values - sal_Int32 m_nTransliterationFlags; + TransliterationFlags m_nTransliterationFlags; // member access @@ -253,8 +255,9 @@ public: sal_uInt16 GetLevLonger() const { return m_nLevLonger; } // all Lev. values will only be considered in case of m_bLevenshtein==sal_True - void SetTransliterationFlags(sal_Int32 _nFlags) { m_nTransliterationFlags = _nFlags; } - sal_Int32 GetTransliterationFlags() const { return m_nTransliterationFlags; } + void SetTransliterationFlags(TransliterationFlags _nFlags) { m_nTransliterationFlags = _nFlags; } + TransliterationFlags + GetTransliterationFlags() const { return m_nTransliterationFlags; } void SetPosition(sal_uInt16 nValue) { m_nPosition = nValue; } sal_uInt16 GetPosition() const { return m_nPosition; } diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx index 25798fd0837c..3a0b1f953e2c 100644 --- a/include/svx/srchdlg.hxx +++ b/include/svx/srchdlg.hxx @@ -40,6 +40,8 @@ class SvxJSearchOptionsPage; class SvxSearchController; struct SearchDlg_Impl; enum class ModifyFlags; +enum class TransliterationFlags; + struct SearchAttrItem { @@ -133,7 +135,7 @@ public: const SearchAttrItemList* GetReplaceItemList() const { return pReplaceList; } - sal_Int32 GetTransliterationFlags() const; + TransliterationFlags GetTransliterationFlags() const; void SetDocWin( vcl::Window* pDocWin ) { mpDocWin = pDocWin; } vcl::Window* GetDocWin() { return mpDocWin; } @@ -231,7 +233,8 @@ private: SvxSearchController* pSearchSetController; SvxSearchController* pReplaceSetController; - mutable sal_Int32 nTransliterationFlags; + mutable TransliterationFlags + nTransliterationFlags; DECL_LINK( ModifyHdl_Impl, Edit&, void ); DECL_LINK( FlagHdl_Impl, Button*, void ); @@ -264,7 +267,7 @@ private: void SetModifyFlag_Impl( const Control* pCtrl ); void SaveToModule_Impl(); - void ApplyTransliterationFlags_Impl( sal_Int32 nSettings ); + void ApplyTransliterationFlags_Impl( TransliterationFlags nSettings ); }; #endif diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index b9e6eb4257f6..a88bed567381 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -24,9 +24,6 @@ #include <svx/zoom_def.hxx> #include <editeng/edtdlg.hxx> -class SdrModel; -class SdrView; - #include <svx/dstribut_enum.hxx> #include <svx/rectenum.hxx> #include <com/sun/star/container/XIndexContainer.hpp> @@ -42,11 +39,10 @@ namespace linguistic2{ class XThesaurus; class XHyphenator; }}}} - +class SdrModel; +class SdrView; class SvxSpellWrapper; -typedef VclPtr<SfxTabPage> (*CreateSvxDistributePage)(vcl::Window *pParent, const SfxItemSet &rAttrSet, SvxDistributeHorizontal eHor, SvxDistributeVertical eVer); -typedef const sal_uInt16* (*DialogGetRanges)(); - +enum class TransliterationFlags; struct ExchangeData; class INetURLObject; class GalleryTheme; @@ -58,6 +54,9 @@ class SdrObject; class SvxSpellWrapper; struct FmSearchContext; +typedef VclPtr<SfxTabPage> (*CreateSvxDistributePage)(vcl::Window *pParent, const SfxItemSet &rAttrSet, SvxDistributeHorizontal eHor, SvxDistributeVertical eVer); +typedef const sal_uInt16* (*DialogGetRanges)(); + typedef ::std::vector< OUString > TargetList; namespace svx{ class SpellDialogChildWindow;} @@ -163,7 +162,7 @@ class AbstractSvxJSearchOptionsDialog :public VclAbstractDialog protected: virtual ~AbstractSvxJSearchOptionsDialog() override = default; public: - virtual sal_Int32 GetTransliterationFlags() const = 0; + virtual TransliterationFlags GetTransliterationFlags() const = 0; }; class AbstractFmInputRecordNoDialog :public VclAbstractDialog @@ -396,7 +395,7 @@ public: )=0; virtual VclPtr<AbstractSvxJSearchOptionsDialog> CreateSvxJSearchOptionsDialog( vcl::Window* pParent, const SfxItemSet& rOptionsSet, - sal_Int32 nInitialFlags )=0; + TransliterationFlags nInitialFlags )=0; virtual VclPtr<AbstractFmInputRecordNoDialog> CreateFmInputRecordNoDialog() = 0; virtual VclPtr<AbstractSvxNewDictionaryDialog> CreateSvxNewDictionaryDialog( vcl::Window* pParent ) = 0; virtual VclPtr<VclAbstractDialog> CreateSvxEditDictionaryDialog( vcl::Window* pParent, diff --git a/include/unotools/caserotate.hxx b/include/unotools/caserotate.hxx index 36a93b1ee0d2..adc26a6eec8a 100644 --- a/include/unotools/caserotate.hxx +++ b/include/unotools/caserotate.hxx @@ -10,9 +10,10 @@ #define INCLUDED_UNOTOOLS_CASEROTATE_HXX #include <sal/config.h> - #include <unotools/unotoolsdllapi.h> +enum class TransliterationFlags; + //TODO Use XCharacterClassification::getStringType to determine the current //(possibly mixed) case type and rotate to the next one @@ -24,7 +25,7 @@ public: RotateTransliteration() : nF3ShiftCounter(0) { } - sal_uInt32 getNextMode(); + TransliterationFlags getNextMode(); }; #endif diff --git a/include/unotools/searchopt.hxx b/include/unotools/searchopt.hxx index fe8509b0cb42..6b43219094ac 100644 --- a/include/unotools/searchopt.hxx +++ b/include/unotools/searchopt.hxx @@ -24,6 +24,7 @@ #include <memory> class SvtSearchOptions_Impl; +enum class TransliterationFlags; class UNOTOOLS_DLLPUBLIC SvtSearchOptions { @@ -38,7 +39,7 @@ public: void Commit(); - sal_Int32 GetTransliterationFlags() const; + TransliterationFlags GetTransliterationFlags() const; // General Options diff --git a/include/unotools/textsearch.hxx b/include/unotools/textsearch.hxx index 145e6607d49c..71048c226f0d 100644 --- a/include/unotools/textsearch.hxx +++ b/include/unotools/textsearch.hxx @@ -26,7 +26,6 @@ #include <com/sun/star/uno/Reference.h> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/util/XTextSearch2.hpp> -#include <com/sun/star/util/SearchOptions2.hpp> class CharClass; @@ -39,6 +38,11 @@ namespace com { } } } +namespace i18nutil { + struct SearchOptions; + struct SearchOptions2; +} +enum class TransliterationFlags; namespace utl { @@ -107,7 +111,7 @@ private: int nLEV_LongerZ; // asian flags - used for the transliteration - long nTransliterationFlags; + TransliterationFlags nTransliterationFlags; public: SearchParam( const OUString &rText, @@ -132,7 +136,7 @@ public: // signed return for API use sal_Int32 GetWildEscChar() const { return static_cast<sal_Int32>(m_cWildEscChar); } - long GetTransliterationFlags() const { return nTransliterationFlags; } + TransliterationFlags GetTransliterationFlags() const { return nTransliterationFlags; } }; // Utility class for searching a substring in a string. @@ -147,7 +151,7 @@ public: class UNOTOOLS_DLLPUBLIC TextSearch { static css::uno::Reference< css::util::XTextSearch2 > - getXTextSearch( const css::util::SearchOptions2& rPara ); + getXTextSearch( const i18nutil::SearchOptions2& rPara ); css::uno::Reference < css::util::XTextSearch2 > xTextSearch; @@ -161,7 +165,7 @@ public: TextSearch( const SearchParam & rPara, LanguageType nLanguage ); TextSearch( const SearchParam & rPara, const CharClass& rCClass ); - TextSearch( const css::util::SearchOptions2& rPara ); + TextSearch( const i18nutil::SearchOptions2& rPara ); ~TextSearch(); /* search in the (selected) text the search string: @@ -190,7 +194,7 @@ public: sal_Int32* pStart, sal_Int32* pEnd, css::util::SearchResult* pRes = nullptr ); - void SetLocale( const css::util::SearchOptions2& rOpt, + void SetLocale( const i18nutil::SearchOptions2& rOpt, const css::lang::Locale& rLocale ); /* replace back references in the replace string by the sub expressions from the search result */ @@ -200,7 +204,7 @@ public: SearchOptions2 yet. Better fix your module if you want to support wildcard search. */ - static css::util::SearchOptions2 UpgradeToSearchOptions2( const css::util::SearchOptions& rOptions ); + static i18nutil::SearchOptions2 UpgradeToSearchOptions2( const i18nutil::SearchOptions& rOptions ); }; diff --git a/include/unotools/transliterationwrapper.hxx b/include/unotools/transliterationwrapper.hxx index 2c2caa785dba..7508386bf3b7 100644 --- a/include/unotools/transliterationwrapper.hxx +++ b/include/unotools/transliterationwrapper.hxx @@ -30,6 +30,7 @@ namespace com { namespace sun { namespace star { class XComponentContext; } }}} +enum class TransliterationFlags; namespace utl { @@ -38,7 +39,7 @@ class UNOTOOLS_DLLPUBLIC TransliterationWrapper { css::uno::Reference< css::i18n::XExtendedTransliteration > xTrans; LanguageTag aLanguageTag; - sal_uInt32 nType; + TransliterationFlags nType; mutable bool bFirstCall; TransliterationWrapper( const TransliterationWrapper& ) = delete; @@ -49,11 +50,11 @@ class UNOTOOLS_DLLPUBLIC TransliterationWrapper public: TransliterationWrapper( const css::uno::Reference< css::uno::XComponentContext > & rxContext, - sal_uInt32 nType ); + TransliterationFlags nType ); ~TransliterationWrapper(); - sal_uInt32 getType() const { return nType; } + TransliterationFlags getType() const { return nType; } bool needLanguageForTheMode() const; diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx index 5937e9066f44..435295d177fe 100644 --- a/include/vcl/textview.hxx +++ b/include/vcl/textview.hxx @@ -47,6 +47,9 @@ namespace com { namespace sun { namespace star { struct SearchOptions; } }}} +namespace i18nutil { + struct SearchOptions; +} struct ImpTextView; @@ -204,8 +207,8 @@ public: bool MatchGroup(); - bool Search( const css::util::SearchOptions& rSearchOptions, bool bForward ); - sal_uInt16 Replace( const css::util::SearchOptions& rSearchOptions, bool bAll, bool bForward ); + bool Search( const i18nutil::SearchOptions& rSearchOptions, bool bForward ); + sal_uInt16 Replace( const i18nutil::SearchOptions& rSearchOptions, bool bAll, bool bForward ); bool IndentBlock(); bool UnindentBlock(); diff --git a/include/vcl/xtextedt.hxx b/include/vcl/xtextedt.hxx index 3db5f6c7e313..23b0d05bf336 100644 --- a/include/vcl/xtextedt.hxx +++ b/include/vcl/xtextedt.hxx @@ -40,7 +40,7 @@ public: virtual ~ExtTextEngine() override; TextSelection MatchGroup( const TextPaM& rCursor ) const; - bool Search( TextSelection& rSel, const css::util::SearchOptions& rSearchOptions, bool bForward = true ); + bool Search( TextSelection& rSel, const i18nutil::SearchOptions& rSearchOptions, bool bForward = true ); }; #endif // INCLUDED_VCL_XTEXTEDT_HXX |