From 7e01bc8d28ffefd4539a5eae2587e1f7da0999e7 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Tue, 6 Oct 2009 12:34:07 +0200 Subject: #i103496#: removes sfx2 dependency from linguistic --- linguistic/source/dlistimp.cxx | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'linguistic/source/dlistimp.cxx') diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index fea10319a99c..80c61e64001b 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -30,9 +30,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_linguistic.hxx" -#include "dlistimp.hxx" -#include "dicimp.hxx" -#include "lngopt.hxx" #include #include @@ -41,16 +38,22 @@ #include #include #include -#include -#include #include // helper for factories #include +#include +#include #include #include #include #include #include #include +#include + +#include "defs.hxx" +#include "dlistimp.hxx" +#include "dicimp.hxx" +#include "lngopt.hxx" //using namespace utl; using namespace osl; @@ -930,10 +933,28 @@ static BOOL IsVers2OrNewer( const String& rFileURL, USHORT& nLng, BOOL& bNeg ) return FALSE; // get stream to be used - SfxMedium aMedium( rFileURL, STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE ); - SvStream *pStream = aMedium.GetInStream(); + uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() ); + + // get XInputStream stream + uno::Reference< io::XInputStream > xStream; + try + { + uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance( + A2OU( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW ); + xStream = xAccess->openFileRead( rFileURL ); + } + catch (uno::Exception & e) + { + DBG_ASSERT( 0, "failed to get input stream" ); + (void) e; + } + DBG_ASSERT( xStream.is(), "failed to get stream for read" ); + if (!xStream.is()) + return FALSE; + + SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); - int nDicVersion = ReadDicVersion (pStream, nLng, bNeg); + int nDicVersion = ReadDicVersion(pStream, nLng, bNeg); if (2 == nDicVersion || nDicVersion >= 5) return TRUE; -- cgit