summaryrefslogtreecommitdiff
path: root/linguistic/source/dlistimp.cxx
diff options
context:
space:
mode:
authorThomas Lange <tl@openoffice.org>2009-09-29 14:30:58 +0000
committerThomas Lange <tl@openoffice.org>2009-09-29 14:30:58 +0000
commit99e0c16a598611c7bb7e8d0fa1afffcf428e2f92 (patch)
tree8c0a3afdf3a2b21de462d1290a60acf15cb3f56b /linguistic/source/dlistimp.cxx
parentd86ed27c5d8b22f5c0fe2094061ecc9bec07f2af (diff)
#i105421# get rid of sfx2
Diffstat (limited to 'linguistic/source/dlistimp.cxx')
-rw-r--r--linguistic/source/dlistimp.cxx48
1 files changed, 35 insertions, 13 deletions
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 4da58e270991..6d247a16b605 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -30,21 +30,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_linguistic.hxx"
-#include "dlistimp.hxx"
-#include "dicimp.hxx"
-#include "lngopt.hxx"
+#include <cppuhelper/factory.hxx>
+#include <i18npool/mslangid.hxx>
#include <osl/file.hxx>
+#include <svtools/pathoptions.hxx>
+#include <svtools/useroptions.hxx>
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
#include <tools/urlobj.hxx>
-#include <i18npool/mslangid.hxx>
-#include <svtools/pathoptions.hxx>
-#include <svtools/useroptions.hxx>
-#include <sfx2/docfile.hxx>
-#include <vcl/svapp.hxx>
-#include <cppuhelper/factory.hxx> // helper for factories
#include <unotools/localfilehelper.hxx>
+#include <unotools/processfactory.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/uno/Reference.h>
@@ -52,6 +52,11 @@
#include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
+#include "defs.hxx"
+#include "dlistimp.hxx"
+#include "dicimp.hxx"
+#include "lngopt.hxx"
+
//using namespace utl;
using namespace osl;
using namespace rtl;
@@ -929,11 +934,28 @@ static BOOL IsVers2OrNewer( const String& rFileURL, USHORT& nLng, BOOL& bNeg )
if(aExt != aDIC)
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( utl::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;