1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_DEFS_HXX
21 #define INCLUDED_LINGUISTIC_SOURCE_DEFS_HXX
23 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
24 #include <com/sun/star/linguistic2/XProofreader.hpp>
25 #include <com/sun/star/linguistic2/XHyphenator.hpp>
26 #include <com/sun/star/linguistic2/XThesaurus.hpp>
28 #include <boost/shared_ptr.hpp>
34 typedef boost::shared_ptr
< SvStream
> SvStreamPtr
;
38 css::uno::Sequence
< OUString
> aSvcImplNames
;
40 sal_Int16 nLastTriedSvcIndex
;
44 LangSvcEntries() : nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false) {}
46 inline LangSvcEntries( const css::uno::Sequence
< OUString
> &rSvcImplNames
) :
47 aSvcImplNames(rSvcImplNames
),
48 nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
52 inline LangSvcEntries( const OUString
&rSvcImplName
) :
53 nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
55 aSvcImplNames
.realloc(1);
56 aSvcImplNames
[0] = rSvcImplName
;
59 bool IsAlreadyWarned() const { return bAlreadyWarned
; }
60 void SetAlreadyWarned( bool bVal
) { bAlreadyWarned
= bVal
; }
61 bool IsDoWarnAgain() const { return bDoWarnAgain
; }
62 void SetDoWarnAgain( bool bVal
) { bDoWarnAgain
= bVal
; }
66 aSvcImplNames
.realloc(0);
67 nLastTriedSvcIndex
= -1;
68 bAlreadyWarned
= false;
73 struct LangSvcEntries_Spell
: public LangSvcEntries
75 css::uno::Sequence
< css::uno::Reference
< css::linguistic2::XSpellChecker
> > aSvcRefs
;
77 LangSvcEntries_Spell() : LangSvcEntries() {}
78 LangSvcEntries_Spell( const css::uno::Sequence
< OUString
> &rSvcImplNames
) : LangSvcEntries( rSvcImplNames
) {}
81 struct LangSvcEntries_Grammar
: public LangSvcEntries
83 css::uno::Sequence
< css::uno::Reference
< css::linguistic2::XProofreader
> > aSvcRefs
;
85 LangSvcEntries_Grammar() : LangSvcEntries() {}
86 LangSvcEntries_Grammar( const OUString
&rSvcImplName
) : LangSvcEntries( rSvcImplName
) {}
89 struct LangSvcEntries_Hyph
: public LangSvcEntries
91 css::uno::Sequence
< css::uno::Reference
< css::linguistic2::XHyphenator
> > aSvcRefs
;
93 LangSvcEntries_Hyph() : LangSvcEntries() {}
94 LangSvcEntries_Hyph( const OUString
&rSvcImplName
) : LangSvcEntries( rSvcImplName
) {}
97 struct LangSvcEntries_Thes
: public LangSvcEntries
99 css::uno::Sequence
< css::uno::Reference
< css::linguistic2::XThesaurus
> > aSvcRefs
;
101 LangSvcEntries_Thes() : LangSvcEntries() {}
102 LangSvcEntries_Thes( const css::uno::Sequence
< OUString
> &rSvcImplNames
) : LangSvcEntries( rSvcImplNames
) {}
106 // virtual base class for the different dispatchers
107 class LinguDispatcher
110 enum DspType
{ DSP_SPELL
, DSP_HYPH
, DSP_THES
, DSP_GRAMMAR
};
112 virtual void SetServiceList( const css::lang::Locale
&rLocale
, const css::uno::Sequence
< OUString
> &rSvcImplNames
) = 0;
113 virtual css::uno::Sequence
< OUString
> GetServiceList( const css::lang::Locale
&rLocale
) const = 0;
114 virtual DspType
GetDspType() const = 0;
117 ~LinguDispatcher() {}
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */