Update ooo320-m1
[ooovba.git] / linguistic / source / defs.hxx
blob7068faae2561af6f7c4412fc68407987c1b6475d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: defs.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _LINGUISTIC_DEFS_HXX_
32 #define _LINGUISTIC_DEFS_HXX_
34 #include <com/sun/star/linguistic2/XSpellChecker.hpp>
35 #include <com/sun/star/linguistic2/XProofreader.hpp>
36 #include <com/sun/star/linguistic2/XHyphenator.hpp>
37 #include <com/sun/star/linguistic2/XThesaurus.hpp>
39 ///////////////////////////////////////////////////////////////////////////
41 #define A2OU(x) ::rtl::OUString::createFromAscii( x )
43 namespace css = ::com::sun::star;
45 ///////////////////////////////////////////////////////////////////////////
47 struct LangSvcEntries
49 css::uno::Sequence< ::rtl::OUString > aSvcImplNames;
51 sal_Int16 nLastTriedSvcIndex;
52 bool bAlreadyWarned;
53 bool bDoWarnAgain;
55 LangSvcEntries() : nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false) {}
57 inline LangSvcEntries( const css::uno::Sequence< ::rtl::OUString > &rSvcImplNames ) :
58 aSvcImplNames(rSvcImplNames),
59 nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
63 inline LangSvcEntries( const ::rtl::OUString &rSvcImplName ) :
64 nLastTriedSvcIndex(-1), bAlreadyWarned(false), bDoWarnAgain(false)
66 aSvcImplNames.realloc(1);
67 aSvcImplNames[0] = rSvcImplName;
70 bool IsAlreadyWarned() const { return bAlreadyWarned != 0; }
71 void SetAlreadyWarned( bool bVal ) { bAlreadyWarned = 0 != bVal; }
72 bool IsDoWarnAgain() const { return bDoWarnAgain != 0; }
73 void SetDoWarnAgain( bool bVal ) { bDoWarnAgain = 0 != bVal; }
75 inline void Clear()
77 aSvcImplNames.realloc(0);
78 nLastTriedSvcIndex = -1;
79 bAlreadyWarned = false;
80 bDoWarnAgain = false;
84 struct LangSvcEntries_Spell : public LangSvcEntries
86 css::uno::Sequence< css::uno::Reference< css::linguistic2::XSpellChecker > > aSvcRefs;
88 LangSvcEntries_Spell() : LangSvcEntries() {}
89 LangSvcEntries_Spell( const css::uno::Sequence< ::rtl::OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {}
92 struct LangSvcEntries_Grammar : public LangSvcEntries
94 css::uno::Sequence< css::uno::Reference< css::linguistic2::XProofreader > > aSvcRefs;
96 LangSvcEntries_Grammar() : LangSvcEntries() {}
97 LangSvcEntries_Grammar( const ::rtl::OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {}
98 };
100 struct LangSvcEntries_Hyph : public LangSvcEntries
102 css::uno::Sequence< css::uno::Reference< css::linguistic2::XHyphenator > > aSvcRefs;
104 LangSvcEntries_Hyph() : LangSvcEntries() {}
105 LangSvcEntries_Hyph( const ::rtl::OUString &rSvcImplName ) : LangSvcEntries( rSvcImplName ) {}
108 struct LangSvcEntries_Thes : public LangSvcEntries
110 css::uno::Sequence< css::uno::Reference< css::linguistic2::XThesaurus > > aSvcRefs;
112 LangSvcEntries_Thes() : LangSvcEntries() {}
113 LangSvcEntries_Thes( const css::uno::Sequence< ::rtl::OUString > &rSvcImplNames ) : LangSvcEntries( rSvcImplNames ) {}
116 ///////////////////////////////////////////////////////////////////////////
118 // virtual base class for the different dispatchers
119 class LinguDispatcher
121 public:
122 enum DspType { DSP_SPELL, DSP_HYPH, DSP_THES, DSP_GRAMMAR };
124 virtual void SetServiceList( const css::lang::Locale &rLocale, const css::uno::Sequence< rtl::OUString > &rSvcImplNames ) = 0;
125 virtual css::uno::Sequence< rtl::OUString > GetServiceList( const css::lang::Locale &rLocale ) const = 0;
126 virtual DspType GetDspType() const = 0;
129 ///////////////////////////////////////////////////////////////////////////
131 #endif