Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _LINGUISTIC_THESDSP_HXX_
21 : #define _LINGUISTIC_THESDSP_HXX_
22 :
23 : #include <com/sun/star/uno/Reference.h>
24 : #include <com/sun/star/uno/Sequence.h>
25 : #include <com/sun/star/beans/XPropertySet.hpp>
26 : #include <com/sun/star/beans/XPropertyAccess.hpp>
27 : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
28 : #include <com/sun/star/lang/XComponent.hpp>
29 : #include <com/sun/star/lang/XInitialization.hpp>
30 : #include <com/sun/star/lang/XServiceDisplayName.hpp>
31 :
32 : #include <com/sun/star/lang/XServiceInfo.hpp>
33 : #include <com/sun/star/linguistic2/XThesaurus.hpp>
34 :
35 : #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
36 : #include <cppuhelper/implbase1.hxx> // helper for implementations
37 : #include <cppuhelper/implbase5.hxx> // helper for implementations
38 : #include <cppuhelper/interfacecontainer.h>
39 :
40 : #include <osl/mutex.hxx>
41 :
42 : #include <boost/shared_ptr.hpp>
43 : #include <map>
44 :
45 : #include "lngopt.hxx"
46 :
47 :
48 :
49 : class ThesaurusDispatcher :
50 : public cppu::WeakImplHelper1
51 : <
52 : ::com::sun::star::linguistic2::XThesaurus
53 : >,
54 : public LinguDispatcher
55 : {
56 : typedef boost::shared_ptr< LangSvcEntries_Thes > LangSvcEntries_Thes_Ptr_t;
57 : typedef std::map< LanguageType, LangSvcEntries_Thes_Ptr_t > ThesSvcByLangMap_t;
58 : ThesSvcByLangMap_t aSvcMap;
59 :
60 : ::com::sun::star::uno::Reference<
61 : ::com::sun::star::linguistic2::XLinguProperties > xPropSet;
62 :
63 : // disallow copy-constructor and assignment-operator for now
64 : ThesaurusDispatcher(const ThesaurusDispatcher &);
65 : ThesaurusDispatcher & operator = (const ThesaurusDispatcher &);
66 :
67 : inline ::com::sun::star::uno::Reference<
68 : ::com::sun::star::linguistic2::XLinguProperties >
69 : GetPropSet();
70 :
71 : void ClearSvcList();
72 :
73 : public:
74 : ThesaurusDispatcher();
75 : virtual ~ThesaurusDispatcher();
76 :
77 : // XSupportedLocales
78 : virtual ::com::sun::star::uno::Sequence<
79 : ::com::sun::star::lang::Locale > SAL_CALL
80 : getLocales()
81 : throw(::com::sun::star::uno::RuntimeException);
82 : virtual sal_Bool SAL_CALL
83 : hasLocale( const ::com::sun::star::lang::Locale& aLocale )
84 : throw(::com::sun::star::uno::RuntimeException);
85 :
86 : // XThesaurus
87 : virtual ::com::sun::star::uno::Sequence<
88 : ::com::sun::star::uno::Reference<
89 : ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
90 : queryMeanings( const OUString& aTerm,
91 : const ::com::sun::star::lang::Locale& aLocale,
92 : const ::com::sun::star::beans::PropertyValues& aProperties )
93 : throw(::com::sun::star::lang::IllegalArgumentException,
94 : ::com::sun::star::uno::RuntimeException);
95 :
96 : // LinguDispatcher
97 : virtual void
98 : SetServiceList( const ::com::sun::star::lang::Locale &rLocale,
99 : const ::com::sun::star::uno::Sequence<
100 : OUString > &rSvcImplNames );
101 : virtual ::com::sun::star::uno::Sequence< OUString >
102 : GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const;
103 : virtual DspType
104 : GetDspType() const;
105 : };
106 :
107 :
108 : inline ::com::sun::star::uno::Reference<
109 : ::com::sun::star::linguistic2::XLinguProperties >
110 0 : ThesaurusDispatcher::GetPropSet()
111 : {
112 0 : return xPropSet.is() ?
113 0 : xPropSet : xPropSet = linguistic::GetLinguProperties();
114 : }
115 :
116 :
117 :
118 : #endif
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|