1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unolingu.hxx,v $
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 _UNO_LINGU_HXX
32 #define _UNO_LINGU_HXX
34 #include <i18npool/lang.h>
35 #include <tools/string.hxx>
36 #include <vos/refernce.hxx>
37 #include <com/sun/star/util/Language.hpp>
38 #include <com/sun/star/lang/Locale.hpp>
39 #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
40 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
41 #include <com/sun/star/linguistic2/XHyphenator.hpp>
42 #include <com/sun/star/linguistic2/XThesaurus.hpp>
43 #include <com/sun/star/linguistic2/XDictionaryList.hpp>
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 #include "svx/svxdllapi.h"
47 class LinguMgrExitLstnr
;
51 ///////////////////////////////////////////////////////////////////////////
52 // SvxLinguConfigUpdate
53 // class to update configuration items when (before!) the linguistic is used.
55 // This class is called by all the dummy implementations to update all of the
56 // configuration (list of used/available services) when the linguistic is
57 // accessed for the first time.
59 class SvxLinguConfigUpdate
61 static INT32 nCurrentDataFilesChangedCheckValue
;
62 static INT16 nNeedUpdating
; // n == -1 => needs to be checked
63 // n == 0 => already updated, nothing to be done
64 // n == 1 => needs to be updated
66 static INT32
CalcDataFilesChangedCheckValue();
70 SVX_DLLPUBLIC
static void UpdateAll( sal_Bool bForceCheck
= sal_False
);
71 static BOOL
IsNeedUpdateAll( sal_Bool bForceCheck
= sal_False
);
74 ///////////////////////////////////////////////////////////////////////////
76 class SVX_DLLPUBLIC LinguMgr
78 friend class LinguMgrExitLstnr
;
80 //static ::VOS::ORefCount aRefCount;
82 static ::com::sun::star::uno::Reference
<
83 ::com::sun::star::linguistic2::XLinguServiceManager
> xLngSvcMgr
;
84 static ::com::sun::star::uno::Reference
<
85 ::com::sun::star::linguistic2::XSpellChecker1
> xSpell
;
86 static ::com::sun::star::uno::Reference
<
87 ::com::sun::star::linguistic2::XHyphenator
> xHyph
;
88 static ::com::sun::star::uno::Reference
<
89 ::com::sun::star::linguistic2::XThesaurus
> xThes
;
90 static ::com::sun::star::uno::Reference
<
91 ::com::sun::star::linguistic2::XDictionaryList
> xDicList
;
92 static ::com::sun::star::uno::Reference
<
93 ::com::sun::star::beans::XPropertySet
> xProp
;
95 static ::com::sun::star::uno::Reference
<
96 ::com::sun::star::linguistic2::XDictionary
> xIgnoreAll
;
97 static ::com::sun::star::uno::Reference
<
98 ::com::sun::star::linguistic2::XDictionary
> xChangeAll
;
100 static LinguMgrExitLstnr
*pExitLstnr
;
101 static sal_Bool bExiting
;
103 static ::com::sun::star::uno::Reference
<
104 ::com::sun::star::linguistic2::XSpellChecker1
> GetSpell();
105 static ::com::sun::star::uno::Reference
<
106 ::com::sun::star::linguistic2::XHyphenator
> GetHyph();
107 static ::com::sun::star::uno::Reference
<
108 ::com::sun::star::linguistic2::XThesaurus
> GetThes();
109 static ::com::sun::star::uno::Reference
<
110 ::com::sun::star::linguistic2::XDictionaryList
> GetDicList();
111 static ::com::sun::star::uno::Reference
<
112 ::com::sun::star::beans::XPropertySet
> GetProp();
113 static ::com::sun::star::uno::Reference
<
114 ::com::sun::star::linguistic2::XDictionary
> GetStandard();
115 static ::com::sun::star::uno::Reference
<
116 ::com::sun::star::linguistic2::XDictionary
> GetIgnoreAll();
117 static ::com::sun::star::uno::Reference
<
118 ::com::sun::star::linguistic2::XDictionary
> GetChangeAll();
120 // disallow access to copy-constructor and assignment-operator
121 LinguMgr(const LinguMgr
&);
122 LinguMgr
& operator = (const LinguMgr
&);
126 static ::com::sun::star::uno::Reference
<
127 ::com::sun::star::linguistic2::XSpellChecker1
> GetSpellChecker();
128 static ::com::sun::star::uno::Reference
<
129 ::com::sun::star::linguistic2::XHyphenator
> GetHyphenator();
130 static ::com::sun::star::uno::Reference
<
131 ::com::sun::star::linguistic2::XThesaurus
> GetThesaurus();
132 static ::com::sun::star::uno::Reference
<
133 ::com::sun::star::linguistic2::XDictionaryList
> GetDictionaryList();
134 static ::com::sun::star::uno::Reference
<
135 ::com::sun::star::beans::XPropertySet
> GetLinguPropertySet();
137 static ::com::sun::star::uno::Reference
<
138 ::com::sun::star::linguistic2::XLinguServiceManager
> GetLngSvcMgr();
140 static ::com::sun::star::uno::Reference
<
141 ::com::sun::star::linguistic2::XDictionary
> GetStandardDic();
142 static ::com::sun::star::uno::Reference
<
143 ::com::sun::star::linguistic2::XDictionary
> GetIgnoreAllList();
144 static ::com::sun::star::uno::Reference
<
145 ::com::sun::star::linguistic2::XDictionary
> GetChangeAllList();
147 // update all configuration entries
148 static void UpdateAll();
151 ///////////////////////////////////////////////////////////////////////////
153 namespace com
{ namespace sun
{ namespace star
{ namespace linguistic2
{
154 class XHyphenatedWord
;
158 struct SvxAlternativeSpelling
161 ::com::sun::star::uno::Reference
<
162 ::com::sun::star::linguistic2::XHyphenatedWord
> xHyphWord
;
167 inline SvxAlternativeSpelling();
170 inline SvxAlternativeSpelling::SvxAlternativeSpelling() :
171 nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(FALSE
)
176 SVX_DLLPUBLIC SvxAlternativeSpelling
SvxGetAltSpelling(
177 const ::com::sun::star::uno::Reference
<
178 ::com::sun::star::linguistic2::XHyphenatedWord
> & rHyphWord
);
181 ///////////////////////////////////////////////////////////////////////////
183 class SVX_DLLPUBLIC SvxDicListChgClamp
186 ::com::sun::star::uno::Reference
<
187 ::com::sun::star::linguistic2::XDictionaryList
> xDicList
;
189 // disallow access to copy-constructor and assignment-operator
190 SVX_DLLPRIVATE
SvxDicListChgClamp(const SvxDicListChgClamp
&);
191 SVX_DLLPRIVATE SvxDicListChgClamp
& operator = (const SvxDicListChgClamp
&);
194 SvxDicListChgClamp( ::com::sun::star::uno::Reference
<
195 ::com::sun::star::linguistic2::XDictionaryList
> &rxDicList
);
196 ~SvxDicListChgClamp();
199 ///////////////////////////////////////////////////////////////////////////
201 //TL:TODO: remove those functions or make them inline
202 SVX_DLLPUBLIC ::com::sun::star::uno::Reference
<
203 ::com::sun::star::linguistic2::XSpellChecker1
> SvxGetSpellChecker();
204 ::com::sun::star::uno::Reference
<
205 ::com::sun::star::linguistic2::XHyphenator
> SvxGetHyphenator();
206 ::com::sun::star::uno::Reference
<
207 ::com::sun::star::linguistic2::XThesaurus
> SvxGetThesaurus();
208 SVX_DLLPUBLIC ::com::sun::star::uno::Reference
<
209 ::com::sun::star::linguistic2::XDictionaryList
> SvxGetDictionaryList();
210 SVX_DLLPUBLIC ::com::sun::star::uno::Reference
<
211 ::com::sun::star::beans::XPropertySet
> SvxGetLinguPropertySet();
212 //TL:TODO: remove argument or provide SvxGetIgnoreAllList with the same one
213 SVX_DLLPUBLIC ::com::sun::star::uno::Reference
<
214 ::com::sun::star::linguistic2::XDictionary
> SvxGetOrCreatePosDic(
215 ::com::sun::star::uno::Reference
<
216 ::com::sun::star::linguistic2::XDictionaryList
> xDicList
);
217 SVX_DLLPUBLIC ::com::sun::star::uno::Reference
<
218 ::com::sun::star::linguistic2::XDictionary
> SvxGetIgnoreAllList();
219 SVX_DLLPUBLIC ::com::sun::star::uno::Reference
<
220 ::com::sun::star::linguistic2::XDictionary
> SvxGetChangeAllList();
222 ///////////////////////////////////////////////////////////////////////////
226 SVX_DLLPUBLIC LanguageType
SvxLocaleToLanguage(
227 const ::com::sun::star::lang::Locale
& rLocale
);
228 SVX_DLLPUBLIC ::com::sun::star::lang::Locale
& SvxLanguageToLocale(
229 ::com::sun::star::lang::Locale
& rLocale
, LanguageType eLang
);
230 SVX_DLLPUBLIC ::com::sun::star::lang::Locale
SvxCreateLocale( LanguageType eLang
);
233 SVX_DLLPUBLIC
short SvxDicError( Window
*pParent
, sal_Int16 nError
);