1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _LINGUISTIC_CONVDICLIST_HXX_ 25 #define _LINGUISTIC_CONVDICLIST_HXX_ 26 27 #include <com/sun/star/linguistic2/XConversionDictionaryList.hpp> 28 #include <com/sun/star/lang/XComponent.hpp> 29 #include <com/sun/star/lang/XServiceInfo.hpp> 30 #include <cppuhelper/implbase3.hxx> 31 #include <cppuhelper/interfacecontainer.h> 32 #include <svl/svarray.hxx> 33 #include <tools/debug.hxx> 34 35 #include "linguistic/misc.hxx" 36 #include "lngopt.hxx" 37 38 39 class ConvDicNameContainer; 40 41 /////////////////////////////////////////////////////////////////////////// 42 43 class ConvDicList : 44 public cppu::WeakImplHelper3 45 < 46 ::com::sun::star::linguistic2::XConversionDictionaryList, 47 ::com::sun::star::lang::XComponent, 48 ::com::sun::star::lang::XServiceInfo 49 > 50 { 51 52 class MyAppExitListener : public linguistic::AppExitListener 53 { 54 ConvDicList & rMyDicList; 55 56 public: 57 MyAppExitListener( ConvDicList &rDicList ) : rMyDicList( rDicList ) {} 58 virtual void AtExit(); 59 }; 60 61 62 ::cppu::OInterfaceContainerHelper aEvtListeners; 63 64 ConvDicNameContainer *pNameContainer; 65 ::com::sun::star::uno::Reference< 66 ::com::sun::star::container::XNameContainer > xNameContainer; 67 68 MyAppExitListener *pExitListener; 69 ::com::sun::star::uno::Reference< ::com::sun::star::frame:: 70 XTerminateListener > xExitListener; 71 72 sal_Bool bDisposing; 73 74 // disallow copy-constructor and assignment-operator for now 75 ConvDicList( const ConvDicList & ); 76 ConvDicList & operator = (const ConvDicList &); 77 78 ConvDicNameContainer & GetNameContainer(); 79 80 public: 81 ConvDicList(); 82 virtual ~ConvDicList(); 83 84 // XConversionDictionaryList 85 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getDictionaryContainer( ) throw (::com::sun::star::uno::RuntimeException); 86 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); 87 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); 88 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); 89 90 // XComponent 91 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); 92 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 93 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 94 95 // XServiceInfo 96 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 97 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 98 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 99 100 101 static inline ::rtl::OUString 102 getImplementationName_Static() throw(); 103 static com::sun::star::uno::Sequence< ::rtl::OUString > 104 getSupportedServiceNames_Static() throw(); 105 106 // non UNO-specific 107 void FlushDics(); 108 }; 109 110 inline ::rtl::OUString ConvDicList::getImplementationName_Static() throw() 111 { 112 return A2OU( "com.sun.star.lingu2.ConvDicList" ); 113 } 114 115 /////////////////////////////////////////////////////////////////////////// 116 117 #endif 118 119