summaryrefslogtreecommitdiff
path: root/linguistic/source/misc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'linguistic/source/misc.cxx')
-rwxr-xr-x[-rw-r--r--]linguistic/source/misc.cxx150
1 files changed, 75 insertions, 75 deletions
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index d73d9a034ada..73a19fe6d466 100644..100755
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -55,10 +55,10 @@
#include <rtl/instance.hxx>
-#include "misc.hxx"
+#include "linguistic/misc.hxx"
#include "defs.hxx"
-#include "lngprops.hxx"
-#include "hyphdta.hxx"
+#include "linguistic/lngprops.hxx"
+#include "linguistic/hyphdta.hxx"
#include <i18npool/mslangid.hxx>
using namespace utl;
@@ -89,7 +89,7 @@ osl::Mutex & GetLinguMutex()
///////////////////////////////////////////////////////////////////////////
-LocaleDataWrapper & GetLocaleDataWrapper( INT16 nLang )
+LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang )
{
static LocaleDataWrapper aLclDtaWrp(
getProcessServiceFactory(),
@@ -109,10 +109,10 @@ LocaleDataWrapper & GetLocaleDataWrapper( INT16 nLang )
/**
returns text-encoding used for ByteString unicode String conversion
*/
-rtl_TextEncoding GetTextEncoding( INT16 nLanguage )
+rtl_TextEncoding GetTextEncoding( sal_Int16 nLanguage )
{
DBG_ASSERT( nLanguage != LANGUAGE_NONE, "invalid language argument" );
- static INT16 nLastLanguage = LANGUAGE_NONE;
+ static sal_Int16 nLastLanguage = LANGUAGE_NONE;
// set default value for unknown languages
static rtl_TextEncoding nEncoding = RTL_TEXTENCODING_DONTKNOW;
@@ -268,14 +268,14 @@ sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 )
///////////////////////////////////////////////////////////////////////////
-BOOL IsUseDicList( const PropertyValues &rProperties,
+sal_Bool IsUseDicList( const PropertyValues &rProperties,
const uno::Reference< XPropertySet > &rxProp )
{
- BOOL bRes = TRUE;
+ sal_Bool bRes = sal_True;
- INT32 nLen = rProperties.getLength();
+ sal_Int32 nLen = rProperties.getLength();
const PropertyValue *pVal = rProperties.getConstArray();
- INT32 i;
+ sal_Int32 i;
for ( i = 0; i < nLen; ++i)
{
@@ -296,14 +296,14 @@ BOOL IsUseDicList( const PropertyValues &rProperties,
}
-BOOL IsIgnoreControlChars( const PropertyValues &rProperties,
+sal_Bool IsIgnoreControlChars( const PropertyValues &rProperties,
const uno::Reference< XPropertySet > &rxProp )
{
- BOOL bRes = TRUE;
+ sal_Bool bRes = sal_True;
- INT32 nLen = rProperties.getLength();
+ sal_Int32 nLen = rProperties.getLength();
const PropertyValue *pVal = rProperties.getConstArray();
- INT32 i;
+ sal_Int32 i;
for ( i = 0; i < nLen; ++i)
{
@@ -324,9 +324,9 @@ BOOL IsIgnoreControlChars( const PropertyValues &rProperties,
}
-static BOOL lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry )
+static sal_Bool lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry )
{
- BOOL bRes = FALSE;
+ sal_Bool bRes = sal_False;
if (xEntry.is())
{
// there has to be (at least one) '=' denoting a hyphenation position
@@ -340,8 +340,8 @@ static BOOL lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry )
uno::Reference< XDictionaryEntry > SearchDicList(
const uno::Reference< XDictionaryList > &xDicList,
- const OUString &rWord, INT16 nLanguage,
- BOOL bSearchPosDics, BOOL bSearchSpellEntry )
+ const OUString &rWord, sal_Int16 nLanguage,
+ sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry )
{
MutexGuard aGuard( GetLinguMutex() );
@@ -354,15 +354,15 @@ uno::Reference< XDictionaryEntry > SearchDicList(
aDics( xDicList->getDictionaries() );
const uno::Reference< XDictionary >
*pDic = aDics.getConstArray();
- INT32 nDics = xDicList->getCount();
+ sal_Int32 nDics = xDicList->getCount();
- INT32 i;
+ sal_Int32 i;
for (i = 0; i < nDics; i++)
{
uno::Reference< XDictionary > axDic( pDic[i], UNO_QUERY );
DictionaryType eType = axDic->getDictionaryType();
- INT16 nLang = LocaleToLanguage( axDic->getLocale() );
+ sal_Int16 nLang = LocaleToLanguage( axDic->getLocale() );
if ( axDic.is() && axDic->isActive()
&& (nLang == nLanguage || nLang == LANGUAGE_NONE) )
@@ -396,8 +396,8 @@ sal_Bool SaveDictionaries( const uno::Reference< XDictionaryList > &xDicList )
Sequence< uno::Reference< XDictionary > > aDics( xDicList->getDictionaries() );
const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
- INT32 nCount = aDics.getLength();
- for (INT32 i = 0; i < nCount; i++)
+ sal_Int32 nCount = aDics.getLength();
+ for (sal_Int32 i = 0; i < nCount; i++)
{
try
{
@@ -488,14 +488,14 @@ Locale CreateLocale( LanguageType eLang )
return aLocale;
}
-uno::Sequence< Locale > LangSeqToLocaleSeq( const uno::Sequence< INT16 > &rLangSeq )
+uno::Sequence< Locale > LangSeqToLocaleSeq( const uno::Sequence< sal_Int16 > &rLangSeq )
{
- const INT16 *pLang = rLangSeq.getConstArray();
- INT32 nCount = rLangSeq.getLength();
+ const sal_Int16 *pLang = rLangSeq.getConstArray();
+ sal_Int32 nCount = rLangSeq.getLength();
uno::Sequence< Locale > aLocales( nCount );
Locale *pLocale = aLocales.getArray();
- for (INT32 i = 0; i < nCount; ++i)
+ for (sal_Int32 i = 0; i < nCount; ++i)
{
LanguageToLocale( pLocale[i], pLang[ i ] );
}
@@ -503,15 +503,15 @@ uno::Sequence< Locale > LangSeqToLocaleSeq( const uno::Sequence< INT16 > &rLangS
return aLocales;
}
-uno::Sequence< INT16 >
+uno::Sequence< sal_Int16 >
LocaleSeqToLangSeq( uno::Sequence< Locale > &rLocaleSeq )
{
const Locale *pLocale = rLocaleSeq.getConstArray();
- INT32 nCount = rLocaleSeq.getLength();
+ sal_Int32 nCount = rLocaleSeq.getLength();
- uno::Sequence< INT16 > aLangs( nCount );
- INT16 *pLang = aLangs.getArray();
- for (INT32 i = 0; i < nCount; ++i)
+ uno::Sequence< sal_Int16 > aLangs( nCount );
+ sal_Int16 *pLang = aLangs.getArray();
+ for (sal_Int32 i = 0; i < nCount; ++i)
{
pLang[i] = LocaleToLanguage( pLocale[i] );
}
@@ -521,10 +521,10 @@ uno::Sequence< INT16 >
///////////////////////////////////////////////////////////////////////////
-BOOL IsReadOnly( const String &rURL, BOOL *pbExist )
+sal_Bool IsReadOnly( const String &rURL, sal_Bool *pbExist )
{
- BOOL bRes = FALSE;
- BOOL bExists = FALSE;
+ sal_Bool bRes = sal_False;
+ sal_Bool bExists = sal_False;
if (rURL.Len() > 0)
{
@@ -542,7 +542,7 @@ BOOL IsReadOnly( const String &rURL, BOOL *pbExist )
}
catch (Exception &)
{
- bRes = TRUE;
+ bRes = sal_True;
}
}
@@ -554,16 +554,16 @@ BOOL IsReadOnly( const String &rURL, BOOL *pbExist )
///////////////////////////////////////////////////////////////////////////
-static BOOL GetAltSpelling( INT16 &rnChgPos, INT16 &rnChgLen, OUString &rRplc,
+static sal_Bool GetAltSpelling( sal_Int16 &rnChgPos, sal_Int16 &rnChgLen, OUString &rRplc,
uno::Reference< XHyphenatedWord > &rxHyphWord )
{
- BOOL bRes = rxHyphWord->isAlternativeSpelling();
+ sal_Bool bRes = rxHyphWord->isAlternativeSpelling();
if (bRes)
{
OUString aWord( rxHyphWord->getWord() ),
aHyphenatedWord( rxHyphWord->getHyphenatedWord() );
- INT16 nHyphenationPos = rxHyphWord->getHyphenationPos();
- /*INT16 nHyphenPos = rxHyphWord->getHyphenPos()*/;
+ sal_Int16 nHyphenationPos = rxHyphWord->getHyphenationPos();
+ /*sal_Int16 nHyphenPos = rxHyphWord->getHyphenPos()*/;
const sal_Unicode *pWord = aWord.getStr(),
*pAltWord = aHyphenatedWord.getStr();
@@ -577,7 +577,7 @@ static BOOL GetAltSpelling( INT16 &rnChgPos, INT16 &rnChgLen, OUString &rRplc,
// find first different char from left
sal_Int32 nPosL = 0,
nAltPosL = 0;
- for (INT16 i = 0 ; pWord[ nPosL ] == pAltWord[ nAltPosL ]; nPosL++, nAltPosL++, i++)
+ for (sal_Int16 i = 0 ; pWord[ nPosL ] == pAltWord[ nAltPosL ]; nPosL++, nAltPosL++, i++)
{
// restrict changes area beginning to the right to
// the char immediately following the hyphen.
@@ -595,8 +595,8 @@ static BOOL GetAltSpelling( INT16 &rnChgPos, INT16 &rnChgLen, OUString &rRplc,
nPosR--, nAltPosR--)
;
- rnChgPos = sal::static_int_cast< INT16 >(nPosL);
- rnChgLen = sal::static_int_cast< INT16 >(nPosR - nPosL + 1);
+ rnChgPos = sal::static_int_cast< sal_Int16 >(nPosL);
+ rnChgLen = sal::static_int_cast< sal_Int16 >(nPosR - nPosL + 1);
DBG_ASSERT( rnChgLen >= 0, "nChgLen < 0");
sal_Int32 nTxtStart = nPosL;
@@ -607,32 +607,32 @@ static BOOL GetAltSpelling( INT16 &rnChgPos, INT16 &rnChgLen, OUString &rRplc,
}
-static INT16 GetOrigWordPos( const OUString &rOrigWord, INT16 nPos )
+static sal_Int16 GetOrigWordPos( const OUString &rOrigWord, sal_Int16 nPos )
{
- INT32 nLen = rOrigWord.getLength();
- INT32 i = -1;
+ sal_Int32 nLen = rOrigWord.getLength();
+ sal_Int32 i = -1;
while (nPos >= 0 && i++ < nLen)
{
sal_Unicode cChar = rOrigWord[i];
- BOOL bSkip = IsHyphen( cChar ) || IsControlChar( cChar );
+ sal_Bool bSkip = IsHyphen( cChar ) || IsControlChar( cChar );
if (!bSkip)
--nPos;
}
- return sal::static_int_cast< INT16 >((0 <= i && i < nLen) ? i : -1);
+ return sal::static_int_cast< sal_Int16 >((0 <= i && i < nLen) ? i : -1);
}
-INT32 GetPosInWordToCheck( const OUString &rTxt, INT32 nPos )
+sal_Int32 GetPosInWordToCheck( const OUString &rTxt, sal_Int32 nPos )
{
- INT32 nRes = -1;
- INT32 nLen = rTxt.getLength();
+ sal_Int32 nRes = -1;
+ sal_Int32 nLen = rTxt.getLength();
if (0 <= nPos && nPos < nLen)
{
nRes = 0;
- for (INT32 i = 0; i < nPos; ++i)
+ for (sal_Int32 i = 0; i < nPos; ++i)
{
sal_Unicode cChar = rTxt[i];
- BOOL bSkip = IsHyphen( cChar ) || IsControlChar( cChar );
+ sal_Bool bSkip = IsHyphen( cChar ) || IsControlChar( cChar );
if (!bSkip)
++nRes;
}
@@ -648,17 +648,17 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
uno::Reference< XHyphenatedWord > xRes;
if (rOrigWord.getLength() && rxHyphWord.is())
{
- INT16 nChgPos = 0,
+ sal_Int16 nChgPos = 0,
nChgLen = 0;
OUString aRplc;
- BOOL bAltSpelling = GetAltSpelling( nChgPos, nChgLen, aRplc, rxHyphWord );
+ sal_Bool bAltSpelling = GetAltSpelling( nChgPos, nChgLen, aRplc, rxHyphWord );
#if OSL_DEBUG_LEVEL > 1
OUString aWord( rxHyphWord->getWord() );
#endif
OUString aOrigHyphenatedWord;
- INT16 nOrigHyphenPos = -1;
- INT16 nOrigHyphenationPos = -1;
+ sal_Int16 nOrigHyphenPos = -1;
+ sal_Int16 nOrigHyphenationPos = -1;
if (!bAltSpelling)
{
aOrigHyphenatedWord = rOrigWord;
@@ -671,10 +671,10 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
//! B�-c-k-er and Sc-hif-fah-rt
OUString aLeft, aRight;
- INT16 nPos = GetOrigWordPos( rOrigWord, nChgPos );
+ sal_Int16 nPos = GetOrigWordPos( rOrigWord, nChgPos );
// get words like Sc-hif-fah-rt to work correct
- INT16 nHyphenationPos = rxHyphWord->getHyphenationPos();
+ sal_Int16 nHyphenationPos = rxHyphWord->getHyphenationPos();
if (nChgPos > nHyphenationPos)
--nPos;
@@ -685,7 +685,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
aOrigHyphenatedWord += aRplc;
aOrigHyphenatedWord += aRight;
- nOrigHyphenPos = sal::static_int_cast< INT16 >(aLeft.getLength() +
+ nOrigHyphenPos = sal::static_int_cast< sal_Int16 >(aLeft.getLength() +
rxHyphWord->getHyphenPos() - nChgPos);
nOrigHyphenationPos = GetOrigWordPos( rOrigWord, nHyphenationPos );
}
@@ -696,7 +696,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
}
else
{
- INT16 nLang = LocaleToLanguage( rxHyphWord->getLocale() );
+ sal_Int16 nLang = LocaleToLanguage( rxHyphWord->getLocale() );
xRes = new HyphenatedWord(
rOrigWord, nLang, nOrigHyphenationPos,
aOrigHyphenatedWord, nOrigHyphenPos );
@@ -724,7 +724,7 @@ osl::Mutex & lcl_GetCharClassMutex()
}
-BOOL IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLanguage )
+sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -736,7 +736,7 @@ BOOL IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLang
}
-BOOL IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLanguage )
+sal_Bool IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -748,7 +748,7 @@ BOOL IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLang
}
-String ToLower( const String &rText, INT16 nLanguage )
+String ToLower( const String &rText, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -758,7 +758,7 @@ String ToLower( const String &rText, INT16 nLanguage )
}
-String ToUpper( const String &rText, INT16 nLanguage )
+String ToUpper( const String &rText, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -768,7 +768,7 @@ String ToUpper( const String &rText, INT16 nLanguage )
}
-String ToTitle( const String &rText, INT16 nLanguage )
+String ToTitle( const String &rText, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -778,7 +778,7 @@ String ToTitle( const String &rText, INT16 nLanguage )
}
-sal_Unicode ToLower( const sal_Unicode cChar, INT16 nLanguage )
+sal_Unicode ToLower( const sal_Unicode cChar, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -788,7 +788,7 @@ sal_Unicode ToLower( const sal_Unicode cChar, INT16 nLanguage )
}
-sal_Unicode ToUpper( const sal_Unicode cChar, INT16 nLanguage )
+sal_Unicode ToUpper( const sal_Unicode cChar, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -836,7 +836,7 @@ static const sal_uInt32 the_aDigitZeroes [] =
0x0001D7CE //1D7FF ; Decimal # Nd [50] MATHEMATICAL BOLD DIGIT ZERO..MATHEMATICAL MONOSPACE DIGIT NINE
};
-BOOL HasDigits( const OUString &rText )
+sal_Bool HasDigits( const OUString &rText )
{
static const int nNumDigitZeroes = SAL_N_ELEMENTS(the_aDigitZeroes);
const sal_Int32 nLen = rText.getLength();
@@ -851,27 +851,27 @@ BOOL HasDigits( const OUString &rText )
if (nDigitZero > nCodePoint)
break;
if (/*nDigitZero <= nCodePoint &&*/ nCodePoint <= nDigitZero + 9)
- return TRUE;
+ return sal_True;
}
}
- return FALSE;
+ return sal_False;
}
-BOOL IsNumeric( const String &rText )
+sal_Bool IsNumeric( const String &rText )
{
- BOOL bRes = FALSE;
+ sal_Bool bRes = sal_False;
xub_StrLen nLen = rText.Len();
if (nLen)
{
- bRes = TRUE;
+ bRes = sal_True;
xub_StrLen i = 0;
while (i < nLen)
{
sal_Unicode cChar = rText.GetChar( i++ );
if ( !((sal_Unicode)'0' <= cChar && cChar <= (sal_Unicode)'9') )
{
- bRes = FALSE;
+ bRes = sal_False;
break;
}
}