diff options
author | Thomas Lange <tl@openoffice.org> | 2000-12-01 17:58:41 +0000 |
---|---|---|
committer | Thomas Lange <tl@openoffice.org> | 2000-12-01 17:58:41 +0000 |
commit | b5f7e74623b2b7bd6c7ef55cb2d8435ef3047617 (patch) | |
tree | 8931c3bbf01339246e108a0e1c3baadcccdacf7d /linguistic/source | |
parent | 871f5c4f64d9f237e6f082a12e85f7cdbee186d1 (diff) |
#80516# DirEntry removed
Diffstat (limited to 'linguistic/source')
-rw-r--r-- | linguistic/source/dicimp.cxx | 30 | ||||
-rw-r--r-- | linguistic/source/dicimp.hxx | 5 | ||||
-rw-r--r-- | linguistic/source/dlistimp.cxx | 63 |
3 files changed, 52 insertions, 46 deletions
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 98ed3facb118..fe110a44e8eb 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dicimp.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kso $ $Date: 2000-12-01 08:08:15 $ + * last change: $Author: tl $ $Date: 2000-12-01 18:58:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,6 +98,9 @@ #include <ucbhelper/content.hxx> #endif +#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_ +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#endif #include <com/sun/star/linguistic2/DictionaryType.hpp> #include <com/sun/star/linguistic2/DictionaryEventFlags.hpp> @@ -151,15 +154,18 @@ DictionaryNeo::DictionaryNeo(const OUString &rName, if (rMainURL.getLength() > 0) { - // get DirEntry to object - INetURLObject aURLObject; - aURLObject.SetSmartProtocol( INET_PROT_FILE ); - aURLObject.SetURL( rMainURL ); - DBG_ASSERT(!aURLObject.HasError(), "lng : invalid URL"); - String aPathToFile( aURLObject.PathToFileName() ); - DirEntry aDest( aPathToFile ); - - if (!aDest.Exists()) + BOOL bExists = FALSE; + try + { + ::ucb::Content aTestContent( rMainURL , + Reference< ::com::sun::star::ucb::XCommandEnvironment >()); + bExists = aTestContent.isDocument(); + } + catch(...) + { + bExists = FALSE; + } + if (!bExists) { //! create physical representation of an **empty** dictionary //! that could be searched for (see DicList::searchForDictionaries) @@ -946,7 +952,7 @@ BOOL DictionaryNeo::isReadonly_Impl() Any aAny( aContent.getPropertyValue( A2OU( "IsReadOnly" ) ) ); aAny >>= bRes; } - catch (::com::sun::star::ucb::ContentCreationException &) + catch (::ucb::ContentCreationException &) { bRes = TRUE; } diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx index 04988b3bc606..76e87000d1b2 100644 --- a/linguistic/source/dicimp.hxx +++ b/linguistic/source/dicimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dicimp.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-11-17 12:37:32 $ + * last change: $Author: tl $ $Date: 2000-12-01 18:58:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -69,6 +69,7 @@ #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type #include <cppuhelper/implbase3.hxx> // helper for implementations +#include <cppuhelper/implbase1.hxx> // helper for implementations #ifndef _CPPUHELPER_INTERFACECONTAINER_H_ #include <cppuhelper/interfacecontainer.h> diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index 1f0d7313e941..22a6aa4d8d18 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dlistimp.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: tl $ $Date: 2000-11-29 16:07:14 $ + * last change: $Author: tl $ $Date: 2000-12-01 18:58:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,10 @@ #endif #include <cppuhelper/factory.hxx> // helper for factories +#ifndef _UNOTOOLS_LOCALFILEHELPER_HXX +#include <unotools/localfilehelper.hxx> +#endif + #ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_ #include <com/sun/star/frame/XStorable.hpp> #endif @@ -124,7 +128,7 @@ static const sal_Char* aVerStr5 = "WBSWG5"; // forward dedclarations -static BOOL IsVers2( const DirEntry& rPathName, USHORT& nLng, BOOL& bNeg, +static BOOL IsVers2( const String& rFileURL, USHORT& nLng, BOOL& bNeg, sal_Char* pWordBuf); static void AddInternal( Reference< XDictionary > &rDic, @@ -443,26 +447,20 @@ void DicList::searchForDictionaries( ActDicArray &rDicList, { MutexGuard aGuard( GetLinguMutex() ); - // get DirEntry for dictionaries directory - DirEntry aDicDir( rDicDir ); - aDicDir.ToAbs(); - - // Alle auf Platte stehenden Dictionary-Names einlesen - String aDirTmp( String::CreateFromAscii( "*.*" ) ); - aDicDir += DirEntry( aDirTmp ); - Dir aDir(aDicDir, FSYS_KIND_FILE, FSYS_SORT_END); + const Sequence< OUString > aDirCnt( utl::LocalFileHelper(). + GetFolderContents( rDicDir, FALSE ) ); + const OUString *pDirCnt = aDirCnt.getConstArray(); + INT32 nEntries = aDirCnt.getLength(); String aDCN( String::CreateFromAscii( "dcn" ) ); String aDCP( String::CreateFromAscii( "dcp" ) ); - INetURLObject aURLObject; - aURLObject.SetSmartProtocol( INET_PROT_FILE ); - for (USHORT i=0; i < aDir.Count(); ++i) + for (INT32 i = 0; i < nEntries; ++i) { - String aName(aDir[i].GetName()); + String aName( pDirCnt[i] ); USHORT nLang = LANGUAGE_NONE; BOOL bNeg = FALSE; - if(!::IsVers2(aDir[i], nLang, bNeg, aBuf)) + if(!::IsVers2( aName, nLang, bNeg, aBuf )) { // Wenn kein xub_StrLen nPos = aName.Search('.'); @@ -482,6 +480,9 @@ void DicList::searchForDictionaries( ActDicArray &rDicList, // INT16 nSystemLanguage = ::GetSystemLanguage(); String aTmp1 = ToLower( aName, nSystemLanguage ); + xub_StrLen nPos = aTmp1.SearchBackward( '/' ); + if (STRING_NOTFOUND != nPos) + aTmp1 = aTmp1.Copy( nPos + 1 ); String aTmp2; INT32 j; INT32 nCount = rDicList.Count(); @@ -494,16 +495,15 @@ void DicList::searchForDictionaries( ActDicArray &rDicList, } if(j >= nCount) // dictionary not yet in DicList { - String aFileName (rDicDir); - aFileName += DirEntry::GetAccessDelimiter(); - aFileName += aName; - aURLObject.SetSmartURL( aFileName ); - DBG_ASSERT(!aURLObject.HasError(), "lng : invalid URL"); + String rDicURL( aName ); + xub_StrLen nPos = aName.SearchBackward( '/' ); + if (STRING_NOTFOUND != nPos) + aName = aName.Copy( nPos + 1 ); DictionaryType eType = bNeg ? DictionaryType_NEGATIVE : DictionaryType_POSITIVE; Reference< XDictionary > xDic = new DictionaryNeo( aName, nLang, eType, - aURLObject.GetMainURL() ); + rDicURL ); addDictionary( xDic ); nCount++; @@ -936,25 +936,24 @@ static void AddUserData( const Reference< XDictionary > &rDic ) #pragma optimize("ge",off) -static BOOL IsVers2( const DirEntry& rPathName, USHORT& nLng, BOOL& bNeg, +static BOOL IsVers2( const String& rFileURL, USHORT& nLng, BOOL& bNeg, sal_Char* pWordBuf) { + if (rFileURL.Len() == 0) + return FALSE; + String aDIC( String::CreateFromAscii( aDicExt ) ); - String aExt(rPathName.GetExtension()); + String aExt; + xub_StrLen nPos = rFileURL.SearchBackward( '.' ); + if (STRING_NOTFOUND != nPos) + aExt = rFileURL.Copy( nPos + 1 ); aExt.ToLowerAscii(); if(aExt != aDIC) return FALSE; - // get binary files URL - INetURLObject aURLObj; - aURLObj.SetSmartProtocol( INET_PROT_FILE ); - aURLObj.SetSmartURL( rPathName.GetFull() ); - String aFileURL( aURLObj.GetMainURL() ); - // get stream to be used - SfxMedium aMedium( aFileURL, - STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE ); + SfxMedium aMedium( rFileURL, STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE ); aMedium.SetTransferPriority( SFX_TFPRIO_SYNCHRON ); SvStream *pStream = aMedium.GetInStream(); if (!pStream || pStream->GetError()) |