diff options
Diffstat (limited to 'linguistic')
-rw-r--r-- | linguistic/inc/linguistic/misc.hxx | 15 | ||||
-rw-r--r-- | linguistic/inc/linguistic/spelldta.hxx | 10 | ||||
-rw-r--r-- | linguistic/source/misc.cxx | 88 | ||||
-rw-r--r-- | linguistic/source/misc2.cxx | 64 | ||||
-rw-r--r-- | linguistic/source/spelldta.cxx | 52 |
5 files changed, 1 insertions, 228 deletions
diff --git a/linguistic/inc/linguistic/misc.hxx b/linguistic/inc/linguistic/misc.hxx index 7699735c971e..da2415948b02 100644 --- a/linguistic/inc/linguistic/misc.hxx +++ b/linguistic/inc/linguistic/misc.hxx @@ -80,7 +80,7 @@ namespace linguistic #define A2OU(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( x )) /// Flags to be used with the multi-path related functions -/// @see GetDictionaryPaths, GetLinguisticPaths +/// @see GetDictionaryPaths #define PATH_FLAG_INTERNAL 0x01 #define PATH_FLAG_USER 0x02 #define PATH_FLAG_WRITABLE 0x04 @@ -99,10 +99,6 @@ LNG_DLLPUBLIC ::osl::Mutex& GetLinguMutex(); LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang ); -rtl_TextEncoding GetTextEncoding( sal_Int16 nLanguage ); - -rtl::OUString StripTrailingChars( rtl::OUString &rTxt, sal_Unicode cChar ); - sal_Int32 LevDistance( const rtl::OUString &rTxt1, const rtl::OUString &rTxt2 ); ::com::sun::star::lang::Locale @@ -114,9 +110,6 @@ LNG_DLLPUBLIC LanguageType ::com::sun::star::lang::Locale& LanguageToLocale( ::com::sun::star::lang::Locale& rLocale, LanguageType eLang ); -::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > - LangSeqToLocaleSeq( const ::com::sun::star::uno::Sequence< sal_Int16 > &rLangSeq ); - ::com::sun::star::uno::Sequence< sal_Int16 > LocaleSeqToLangSeq( ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > &rLocaleSeq ); @@ -131,17 +124,11 @@ sal_Bool FileExists( const String &rURL ); ::rtl::OUString GetDictionaryWriteablePath(); ::com::sun::star::uno::Sequence< ::rtl::OUString > GetDictionaryPaths( sal_Int16 nPathFlags = PATH_FLAG_ALL ); -::com::sun::star::uno::Sequence< ::rtl::OUString > GetLinguisticPaths( sal_Int16 nPathFlags = PATH_FLAG_ALL ); /// @returns an URL for a new and writable dictionary rDicName. /// The URL will point to the path given by 'GetDictionaryWriteablePath' LNG_DLLPUBLIC String GetWritableDictionaryURL( const String &rDicName ); -// looks for the specified file in the list of paths. -// In case of multiple occurrences only the first found is returned. -String SearchFileInPaths( const String &rFile, const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rPaths ); - - LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( const rtl::OUString &rTxt, sal_Int32 nPos ); ::com::sun::star::uno::Reference< diff --git a/linguistic/inc/linguistic/spelldta.hxx b/linguistic/inc/linguistic/spelldta.hxx index 81ff61791b30..afc8fab96564 100644 --- a/linguistic/inc/linguistic/spelldta.hxx +++ b/linguistic/inc/linguistic/spelldta.hxx @@ -49,16 +49,6 @@ namespace com { namespace sun { namespace star { namespace linguistic { -/////////////////////////////////////////////////////////////////////////// - -::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSpellAlternatives > - MergeProposals( - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSpellAlternatives > &rxAlt1, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSpellAlternatives > &rxAlt2 ); - ::com::sun::star::uno::Sequence< ::rtl::OUString > MergeProposalSeqs( ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt1, diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 2f2df5e2f4a4..0bc393605752 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -102,85 +102,12 @@ LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang ) return aLclDtaWrp; } - -/** - returns text-encoding used for ByteString unicode String conversion - */ -rtl_TextEncoding GetTextEncoding( sal_Int16 nLanguage ) -{ - DBG_ASSERT( nLanguage != LANGUAGE_NONE, "invalid language argument" ); - static sal_Int16 nLastLanguage = LANGUAGE_NONE; - - // set default value for unknown languages - static rtl_TextEncoding nEncoding = RTL_TEXTENCODING_DONTKNOW; - - if (nLastLanguage != nLanguage) - { - //!! IPR uses textencodings Latin-1, Latin-2, Latin-5 and Latin-7 !! - - nLastLanguage = nLanguage; - switch (nLanguage) - { - case LANGUAGE_GERMAN : - case LANGUAGE_GERMAN_SWISS : - case LANGUAGE_ENGLISH_US : - case LANGUAGE_ENGLISH_UK : - case LANGUAGE_FRENCH : - case LANGUAGE_ITALIAN : - case LANGUAGE_SPANISH : - case LANGUAGE_CATALAN : - case LANGUAGE_PORTUGUESE : - case LANGUAGE_PORTUGUESE_BRAZILIAN : - case LANGUAGE_DANISH : - case LANGUAGE_DUTCH : - case LANGUAGE_SWEDISH : - case LANGUAGE_FINNISH : - case LANGUAGE_NORWEGIAN_BOKMAL : - case LANGUAGE_NORWEGIAN_NYNORSK : - case LANGUAGE_AFRIKAANS : - case LANGUAGE_ENGLISH_EIRE : - case LANGUAGE_ENGLISH_AUS : -#ifdef WNT - nEncoding = RTL_TEXTENCODING_MS_1252; break; -#else - nEncoding = RTL_TEXTENCODING_ISO_8859_1; break; -#endif - case LANGUAGE_CZECH : - case LANGUAGE_HUNGARIAN : - case LANGUAGE_POLISH : -#ifdef WNT - nEncoding = RTL_TEXTENCODING_MS_1250; break; -#else - nEncoding = RTL_TEXTENCODING_ISO_8859_2; break; -#endif - case LANGUAGE_RUSSIAN : -#ifdef WNT - nEncoding = RTL_TEXTENCODING_MS_1251; break; -#else - nEncoding = RTL_TEXTENCODING_ISO_8859_5; break; -#endif - case LANGUAGE_GREEK : -#ifdef WNT - nEncoding = RTL_TEXTENCODING_MS_1253; break; -#else - nEncoding = RTL_TEXTENCODING_ISO_8859_7; break; -#endif - default: - DBG_ASSERT( 0, "unexpected language" ); - } - } - - return nEncoding; -} - - static inline sal_Int32 Minimum( sal_Int32 n1, sal_Int32 n2, sal_Int32 n3 ) { sal_Int32 nMin = n1 < n2 ? n1 : n2; return nMin < n3 ? nMin : n3; } - class IntArray2D { private: @@ -481,21 +408,6 @@ Locale CreateLocale( LanguageType eLang ) return aLocale; } -uno::Sequence< Locale > LangSeqToLocaleSeq( const uno::Sequence< sal_Int16 > &rLangSeq ) -{ - const sal_Int16 *pLang = rLangSeq.getConstArray(); - sal_Int32 nCount = rLangSeq.getLength(); - - uno::Sequence< Locale > aLocales( nCount ); - Locale *pLocale = aLocales.getArray(); - for (sal_Int32 i = 0; i < nCount; ++i) - { - LanguageToLocale( pLocale[i], pLang[ i ] ); - } - - return aLocales; -} - uno::Sequence< sal_Int16 > LocaleSeqToLangSeq( uno::Sequence< Locale > &rLocaleSeq ) { diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx index 6895eae9bff8..4bfcb74e9551 100644 --- a/linguistic/source/misc2.cxx +++ b/linguistic/source/misc2.cxx @@ -71,21 +71,6 @@ sal_Bool FileExists( const String &rMainURL ) return bExists; } - -rtl::OUString StripTrailingChars( rtl::OUString &rTxt, sal_Unicode cChar ) -{ - sal_Int32 nTrailing = 0; - sal_Int32 nTxtLen = rTxt.getLength(); - sal_Int32 nIdx = nTxtLen - 1; - while (nIdx >= 0 && rTxt[ nIdx-- ] == cChar) - ++nTrailing; - - rtl::OUString aRes( rTxt.copy( nTxtLen - nTrailing ) ); - rTxt = rTxt.copy( 0, nTxtLen - nTrailing ); - return aRes; -} - - static uno::Sequence< rtl::OUString > GetMultiPaths_Impl( const rtl::OUString &rPathPrefix, sal_Int16 nPathFlags ) @@ -166,11 +151,6 @@ uno::Sequence< rtl::OUString > GetDictionaryPaths( sal_Int16 nPathFlags ) return GetMultiPaths_Impl( A2OU("Dictionary"), nPathFlags ); } -uno::Sequence< rtl::OUString > GetLinguisticPaths( sal_Int16 nPathFlags ) -{ - return GetMultiPaths_Impl( A2OU("Linguistic"), nPathFlags ); -} - String GetWritableDictionaryURL( const String &rDicName ) { // new user writable dictionaries should be created in the 'writable' path @@ -190,50 +170,6 @@ String GetWritableDictionaryURL( const String &rDicName ) return aURLObj.GetMainURL( INetURLObject::NO_DECODE ); } - -String SearchFileInPaths( - const String &rFile, - const uno::Sequence< rtl::OUString > &rPaths ) -{ - //!! see also SvtPathOptions::SearchFile for the riginal code - - String aRes; - - // check in all paths... - const sal_Int32 nPaths = rPaths.getLength(); - for (sal_Int32 k = 0; k < nPaths; ++k) - { - sal_Bool bIsURL = sal_True; - INetURLObject aObj( rPaths[k] ); - if ( aObj.HasError() ) - { - bIsURL = sal_False; - String aURL; - if ( utl::LocalFileHelper::ConvertPhysicalNameToURL( rPaths[k], aURL ) ) - aObj.SetURL( aURL ); - } - - xub_StrLen i, nCount = rFile.GetTokenCount( '/' ); - for ( i = 0; i < nCount; ++i ) - aObj.insertName( rFile.GetToken( i, '/' ) ); - bool bRet = ::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); - - if ( bRet ) - { - if ( !bIsURL ) - ::utl::LocalFileHelper::ConvertURLToPhysicalName( - aObj.GetMainURL( INetURLObject::NO_DECODE ), aRes ); - else - aRes = aObj.GetMainURL( INetURLObject::NO_DECODE ); - break; - } - } - - return aRes; -} - - } // namespace linguistic - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx index ced7de88ed0f..c197fea767e6 100644 --- a/linguistic/source/spelldta.cxx +++ b/linguistic/source/spelldta.cxx @@ -55,60 +55,8 @@ using ::rtl::OUString; namespace linguistic { - - #define MAX_PROPOSALS 40 -Reference< XSpellAlternatives > MergeProposals( - Reference< XSpellAlternatives > &rxAlt1, - Reference< XSpellAlternatives > &rxAlt2) -{ - Reference< XSpellAlternatives > xMerged; - - if (!rxAlt1.is()) - xMerged = rxAlt2; - else if (!rxAlt2.is()) - xMerged = rxAlt1; - else - { - sal_Int32 nAltCount1 = rxAlt1->getAlternativesCount(); - Sequence< OUString > aAlt1( rxAlt1->getAlternatives() ); - const OUString *pAlt1 = aAlt1.getConstArray(); - - sal_Int32 nAltCount2 = rxAlt2->getAlternativesCount(); - Sequence< OUString > aAlt2( rxAlt2->getAlternatives() ); - const OUString *pAlt2 = aAlt2.getConstArray(); - - sal_Int32 nCountNew = Min( nAltCount1 + nAltCount2, (sal_Int32) MAX_PROPOSALS ); - Sequence< OUString > aAltNew( nCountNew ); - OUString *pAltNew = aAltNew.getArray(); - - sal_Int32 nIndex = 0; - sal_Int32 i = 0; - for (int j = 0; j < 2; j++) - { - sal_Int32 nCount = j == 0 ? nAltCount1 : nAltCount2; - const OUString *pAlt = j == 0 ? pAlt1 : pAlt2; - for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++) - { - if (pAlt[i].getLength()) - pAltNew[ nIndex++ ] = pAlt[ i ]; - } - } - DBG_ASSERT(nIndex == nCountNew, "lng : wrong number of proposals"); - - SpellAlternatives *pSpellAlt = new SpellAlternatives; - pSpellAlt->SetWordLanguage( rxAlt1->getWord(), - LocaleToLanguage( rxAlt1->getLocale() ) ); - pSpellAlt->SetFailureType( rxAlt1->getFailureType() ); - pSpellAlt->SetAlternatives( aAltNew ); - xMerged = pSpellAlt; - } - - return xMerged; -} - - sal_Bool SeqHasEntry( const Sequence< OUString > &rSeq, const OUString &rTxt) |