diff options
author | László Németh <nemeth@numbertext.org> | 2018-01-04 12:18:28 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2018-01-05 02:01:16 +0100 |
commit | c8fbce439db78dd85295833df494a651bd64dcd4 (patch) | |
tree | 96cf56a8629a5bbca16a2b3feedb58f50ebda4f8 /linguistic/source/dlistimp.cxx | |
parent | 6247c966942a0e43320a234302a67c1f92c2eea7 (diff) |
Add optional title: field to user dictionaries
LibreOffice stores the title of an user dictionary
only in its file name, but special characters in
file names can result configuration problem for user
dictionaries shipped with LibreOffice.
Optional "title:" field of user dictionaries
supports custom titles with spaces and other UTF-8
characters.
Change-Id: Idbc4c41a2e08f50cfc0fc0d25e960084f5773bec
Reviewed-on: https://gerrit.libreoffice.org/47397
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'linguistic/source/dlistimp.cxx')
-rw-r--r-- | linguistic/source/dlistimp.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index b2a63d6e9480..cdace82de2c6 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -52,7 +52,7 @@ using namespace com::sun::star::linguistic2; using namespace linguistic; -static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& bNeg ); +static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& bNeg, OUString& aDicName ); static void AddInternal( const uno::Reference< XDictionary > &rDic, const OUString& rNew ); @@ -294,8 +294,9 @@ void DicList::SearchForDictionaries( OUString aURL( pDirCnt[i] ); LanguageType nLang = LANGUAGE_NONE; bool bNeg = false; + OUString aDicTitle = ""; - if(!::IsVers2OrNewer( aURL, nLang, bNeg )) + if(!::IsVers2OrNewer( aURL, nLang, bNeg, aDicTitle )) { // When not sal_Int32 nPos = aURL.indexOf('.'); @@ -335,7 +336,7 @@ void DicList::SearchForDictionaries( DictionaryType eType = bNeg ? DictionaryType_NEGATIVE : DictionaryType_POSITIVE; uno::Reference< XDictionary > xDic = - new DictionaryNeo( aDicName, nLang, eType, aURL, bIsWriteablePath ); + new DictionaryNeo( aDicTitle.isEmpty() ? aDicName : aDicTitle, nLang, eType, aURL, bIsWriteablePath ); addDictionary( xDic ); nCount++; @@ -794,7 +795,7 @@ static void AddUserData( const uno::Reference< XDictionary > &rDic ) } } -static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& bNeg ) +static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& bNeg, OUString& aDicName ) { if (rFileURL.isEmpty()) return false; @@ -826,7 +827,7 @@ static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); - int nDicVersion = ReadDicVersion(pStream, nLng, bNeg); + int nDicVersion = ReadDicVersion(pStream, nLng, bNeg, aDicName); return 2 == nDicVersion || nDicVersion >= 5; } |