diff options
author | Mathias Bauer <mba@openoffice.org> | 2011-02-08 11:49:29 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2011-02-08 11:49:29 +0100 |
commit | 40953e8bab7710063353f70ffd4d66a4782b5425 (patch) | |
tree | 7575a84f0d2e6a7110e64b45d999dff045b23d3f /linguistic/source/misc.cxx | |
parent | b31ae53bd29953d09dbda1e37e3ec8aeec81807b (diff) | |
parent | 642c1ee8fac66996d2c500c5e247d17c198c6405 (diff) |
CWS gnumake3: pull in cws removetooltypes01
Diffstat (limited to 'linguistic/source/misc.cxx')
-rw-r--r-- | linguistic/source/misc.cxx | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 25c2a7f6b374..f0a26ca50f09 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -86,7 +86,7 @@ osl::Mutex & GetLinguMutex() /////////////////////////////////////////////////////////////////////////// -LocaleDataWrapper & GetLocaleDataWrapper( INT16 nLang ) +LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang ) { static LocaleDataWrapper aLclDtaWrp( getProcessServiceFactory(), @@ -106,10 +106,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; @@ -265,14 +265,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) { @@ -293,14 +293,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) { @@ -321,9 +321,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 @@ -337,8 +337,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() ); @@ -351,15 +351,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) ) @@ -393,8 +393,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 { @@ -485,14 +485,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 ] ); } @@ -500,15 +500,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] ); } @@ -518,10 +518,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) { @@ -539,7 +539,7 @@ BOOL IsReadOnly( const String &rURL, BOOL *pbExist ) } catch (Exception &) { - bRes = TRUE; + bRes = sal_True; } } @@ -551,16 +551,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(); @@ -574,7 +574,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. @@ -592,8 +592,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; @@ -604,32 +604,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; } @@ -645,17 +645,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; @@ -668,10 +668,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; @@ -682,7 +682,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 ); } @@ -693,7 +693,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 ); @@ -721,7 +721,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() ); @@ -733,7 +733,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() ); @@ -745,7 +745,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() ); @@ -755,7 +755,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() ); @@ -765,7 +765,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() ); @@ -775,7 +775,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() ); @@ -785,7 +785,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() ); @@ -833,7 +833,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 = sizeof(the_aDigitZeroes) / sizeof(the_aDigitZeroes[0]); const sal_Int32 nLen = rText.getLength(); @@ -848,27 +848,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; } } |