summaryrefslogtreecommitdiff
path: root/linguistic/source
diff options
context:
space:
mode:
Diffstat (limited to 'linguistic/source')
-rw-r--r--linguistic/source/convdic.cxx99
-rw-r--r--linguistic/source/convdiclist.cxx136
-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.hxx7
-rw-r--r--linguistic/source/dlistimp.cxx63
-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.cxx16
-rw-r--r--linguistic/source/hyphdta.cxx2
-rw-r--r--linguistic/source/lngopt.cxx11
-rw-r--r--linguistic/source/lngopt.hxx12
-rw-r--r--linguistic/source/lngsvcmgr.cxx37
-rw-r--r--linguistic/source/lngsvcmgr.hxx2
-rw-r--r--linguistic/source/makefile.mk8
-rw-r--r--linguistic/source/misc.cxx23
-rw-r--r--linguistic/source/misc2.cxx40
-rw-r--r--linguistic/source/spelldsp.cxx13
-rw-r--r--linguistic/source/thesdsp.cxx10
23 files changed, 334 insertions, 270 deletions
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 8a544d0450..30129b01ac 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 1d5729b34b..37a536ba87 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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>
@@ -98,7 +96,7 @@ String GetConvDicMainURL( const String &rDicName, const String &rDirectoryURL )
DBG_ASSERT(!aURLObj.HasError(), "invalid URL");
if (aURLObj.HasError())
return String();
- else
+ else
return aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI );
}
@@ -139,7 +137,7 @@ public:
virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
+
// looks for conversion dictionaries with the specified extension
// in the directory and adds them to the container
void AddConvDics( const String &rSearchDirPathURL, const String &rExtension );
@@ -149,10 +147,10 @@ public:
INT32 GetCount() const { return aConvDics.getLength(); }
uno::Reference< XConversionDictionary > GetByName( const OUString& rName );
-
+
const uno::Reference< XConversionDictionary > GetByIndex( INT32 nIdx )
- {
- return aConvDics.getConstArray()[nIdx];
+ {
+ return aConvDics.getConstArray()[nIdx];
}
};
@@ -190,7 +188,7 @@ void ConvDicNameContainer::FlushDics() const
}
-INT32 ConvDicNameContainer::GetIndexByName_Impl(
+INT32 ConvDicNameContainer::GetIndexByName_Impl(
const OUString& rName )
{
INT32 nRes = -1;
@@ -205,7 +203,7 @@ INT32 ConvDicNameContainer::GetIndexByName_Impl(
}
-uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName(
+uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName(
const OUString& rName )
{
uno::Reference< XConversionDictionary > xRes;
@@ -216,7 +214,7 @@ uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName(
}
-uno::Type SAL_CALL ConvDicNameContainer::getElementType( )
+uno::Type SAL_CALL ConvDicNameContainer::getElementType( )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -224,7 +222,7 @@ uno::Type SAL_CALL ConvDicNameContainer::getElementType( )
}
-sal_Bool SAL_CALL ConvDicNameContainer::hasElements( )
+sal_Bool SAL_CALL ConvDicNameContainer::hasElements( )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -232,7 +230,7 @@ sal_Bool SAL_CALL ConvDicNameContainer::hasElements( )
}
-uno::Any SAL_CALL ConvDicNameContainer::getByName( const OUString& rName )
+uno::Any SAL_CALL ConvDicNameContainer::getByName( const OUString& rName )
throw (NoSuchElementException, WrappedTargetException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -243,7 +241,7 @@ uno::Any SAL_CALL ConvDicNameContainer::getByName( const OUString& rName )
}
-uno::Sequence< OUString > SAL_CALL ConvDicNameContainer::getElementNames( )
+uno::Sequence< OUString > SAL_CALL ConvDicNameContainer::getElementNames( )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -258,7 +256,7 @@ uno::Sequence< OUString > SAL_CALL ConvDicNameContainer::getElementNames( )
}
-sal_Bool SAL_CALL ConvDicNameContainer::hasByName( const OUString& rName )
+sal_Bool SAL_CALL ConvDicNameContainer::hasByName( const OUString& rName )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -266,9 +264,9 @@ sal_Bool SAL_CALL ConvDicNameContainer::hasByName( const OUString& rName )
}
-void SAL_CALL ConvDicNameContainer::replaceByName(
- const OUString& rName,
- const uno::Any& rElement )
+void SAL_CALL ConvDicNameContainer::replaceByName(
+ const OUString& rName,
+ const uno::Any& rElement )
throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -284,27 +282,27 @@ void SAL_CALL ConvDicNameContainer::replaceByName(
}
-void SAL_CALL ConvDicNameContainer::insertByName(
- const OUString& rName,
- const Any& rElement )
+void SAL_CALL ConvDicNameContainer::insertByName(
+ const OUString& rName,
+ const Any& rElement )
throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
-
+
if (GetByName( rName ).is())
throw ElementExistException();
uno::Reference< XConversionDictionary > xNew;
rElement >>= xNew;
if (!xNew.is() || xNew->getName() != rName)
throw IllegalArgumentException();
-
+
INT32 nLen = aConvDics.getLength();
aConvDics.realloc( nLen + 1 );
aConvDics.getArray()[ nLen ] = xNew;
}
-void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName )
+void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName )
throw (NoSuchElementException, WrappedTargetException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -345,11 +343,11 @@ void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName )
}
-void ConvDicNameContainer::AddConvDics(
- const String &rSearchDirPathURL,
+void ConvDicNameContainer::AddConvDics(
+ const String &rSearchDirPathURL,
const String &rExtension )
{
- const Sequence< OUString > aDirCnt(
+ const Sequence< OUString > aDirCnt(
utl::LocalFileHelper::GetFolderContents( rSearchDirPathURL, FALSE ) );
const OUString *pDirCnt = aDirCnt.getConstArray();
INT32 nEntries = aDirCnt.getLength();
@@ -372,8 +370,8 @@ void ConvDicNameContainer::AddConvDics(
{
// get decoded dictionary file name
INetURLObject aURLObj( aURL );
- String aDicName = aURLObj.getBase( INetURLObject::LAST_SEGMENT,
- true, INetURLObject::DECODE_WITH_CHARSET,
+ String aDicName = aURLObj.getBase( INetURLObject::LAST_SEGMENT,
+ true, INetURLObject::DECODE_WITH_CHARSET,
RTL_TEXTENCODING_UTF8 );
uno::Reference < XConversionDictionary > xDic;
@@ -408,7 +406,7 @@ class StaticWithInit_ {
public:
/** Gets the static. Mutual exclusion is performed using the
osl global mutex.
-
+
@return
static variable
*/
@@ -466,7 +464,7 @@ ConvDicList::~ConvDicList()
if (!bDisposing && pNameContainer)
pNameContainer->FlushDics();
-
+
pExitListener->Deactivate();
}
@@ -485,7 +483,7 @@ ConvDicNameContainer & ConvDicList::GetNameContainer()
if (!pNameContainer)
{
pNameContainer = new ConvDicNameContainer( *this );
- pNameContainer->AddConvDics( GetDictionaryWriteablePath(),
+ pNameContainer->AddConvDics( GetDictionaryWriteablePath(),
A2OU( CONV_DIC_EXT ) );
xNameContainer = pNameContainer;
@@ -496,7 +494,7 @@ ConvDicNameContainer & ConvDicList::GetNameContainer()
const OUString *pActiveConvDics = aOpt.aActiveConvDics.getConstArray();
for (INT32 i = 0; i < nLen; ++i)
{
- uno::Reference< XConversionDictionary > xDic =
+ uno::Reference< XConversionDictionary > xDic =
pNameContainer->GetByName( pActiveConvDics[i] );
if (xDic.is())
xDic->setActive( sal_True );
@@ -527,10 +525,10 @@ uno::Reference< container::XNameContainer > SAL_CALL ConvDicList::getDictionaryC
}
-uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
- const OUString& rName,
- const Locale& rLocale,
- sal_Int16 nConvDicType )
+uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
+ const OUString& rName,
+ const Locale& rLocale,
+ sal_Int16 nConvDicType )
throw (NoSupportException, ElementExistException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -539,7 +537,7 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
if (GetNameContainer().hasByName( rName ))
throw ElementExistException();
-
+
uno::Reference< XConversionDictionary > xRes;
String aDicMainURL( GetConvDicMainURL( rName, GetDictionaryWriteablePath() ) );
if (nLang == LANGUAGE_KOREAN &&
@@ -552,7 +550,7 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
{
xRes = new ConvDic( rName, nLang, nConvDicType, FALSE, aDicMainURL );
}
-
+
if (!xRes.is())
throw NoSupportException();
else
@@ -566,20 +564,20 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
}
-uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions(
- const OUString& rText,
- sal_Int32 nStartPos,
- sal_Int32 nLength,
- const Locale& rLocale,
- sal_Int16 nConversionDictionaryType,
- ConversionDirection eDirection,
- sal_Int32 nTextConversionOptions )
+uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions(
+ const OUString& rText,
+ sal_Int32 nStartPos,
+ sal_Int32 nLength,
+ const Locale& rLocale,
+ sal_Int16 nConversionDictionaryType,
+ ConversionDirection eDirection,
+ sal_Int32 nTextConversionOptions )
throw (IllegalArgumentException, NoSupportException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
/*INT16 nLang = LocaleToLanguage( rLocale );*/
-
+
INT32 nCount = 0;
uno::Sequence< OUString > aRes( 20 );
OUString *pRes = aRes.getArray();
@@ -595,7 +593,7 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions(
bSupported |= bMatch;
if (bMatch && xDic->isActive())
{
- Sequence< OUString > aNewConv( xDic->getConversions(
+ Sequence< OUString > aNewConv( xDic->getConversions(
rText, nStartPos, nLength,
eDirection, nTextConversionOptions ) );
INT32 nNewLen = aNewConv.getLength();
@@ -621,21 +619,21 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions(
}
-sal_Int16 SAL_CALL ConvDicList::queryMaxCharCount(
- const Locale& rLocale,
- sal_Int16 nConversionDictionaryType,
- ConversionDirection eDirection )
+sal_Int16 SAL_CALL ConvDicList::queryMaxCharCount(
+ const Locale& rLocale,
+ sal_Int16 nConversionDictionaryType,
+ ConversionDirection eDirection )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
-
+
sal_Int16 nRes = 0;
GetNameContainer();
INT32 nLen = GetNameContainer().GetCount();
for (INT32 i = 0; i < nLen; ++i)
{
const uno::Reference< XConversionDictionary > xDic( GetNameContainer().GetByIndex(i) );
- if (xDic.is() &&
+ if (xDic.is() &&
xDic->getLocale() == rLocale &&
xDic->getConversionType() == nConversionDictionaryType)
{
@@ -648,7 +646,7 @@ sal_Int16 SAL_CALL ConvDicList::queryMaxCharCount(
}
-void SAL_CALL ConvDicList::dispose( )
+void SAL_CALL ConvDicList::dispose( )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -663,8 +661,8 @@ void SAL_CALL ConvDicList::dispose( )
}
-void SAL_CALL ConvDicList::addEventListener(
- const uno::Reference< XEventListener >& rxListener )
+void SAL_CALL ConvDicList::addEventListener(
+ const uno::Reference< XEventListener >& rxListener )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -673,8 +671,8 @@ void SAL_CALL ConvDicList::addEventListener(
}
-void SAL_CALL ConvDicList::removeEventListener(
- const uno::Reference< XEventListener >& rxListener )
+void SAL_CALL ConvDicList::removeEventListener(
+ const uno::Reference< XEventListener >& rxListener )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -683,7 +681,7 @@ void SAL_CALL ConvDicList::removeEventListener(
}
-OUString SAL_CALL ConvDicList::getImplementationName( )
+OUString SAL_CALL ConvDicList::getImplementationName( )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -691,7 +689,7 @@ OUString SAL_CALL ConvDicList::getImplementationName( )
}
-sal_Bool SAL_CALL ConvDicList::supportsService( const OUString& rServiceName )
+sal_Bool SAL_CALL ConvDicList::supportsService( const OUString& rServiceName )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -699,7 +697,7 @@ sal_Bool SAL_CALL ConvDicList::supportsService( const OUString& rServiceName )
}
-uno::Sequence< OUString > SAL_CALL ConvDicList::getSupportedServiceNames( )
+uno::Sequence< OUString > SAL_CALL ConvDicList::getSupportedServiceNames( )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -707,7 +705,7 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::getSupportedServiceNames( )
}
-uno::Sequence< OUString > ConvDicList::getSupportedServiceNames_Static()
+uno::Sequence< OUString > ConvDicList::getSupportedServiceNames_Static()
throw()
{
uno::Sequence< OUString > aSNS( 1 );
@@ -718,7 +716,7 @@ uno::Sequence< OUString > ConvDicList::getSupportedServiceNames_Static()
///////////////////////////////////////////////////////////////////////////
-uno::Reference< uno::XInterface > SAL_CALL ConvDicList_CreateInstance(
+uno::Reference< uno::XInterface > SAL_CALL ConvDicList_CreateInstance(
const uno::Reference< XMultiServiceFactory > & /*rSMgr*/ )
throw(Exception)
{
@@ -750,7 +748,7 @@ sal_Bool SAL_CALL ConvDicList_writeInfo(
}
-void * SAL_CALL ConvDicList_getFactory(
+void * SAL_CALL ConvDicList_getFactory(
const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager, void * )
{
diff --git a/linguistic/source/convdiclist.hxx b/linguistic/source/convdiclist.hxx
index 65021041d6..36416d5561 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 772666a90c..a0efca3089 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 ab1deee005..1ada0a8fb8 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 7068faae25..02d6fbd343 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 e894e7e80c..2343328aa0 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 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);
- // get stream to use
- SfxMedium aMedium( rMainURL, STREAM_READ | STREAM_SHARE_DENYWRITE, FALSE );
- SvStream *pStream = aMedium.GetInStream();
- if (!pStream)
- return nErr;
+ 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() );
+
+ // 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);
- 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;
+ 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 ab60c94f97..99099eb706 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();
///////////////////////////////////////////////////////////////////////////
@@ -85,8 +86,8 @@ class DictionaryNeo :
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XDictionaryEntry > xEntry);
- ULONG loadEntries(const ::rtl::OUString &rMainURL);
- ULONG saveEntries(const ::rtl::OUString &rMainURL);
+ ULONG loadEntries(const ::rtl::OUString &rMainURL);
+ ULONG saveEntries(const ::rtl::OUString &rMainURL);
int cmpDicEntry(const ::rtl::OUString &rWord1,
const ::rtl::OUString &rWord2,
BOOL bSimilarOnly = FALSE);
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 0436504c2b..0c27c945af 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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;
@@ -317,9 +320,9 @@ DicList::~DicList()
}
-void DicList::SearchForDictionaries(
+void DicList::SearchForDictionaries(
DictionaryVec_t&rDicList,
- const String &rDicDirURL,
+ const String &rDicDirURL,
BOOL bIsWriteablePath )
{
osl::MutexGuard aGuard( GetLinguMutex() );
@@ -374,10 +377,10 @@ void DicList::SearchForDictionaries(
{
// get decoded dictionary file name
INetURLObject aURLObj( aURL );
- String aDicName = aURLObj.getName( INetURLObject::LAST_SEGMENT,
- true, INetURLObject::DECODE_WITH_CHARSET,
+ String aDicName = aURLObj.getName( INetURLObject::LAST_SEGMENT,
+ true, INetURLObject::DECODE_WITH_CHARSET,
RTL_TEXTENCODING_UTF8 );
-
+
DictionaryType eType = bNeg ? DictionaryType_NEGATIVE : DictionaryType_POSITIVE;
uno::Reference< XDictionary > xDic =
new DictionaryNeo( aDicName, nLang, eType, aURL, bIsWriteablePath );
@@ -686,8 +689,8 @@ void DicList::_CreateDicList()
xIgnAll->setActive( TRUE );
addDictionary( xIgnAll );
}
-
-
+
+
// evaluate list of dictionaries to be activated from configuration
//
//! to suppress overwriting the list of active dictionaries in the
@@ -707,11 +710,11 @@ void DicList::_CreateDicList()
xDic->setActive( TRUE );
}
}
-
+
// suppress collected events during creation of the dictionary list.
// there should be no events during creation.
pDicEvtLstnrHelper->ClearEvents();
-
+
pDicEvtLstnrHelper->EndCollectEvents();
bInCreation = FALSE;
@@ -930,13 +933,31 @@ 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;
-
+
return FALSE;
}
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 700b43cb22..25d8ca19b7 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>
@@ -791,7 +790,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 9cac236ea0..8df73a1b18 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 abd8879dbc..a6e3e17b7e 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 7bc8c343af..7a0da09b39 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>
@@ -275,7 +275,8 @@ Reference< XHyphenatedWord > SAL_CALL
return xRes;
// search for entry with that language
- LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get();
+ HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
+ LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
BOOL bWordModified = FALSE;
if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen))
@@ -418,7 +419,8 @@ Reference< XHyphenatedWord > SAL_CALL
return xRes;
// search for entry with that language
- LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get();
+ HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
+ LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
BOOL bWordModified = FALSE;
if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2))
@@ -555,7 +557,8 @@ Reference< XPossibleHyphens > SAL_CALL
return xRes;
// search for entry with that language
- LangSvcEntries_Hyph *pEntry = aSvcMap[ nLanguage ].get();
+ HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
+ LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (!pEntry)
{
@@ -713,8 +716,9 @@ Sequence< OUString >
// search for entry with that language and use data from that
INT16 nLanguage = LocaleToLanguage( rLocale );
- HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this;
- const LangSvcEntries_Hyph *pEntry = pThis->aSvcMap[ nLanguage ].get();
+ HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this;
+ const HyphSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
+ const LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (pEntry)
{
aRes = pEntry->aSvcImplNames;
diff --git a/linguistic/source/hyphdta.cxx b/linguistic/source/hyphdta.cxx
index 34ea7299a9..7a8233d0af 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 fc6f4c7cc3..3b819154e1 100644
--- a/linguistic/source/lngopt.cxx
+++ b/linguistic/source/lngopt.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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
@@ -338,7 +337,7 @@ const SfxItemPropertyMapEntry* lcl_GetLinguProps()
&::getCppuType( (sal_Int16*)0 ), 0, 0 },
{ MAP_CHAR_LEN(UPN_HYPH_MIN_WORD_LENGTH), WID_HYPH_MIN_WORD_LENGTH,
&::getCppuType( (sal_Int16*)0 ), 0, 0 },
- { MAP_CHAR_LEN(UPN_IS_GERMAN_PRE_REFORM), WID_IS_GERMAN_PRE_REFORM, /*! deprecated !*/
+ { MAP_CHAR_LEN(UPN_IS_GERMAN_PRE_REFORM), WID_IS_GERMAN_PRE_REFORM, /*! deprecated !*/
&::getBooleanCppuType(), 0, 0 },
{ MAP_CHAR_LEN(UPN_IS_HYPH_AUTO), WID_IS_HYPH_AUTO,
&::getBooleanCppuType(), 0, 0 },
@@ -350,9 +349,9 @@ const SfxItemPropertyMapEntry* lcl_GetLinguProps()
&::getBooleanCppuType(), 0, 0 },
{ MAP_CHAR_LEN(UPN_IS_SPELL_CAPITALIZATION), WID_IS_SPELL_CAPITALIZATION,
&::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN(UPN_IS_SPELL_HIDE), WID_IS_SPELL_HIDE, /*! deprecated !*/
+ { MAP_CHAR_LEN(UPN_IS_SPELL_HIDE), WID_IS_SPELL_HIDE, /*! deprecated !*/
&::getBooleanCppuType(), 0, 0 },
- { MAP_CHAR_LEN(UPN_IS_SPELL_IN_ALL_LANGUAGES), WID_IS_SPELL_IN_ALL_LANGUAGES, /*! deprecated !*/
+ { MAP_CHAR_LEN(UPN_IS_SPELL_IN_ALL_LANGUAGES), WID_IS_SPELL_IN_ALL_LANGUAGES, /*! deprecated !*/
&::getBooleanCppuType(), 0, 0 },
{ MAP_CHAR_LEN(UPN_IS_SPELL_SPECIAL), WID_IS_SPELL_SPECIAL,
&::getBooleanCppuType(), 0, 0 },
diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx
index 2188ef4d88..695df4ac6c 100644
--- a/linguistic/source/lngopt.hxx
+++ b/linguistic/source/lngopt.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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 {
@@ -87,7 +87,7 @@ public:
BOOL SetValue( ::com::sun::star::uno::Any &rOld,
const ::com::sun::star::uno::Any &rVal, INT32 nWID );
void GetValue( ::com::sun::star::uno::Any &rVal, INT32 nWID ) const;
-
+
static ::rtl::OUString GetName( INT32 nWID );
const ::com::sun::star::uno::Sequence< rtl::OUString >
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 2a70e9eeb1..64de21260c 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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>
@@ -134,7 +134,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
aLanguages.insert( nLang );
}
}
- else
+ else
{
DBG_ASSERT( 0, "interface not supported by service" );
}
@@ -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();
}
@@ -753,7 +756,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pThesDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
}
}
- else
+ else
{
DBG_ASSERT( 0, "nofified for unexpected property" );
}
@@ -801,9 +804,9 @@ void LngSvcMgr::GetGrammarCheckerDsp_Impl( sal_Bool bSetSvcList )
uno::Reference< linguistic2::XProofreadingIterator > xGCI;
try
{
- uno::Reference< lang::XMultiServiceFactory > xMgr(
+ uno::Reference< lang::XMultiServiceFactory > xMgr(
utl::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- xGCI = uno::Reference< linguistic2::XProofreadingIterator >(
+ xGCI = uno::Reference< linguistic2::XProofreadingIterator >(
xMgr->createInstance( A2OU( SN_GRAMMARCHECKINGITERATOR ) ), uno::UNO_QUERY_THROW );
}
catch (uno::Exception &)
@@ -887,7 +890,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
DBG_ASSERT( 0, "createInstance failed" );
}
}
-
+
if (xSvc.is())
{
OUString aImplName;
@@ -953,7 +956,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
DBG_ASSERT( 0, "createInstance failed" );
}
}
-
+
if (xSvc.is())
{
OUString aImplName;
@@ -1671,7 +1674,7 @@ BOOL LngSvcMgr::SaveCfgSvcs( const String &rServiceName )
pNodeName = "ServiceManager/HyphenatorList";
else if (pDsp == pThesDsp)
pNodeName = "ServiceManager/ThesaurusList";
- else
+ else
{
DBG_ASSERT( 0, "node name missing" );
}
@@ -1765,7 +1768,7 @@ static uno::Sequence< OUString > GetLangSvc( const uno::Any &rVal )
aRes.realloc(1);
aRes.getArray()[0] = aImplName;
}
- else
+ else
{
DBG_ASSERT( 0, "GetLangSvc: unexpected type encountered" );
}
diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx
index 1c96adea46..7ee9ad0ba6 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 0012a9acd1..bdf0b297d2 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 2df19215fd..b45e4eca3f 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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;
@@ -90,10 +91,10 @@ osl::Mutex & GetLinguMutex()
LocaleDataWrapper & GetLocaleDataWrapper( INT16 nLang )
{
- static LocaleDataWrapper aLclDtaWrp(
- getProcessServiceFactory(),
- CreateLocale( Application::GetSettings().GetUILanguage() ) );
-
+ static LocaleDataWrapper aLclDtaWrp(
+ getProcessServiceFactory(),
+ CreateLocale( SvtSysLocale().GetUILanguage() ) );
+
const Locale &rLcl = aLclDtaWrp.getLoadedLocale();
Locale aLcl( CreateLocale( nLang ) );
if (aLcl.Language != rLcl.Language ||
@@ -243,8 +244,8 @@ sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 )
sal_Unicode c1i = rTxt1.getStr()[i - 1];
sal_Unicode c2k = rTxt2.getStr()[k - 1];
sal_Int32 nCost = c1i == c2k ? 0 : 1;
- sal_Int32 nNew = Minimum( aData.Value(i-1, k ) + 1,
- aData.Value(i , k-1) + 1,
+ sal_Int32 nNew = Minimum( aData.Value(i-1, k ) + 1,
+ aData.Value(i , k-1) + 1,
aData.Value(i-1, k-1) + nCost );
// take transposition (exchange with left or right char) in account
if (2 < i && 2 < k)
@@ -798,7 +799,7 @@ sal_Unicode ToUpper( const sal_Unicode cChar, INT16 nLanguage )
// sorted(!) array of unicode ranges for code points that are exclusively(!) used as numbers
// and thus may NOT not be part of names or words like the Chinese/Japanese number characters
-static const sal_uInt32 the_aDigitZeroes [] =
+static const sal_uInt32 the_aDigitZeroes [] =
{
0x00000030, //0039 ; Decimal # Nd [10] DIGIT ZERO..DIGIT NINE
0x00000660, //0669 ; Decimal # Nd [10] ARABIC-INDIC DIGIT ZERO..ARABIC-INDIC DIGIT NINE
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index 297366322f..ffd54b78f8 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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>
@@ -63,7 +63,7 @@ BOOL FileExists( const String &rMainURL )
{
try
{
- ::ucbhelper::Content aContent( rMainURL,
+ ::ucbhelper::Content aContent( rMainURL,
uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >());
bExists = aContent.isDocument();
}
@@ -99,7 +99,7 @@ String GetFileURL( SvtPathOptions::Pathes ePath, const String &rFileName )
String GetModulePath( SvtPathOptions::Pathes ePath, BOOL bAddAccessDelim )
{
String aRes;
-
+
SvtPathOptions aPathOpt;
switch (ePath)
{
@@ -131,7 +131,7 @@ String GetModulePath( SvtPathOptions::Pathes ePath, BOOL bAddAccessDelim )
aRes += '/';
#endif
}
-
+
return aRes;
}
@@ -146,7 +146,7 @@ rtl::OUString StripTrailingChars( rtl::OUString &rTxt, sal_Unicode cChar )
sal_Int32 nIdx = nTxtLen - 1;
while (nIdx >= 0 && rTxt[ nIdx-- ] == cChar)
++nTrailing;
-
+
rtl::OUString aRes( rTxt.copy( nTxtLen - nTrailing ) );
rTxt = rTxt.copy( 0, nTxtLen - nTrailing );
return aRes;
@@ -154,7 +154,7 @@ rtl::OUString StripTrailingChars( rtl::OUString &rTxt, sal_Unicode cChar )
///////////////////////////////////////////////////////////////////////////
-static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
+static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
const rtl::OUString &rPathPrefix,
sal_Int16 nPathFlags )
{
@@ -162,7 +162,7 @@ static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
uno::Sequence< rtl::OUString > aInternalPaths;
uno::Sequence< rtl::OUString > aUserPaths;
rtl::OUString aWritablePath;
-
+
bool bSuccess = true;
uno::Reference< lang::XMultiServiceFactory > xMgr( utl::getProcessServiceFactory() );
if (xMgr.is())
@@ -176,7 +176,7 @@ static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
aUser .AppendAscii( "_user" );
aWriteable.AppendAscii( "_writable" );
- uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance(
+ uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance(
A2OU( "com.sun.star.util.PathSettings" ) ), uno::UNO_QUERY_THROW );
xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths;
xPathSettings->getPropertyValue( aUser ) >>= aUserPaths;
@@ -185,7 +185,7 @@ static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
catch (uno::Exception &)
{
bSuccess = false;
- }
+ }
}
if (bSuccess)
{
@@ -211,10 +211,10 @@ static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
const bool bAddInternal = &rPathSeq == &aInternalPaths && (nPathFlags & PATH_FLAG_INTERNAL);
if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0)
pRes[ nCount++ ] = pPathSeq[k];
- }
- }
+ }
+ }
aRes.realloc( nCount );
- }
+ }
return aRes;
}
@@ -227,17 +227,17 @@ rtl::OUString GetDictionaryWriteablePath()
if (aPaths.getLength() > 0)
aRes = aPaths[0];
return aRes;
-}
+}
uno::Sequence< rtl::OUString > GetDictionaryPaths( sal_Int16 nPathFlags )
{
return GetMultiPaths_Impl( A2OU("Dictionary"), nPathFlags );
}
-
+
uno::Sequence< rtl::OUString > GetLinguisticPaths( sal_Int16 nPathFlags )
{
return GetMultiPaths_Impl( A2OU("Linguistic"), nPathFlags );
-}
+}
String GetWritableDictionaryURL( const String &rDicName )
{
@@ -256,12 +256,12 @@ String GetWritableDictionaryURL( const String &rDicName )
}
-String SearchFileInPaths(
- const String &rFile,
+String SearchFileInPaths(
+ const String &rFile,
const uno::Sequence< rtl::OUString > &rPaths )
{
//!! see also SvtPathOptions::SearchFile for the riginal code
-
+
String aRes;
// check in all paths...
@@ -295,7 +295,7 @@ String SearchFileInPaths(
}
return aRes;
-}
+}
} // namespace linguistic
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index e88a509ccb..870923f6d2 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>
@@ -330,7 +330,8 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
return bRes;
// search for entry with that language
- LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get();
+ SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
+ LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (!pEntry)
{
@@ -497,7 +498,8 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
return xRes;
// search for entry with that language
- LangSvcEntries_Spell *pEntry = aSvcMap[ nLanguage ].get();
+ SpellSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
+ LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (!pEntry)
{
@@ -847,8 +849,9 @@ Sequence< OUString >
// search for entry with that language and use data from that
INT16 nLanguage = LocaleToLanguage( rLocale );
- SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this;
- const LangSvcEntries_Spell *pEntry = pThis->aSvcMap[ nLanguage ].get();
+ SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this;
+ const SpellSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
+ const LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (pEntry)
aRes = pEntry->aSvcImplNames;
diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx
index 9ba9f9f9ce..e6604ae080 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>
@@ -136,7 +136,8 @@ Sequence< Reference< XMeaning > > SAL_CALL
return aMeanings;
// search for entry with that language
- LangSvcEntries_Thes *pEntry = aSvcMap[ nLanguage ].get();
+ ThesSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) );
+ LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (!pEntry)
{
@@ -264,8 +265,9 @@ Sequence< OUString >
// search for entry with that language and use data from that
INT16 nLanguage = LocaleToLanguage( rLocale );
- ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this;
- const LangSvcEntries_Thes *pEntry = pThis->aSvcMap[ nLanguage ].get();
+ ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this;
+ const ThesSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
+ const LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
if (pEntry)
aRes = pEntry->aSvcImplNames;