1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _LINGUISTIC_CONVDICLIST_HXX_ 29 #define _LINGUISTIC_CONVDICLIST_HXX_ 30 31 #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp> 32 #include <com/sun/star/lang/XComponent.hpp> 33 #include <com/sun/star/lang/XServiceInfo.hpp> 34 #include <cppuhelper/implbase3.hxx> 35 #include <cppuhelper/interfacecontainer.h> 36 #include <svl/svarray.hxx> 37 #include <tools/debug.hxx> 38 39 #include "linguistic/misc.hxx" 40 #include "lngopt.hxx" 41 42 43 class ConvDicNameContainer; 44 45 /////////////////////////////////////////////////////////////////////////// 46 47 class ConvDicList : 48 public cppu::WeakImplHelper3 49 < 50 ::com::sun::star::linguistic2::XConversionDictionaryList, 51 ::com::sun::star::lang::XComponent, 52 ::com::sun::star::lang::XServiceInfo 53 > 54 { 55 56 class MyAppExitListener : public linguistic::AppExitListener 57 { 58 ConvDicList & rMyDicList; 59 60 public: 61 MyAppExitListener( ConvDicList &rDicList ) : rMyDicList( rDicList ) {} 62 virtual void AtExit(); 63 }; 64 65 66 ::cppu::OInterfaceContainerHelper aEvtListeners; 67 68 ConvDicNameContainer *pNameContainer; 69 ::com::sun::star::uno::Reference< 70 ::com::sun::star::container::XNameContainer > xNameContainer; 71 72 MyAppExitListener *pExitListener; 73 ::com::sun::star::uno::Reference< ::com::sun::star::frame:: 74 XTerminateListener > xExitListener; 75 76 sal_Bool bDisposing; 77 78 // disallow copy-constructor and assignment-operator for now 79 ConvDicList( const ConvDicList & ); 80 ConvDicList & operator = (const ConvDicList &); 81 82 ConvDicNameContainer & GetNameContainer(); 83 84 public: 85 ConvDicList(); 86 virtual ~ConvDicList(); 87 88 // XConversionDictionaryList 89 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getDictionaryContainer( ) throw (::com::sun::star::uno::RuntimeException); 90 virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary > SAL_CALL addNewDictionary( const ::rtl::OUString& aName, const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nConversionDictionaryType ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); 91 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL queryConversions( const ::rtl::OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nConversionDictionaryType, ::com::sun::star::linguistic2::ConversionDirection eDirection, sal_Int32 nTextConversionOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); 92 virtual sal_Int16 SAL_CALL queryMaxCharCount( const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nConversionDictionaryType, ::com::sun::star::linguistic2::ConversionDirection eDirection ) throw (::com::sun::star::uno::RuntimeException); 93 94 // XComponent 95 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); 96 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 97 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 98 99 // XServiceInfo 100 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 101 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 102 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 103 104 105 static inline ::rtl::OUString 106 getImplementationName_Static() throw(); 107 static com::sun::star::uno::Sequence< ::rtl::OUString > 108 getSupportedServiceNames_Static() throw(); 109 110 // non UNO-specific 111 void FlushDics(); 112 }; 113 114 inline ::rtl::OUString ConvDicList::getImplementationName_Static() throw() 115 { 116 return A2OU( "com.sun.star.lingu2.ConvDicList" ); 117 } 118 119 /////////////////////////////////////////////////////////////////////////// 120 121 #endif 122 123