1*63ce064aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*63ce064aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*63ce064aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*63ce064aSAndrew Rist * distributed with this work for additional information 6*63ce064aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*63ce064aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*63ce064aSAndrew Rist * "License"); you may not use this file except in compliance 9*63ce064aSAndrew Rist * with the License. You may obtain a copy of the License at 10*63ce064aSAndrew Rist * 11*63ce064aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*63ce064aSAndrew Rist * 13*63ce064aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*63ce064aSAndrew Rist * software distributed under the License is distributed on an 15*63ce064aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*63ce064aSAndrew Rist * KIND, either express or implied. See the License for the 17*63ce064aSAndrew Rist * specific language governing permissions and limitations 18*63ce064aSAndrew Rist * under the License. 19*63ce064aSAndrew Rist * 20*63ce064aSAndrew Rist *************************************************************/ 21*63ce064aSAndrew Rist 22*63ce064aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _LINGUISTIC_THESDSP_HXX_ 25cdf0e10cSrcweir #define _LINGUISTIC_THESDSP_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 28cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h> 29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp> 31cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp> 32cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceDisplayName.hpp> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 37cdf0e10cSrcweir #include <com/sun/star/linguistic2/XThesaurus.hpp> 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type 40cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> // helper for implementations 41cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> // helper for implementations 42cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include <vos/mutex.hxx> 45cdf0e10cSrcweir 46cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 47cdf0e10cSrcweir #include <map> 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include "lngopt.hxx" 50cdf0e10cSrcweir 51cdf0e10cSrcweir 52cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 53cdf0e10cSrcweir 54cdf0e10cSrcweir class ThesaurusDispatcher : 55cdf0e10cSrcweir public cppu::WeakImplHelper1 56cdf0e10cSrcweir < 57cdf0e10cSrcweir ::com::sun::star::linguistic2::XThesaurus 58cdf0e10cSrcweir >, 59cdf0e10cSrcweir public LinguDispatcher 60cdf0e10cSrcweir { 61cdf0e10cSrcweir typedef boost::shared_ptr< LangSvcEntries_Thes > LangSvcEntries_Thes_Ptr_t; 62cdf0e10cSrcweir typedef std::map< LanguageType, LangSvcEntries_Thes_Ptr_t > ThesSvcByLangMap_t; 63cdf0e10cSrcweir ThesSvcByLangMap_t aSvcMap; 64cdf0e10cSrcweir 65cdf0e10cSrcweir ::com::sun::star::uno::Reference< 66cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet > xPropSet; 67cdf0e10cSrcweir 68cdf0e10cSrcweir // disallow copy-constructor and assignment-operator for now 69cdf0e10cSrcweir ThesaurusDispatcher(const ThesaurusDispatcher &); 70cdf0e10cSrcweir ThesaurusDispatcher & operator = (const ThesaurusDispatcher &); 71cdf0e10cSrcweir 72cdf0e10cSrcweir inline ::com::sun::star::uno::Reference< 73cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet > 74cdf0e10cSrcweir GetPropSet(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir void ClearSvcList(); 77cdf0e10cSrcweir 78cdf0e10cSrcweir public: 79cdf0e10cSrcweir ThesaurusDispatcher(); 80cdf0e10cSrcweir virtual ~ThesaurusDispatcher(); 81cdf0e10cSrcweir 82cdf0e10cSrcweir // XSupportedLocales 83cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< 84cdf0e10cSrcweir ::com::sun::star::lang::Locale > SAL_CALL 85cdf0e10cSrcweir getLocales() 86cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 87cdf0e10cSrcweir virtual sal_Bool SAL_CALL 88cdf0e10cSrcweir hasLocale( const ::com::sun::star::lang::Locale& aLocale ) 89cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 90cdf0e10cSrcweir 91cdf0e10cSrcweir // XThesaurus 92cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< 93cdf0e10cSrcweir ::com::sun::star::uno::Reference< 94cdf0e10cSrcweir ::com::sun::star::linguistic2::XMeaning > > SAL_CALL 95cdf0e10cSrcweir queryMeanings( const ::rtl::OUString& aTerm, 96cdf0e10cSrcweir const ::com::sun::star::lang::Locale& aLocale, 97cdf0e10cSrcweir const ::com::sun::star::beans::PropertyValues& aProperties ) 98cdf0e10cSrcweir throw(::com::sun::star::lang::IllegalArgumentException, 99cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 100cdf0e10cSrcweir 101cdf0e10cSrcweir // LinguDispatcher 102cdf0e10cSrcweir virtual void 103cdf0e10cSrcweir SetServiceList( const ::com::sun::star::lang::Locale &rLocale, 104cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< 105cdf0e10cSrcweir rtl::OUString > &rSvcImplNames ); 106cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< rtl::OUString > 107cdf0e10cSrcweir GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const; 108cdf0e10cSrcweir virtual DspType 109cdf0e10cSrcweir GetDspType() const; 110cdf0e10cSrcweir }; 111cdf0e10cSrcweir 112cdf0e10cSrcweir 113cdf0e10cSrcweir inline ::com::sun::star::uno::Reference< 114cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet > GetPropSet()115cdf0e10cSrcweir ThesaurusDispatcher::GetPropSet() 116cdf0e10cSrcweir { 117cdf0e10cSrcweir return xPropSet.is() ? 118cdf0e10cSrcweir xPropSet : xPropSet = linguistic::GetLinguProperties(); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir 122cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////// 123cdf0e10cSrcweir 124cdf0e10cSrcweir #endif 125cdf0e10cSrcweir 126