summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-23 16:15:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-01 07:28:03 +0000
commit4c09fc48e9fa9114f32f2973090cbe75177cdd37 (patch)
tree09d4ee3c2d75d038f45ba13a086a344d35aeadb6 /basic
parentd97380c66904328e9d706a0b03a6800dc048aa7d (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 'basic')
-rw-r--r--basic/source/classes/global.cxx3
-rw-r--r--basic/source/runtime/methods.cxx22
-rw-r--r--basic/source/runtime/runtime.cxx6
3 files changed, 16 insertions, 15 deletions
diff --git a/basic/source/classes/global.cxx b/basic/source/classes/global.cxx
index 0c45b282f094..8f5472daae66 100644
--- a/basic/source/classes/global.cxx
+++ b/basic/source/classes/global.cxx
@@ -9,6 +9,7 @@
#include <comphelper/processfactory.hxx>
#include <i18nlangtag/lang.h>
+#include <i18nutil/transliteration.hxx>
#include <rtl/instance.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <vcl/svapp.hxx>
@@ -26,7 +27,7 @@ namespace
lclTransliterationWrapper()
: m_aTransliteration(
comphelper::getProcessComponentContext(),
- css::i18n::TransliterationModules_IGNORE_CASE )
+ TransliterationFlags::IGNORE_CASE )
{
const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
m_aTransliteration.loadModuleIfNeeded( eOfficeLanguage );
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 3447bff32949..33e4f3640a40 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1667,9 +1667,9 @@ RTLFUNC(StrComp)
uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
pTransliterationWrapper = GetSbData()->pTransliterationWrapper =
new ::utl::TransliterationWrapper( xContext,
- i18n::TransliterationModules_IGNORE_CASE |
- i18n::TransliterationModules_IGNORE_KANA |
- i18n::TransliterationModules_IGNORE_WIDTH );
+ TransliterationFlags::IGNORE_CASE |
+ TransliterationFlags::IGNORE_KANA |
+ TransliterationFlags::IGNORE_WIDTH );
}
LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType();
@@ -4266,7 +4266,7 @@ RTLFUNC(StrConv)
return;
}
- sal_Int32 nType = 0;
+ TransliterationFlags nType = TransliterationFlags::NONE;
if ( (nConversion & 0x03) == 3 ) // vbProperCase
{
const CharClass& rCharClass = GetCharClass();
@@ -4274,30 +4274,30 @@ RTLFUNC(StrConv)
}
else if ( (nConversion & 0x01) == 1 ) // vbUpperCase
{
- nType |= i18n::TransliterationModules_LOWERCASE_UPPERCASE;
+ nType |= TransliterationFlags::LOWERCASE_UPPERCASE;
}
else if ( (nConversion & 0x02) == 2 ) // vbLowerCase
{
- nType |= i18n::TransliterationModules_UPPERCASE_LOWERCASE;
+ nType |= TransliterationFlags::UPPERCASE_LOWERCASE;
}
if ( (nConversion & 0x04) == 4 ) // vbWide
{
- nType |= i18n::TransliterationModules_HALFWIDTH_FULLWIDTH;
+ nType |= TransliterationFlags::HALFWIDTH_FULLWIDTH;
}
else if ( (nConversion & 0x08) == 8 ) // vbNarrow
{
- nType |= i18n::TransliterationModules_FULLWIDTH_HALFWIDTH;
+ nType |= TransliterationFlags::FULLWIDTH_HALFWIDTH;
}
if ( (nConversion & 0x10) == 16) // vbKatakana
{
- nType |= i18n::TransliterationModules_HIRAGANA_KATAKANA;
+ nType |= TransliterationFlags::HIRAGANA_KATAKANA;
}
else if ( (nConversion & 0x20) == 32 ) // vbHiragana
{
- nType |= i18n::TransliterationModules_KATAKANA_HIRAGANA;
+ nType |= TransliterationFlags::KATAKANA_HIRAGANA;
}
OUString aNewStr( aOldStr );
- if( nType != 0 )
+ if( nType != TransliterationFlags::NONE )
{
uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
::utl::TransliterationWrapper aTransliterationWrapper( xContext, nType );
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 2f9284ef8254..e3615b13fc12 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -28,7 +28,6 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/script/XDefaultMethod.hpp>
#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/util/SearchOptions2.hpp>
#include <com/sun/star/util/SearchAlgorithms2.hpp>
#include <comphelper/processfactory.hxx>
@@ -48,6 +47,7 @@
#include <svl/zforlist.hxx>
+#include <i18nutil/searchopt.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/textsearch.hxx>
@@ -1503,7 +1503,7 @@ void SbiRuntime::StepLIKE()
OUString pattern = VBALikeToRegexp(refVar1->GetOUString());
OUString value = refVar2->GetOUString();
- css::util::SearchOptions2 aSearchOpt;
+ i18nutil::SearchOptions2 aSearchOpt;
aSearchOpt.AlgorithmType2 = css::util::SearchAlgorithms2::REGEXP;
@@ -1518,7 +1518,7 @@ void SbiRuntime::StepLIKE()
}
if( bTextMode )
{
- aSearchOpt.transliterateFlags |= css::i18n::TransliterationModules_IGNORE_CASE;
+ aSearchOpt.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
}
SbxVariable* pRes = new SbxVariable;
utl::TextSearch aSearch( aSearchOpt);