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 : ThesaurusDispatcher(const ThesaurusDispatcher &) SAL_DELETED_FUNCTION;
63 : ThesaurusDispatcher & operator = (const ThesaurusDispatcher &) SAL_DELETED_FUNCTION;
64 :
65 : inline ::com::sun::star::uno::Reference<
66 : ::com::sun::star::linguistic2::XLinguProperties >
67 : GetPropSet();
68 :
69 : void ClearSvcList();
70 :
71 : public:
72 : ThesaurusDispatcher();
73 : virtual ~ThesaurusDispatcher();
74 :
75 : // XSupportedLocales
76 : virtual ::com::sun::star::uno::Sequence<
77 : ::com::sun::star::lang::Locale > SAL_CALL
78 : getLocales()
79 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 : virtual sal_Bool SAL_CALL
81 : hasLocale( const ::com::sun::star::lang::Locale& aLocale )
82 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 :
84 : // XThesaurus
85 : virtual ::com::sun::star::uno::Sequence<
86 : ::com::sun::star::uno::Reference<
87 : ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
88 : queryMeanings( const OUString& aTerm,
89 : const ::com::sun::star::lang::Locale& aLocale,
90 : const ::com::sun::star::beans::PropertyValues& aProperties )
91 : throw(::com::sun::star::lang::IllegalArgumentException,
92 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 :
94 : // LinguDispatcher
95 : virtual void
96 : SetServiceList( const ::com::sun::star::lang::Locale &rLocale,
97 : const ::com::sun::star::uno::Sequence<
98 : OUString > &rSvcImplNames ) SAL_OVERRIDE;
99 : virtual ::com::sun::star::uno::Sequence< OUString >
100 : GetServiceList( const ::com::sun::star::lang::Locale &rLocale ) const SAL_OVERRIDE;
101 : virtual DspType
102 : GetDspType() const SAL_OVERRIDE;
103 : };
104 :
105 :
106 : inline ::com::sun::star::uno::Reference<
107 : ::com::sun::star::linguistic2::XLinguProperties >
108 0 : ThesaurusDispatcher::GetPropSet()
109 : {
110 0 : return xPropSet.is() ?
111 0 : xPropSet : xPropSet = linguistic::GetLinguProperties();
112 : }
113 :
114 :
115 :
116 : #endif
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|