summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-01-05 13:09:26 +0100
committersb <sb@openoffice.org>2010-01-05 13:09:26 +0100
commita44418ec3038019bfdffa8e1df3a0a080f74b0a9 (patch)
tree6d6c5dd4243b39d2e0c35835a656cafe0a30f066 /linguistic
parentd9164f354a8951ad220d5ae937517228296d1922 (diff)
parent0de34b05f3c1a0409d23b63b9e69d4d7abbe1090 (diff)
sb111: merged in DEV300_m68
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/inc/lngprops.hxx2
-rw-r--r--linguistic/inc/misc.hxx3
-rw-r--r--linguistic/prj/build.lst2
-rw-r--r--linguistic/source/convdic.cxx97
-rw-r--r--linguistic/source/convdiclist.cxx8
-rw-r--r--linguistic/source/convdiclist.hxx2
-rw-r--r--linguistic/source/convdicxml.cxx3
-rw-r--r--linguistic/source/convdicxml.hxx2
-rw-r--r--linguistic/source/defs.hxx7
-rw-r--r--linguistic/source/dicimp.cxx103
-rw-r--r--linguistic/source/dicimp.hxx3
-rw-r--r--linguistic/source/dlistimp.cxx41
-rw-r--r--linguistic/source/gciterator.cxx6
-rw-r--r--linguistic/source/grammarchecker.cxx1
-rw-r--r--linguistic/source/hhconvdic.cxx1
-rw-r--r--linguistic/source/hyphdsp.cxx2
-rw-r--r--linguistic/source/hyphdta.cxx2
-rw-r--r--linguistic/source/lngopt.cxx3
-rw-r--r--linguistic/source/lngopt.hxx8
-rw-r--r--linguistic/source/lngsvcmgr.cxx19
-rw-r--r--linguistic/source/lngsvcmgr.hxx2
-rw-r--r--linguistic/source/makefile.mk8
-rw-r--r--linguistic/source/misc.cxx9
-rw-r--r--linguistic/source/misc2.cxx2
-rw-r--r--linguistic/source/spelldsp.cxx2
-rw-r--r--linguistic/source/thesdsp.cxx2
26 files changed, 197 insertions, 143 deletions
diff --git a/linguistic/inc/lngprops.hxx b/linguistic/inc/lngprops.hxx
index 2714c439d18e..6903d3f1d897 100644
--- a/linguistic/inc/lngprops.hxx
+++ b/linguistic/inc/lngprops.hxx
@@ -31,7 +31,7 @@
#ifndef _LINGUISTIC_LNGPROPS_HHX_
#define _LINGUISTIC_LNGPROPS_HHX_
-#include <svtools/linguprops.hxx>
+#include <unotools/linguprops.hxx>
// maximal number of suggestions to be returned in spelling context-menu
// (may not include results added by looking up user dictionaries)
diff --git a/linguistic/inc/misc.hxx b/linguistic/inc/misc.hxx
index 6f06948db4af..683641f045a5 100644
--- a/linguistic/inc/misc.hxx
+++ b/linguistic/inc/misc.hxx
@@ -44,13 +44,12 @@
#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
#include <cppuhelper/implbase1.hxx> // helper for implementations
-#include <svtools/pathoptions.hxx>
+#include <unotools/pathoptions.hxx>
#include <i18npool/lang.h>
#include <tools/string.hxx>
#include <unotools/charclass.hxx>
#include <osl/thread.h>
#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
namespace com { namespace sun { namespace star { namespace beans {
class XPropertySet;
diff --git a/linguistic/prj/build.lst b/linguistic/prj/build.lst
index 0b8f5f62fb1c..8e09e3fd4226 100644
--- a/linguistic/prj/build.lst
+++ b/linguistic/prj/build.lst
@@ -1,4 +1,4 @@
-lg linguistic : xmloff sfx2 NULL
+lg linguistic : svl xmloff ucbhelper vos comphelper ICU:icu NULL
lg linguistic usr1 - all lg_mkout NULL
lg linguistic\prj get - all lg_prj NULL
lg linguistic\inc nmake - all lg_inc NULL
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index c58e7d142d47..068f9147f426 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -30,19 +30,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_linguistic.hxx"
+
+#include <cppuhelper/factory.hxx>
#include <i18npool/lang.h>
-#include <tools/urlobj.hxx>
+#include <osl/mutex.hxx>
#include <tools/debug.hxx>
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
-#include <tools/string.hxx>
#include <tools/stream.hxx>
-#include <sfx2/docfile.hxx>
-#include <osl/mutex.hxx>
-#include <unotools/processfactory.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
+#include <unotools/processfactory.hxx>
+#include <unotools/streamwrap.hxx>
+#include <unotools/ucbstreamhelper.hxx>
-#include <cppuhelper/factory.hxx> // helper for factories
#include <com/sun/star/linguistic2/XConversionDictionary.hpp>
#include <com/sun/star/linguistic2/ConversionDictionaryType.hpp>
#include <com/sun/star/linguistic2/XConversionPropertyType.hpp>
@@ -50,18 +52,19 @@
#include <com/sun/star/util/XFlushable.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/EventObject.hpp>
-#ifndef _COM_SUN_STAR_UNO_REFERENCE_HPP_
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/uno/Reference.h>
-#endif
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/util/XFlushListener.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
-#include <unotools/streamwrap.hxx>
#include "convdic.hxx"
@@ -84,28 +87,31 @@ using namespace linguistic;
///////////////////////////////////////////////////////////////////////////
-
void ReadThroughDic( const String &rMainURL, ConvDicXMLImport &rImport )
{
if (rMainURL.Len() == 0)
return;
-
- // get stream to be used
DBG_ASSERT(!INetURLObject( rMainURL ).HasError(), "invalid URL");
- SfxMedium aMedium( rMainURL, STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE );
- SvStream *pStream = aMedium.GetInStream();
- DBG_ASSERT( pStream, "input stream missing" );
- if (!pStream || pStream->GetError())
- return;
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory(
- utl::getProcessServiceFactory() );
- DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" );
- if (!xServiceFactory.is())
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( utl::getProcessServiceFactory() );
+
+ // get xInputStream stream
+ uno::Reference< io::XInputStream > xIn;
+ try
+ {
+ uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance(
+ A2OU( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+ xIn = xAccess->openFileRead( rMainURL );
+ }
+ catch (uno::Exception & e)
+ {
+ DBG_ASSERT( 0, "failed to get input stream" );
+ (void) e;
+ }
+ if (!xIn.is())
return;
- uno::Reference< io::XInputStream > xIn = new utl::OInputStreamWrapper( *pStream );
- DBG_ASSERT( xIn.is(), "input stream missing" );
+ SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xIn ) );
ULONG nError = sal::static_int_cast< ULONG >(-1);
@@ -159,7 +165,6 @@ void ReadThroughDic( const String &rMainURL, ConvDicXMLImport &rImport )
}
}
-
BOOL IsConvDic( const String &rFileURL, INT16 &nLang, sal_Int16 &nConvType )
{
BOOL bRes = FALSE;
@@ -259,12 +264,10 @@ void ConvDic::Load()
//!! prevent function from being called recursively via HasEntry, AddEntry
bNeedEntries = FALSE;
-
ConvDicXMLImport *pImport = new ConvDicXMLImport( this, aMainURL );
//!! keep a first reference to ensure the lifetime of the object !!
uno::Reference< XInterface > xRef( (document::XFilter *) pImport, UNO_QUERY );
ReadThroughDic( aMainURL, *pImport ); // will implicitly add the entries
-
bIsModified = FALSE;
}
@@ -274,23 +277,29 @@ void ConvDic::Save()
DBG_ASSERT( !bNeedEntries, "saving while entries missing" );
if (aMainURL.Len() == 0 || bNeedEntries)
return;
-
DBG_ASSERT(!INetURLObject( aMainURL ).HasError(), "invalid URL");
- SfxMedium aMedium( aMainURL, STREAM_WRITE | STREAM_TRUNC | STREAM_SHARE_DENYALL,
- FALSE );
- aMedium.CreateTempFile(); // use temp file to write to...
- SvStream *pStream = aMedium.GetOutStream();
- DBG_ASSERT( pStream, "output stream missing" );
- if (!pStream || pStream->GetError())
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( utl::getProcessServiceFactory() );
+
+ // get XOutputStream stream
+ uno::Reference< io::XStream > xStream;
+ try
+ {
+ uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance(
+ A2OU( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+ xStream = xAccess->openFileReadWrite( aMainURL );
+ }
+ catch (uno::Exception & e)
+ {
+ DBG_ASSERT( 0, "failed to get input stream" );
+ (void) e;
+ }
+ if (!xStream.is())
return;
- uno::Reference< io::XOutputStream > xOut(
- new utl::OOutputStreamWrapper( *pStream ) );
- DBG_ASSERT( xOut.is(), "output stream missing" );
+
+ SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) );
// get XML writer
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory(
- utl::getProcessServiceFactory() );
uno::Reference< io::XActiveDataSource > xSaxWriter;
if (xServiceFactory.is())
{
@@ -306,27 +315,21 @@ void ConvDic::Save()
}
DBG_ASSERT( xSaxWriter.is(), "can't instantiate XML writer" );
- if (xSaxWriter.is() && xOut.is())
+ if (xSaxWriter.is() && xStream.is())
{
// connect XML writer to output stream
- xSaxWriter->setOutputStream( xOut );
+ xSaxWriter->setOutputStream( xStream->getOutputStream() );
// prepare arguments (prepend doc handler to given arguments)
uno::Reference< xml::sax::XDocumentHandler > xDocHandler( xSaxWriter, UNO_QUERY );
-
ConvDicXMLExport *pExport = new ConvDicXMLExport( *this, aMainURL, xDocHandler );
//!! keep a first(!) reference until everything is done to
//!! ensure the proper lifetime of the object
uno::Reference< document::XFilter > aRef( (document::XFilter *) pExport );
- sal_Bool bRet = pExport->Export( aMedium ); // write entries to file
+ sal_Bool bRet = pExport->Export(); // write entries to file
DBG_ASSERT( !pStream->GetError(), "I/O error while writing to stream" );
if (bRet)
- {
- // flush file, close it and release any lock
- aMedium.Close();
- aMedium.Commit();
bIsModified = FALSE;
- }
}
DBG_ASSERT( !bIsModified, "dictionary still modified after save. Save failed?" );
}
diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx
index ff68146834bf..831c67b7baa8 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -33,11 +33,9 @@
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
#include <tools/urlobj.hxx>
-#include <svtools/pathoptions.hxx>
-#include <svtools/useroptions.hxx>
-#include <svtools/lingucfg.hxx>
-#include <sfx2/docfile.hxx>
-#include <vcl/svapp.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/useroptions.hxx>
+#include <unotools/lingucfg.hxx>
#include <rtl/instance.hxx>
#include <cppuhelper/factory.hxx> // helper for factories
#include <unotools/localfilehelper.hxx>
diff --git a/linguistic/source/convdiclist.hxx b/linguistic/source/convdiclist.hxx
index 7a7f866a69a1..8467955b4d87 100644
--- a/linguistic/source/convdiclist.hxx
+++ b/linguistic/source/convdiclist.hxx
@@ -36,7 +36,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/interfacecontainer.h>
-#include <svtools/svarray.hxx>
+#include <svl/svarray.hxx>
#include <tools/debug.hxx>
#include "misc.hxx"
diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index 34133a4bc2f9..70ada335f57e 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -36,7 +36,6 @@
#include <tools/string.hxx>
#include <i18npool/mslangid.hxx>
#include <tools/stream.hxx>
-#include <sfx2/docfile.hxx>
#include <osl/mutex.hxx>
#include <unotools/processfactory.hxx>
#include <ucbhelper/content.hxx>
@@ -335,7 +334,7 @@ void ConvDicXMLRightTextContext_Impl::EndElement()
///////////////////////////////////////////////////////////////////////////
-sal_Bool ConvDicXMLExport::Export( SfxMedium & /*rMedium*/ )
+sal_Bool ConvDicXMLExport::Export()
{
sal_Bool bRet = sal_False;
diff --git a/linguistic/source/convdicxml.hxx b/linguistic/source/convdicxml.hxx
index 0746b5998589..f0a3ae4417d4 100644
--- a/linguistic/source/convdicxml.hxx
+++ b/linguistic/source/convdicxml.hxx
@@ -79,7 +79,7 @@ public:
void _ExportContent();
sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass );
- sal_Bool Export( SfxMedium &rMedium );
+ sal_Bool Export();
};
diff --git a/linguistic/source/defs.hxx b/linguistic/source/defs.hxx
index ca3a611c30ee..48b6dc6d82e7 100644
--- a/linguistic/source/defs.hxx
+++ b/linguistic/source/defs.hxx
@@ -36,10 +36,17 @@
#include <com/sun/star/linguistic2/XHyphenator.hpp>
#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <boost/shared_ptr.hpp>
+
+class SvStream;
+
+
///////////////////////////////////////////////////////////////////////////
#define A2OU(x) ::rtl::OUString::createFromAscii( x )
+typedef boost::shared_ptr< SvStream > SvStreamPtr;
+
namespace css = ::com::sun::star;
///////////////////////////////////////////////////////////////////////////
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 1555fd3df4d7..fa7dd0be3948 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -30,29 +30,30 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_linguistic.hxx"
-#include <i18npool/lang.h>
-#ifndef _DICIMP_HXX
+#include <cppuhelper/factory.hxx>
#include <dicimp.hxx>
-#endif
-#ifndef _HYPHIMP_HXX
#include <hyphdsp.hxx>
-#endif
-#include <tools/urlobj.hxx>
+#include <i18npool/lang.h>
+#include <i18npool/mslangid.hxx>
+#include <osl/mutex.hxx>
#include <tools/debug.hxx>
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
#include <tools/string.hxx>
-#include <sfx2/docfile.hxx>
-#include <osl/mutex.hxx>
+#include <tools/urlobj.hxx>
#include <unotools/processfactory.hxx>
-#include <i18npool/mslangid.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/linguistic2/DictionaryType.hpp>
#include <com/sun/star/linguistic2/DictionaryEventFlags.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+#include "defs.hxx"
-#include <cppuhelper/factory.hxx> // helper for factories
using namespace utl;
using namespace osl;
@@ -88,7 +89,7 @@ static sal_Bool getTag(const ByteString &rLine,
}
-INT16 ReadDicVersion( SvStream *pStream, USHORT &nLng, BOOL &bNeg )
+INT16 ReadDicVersion( SvStreamPtr &rpStream, USHORT &nLng, BOOL &bNeg )
{
// Sniff the header
INT16 nDicVersion;
@@ -97,13 +98,13 @@ INT16 ReadDicVersion( SvStream *pStream, USHORT &nLng, BOOL &bNeg )
nLng = LANGUAGE_NONE;
bNeg = FALSE;
- if (!pStream || pStream->GetError())
+ if (!rpStream.get() || rpStream->GetError())
return -1;
- sal_Size nSniffPos = pStream->Tell();
+ sal_Size nSniffPos = rpStream->Tell();
static sal_Size nVerOOo7Len = sal::static_int_cast< sal_Size >(strlen( pVerOOo7 ));
pMagicHeader[ nVerOOo7Len ] = '\0';
- if ((pStream->Read((void *) pMagicHeader, nVerOOo7Len) == nVerOOo7Len) &&
+ if ((rpStream->Read((void *) pMagicHeader, nVerOOo7Len) == nVerOOo7Len) &&
!strcmp(pMagicHeader, pVerOOo7))
{
sal_Bool bSuccess;
@@ -112,10 +113,10 @@ INT16 ReadDicVersion( SvStream *pStream, USHORT &nLng, BOOL &bNeg )
nDicVersion = 7;
// 1st skip magic / header line
- pStream->ReadLine(aLine);
+ rpStream->ReadLine(aLine);
// 2nd line: language all | en-US | pt-BR ...
- while (sal_True == (bSuccess = pStream->ReadLine(aLine)))
+ while (sal_True == (bSuccess = rpStream->ReadLine(aLine)))
{
ByteString aTagValue;
@@ -151,13 +152,13 @@ INT16 ReadDicVersion( SvStream *pStream, USHORT &nLng, BOOL &bNeg )
{
USHORT nLen;
- pStream->Seek (nSniffPos );
+ rpStream->Seek (nSniffPos );
- *pStream >> nLen;
+ *rpStream >> nLen;
if (nLen >= MAX_HEADER_LENGTH)
return -1;
- pStream->Read(pMagicHeader, nLen);
+ rpStream->Read(pMagicHeader, nLen);
pMagicHeader[nLen] = '\0';
// Check version magic
@@ -175,14 +176,14 @@ INT16 ReadDicVersion( SvStream *pStream, USHORT &nLng, BOOL &bNeg )
6 == nDicVersion)
{
// The language of the dictionary
- *pStream >> nLng;
+ *rpStream >> nLng;
if (VERS2_NOLANGUAGE == nLng)
nLng = LANGUAGE_NONE;
// Negative Flag
sal_Char nTmp;
- *pStream >> nTmp;
+ *rpStream >> nTmp;
bNeg = (BOOL)nTmp;
}
}
@@ -271,13 +272,27 @@ ULONG DictionaryNeo::loadEntries(const OUString &rMainURL)
if (rMainURL.getLength() == 0)
return 0;
- ULONG nErr = sal::static_int_cast< ULONG >(-1);
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( utl::getProcessServiceFactory() );
- // get stream to use
- SfxMedium aMedium( rMainURL, STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE );
- SvStream *pStream = aMedium.GetInStream();
- if (!pStream)
- return nErr;
+ // 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( rMainURL );
+ }
+ catch (uno::Exception & e)
+ {
+ DBG_ASSERT( 0, "failed to get input stream" );
+ (void) e;
+ }
+ if (!xStream.is())
+ return static_cast< ULONG >(-1);
+
+ SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) );
+
+ ULONG nErr = sal::static_int_cast< ULONG >(-1);
// Header einlesen
BOOL bNegativ;
@@ -285,6 +300,7 @@ ULONG DictionaryNeo::loadEntries(const OUString &rMainURL)
nDicVersion = ReadDicVersion(pStream, nLang, bNegativ);
if (0 != (nErr = pStream->GetError()))
return nErr;
+
nLanguage = nLang;
eDicType = bNegativ ? DictionaryType_NEGATIVE : DictionaryType_POSITIVE;
@@ -398,16 +414,29 @@ ULONG DictionaryNeo::saveEntries(const OUString &rURL)
if (rURL.getLength() == 0)
return 0;
+ DBG_ASSERT(!INetURLObject( rURL ).HasError(), "lng : invalid URL");
- ULONG nErr = sal::static_int_cast< ULONG >(-1);
+ uno::Reference< lang::XMultiServiceFactory > xServiceFactory( utl::getProcessServiceFactory() );
- DBG_ASSERT(!INetURLObject( rURL ).HasError(), "lng : invalid URL");
- SfxMedium aMedium( rURL, STREAM_WRITE | STREAM_TRUNC | STREAM_SHARE_DENYALL,
- FALSE );
- aMedium.CreateTempFile(); // use temp file to write to...
- SvStream *pStream = aMedium.GetOutStream();
- if (!pStream)
- return nErr;
+ // get XOutputStream stream
+ uno::Reference< io::XStream > xStream;
+ try
+ {
+ uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance(
+ A2OU( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+ xStream = xAccess->openFileReadWrite( rURL );
+ }
+ catch (uno::Exception & e)
+ {
+ DBG_ASSERT( 0, "failed to get input stream" );
+ (void) e;
+ }
+ if (!xStream.is())
+ return static_cast< ULONG >(-1);
+
+ SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) );
+
+ ULONG nErr = sal::static_int_cast< ULONG >(-1);
rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
if (nDicVersion >= 6)
@@ -500,10 +529,6 @@ ULONG DictionaryNeo::saveEntries(const OUString &rURL)
//! get return value before Stream is destroyed
ULONG nError = pStream->GetError();
- // flush file, close it and release any lock
- aMedium.Close();
- aMedium.Commit();
-
return nError;
}
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index 52eada08c486..917890bdd63c 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -42,6 +42,7 @@
#include <tools/string.hxx>
#include <tools/stream.hxx>
+#include "defs.hxx"
#include "misc.hxx"
@@ -49,7 +50,7 @@
#define DIC_MAX_ENTRIES 30000
-INT16 ReadDicVersion( SvStream *pStream, USHORT &nLng, BOOL &bNeg );
+INT16 ReadDicVersion( SvStreamPtr &rpStream, USHORT &nLng, BOOL &bNeg );
const String GetDicExtension();
///////////////////////////////////////////////////////////////////////////
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 4da58e270991..80c61e64001b 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -30,27 +30,30 @@
// 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>
#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 <unotools/pathoptions.hxx>
+#include <unotools/useroptions.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;
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index bb63e9bb8c8b..2697d5880b80 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -63,7 +63,6 @@
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/extract.hxx>
#include <cppuhelper/factory.hxx>
-#include <vcl/unohelp.hxx>
#include <i18npool/mslangid.hxx>
#include <unotools/processfactory.hxx>
@@ -790,7 +789,10 @@ sal_Int32 GrammarCheckingIterator::GetSuggestedEndOfSentence(
uno::Reference< i18n::XBreakIterator > xBreakIterator;
if (!m_xBreakIterator.is())
{
- m_xBreakIterator = vcl::unohelper::CreateBreakIterator();
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ if ( xMSF.is() )
+ xBreakIterator = uno::Reference < i18n::XBreakIterator >( xMSF->createInstance(
+ ::rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator") ), uno::UNO_QUERY );
}
sal_Int32 nTextLen = rText.getLength();
sal_Int32 nEndPosition = nTextLen;
diff --git a/linguistic/source/grammarchecker.cxx b/linguistic/source/grammarchecker.cxx
index 3d4953b8e17a..5985ffe7d27b 100644
--- a/linguistic/source/grammarchecker.cxx
+++ b/linguistic/source/grammarchecker.cxx
@@ -34,7 +34,6 @@
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/linguistic2/XGrammarChecker.hpp>
#include <com/sun/star/i18n/XBreakIterator.hpp>
-#include <vcl/unohelp.hxx>
#include <cppuhelper/implbase4.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
diff --git a/linguistic/source/hhconvdic.cxx b/linguistic/source/hhconvdic.cxx
index 7972c1b208c7..980aabb51bef 100644
--- a/linguistic/source/hhconvdic.cxx
+++ b/linguistic/source/hhconvdic.cxx
@@ -37,7 +37,6 @@
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
#include <tools/string.hxx>
-#include <sfx2/docfile.hxx>
#include <osl/mutex.hxx>
#include <unotools/processfactory.hxx>
#include <ucbhelper/content.hxx>
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index e1ebe970a44f..64907ab04f24 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -41,7 +41,7 @@
#include <i18npool/lang.h>
#include <unotools/localedatawrapper.hxx>
#include <tools/debug.hxx>
-#include <svtools/lngmisc.hxx>
+#include <svl/lngmisc.hxx>
#include <unotools/processfactory.hxx>
#include <osl/mutex.hxx>
diff --git a/linguistic/source/hyphdta.cxx b/linguistic/source/hyphdta.cxx
index 5286a6aada22..ea7d8e7c8233 100644
--- a/linguistic/source/hyphdta.cxx
+++ b/linguistic/source/hyphdta.cxx
@@ -39,7 +39,7 @@
#include <rtl/ustrbuf.hxx>
#include <tools/debug.hxx>
-#include <svtools/lngmisc.hxx>
+#include <svl/lngmisc.hxx>
#include <unotools/localedatawrapper.hxx>
//using namespace utl;
diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx
index 995b0686e2f8..6eb59fa09ef4 100644
--- a/linguistic/source/lngopt.cxx
+++ b/linguistic/source/lngopt.cxx
@@ -35,8 +35,7 @@
#include "lngprops.hxx"
#include "misc.hxx"
#include <tools/debug.hxx>
-#include <svtools/lingucfg.hxx>
-#include <vcl/svapp.hxx>
+#include <unotools/lingucfg.hxx>
#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
#include <cppuhelper/implbase1.hxx> // helper for implementations
diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx
index b424970a929b..f690fc1112c8 100644
--- a/linguistic/source/lngopt.hxx
+++ b/linguistic/source/lngopt.hxx
@@ -41,16 +41,16 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/lang/XComponent.hpp>
-#include <svtools/lingucfg.hxx>
-#include <svtools/itemprop.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svl/itemprop.hxx>
#include <unotools/configitem.hxx>
#include <com/sun/star/uno/Any.h>
#include <tools/solar.h>
-#include <vcl/timer.hxx>
-#include <svtools/itemprop.hxx>
+#include <svl/itemprop.hxx>
#include "misc.hxx"
#include "defs.hxx"
+#include <vos/refernce.hxx>
namespace com { namespace sun { namespace star {
namespace beans {
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 368f61b4eab1..e9b41cb51cfb 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -40,7 +40,7 @@
#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp>
#include <tools/solar.h>
-#include <svtools/lingucfg.hxx>
+#include <unotools/lingucfg.hxx>
#include <unotools/processfactory.hxx>
#include <i18npool/lang.h>
#include <i18npool/mslangid.hxx>
@@ -288,7 +288,7 @@ class LngSvcMgrListenerHelper :
>
{
LngSvcMgr &rMyManager;
- Timer aLaunchTimer;
+// Timer aLaunchTimer;
//cppu::OMultiTypeInterfaceContainerHelper aListeners;
::cppu::OInterfaceContainerHelper aLngSvcMgrListeners;
@@ -304,7 +304,8 @@ class LngSvcMgrListenerHelper :
void LaunchEvent( INT16 nLngSvcEvtFlags );
- DECL_LINK( TimeOut, Timer* );
+// DECL_LINK( TimeOut, Timer* );
+ long Timeout();
public:
LngSvcMgrListenerHelper( LngSvcMgr &rLngSvcMgr,
@@ -363,8 +364,8 @@ LngSvcMgrListenerHelper::LngSvcMgrListenerHelper(
//! listeners, and each of them is launching an event of it's own!)
//! Thus this behaviour is necessary to avoid unecessary actions of
//! this objects listeners!
- aLaunchTimer.SetTimeout( 2000 );
- aLaunchTimer.SetTimeoutHdl( LINK( this, LngSvcMgrListenerHelper, TimeOut ) );
+// aLaunchTimer.SetTimeout( 2000 );
+// aLaunchTimer.SetTimeoutHdl( LINK( this, LngSvcMgrListenerHelper, TimeOut ) );
nCombinedLngSvcEvt = 0;
}
@@ -385,11 +386,12 @@ void SAL_CALL LngSvcMgrListenerHelper::disposing( const lang::EventObject& rSour
}
-IMPL_LINK( LngSvcMgrListenerHelper, TimeOut, Timer*, pTimer )
+//IMPL_LINK( LngSvcMgrListenerHelper, TimeOut, Timer*, pTimer )
+long LngSvcMgrListenerHelper::Timeout()
{
osl::MutexGuard aGuard( GetLinguMutex() );
- if (&aLaunchTimer == pTimer)
+// if (&aLaunchTimer == pTimer)
{
// change event source to LinguServiceManager since the listeners
// probably do not know (and need not to know) about the specific
@@ -416,7 +418,8 @@ IMPL_LINK( LngSvcMgrListenerHelper, TimeOut, Timer*, pTimer )
void LngSvcMgrListenerHelper::AddLngSvcEvt( INT16 nLngSvcEvt )
{
nCombinedLngSvcEvt |= nLngSvcEvt;
- aLaunchTimer.Start();
+// aLaunchTimer.Start();
+ Timeout();
}
diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx
index aa7587527587..9716b082ddd5 100644
--- a/linguistic/source/lngsvcmgr.hxx
+++ b/linguistic/source/lngsvcmgr.hxx
@@ -43,7 +43,7 @@
#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
#include <unotools/configitem.hxx>
-#include <vcl/timer.hxx>
+//#include <vcl/timer.hxx>
#include "misc.hxx"
#include "defs.hxx"
diff --git a/linguistic/source/makefile.mk b/linguistic/source/makefile.mk
index 0012a9acd156..bdf0b297d2f2 100644
--- a/linguistic/source/makefile.mk
+++ b/linguistic/source/makefile.mk
@@ -68,17 +68,15 @@ SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
$(VOSLIB) \
$(TOOLSLIB) \
$(I18NISOLANGLIB) \
- $(SVTOOLLIB) \
- $(SVLLIB) \
- $(VCLLIB) \
- $(SFXLIB) \
+ $(SVLLIB) \
$(SALLIB) \
+ $(XMLOFFLIB) \
$(UCBHELPERLIB) \
$(UNOTOOLSLIB) \
- $(XMLOFFLIB) \
$(ICUUCLIB)
# build DLL
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 91beaa2e2c9f..1067a9c369c9 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -33,8 +33,8 @@
#include <tools/string.hxx>
#include <tools/fsys.hxx>
#include <tools/debug.hxx>
-#include <svtools/pathoptions.hxx>
-#include <svtools/lngmisc.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svl/lngmisc.hxx>
#include <ucbhelper/content.hxx>
#include <i18npool/mslangid.hxx>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
@@ -52,6 +52,7 @@
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <unotools/processfactory.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <unotools/syslocale.hxx>
#include <rtl/instance.hxx>
@@ -59,7 +60,7 @@
#include "defs.hxx"
#include "lngprops.hxx"
#include "hyphdta.hxx"
-
+#include <i18npool/mslangid.hxx>
using namespace utl;
using namespace osl;
@@ -92,7 +93,7 @@ LocaleDataWrapper & GetLocaleDataWrapper( INT16 nLang )
{
static LocaleDataWrapper aLclDtaWrp(
getProcessServiceFactory(),
- CreateLocale( Application::GetSettings().GetUILanguage() ) );
+ CreateLocale( SvtSysLocale().GetUILanguage() ) );
const Locale &rLcl = aLclDtaWrp.getLoadedLocale();
Locale aLcl( CreateLocale( nLang ) );
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index f89ebc1bc661..ffd54b78f860 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -35,7 +35,7 @@
#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
#include <tools/debug.hxx>
-#include <svtools/pathoptions.hxx>
+#include <unotools/pathoptions.hxx>
#include <unotools/processfactory.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/localedatawrapper.hxx>
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 6009461c7e7c..a89e6368781d 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -40,7 +40,7 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/processfactory.hxx>
#include <tools/debug.hxx>
-#include <svtools/lngmisc.hxx>
+#include <svl/lngmisc.hxx>
#include <osl/mutex.hxx>
#include <vector>
diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx
index b944e3a44d1b..ed537cc20043 100644
--- a/linguistic/source/thesdsp.cxx
+++ b/linguistic/source/thesdsp.cxx
@@ -32,7 +32,7 @@
#include "precompiled_linguistic.hxx"
#include <i18npool/lang.h>
#include <tools/debug.hxx>
-#include <svtools/lngmisc.hxx>
+#include <svl/lngmisc.hxx>
#include <cppuhelper/factory.hxx> // helper for factories
#include <com/sun/star/registry/XRegistryKey.hpp>