Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / linguistic / source / thesdsp.hxx
blob954723417a0ac2f6035d9a0a8e204044351c71d0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_LINGUISTIC_SOURCE_THESDSP_HXX
21 #define INCLUDED_LINGUISTIC_SOURCE_THESDSP_HXX
23 #include <com/sun/star/uno/Reference.h>
24 #include <com/sun/star/uno/Sequence.h>
26 #include <com/sun/star/linguistic2/XLinguProperties.hpp>
27 #include <com/sun/star/linguistic2/XThesaurus.hpp>
29 #include <cppuhelper/implbase.hxx>
30 #include <linguistic/misc.hxx>
32 #include <map>
33 #include <memory>
35 #include "defs.hxx"
38 class ThesaurusDispatcher :
39 public cppu::WeakImplHelper< css::linguistic2::XThesaurus >,
40 public LinguDispatcher
42 typedef std::shared_ptr< LangSvcEntries_Thes > LangSvcEntries_Thes_Ptr_t;
43 typedef std::map< LanguageType, LangSvcEntries_Thes_Ptr_t > ThesSvcByLangMap_t;
44 ThesSvcByLangMap_t aSvcMap;
46 css::uno::Reference< css::linguistic2::XLinguProperties > xPropSet;
48 ThesaurusDispatcher(const ThesaurusDispatcher &) = delete;
49 ThesaurusDispatcher & operator = (const ThesaurusDispatcher &) = delete;
51 inline css::uno::Reference< css::linguistic2::XLinguProperties >
52 GetPropSet();
54 void ClearSvcList();
56 public:
57 ThesaurusDispatcher();
58 virtual ~ThesaurusDispatcher() override;
60 // XSupportedLocales
61 virtual css::uno::Sequence< css::lang::Locale > SAL_CALL
62 getLocales() override;
63 virtual sal_Bool SAL_CALL
64 hasLocale( const css::lang::Locale& aLocale ) override;
66 // XThesaurus
67 virtual css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > > SAL_CALL
68 queryMeanings( const OUString& aTerm,
69 const css::lang::Locale& aLocale,
70 const css::uno::Sequence< ::css::beans::PropertyValue >& aProperties ) override;
72 // LinguDispatcher
73 virtual void
74 SetServiceList( const css::lang::Locale &rLocale,
75 const css::uno::Sequence< OUString > &rSvcImplNames ) override;
76 virtual css::uno::Sequence< OUString >
77 GetServiceList( const css::lang::Locale &rLocale ) const override;
81 inline css::uno::Reference< css::linguistic2::XLinguProperties >
82 ThesaurusDispatcher::GetPropSet()
84 return xPropSet.is() ?
85 xPropSet : xPropSet = linguistic::GetLinguProperties();
89 #endif
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */