diff options
Diffstat (limited to 'linguistic/source/convdiclist.cxx')
-rw-r--r-- | linguistic/source/convdiclist.cxx | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx index 436f321470..7d5d65e9a3 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 @@ -30,13 +30,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_linguistic.hxx" + #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 <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> @@ -97,7 +97,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 ); } @@ -138,7 +138,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 ); @@ -148,10 +148,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]; } }; @@ -189,7 +189,7 @@ void ConvDicNameContainer::FlushDics() const } -INT32 ConvDicNameContainer::GetIndexByName_Impl( +INT32 ConvDicNameContainer::GetIndexByName_Impl( const OUString& rName ) { INT32 nRes = -1; @@ -204,7 +204,7 @@ INT32 ConvDicNameContainer::GetIndexByName_Impl( } -uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName( +uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName( const OUString& rName ) { uno::Reference< XConversionDictionary > xRes; @@ -215,7 +215,7 @@ uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName( } -uno::Type SAL_CALL ConvDicNameContainer::getElementType( ) +uno::Type SAL_CALL ConvDicNameContainer::getElementType( ) throw (RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); @@ -223,7 +223,7 @@ uno::Type SAL_CALL ConvDicNameContainer::getElementType( ) } -sal_Bool SAL_CALL ConvDicNameContainer::hasElements( ) +sal_Bool SAL_CALL ConvDicNameContainer::hasElements( ) throw (RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); @@ -231,7 +231,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() ); @@ -242,7 +242,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() ); @@ -257,7 +257,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() ); @@ -265,9 +265,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() ); @@ -283,27 +283,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() ); @@ -344,11 +344,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(); @@ -371,8 +371,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; @@ -407,7 +407,7 @@ class StaticWithInit_ { public: /** Gets the static. Mutual exclusion is performed using the osl global mutex. - + @return static variable */ @@ -465,7 +465,7 @@ ConvDicList::~ConvDicList() if (!bDisposing && pNameContainer) pNameContainer->FlushDics(); - + pExitListener->Deactivate(); } @@ -484,7 +484,7 @@ ConvDicNameContainer & ConvDicList::GetNameContainer() if (!pNameContainer) { pNameContainer = new ConvDicNameContainer( *this ); - pNameContainer->AddConvDics( GetDictionaryWriteablePath(), + pNameContainer->AddConvDics( GetDictionaryWriteablePath(), A2OU( CONV_DIC_EXT ) ); xNameContainer = pNameContainer; @@ -495,7 +495,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 ); @@ -526,10 +526,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() ); @@ -538,7 +538,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 && @@ -551,7 +551,7 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary( { xRes = new ConvDic( rName, nLang, nConvDicType, FALSE, aDicMainURL ); } - + if (!xRes.is()) throw NoSupportException(); else @@ -565,20 +565,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(); @@ -594,7 +594,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(); @@ -620,21 +620,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) { @@ -647,7 +647,7 @@ sal_Int16 SAL_CALL ConvDicList::queryMaxCharCount( } -void SAL_CALL ConvDicList::dispose( ) +void SAL_CALL ConvDicList::dispose( ) throw (RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); @@ -662,8 +662,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() ); @@ -672,8 +672,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() ); @@ -682,7 +682,7 @@ void SAL_CALL ConvDicList::removeEventListener( } -OUString SAL_CALL ConvDicList::getImplementationName( ) +OUString SAL_CALL ConvDicList::getImplementationName( ) throw (RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); @@ -690,7 +690,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() ); @@ -698,7 +698,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() ); @@ -706,7 +706,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 ); @@ -717,7 +717,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) { @@ -749,7 +749,7 @@ sal_Bool SAL_CALL ConvDicList_writeInfo( } -void * SAL_CALL ConvDicList_getFactory( +void * SAL_CALL ConvDicList_getFactory( const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * ) { |