summaryrefslogtreecommitdiff
path: root/linguistic/source/dlistimp.cxx
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-10-06 12:34:07 +0200
committerMathias Bauer <mba@openoffice.org>2009-10-06 12:34:07 +0200
commit7e01bc8d28ffefd4539a5eae2587e1f7da0999e7 (patch)
tree852197240d21648f8106b1b4f361f77e5fac7148 /linguistic/source/dlistimp.cxx
parentbff284e216792b8d2a4e498beaba806eeddf844a (diff)
#i103496#: removes sfx2 dependency from linguistic
Diffstat (limited to 'linguistic/source/dlistimp.cxx')
-rw-r--r--linguistic/source/dlistimp.cxx37
1 files changed, 29 insertions, 8 deletions
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 <osl/file.hxx>
#include <tools/fsys.hxx>
@@ -41,16 +38,22 @@
#include <i18npool/mslangid.hxx>
#include <unotools/pathoptions.hxx>
#include <unotools/useroptions.hxx>
-#include <sfx2/docfile.hxx>
-#include <vcl/svapp.hxx>
#include <cppuhelper/factory.hxx> // helper for factories
#include <unotools/localfilehelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/ucbstreamhelper.hxx>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/linguistic2/DictionaryEventFlags.hpp>
#include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+
+#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;