From 93ef9a43a53218bdfbdea2ec20fba73fef08db75 Mon Sep 17 00:00:00 2001 From: Alexandre Vicenzi Date: Fri, 31 Jan 2014 04:53:17 -0200 Subject: fdo#54938 Convert bridges, editeng and others to cppu::supportsService Change-Id: I7ff5189473c3e0831c2f1e95264d1a04f3b716a9 Reviewed-on: https://gerrit.libreoffice.org/7761 Tested-by: LibreOffice gerrit bot Reviewed-by: Marcos Souza Tested-by: Marcos Souza --- linguistic/source/convdiclist.cxx | 80 ++++++++++----------------------------- 1 file changed, 20 insertions(+), 60 deletions(-) (limited to 'linguistic/source') diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx index b6d65fa2b4fb..623253b8bfd0 100644 --- a/linguistic/source/convdiclist.cxx +++ b/linguistic/source/convdiclist.cxx @@ -17,31 +17,31 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include +#include +#include +#include #include -#include +#include +#include +#include #include +#include +#include +#include +#include #include +#include +#include +#include +#include -#include "convdiclist.hxx" #include "convdic.hxx" +#include "convdiclist.hxx" +#include "defs.hxx" #include "hhconvdic.hxx" #include "linguistic/misc.hxx" -#include "defs.hxx" using namespace osl; using namespace com::sun::star; @@ -51,11 +51,8 @@ using namespace com::sun::star::container; using namespace com::sun::star::linguistic2; using namespace linguistic; - #define SN_CONV_DICTIONARY_LIST "com.sun.star.linguistic2.ConversionDictionaryList" - - bool operator == ( const Locale &r1, const Locale &r2 ) { return r1.Language == r2.Language && @@ -63,7 +60,6 @@ bool operator == ( const Locale &r1, const Locale &r2 ) r1.Variant == r2.Variant; } - OUString GetConvDicMainURL( const OUString &rDicName, const OUString &rDirectoryURL ) { // build URL to use for new (persistent) dictionaries @@ -81,7 +77,6 @@ OUString GetConvDicMainURL( const OUString &rDicName, const OUString &rDirectory return aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI ); } - class ConvDicNameContainer : public cppu::WeakImplHelper1 < @@ -117,7 +112,6 @@ public: virtual void SAL_CALL insertByName( const 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 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 OUString &rSearchDirPathURL, const OUString &rExtension ); @@ -134,18 +128,15 @@ public: } }; - ConvDicNameContainer::ConvDicNameContainer( ConvDicList &rMyConvDicList ) : rConvDicList( rMyConvDicList ) { } - ConvDicNameContainer::~ConvDicNameContainer() { } - void ConvDicNameContainer::FlushDics() const { sal_Int32 nLen = aConvDics.getLength(); @@ -167,7 +158,6 @@ void ConvDicNameContainer::FlushDics() const } } - sal_Int32 ConvDicNameContainer::GetIndexByName_Impl( const OUString& rName ) { @@ -182,7 +172,6 @@ sal_Int32 ConvDicNameContainer::GetIndexByName_Impl( return nRes; } - uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName( const OUString& rName ) { @@ -193,7 +182,6 @@ uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName( return xRes; } - uno::Type SAL_CALL ConvDicNameContainer::getElementType( ) throw (RuntimeException) { @@ -201,7 +189,6 @@ uno::Type SAL_CALL ConvDicNameContainer::getElementType( ) return uno::Type( ::getCppuType( (uno::Reference< XConversionDictionary > *) 0) ); } - sal_Bool SAL_CALL ConvDicNameContainer::hasElements( ) throw (RuntimeException) { @@ -209,7 +196,6 @@ sal_Bool SAL_CALL ConvDicNameContainer::hasElements( ) return aConvDics.getLength() > 0; } - uno::Any SAL_CALL ConvDicNameContainer::getByName( const OUString& rName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException) { @@ -220,7 +206,6 @@ uno::Any SAL_CALL ConvDicNameContainer::getByName( const OUString& rName ) return makeAny( xRes ); } - uno::Sequence< OUString > SAL_CALL ConvDicNameContainer::getElementNames( ) throw (RuntimeException) { @@ -235,7 +220,6 @@ uno::Sequence< OUString > SAL_CALL ConvDicNameContainer::getElementNames( ) return aRes; } - sal_Bool SAL_CALL ConvDicNameContainer::hasByName( const OUString& rName ) throw (RuntimeException) { @@ -243,7 +227,6 @@ sal_Bool SAL_CALL ConvDicNameContainer::hasByName( const OUString& rName ) return GetByName( rName ).is(); } - void SAL_CALL ConvDicNameContainer::replaceByName( const OUString& rName, const uno::Any& rElement ) @@ -261,7 +244,6 @@ void SAL_CALL ConvDicNameContainer::replaceByName( aConvDics.getArray()[ nRplcIdx ] = xNew; } - void SAL_CALL ConvDicNameContainer::insertByName( const OUString& rName, const Any& rElement ) @@ -281,7 +263,6 @@ void SAL_CALL ConvDicNameContainer::insertByName( aConvDics.getArray()[ nLen ] = xNew; } - void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException) { @@ -323,7 +304,6 @@ void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName ) aConvDics.realloc( nLen - 1 ); } - void ConvDicNameContainer::AddConvDics( const OUString &rSearchDirPathURL, const OUString &rExtension ) @@ -375,7 +355,6 @@ void ConvDicNameContainer::AddConvDics( } } - namespace { struct StaticConvDicList : public rtl::StaticWithInit< @@ -386,7 +365,6 @@ namespace }; } - void ConvDicList::MyAppExitListener::AtExit() { rMyDicList.FlushDics(); @@ -404,7 +382,6 @@ ConvDicList::ConvDicList() : pExitListener->Activate(); } - ConvDicList::~ConvDicList() { @@ -414,7 +391,6 @@ ConvDicList::~ConvDicList() pExitListener->Deactivate(); } - void ConvDicList::FlushDics() { // check only pointer to avoid creating the container when @@ -423,7 +399,6 @@ void ConvDicList::FlushDics() pNameContainer->FlushDics(); } - ConvDicNameContainer & ConvDicList::GetNameContainer() { if (!pNameContainer) @@ -460,7 +435,6 @@ ConvDicNameContainer & ConvDicList::GetNameContainer() return *pNameContainer; } - uno::Reference< container::XNameContainer > SAL_CALL ConvDicList::getDictionaryContainer( ) throw (RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); @@ -469,7 +443,6 @@ uno::Reference< container::XNameContainer > SAL_CALL ConvDicList::getDictionaryC return xNameContainer; } - uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary( const OUString& rName, const Locale& rLocale, @@ -508,7 +481,6 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary( return xRes; } - uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions( const OUString& rText, sal_Int32 nStartPos, @@ -561,7 +533,6 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions( return aRes; } - sal_Int16 SAL_CALL ConvDicList::queryMaxCharCount( const Locale& rLocale, sal_Int16 nConversionDictionaryType, @@ -588,7 +559,6 @@ sal_Int16 SAL_CALL ConvDicList::queryMaxCharCount( return nRes; } - void SAL_CALL ConvDicList::dispose( ) throw (RuntimeException) { @@ -603,7 +573,6 @@ void SAL_CALL ConvDicList::dispose( ) } } - void SAL_CALL ConvDicList::addEventListener( const uno::Reference< XEventListener >& rxListener ) throw (RuntimeException) @@ -613,7 +582,6 @@ void SAL_CALL ConvDicList::addEventListener( aEvtListeners.addInterface( rxListener ); } - void SAL_CALL ConvDicList::removeEventListener( const uno::Reference< XEventListener >& rxListener ) throw (RuntimeException) @@ -623,31 +591,26 @@ void SAL_CALL ConvDicList::removeEventListener( aEvtListeners.removeInterface( rxListener ); } - -OUString SAL_CALL ConvDicList::getImplementationName( ) +OUString SAL_CALL ConvDicList::getImplementationName() throw (RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); return getImplementationName_Static(); } - sal_Bool SAL_CALL ConvDicList::supportsService( const OUString& rServiceName ) throw (RuntimeException) { - MutexGuard aGuard( GetLinguMutex() ); - return rServiceName == SN_CONV_DICTIONARY_LIST; + return cppu::supportsService(this, rServiceName); } - -uno::Sequence< OUString > SAL_CALL ConvDicList::getSupportedServiceNames( ) +uno::Sequence< OUString > SAL_CALL ConvDicList::getSupportedServiceNames() throw (RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); return getSupportedServiceNames_Static(); } - uno::Sequence< OUString > ConvDicList::getSupportedServiceNames_Static() throw() { @@ -656,8 +619,6 @@ uno::Sequence< OUString > ConvDicList::getSupportedServiceNames_Static() return aSNS; } - - uno::Reference< uno::XInterface > SAL_CALL ConvDicList_CreateInstance( const uno::Reference< XMultiServiceFactory > & /*rSMgr*/ ) throw(Exception) @@ -685,5 +646,4 @@ void * SAL_CALL ConvDicList_getFactory( return pRet; } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit