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