Line data Source code
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 : #ifndef _UNO_LINGU_HXX
21 : #define _UNO_LINGU_HXX
22 :
23 : #include <i18nlangtag/lang.h>
24 : #include <tools/string.hxx>
25 : #include <com/sun/star/util/Language.hpp>
26 : #include <com/sun/star/linguistic2/XLinguServiceManager2.hpp>
27 : #include <com/sun/star/linguistic2/XLinguProperties.hpp>
28 : #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
29 : #include <com/sun/star/linguistic2/XHyphenator.hpp>
30 : #include <com/sun/star/linguistic2/XThesaurus.hpp>
31 : #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
32 : #include <com/sun/star/beans/XPropertySet.hpp>
33 : #include "editeng/editengdllapi.h"
34 :
35 : class LinguMgrExitLstnr;
36 :
37 : class Window;
38 :
39 : ///////////////////////////////////////////////////////////////////////////
40 :
41 : class EDITENG_DLLPUBLIC LinguMgr
42 : {
43 : friend class LinguMgrExitLstnr;
44 :
45 : static ::com::sun::star::uno::Reference<
46 : ::com::sun::star::linguistic2::XLinguServiceManager2 > xLngSvcMgr;
47 : static ::com::sun::star::uno::Reference<
48 : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
49 : static ::com::sun::star::uno::Reference<
50 : ::com::sun::star::linguistic2::XHyphenator > xHyph;
51 : static ::com::sun::star::uno::Reference<
52 : ::com::sun::star::linguistic2::XThesaurus > xThes;
53 : static ::com::sun::star::uno::Reference<
54 : ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
55 : static ::com::sun::star::uno::Reference<
56 : ::com::sun::star::linguistic2::XLinguProperties > xProp;
57 :
58 : static ::com::sun::star::uno::Reference<
59 : ::com::sun::star::linguistic2::XDictionary > xIgnoreAll;
60 : static ::com::sun::star::uno::Reference<
61 : ::com::sun::star::linguistic2::XDictionary > xChangeAll;
62 :
63 : static LinguMgrExitLstnr *pExitLstnr;
64 : static sal_Bool bExiting;
65 :
66 : static ::com::sun::star::uno::Reference<
67 : ::com::sun::star::linguistic2::XSpellChecker1 > GetSpell();
68 : static ::com::sun::star::uno::Reference<
69 : ::com::sun::star::linguistic2::XHyphenator > GetHyph();
70 : static ::com::sun::star::uno::Reference<
71 : ::com::sun::star::linguistic2::XThesaurus > GetThes();
72 : static ::com::sun::star::uno::Reference<
73 : ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDicList();
74 : static ::com::sun::star::uno::Reference<
75 : ::com::sun::star::linguistic2::XLinguProperties > GetProp();
76 : static ::com::sun::star::uno::Reference<
77 : ::com::sun::star::linguistic2::XDictionary > GetStandard();
78 : static ::com::sun::star::uno::Reference<
79 : ::com::sun::star::linguistic2::XDictionary > GetIgnoreAll();
80 : static ::com::sun::star::uno::Reference<
81 : ::com::sun::star::linguistic2::XDictionary > GetChangeAll();
82 :
83 : // disallow access to copy-constructor and assignment-operator
84 : LinguMgr(const LinguMgr &);
85 : LinguMgr & operator = (const LinguMgr &);
86 :
87 : public:
88 :
89 : static ::com::sun::star::uno::Reference<
90 : ::com::sun::star::linguistic2::XSpellChecker1 > GetSpellChecker();
91 : static ::com::sun::star::uno::Reference<
92 : ::com::sun::star::linguistic2::XHyphenator > GetHyphenator();
93 : static ::com::sun::star::uno::Reference<
94 : ::com::sun::star::linguistic2::XThesaurus > GetThesaurus();
95 : static ::com::sun::star::uno::Reference<
96 : ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList();
97 : static ::com::sun::star::uno::Reference<
98 : ::com::sun::star::linguistic2::XLinguProperties > GetLinguPropertySet();
99 :
100 : static ::com::sun::star::uno::Reference<
101 : ::com::sun::star::linguistic2::XLinguServiceManager2 > GetLngSvcMgr();
102 :
103 : static ::com::sun::star::uno::Reference<
104 : ::com::sun::star::linguistic2::XDictionary > GetStandardDic();
105 : static ::com::sun::star::uno::Reference<
106 : ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
107 : static ::com::sun::star::uno::Reference<
108 : ::com::sun::star::linguistic2::XDictionary > GetChangeAllList();
109 : };
110 :
111 : ///////////////////////////////////////////////////////////////////////////
112 :
113 : namespace com { namespace sun { namespace star { namespace linguistic2 {
114 : class XHyphenatedWord;
115 : }}}}
116 :
117 :
118 0 : struct SvxAlternativeSpelling
119 : {
120 : String aReplacement;
121 : ::com::sun::star::uno::Reference<
122 : ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord;
123 : sal_Int16 nChangedPos,
124 : nChangedLength;
125 : sal_Bool bIsAltSpelling;
126 :
127 : inline SvxAlternativeSpelling();
128 : };
129 :
130 0 : inline SvxAlternativeSpelling::SvxAlternativeSpelling() :
131 0 : nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(sal_False)
132 : {
133 0 : }
134 :
135 :
136 : EDITENG_DLLPUBLIC SvxAlternativeSpelling SvxGetAltSpelling(
137 : const ::com::sun::star::uno::Reference<
138 : ::com::sun::star::linguistic2::XHyphenatedWord > & rHyphWord );
139 :
140 :
141 : ///////////////////////////////////////////////////////////////////////////
142 :
143 : class EDITENG_DLLPUBLIC SvxDicListChgClamp
144 : {
145 : private:
146 : ::com::sun::star::uno::Reference<
147 : ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
148 :
149 : // disallow access to copy-constructor and assignment-operator
150 : EDITENG_DLLPRIVATE SvxDicListChgClamp(const SvxDicListChgClamp &);
151 : EDITENG_DLLPRIVATE SvxDicListChgClamp & operator = (const SvxDicListChgClamp &);
152 :
153 : public:
154 : SvxDicListChgClamp( ::com::sun::star::uno::Reference<
155 : ::com::sun::star::linguistic2::XSearchableDictionaryList > &rxDicList );
156 : ~SvxDicListChgClamp();
157 : };
158 :
159 : ///////////////////////////////////////////////////////////////////////////
160 :
161 : //TODO: remove those functions or make them inline
162 : EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
163 : ::com::sun::star::linguistic2::XSpellChecker1 > SvxGetSpellChecker();
164 : EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
165 : ::com::sun::star::linguistic2::XHyphenator > SvxGetHyphenator();
166 : EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
167 : ::com::sun::star::linguistic2::XThesaurus > SvxGetThesaurus();
168 : EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
169 : ::com::sun::star::linguistic2::XSearchableDictionaryList > SvxGetDictionaryList();
170 : EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
171 : ::com::sun::star::linguistic2::XLinguProperties > SvxGetLinguPropertySet();
172 : //TODO: remove argument or provide SvxGetIgnoreAllList with the same one
173 : EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
174 : ::com::sun::star::linguistic2::XDictionary > SvxGetOrCreatePosDic(
175 : ::com::sun::star::uno::Reference<
176 : ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList );
177 : EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
178 : ::com::sun::star::linguistic2::XDictionary > SvxGetIgnoreAllList();
179 : EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
180 : ::com::sun::star::linguistic2::XDictionary > SvxGetChangeAllList();
181 :
182 : ///////////////////////////////////////////////////////////////////////////
183 : // misc functions
184 : //
185 :
186 : EDITENG_DLLPUBLIC short SvxDicError( Window *pParent, sal_Int16 nError );
187 :
188 :
189 : #endif
190 :
191 :
192 :
193 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|