/src/libreoffice/linguistic/source/defs.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | #include <com/sun/star/linguistic2/XSpellChecker.hpp> |
23 | | #include <com/sun/star/linguistic2/XHyphenator.hpp> |
24 | | #include <com/sun/star/linguistic2/XThesaurus.hpp> |
25 | | |
26 | | #include <memory> |
27 | | |
28 | | class SvStream; |
29 | | |
30 | | typedef std::shared_ptr< SvStream > SvStreamPtr; |
31 | | |
32 | | struct LangSvcEntries |
33 | | { |
34 | | css::uno::Sequence< OUString > aSvcImplNames; |
35 | | |
36 | | sal_Int16 nLastTriedSvcIndex; |
37 | | |
38 | | explicit LangSvcEntries( const css::uno::Sequence< OUString > &rSvcImplNames ) : |
39 | 0 | aSvcImplNames(rSvcImplNames), |
40 | 0 | nLastTriedSvcIndex(-1) |
41 | 0 | { |
42 | 0 | } |
43 | | |
44 | | explicit LangSvcEntries( const OUString &rSvcImplName ) : |
45 | 0 | nLastTriedSvcIndex(-1) |
46 | 0 | { |
47 | 0 | aSvcImplNames = { rSvcImplName }; |
48 | 0 | } |
49 | | |
50 | | void Clear() |
51 | 0 | { |
52 | 0 | aSvcImplNames.realloc(0); |
53 | 0 | nLastTriedSvcIndex = -1; |
54 | 0 | } |
55 | | }; |
56 | | |
57 | | struct LangSvcEntries_Spell : public LangSvcEntries |
58 | | { |
59 | | css::uno::Sequence< css::uno::Reference< css::linguistic2::XSpellChecker > > aSvcRefs; |
60 | | |
61 | 0 | explicit LangSvcEntries_Spell( const css::uno::Sequence< OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {} |
62 | | }; |
63 | | |
64 | | struct LangSvcEntries_Hyph : public LangSvcEntries |
65 | | { |
66 | | css::uno::Sequence< css::uno::Reference< css::linguistic2::XHyphenator > > aSvcRefs; |
67 | | |
68 | 0 | explicit LangSvcEntries_Hyph( const OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {} |
69 | | }; |
70 | | |
71 | | struct LangSvcEntries_Thes : public LangSvcEntries |
72 | | { |
73 | | css::uno::Sequence< css::uno::Reference< css::linguistic2::XThesaurus > > aSvcRefs; |
74 | | |
75 | 0 | explicit LangSvcEntries_Thes( const css::uno::Sequence< OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {} |
76 | | }; |
77 | | |
78 | | |
79 | | // virtual base class for the different dispatchers |
80 | | class LinguDispatcher |
81 | | { |
82 | | public: |
83 | | virtual void SetServiceList( const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames ) = 0; |
84 | | virtual css::uno::Sequence< OUString > GetServiceList( const css::lang::Locale &rLocale ) const = 0; |
85 | | |
86 | | protected: |
87 | 0 | ~LinguDispatcher() {} |
88 | | }; |
89 | | |
90 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |