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 INCLUDED_LINGUISTIC_SOURCE_THESDSP_HXX
21 : #define INCLUDED_LINGUISTIC_SOURCE_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 <cppuhelper/implbase1.hxx>
36 : #include <cppuhelper/implbase5.hxx>
37 : #include <cppuhelper/interfacecontainer.h>
38 :
39 : #include <osl/mutex.hxx>
40 :
41 : #include <boost/shared_ptr.hpp>
42 : #include <map>
43 :
44 : #include "lngopt.hxx"
45 :
46 :
47 :
48 : class ThesaurusDispatcher :
49 : public cppu::WeakImplHelper1
50 : <
51 : ::com::sun::star::linguistic2::XThesaurus
52 : >,
53 : public LinguDispatcher
54 : {
55 : typedef boost::shared_ptr< LangSvcEntries_Thes > LangSvcEntries_Thes_Ptr_t;
56 : typedef std::map< LanguageType, LangSvcEntries_Thes_Ptr_t > ThesSvcByLangMap_t;
57 : ThesSvcByLangMap_t aSvcMap;
58 :
59 : ::com::sun::star::uno::Reference<
60 : ::com::sun::star::linguistic2::XLinguProperties > xPropSet;
61 :
62 : // disallow copy-constructor and assignment-operator for now
63 : ThesaurusDispatcher(const ThesaurusDispatcher &);
64 : ThesaurusDispatcher & operator = (const ThesaurusDispatcher &);
65 :
66 : inline ::com::sun::star::uno::Reference<
67 : ::com::sun::star::linguistic2::XLinguProperties >
68 : GetPropSet();
69 :
70 : void ClearSvcList();
71 :
72 : public:
73 : ThesaurusDispatcher();
74 : virtual ~ThesaurusDispatcher();
75 :
76 : // XSupportedLocales
77 : virtual ::com::sun::star::uno::Sequence<
78 : ::com::sun::star::lang::Locale > SAL_CALL
79 : getLocales()
80 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 : virtual sal_Bool SAL_CALL
82 : hasLocale( const ::com::sun::star::lang::Locale& aLocale )
83 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 :
85 : // XThesaurus
86 : virtual ::com::sun::star::uno::Sequence<
87 : ::com::sun::star::uno::Reference<
88 : ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
89 : queryMeanings( const OUString& aTerm,
90 : const ::com::sun::star::lang::Locale& aLocale,
91 : const ::com::sun::star::beans::PropertyValues& aProperties )
92 : throw(::com::sun::star::lang::IllegalArgumentException,
93 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 :
95 : // LinguDispatcher
96 : virtual void
97 : SetServiceList( const ::com::sun::star::lang::Locale &rLocale,
98 : const ::com::sun::star::uno::Sequence<
99 : OUString > &rSvcImplNames ) SAL_OVERRIDE;
100 : virtual ::com::sun::star::uno::Sequence< OUString >
101 : GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const SAL_OVERRIDE;
102 : virtual DspType
103 : GetDspType() const SAL_OVERRIDE;
104 : };
105 :
106 :
107 : inline ::com::sun::star::uno::Reference<
108 : ::com::sun::star::linguistic2::XLinguProperties >
109 0 : ThesaurusDispatcher::GetPropSet()
110 : {
111 0 : return xPropSet.is() ?
112 0 : xPropSet : xPropSet = linguistic::GetLinguProperties();
113 : }
114 :
115 :
116 :
117 : #endif
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|