Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/editeng/svxacorr.hxx
Line
Count
Source
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 INCLUDED_EDITENG_SVXACORR_HXX
21
#define INCLUDED_EDITENG_SVXACORR_HXX
22
23
#include <o3tl/sorted_vector.hxx>
24
#include <o3tl/typed_flags_set.hxx>
25
#include <o3tl/string_view.hxx>
26
#include <i18nlangtag/languagetag.hxx>
27
#include <rtl/ref.hxx>
28
#include <tools/time.hxx>
29
#include <tools/date.hxx>
30
#include <editeng/swafopt.hxx>
31
#include <editeng/editengdllapi.h>
32
#include <unotools/charclass.hxx>
33
34
#include <optional>
35
#include <map>
36
#include <memory>
37
#include <string_view>
38
#include <utility>
39
40
class SfxPoolItem;
41
class SotStorage;
42
class SvxAutoCorrect;
43
class SfxObjectShell;
44
namespace vcl { class Window; }
45
namespace com::sun::star::embed { class XStorage; }
46
47
struct CompareSvStringsISortDtor
48
{
49
    bool operator()( std::u16string_view lhs, std::u16string_view rhs ) const
50
0
    {
51
0
        return o3tl::compareToIgnoreAsciiCase( lhs, rhs ) < 0;
52
0
    }
53
};
54
55
class SvStringsISortDtor
56
    : public o3tl::sorted_vector<OUString, CompareSvStringsISortDtor>
57
{
58
};
59
60
// Auto correct flags
61
enum class ACFlags : sal_uInt32 {
62
    NONE                 = 0x00000000,
63
    CapitalStartSentence = 0x00000001,   // Capital letters at the beginning of a sentence
64
    CapitalStartWord     = 0x00000002,   // not two Capital letters at the beginning of a word
65
    AddNonBrkSpace       = 0x00000004,   // Add non breaking space before :,?!%
66
    ChgOrdinalNumber     = 0x00000008,   // Ordinal-Number 1st, 2nd,..
67
    ChgToEnEmDash        = 0x00000010,   // - -> Endash/Emdash
68
    ChgWeightUnderl      = 0x00000020,   // * -> Bold, _ -> Underscore
69
    SetINetAttr          = 0x00000040,   // Set INetAttribute
70
    Autocorrect          = 0x00000080,   // Call AutoCorrect
71
    ChgQuotes            = 0x00000100,   // replace double quotes
72
    SaveWordCplSttLst    = 0x00000200,   // Save Auto correction of Capital letter at beginning of sentence.
73
    SaveWordWordStartLst    = 0x00000400,   // Save Auto correction of TWo INitial CApitals or sMALL iNITIAL.
74
    IgnoreDoubleSpace    = 0x00000800,   // Ignore 2 Spaces
75
    ChgSglQuotes         = 0x00001000,   // Replace simple quotes
76
    CorrectCapsLock      = 0x00002000,   // Correct accidental use of cAPS LOCK key
77
    TransliterateRTL     = 0x00004000,   // Transliterate RTL text
78
    ChgAngleQuotes       = 0x00008000,   // >>, << -> angle quotes in some languages
79
    SetDOIAttr           = 0x00010000,   // Set DOIAttribute
80
    EsperantoHats        = 0x00020000,   // Cxapelo -> ĉapelo
81
82
    ChgWordLstLoad       = 0x20000000,   // Replacement list loaded
83
    CplSttLstLoad        = 0x40000000,   // Exception list for Capital letters Start loaded
84
    WordStartLstLoad        = 0x80000000,   // Exception list for Word Start loaded
85
};
86
constexpr sal_uInt32 AC_OPTION_MASK = 0x3ffff;
87
constexpr sal_uInt32 AC_LOAD_MASK = 0xe0000000;
88
namespace o3tl {
89
    template<> struct typed_flags<ACFlags> : is_typed_flags<ACFlags, AC_LOAD_MASK | AC_OPTION_MASK>
90
    {
91
    };
92
}
93
94
enum class ACQuotes
95
{
96
    NONE,
97
    NonBreakingSpace,
98
    CapitalizeIAm,
99
    DoubleAngleQuote,
100
    UseApostrophe,
101
};
102
103
// TODO: handle code points > U+FFFF and check users of this class
104
105
// only a mapping class
106
class EDITENG_DLLPUBLIC SvxAutoCorrDoc
107
{
108
public:
109
    virtual ~SvxAutoCorrDoc();
110
111
    virtual bool Delete( sal_Int32 nStt, sal_Int32 nEnd ) = 0;
112
    virtual bool Insert( sal_Int32 nPos, const OUString& rTxt ) = 0;
113
    virtual bool Replace( sal_Int32 nPos, const OUString& rTxt ) = 0;
114
    virtual bool ReplaceRange( sal_Int32 nPos, sal_Int32 nLen, const OUString& rTxt ) = 0;
115
116
    virtual void SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId,
117
                            SfxPoolItem& ) = 0;
118
119
    virtual bool SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL ) = 0;
120
121
    // Return the text of a previous paragraph.
122
    // If no paragraph exits or just an empty one, then return an empty string.
123
    // The flag indicates:
124
    //      TRUE: before the normal insertion position (TRUE)
125
    //      FALSE: in which the corrected word was inserted.
126
    //             (Does not to have to be the same paragraph !!!!)
127
    virtual OUString const* GetPrevPara(bool bAtNormalPos) = 0;
128
129
    virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
130
                                  SvxAutoCorrect& rACorrect,
131
                                  OUString* pPara ) = 0;
132
    virtual bool TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
133
                                  bool bApply = false ) = 0;
134
135
    // Is called after the change of the signs by the functions
136
    //  - FnCapitalStartWord
137
    //  - FnCapitalStartSentence
138
    // As an option, the words can then be inserted into the exception lists.
139
    virtual void SaveCpltSttWord( ACFlags nFlag, sal_Int32 nPos,
140
                                    const OUString& rExceptWord,
141
                                    sal_Unicode cChar );
142
143
    // which language at the position?
144
    virtual LanguageType GetLanguage( sal_Int32 nPos ) const;
145
};
146
147
148
class EDITENG_DLLPUBLIC SvxAutocorrWord
149
{
150
    OUString sShort, sLong;
151
    bool bIsTxtOnly;                // Is pure ASCII - Text
152
public:
153
    SvxAutocorrWord( OUString aS, OUString aL, bool bFlag = true )
154
0
        : sShort(std::move( aS )), sLong(std::move( aL )), bIsTxtOnly( bFlag )
155
0
    {}
156
157
0
    const OUString& GetShort() const                  { return sShort; }
158
0
    const OUString& GetLong() const                   { return sLong; }
159
0
    bool IsTextOnly() const                           { return bIsTxtOnly; }
160
};
161
162
class EDITENG_DLLPUBLIC SvxAutocorrWordList
163
{
164
    struct Impl;
165
    std::unique_ptr<Impl> mpImpl;
166
167
    SvxAutocorrWordList( const SvxAutocorrWordList& ) = delete;
168
    const SvxAutocorrWordList& operator= ( const SvxAutocorrWordList& ) = delete;
169
170
    std::optional<SvxAutocorrWord> WordMatches(const SvxAutocorrWord *pFnd,
171
                                               std::u16string_view rTxt,
172
                                               sal_Int32 &rStt,
173
                                               sal_Int32 nEndPos) const;
174
public:
175
    class EDITENG_DLLPUBLIC Iterator {
176
        struct Impl;
177
        std::unique_ptr<Impl> mpImpl;
178
179
        // For construction from containers in *SvxAutocorrWordList::mpImpl
180
        friend class SvxAutocorrWordList;
181
        Iterator(std::unique_ptr<Impl> pImpl);
182
183
    public:
184
        Iterator(const Iterator& it);
185
        ~Iterator();
186
        bool Step();
187
        const SvxAutocorrWord& operator*() const;
188
        const SvxAutocorrWord* operator->() const;
189
    };
190
191
    class EDITENG_DLLPUBLIC WordSearchStatus {
192
        SvxAutocorrWord               mFnd;
193
194
        // For iteration
195
        friend class SvxAutocorrWordList;
196
        const SvxAutocorrWordList*    mpAutocorrWordList;
197
        SvxAutocorrWordList::Iterator mAutocorrWordListIter;
198
199
    public:
200
        WordSearchStatus(
201
            const SvxAutocorrWord& aFnd,
202
            const SvxAutocorrWordList* pAutocorrWordList,
203
            const SvxAutocorrWordList::Iterator& autocorrWordListIter
204
0
        ) : mFnd(aFnd), mpAutocorrWordList(pAutocorrWordList),
205
0
            mAutocorrWordListIter(autocorrWordListIter)
206
0
        {}
207
0
        const SvxAutocorrWord* GetAutocorrWord() const {
208
0
            return &mFnd;
209
0
        }
210
0
        const SvxAutocorrWordList* GetAutocorrWordList() const {
211
0
            return mpAutocorrWordList;
212
0
        }
213
0
        const SvxAutocorrWord* GetWordAtIter() const {
214
0
            return &*mAutocorrWordListIter;
215
0
        }
216
0
        bool StepIter() {
217
0
            return mAutocorrWordListIter.Step();
218
0
        }
219
    };
220
221
    SvxAutocorrWordList();
222
                           // free any objects still in the set
223
                           ~SvxAutocorrWordList();
224
    void                   DeleteAndDestroyAll();
225
    bool                   ContainsPattern(const OUString& sShort) const;
226
    const SvxAutocorrWord* Insert(SvxAutocorrWord aWord) const;
227
    std::optional<SvxAutocorrWord> FindAndRemove(const SvxAutocorrWord *pWord);
228
    void                   LoadEntry(const OUString& sWrong, const OUString& sRight, bool bOnlyTxt);
229
    bool                   empty() const;
230
231
    struct CompareSvxAutocorrWordList;
232
    typedef std::vector<SvxAutocorrWord> AutocorrWordSetType;
233
    const AutocorrWordSetType & getSortedContent() const;
234
235
    std::optional<WordSearchStatus>
236
    SearchWordsInList(std::u16string_view rTxt, sal_Int32& rStt, sal_Int32 nEndPos) const;
237
    bool
238
    SearchWordsNext(std::u16string_view rTxt, sal_Int32& rStt, sal_Int32 nEndPos, WordSearchStatus& rStatus) const;
239
};
240
241
class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists
242
{
243
    OUString sShareAutoCorrFile, sUserAutoCorrFile;
244
    // If the AutoCorr file is newer
245
    Date aModifiedDate;
246
    tools::Time aModifiedTime, aLastCheckTime;
247
248
    std::unique_ptr<SvStringsISortDtor> pCplStt_ExcptLst;
249
    std::unique_ptr<SvStringsISortDtor> pWordStart_ExcptLst;
250
    std::unique_ptr<SvxAutocorrWordList> pAutocorr_List;
251
    SvxAutoCorrect&         rAutoCorrect;
252
253
    ACFlags nFlags;
254
255
    bool IsFileChanged_Imp();
256
    void LoadXMLExceptList_Imp( std::unique_ptr<SvStringsISortDtor>& rpLst,
257
                                const OUString& sStrmName,
258
                                rtl::Reference<SotStorage>& rStg);
259
    static void SaveExceptList_Imp( const SvStringsISortDtor& rLst,
260
                                const OUString& sStrmName,
261
                                rtl::Reference<SotStorage> const & rStg,
262
                                bool bConvert = false);
263
264
    bool MakeBlocklist_Imp( SotStorage& rStg );
265
    void RemoveStream_Imp( const OUString& rName );
266
    void MakeUserStorage_Impl();
267
268
public:
269
    SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent,
270
            OUString aShareAutoCorrectFile,
271
            OUString aUserAutoCorrectFile);
272
    ~SvxAutoCorrectLanguageLists();
273
274
    // Load, Set, Get - the replacement list
275
    SvxAutocorrWordList* LoadAutocorrWordList();
276
    const SvxAutocorrWordList* GetAutocorrWordList();
277
278
    // Load, Set, Get - the exception list for Capital letter at the
279
    // beginning of a sentence
280
    SvStringsISortDtor* LoadCplSttExceptList();
281
    void SaveCplSttExceptList();
282
    SvStringsISortDtor* GetCplSttExceptList();
283
    bool AddToCplSttExceptList(const OUString& rNew);
284
285
    // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL
286
    SvStringsISortDtor* LoadWordStartExceptList();
287
    void SaveWordStartExceptList();
288
    SvStringsISortDtor* GetWordStartExceptList();
289
    bool AddToWordStartExceptList(const OUString& rNew);
290
291
    // Save word substitutions:
292
    //      Store these directly in the storage. The word list is updated
293
    //      accordingly!
294
    //  - pure Text
295
    bool PutText( const OUString& rShort, const OUString& rLong );
296
    //  - Text with attribution (only the SWG - SWG format!)
297
    void PutText( const OUString& rShort, SfxObjectShell& );
298
    //  - Make combined changes in one pass
299
    bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, std::vector<SvxAutocorrWord>& aDeleteEntries );
300
};
301
302
class EDITENG_DLLPUBLIC SvxAutoCorrect
303
{
304
    friend class SvxAutoCorrectLanguageLists;
305
306
    OUString sShareAutoCorrFile, sUserAutoCorrFile;
307
308
    SvxSwAutoFormatFlags aSwFlags;     // StarWriter AutoFormat Flags
309
310
    // all languages in a table
311
    std::map<LanguageTag, SvxAutoCorrectLanguageLists> m_aLangTable;
312
    std::map<LanguageTag, sal_Int64> aLastFileTable;
313
    std::optional<CharClass> moCharClass;
314
315
    LanguageType eCharClassLang;
316
317
    ACFlags nFlags;
318
    sal_Unicode cStartDQuote, cEndDQuote, cStartSQuote, cEndSQuote;
319
320
321
    // private methods
322
    SvxAutoCorrectLanguageLists& GetLanguageList_( LanguageType eLang );
323
324
    void GetCharClass_( LanguageType eLang );
325
326
protected:
327
    //  - Text with attribution (only the SWG - SWG format!)
328
    //      rShort is the stream name - encrypted!
329
    virtual bool PutText( const css::uno::Reference < css::embed::XStorage >& rStg,
330
                              const OUString& rFileName, const OUString& rShort, SfxObjectShell&, OUString& );
331
332
    // required language in the table add if possible only when the file exists
333
    bool    CreateLanguageFile(const LanguageTag& rLanguageTag, bool bNewFile = true);
334
    //  - Return the replacement text (only for SWG format, all others can be
335
    //      taken from the word list!)
336
    //      rShort is the stream name - encrypted!
337
public:
338
339
    sal_Unicode GetQuote( sal_Unicode cInsChar, bool bSttQuote,
340
                            LanguageType eLang ) const;
341
    virtual bool GetLongText( const OUString& rShort, OUString& rLong );
342
343
    virtual void refreshBlockList( const css::uno::Reference < css::embed::XStorage >& rStg);
344
345
    SvxAutoCorrect( OUString aShareAutocorrFile,
346
                    OUString aUserAutocorrFile );
347
    SvxAutoCorrect( const SvxAutoCorrect& );
348
    virtual ~SvxAutoCorrect();
349
350
    /** Execute an AutoCorrect.
351
        Returns what has been executed, according to the above auto correct flags.
352
        @param  io_bNbspRunNext
353
                Remembers if a NO-BREAK SPACE was added (eg. in "fr" language)
354
                (set to <TRUE/>) at the last character input that may have to
355
                be removed again depending on what character is following.
356
     */
357
    // FIXME: this has the horrible flaw that the rTxt must be a reference
358
    // to the actual SwTxtNode/EditNode string because it inserts the character
359
    // in rDoc and expects that to side-effect rTxt
360
    void DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
361
                           sal_Int32 nPos, sal_Unicode cInsChar, bool bInsert, bool& io_bNbspRunNext,
362
                           vcl::Window const * pFrameWin = nullptr );
363
364
    // Return for the autotext expansion the previous word,
365
    // AutoCorrect - corresponding algorithm
366
    OUString GetPrevAutoCorrWord(SvxAutoCorrDoc const& rDoc, const OUString& rTxt, sal_Int32 nPos);
367
368
    // Returns vector candidates for AutoText name match, starting with the longest string between
369
    // 3 and 9 characters long, that is a chunk of text starting with a whitespace or with a word's
370
    // first character, and ending at the current cursor position or empty string if no such string
371
    // exists
372
    static std::vector<OUString> GetChunkForAutoText(std::u16string_view rTxt, sal_Int32 nPos);
373
374
    // Search for the words in the replacement table.
375
    // rText - check in this text the words of the list
376
    // rStt - the detected starting position
377
    // nEnd - to check position - as of this item forward
378
    // rLang - Input: in which language is searched
379
    //         Output: in which "language list" was it found
380
    std::optional<SvxAutocorrWordList::WordSearchStatus>
381
    SearchWordsInList( std::u16string_view rTxt,
382
                       sal_Int32& rStt, sal_Int32 nEndPos,
383
                       SvxAutoCorrDoc& rDoc,
384
                       LanguageTag& rLang );
385
    static bool SearchWordsNext( std::u16string_view rTxt,
386
                          sal_Int32& rStt, sal_Int32 nEndPos,
387
                          SvxAutocorrWordList::WordSearchStatus& rStatus );
388
389
    // Query/Set the Character for the Quote substitution
390
0
    sal_Unicode GetStartSingleQuote() const         { return cStartSQuote; }
391
0
    sal_Unicode GetEndSingleQuote() const           { return cEndSQuote; }
392
0
    sal_Unicode GetStartDoubleQuote() const         { return cStartDQuote; }
393
0
    sal_Unicode GetEndDoubleQuote() const           { return cEndDQuote; }
394
395
0
    void SetStartSingleQuote( const sal_Unicode cStart )    { cStartSQuote = cStart; }
396
0
    void SetEndSingleQuote( const sal_Unicode cEnd )        { cEndSQuote = cEnd; }
397
0
    void SetStartDoubleQuote( const sal_Unicode cStart )    { cStartDQuote = cStart; }
398
0
    void SetEndDoubleQuote( const sal_Unicode cEnd )        { cEndDQuote = cEnd; }
399
400
    OUString GetQuote( SvxAutoCorrDoc const & rDoc, sal_Int32 nInsPos,
401
                    sal_Unicode cInsChar, bool bSttQuote );
402
    void InsertQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos,
403
                    sal_Unicode cInsChar, bool bSttQuote, bool bIns,
404
                    LanguageType eLang, ACQuotes eType ) const;
405
406
    // Query/Set the name of the AutoCorrect file
407
    // the default is "autocorr.dat"
408
    OUString GetAutoCorrFileName( const LanguageTag& rLanguageTag /* = LANGUAGE_SYSTEM */ ,
409
                                bool bNewFile = false,
410
                                bool bTstUserExist = false,
411
                                bool bUnlocalized = false ) const;
412
413
    // Query/Set the current settings of AutoCorrect
414
0
    ACFlags GetFlags() const                { return nFlags; }
415
0
    SvxSwAutoFormatFlags&   GetSwFlags()    { return aSwFlags;}
416
0
    const SvxSwAutoFormatFlags& GetSwFlags() const { return aSwFlags; }
417
    bool IsAutoCorrFlag( ACFlags nFlag ) const
418
0
                                { return bool(nFlags & nFlag); }
419
    void SetAutoCorrFlag( ACFlags nFlag, bool bOn = true );
420
421
    // Load, Set, Get - the replacement list
422
    SvxAutocorrWordList* LoadAutocorrWordList( LanguageType eLang )
423
0
        { return GetLanguageList_( eLang ).LoadAutocorrWordList(); }
424
425
    // Save word substitutions:
426
    //      Save these directly in the storage. The word list is updated
427
    //      accordingly!
428
    //  - pure Text
429
    bool PutText( const OUString& rShort, const OUString& rLong, LanguageType eLang );
430
    //  - Text with attribution (only in the SWG - SWG format!)
431
    void PutText( const OUString& rShort, SfxObjectShell& rShell, LanguageType eLang )
432
0
        { GetLanguageList_( eLang ).PutText(rShort, rShell ); }
433
434
    void MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries,
435
                                  std::vector<SvxAutocorrWord>& aDeleteEntries,
436
                                  LanguageType eLang );
437
438
    // Load, Set, Get - the exception list for capital letters at the
439
    // beginning of a sentence
440
    void SaveCplSttExceptList( LanguageType eLang );
441
    SvStringsISortDtor* LoadCplSttExceptList(LanguageType eLang)
442
0
        {   return GetLanguageList_( eLang ).LoadCplSttExceptList(); }
443
    const SvStringsISortDtor* GetCplSttExceptList( LanguageType eLang )
444
0
        {   return GetLanguageList_( eLang ).GetCplSttExceptList(); }
445
446
    // Adds a single word. The list will be immediately written to the file!
447
    bool AddCplSttException( const OUString& rNew, LanguageType eLang );
448
449
    // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL
450
    void SaveWordStartExceptList( LanguageType eLang );
451
    SvStringsISortDtor* LoadWordStartExceptList( LanguageType eLang )
452
0
        {   return GetLanguageList_( eLang ).LoadWordStartExceptList(); }
453
    const SvStringsISortDtor* GetWordStartExceptList( LanguageType eLang )
454
0
        {   return GetLanguageList_( eLang ).GetWordStartExceptList(); }
455
    // Adds a single word. The list will be immediately written to the file!
456
    bool AddWordStartException( const OUString& rNew, LanguageType eLang);
457
458
    // Search through the Languages for the entry
459
    bool FindInWordStartExceptList( LanguageType eLang, std::u16string_view sWord );
460
    bool FindInCplSttExceptList( LanguageType eLang, const OUString& sWord,
461
                                    bool bAbbreviation = false);
462
463
    // Methods for the auto-correction
464
    void FnCapitalStartWord( SvxAutoCorrDoc&, const OUString&,
465
                                sal_Int32 nSttPos, sal_Int32 nEndPos,
466
                                LanguageType eLang );
467
    bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const OUString&,
468
                                sal_Int32 nSttPos, sal_Int32 nEndPos,
469
                                LanguageType eLang );
470
    bool FnChgToEnEmDash( SvxAutoCorrDoc&, const OUString&,
471
                                sal_Int32 nSttPos, sal_Int32 nEndPos,
472
                                LanguageType eLang );
473
    // Returns an updated position, at which the insertion/removal happened. It may be
474
    // a smaller value, if leading spaces were removed. If unsuccessful, returns -1.
475
    sal_Int32 FnAddNonBrkSpace( SvxAutoCorrDoc&, std::u16string_view,
476
                                sal_Int32 nEndPos,
477
                                LanguageType eLang, bool& io_bNbspRunNext );
478
    bool FnSetINetAttr( SvxAutoCorrDoc&, const OUString&,
479
                                sal_Int32 nSttPos, sal_Int32 nEndPos,
480
                                LanguageType eLang );
481
    bool FnSetDOIAttr( SvxAutoCorrDoc&, std::u16string_view,
482
                                sal_Int32 nSttPos, sal_Int32 nEndPos,
483
                                LanguageType eLang );
484
    bool FnChgWeightUnderl( SvxAutoCorrDoc&, const OUString&,
485
                                sal_Int32 nEndPos );
486
    void FnCapitalStartSentence( SvxAutoCorrDoc&, const OUString&, bool bNormalPos,
487
                                sal_Int32 nSttPos, sal_Int32 nEndPos,
488
                                LanguageType eLang);
489
    bool FnCorrectCapsLock( SvxAutoCorrDoc&, const OUString&,
490
                            sal_Int32 nSttPos, sal_Int32 nEndPos,
491
                            LanguageType eLang );
492
    void FnAddEsperantoHats( SvxAutoCorrDoc&, std::u16string_view, sal_Int32 nStartPos,
493
                             sal_Int32& nEndPos );
494
495
    static ACFlags  GetDefaultFlags();
496
497
// returns sal_True for characters where the function
498
// 'SvxAutoCorrect::AutoCorrect' should be called.
499
// (used to avoid occasional 'collisions' with (Thai) input-sequence-checking)
500
    static bool     IsAutoCorrectChar( sal_Unicode cChar );
501
502
    static bool NeedsHardspaceAutocorr( sal_Unicode cChar );
503
504
    CharClass& GetCharClass( LanguageType eLang )
505
0
    {
506
0
        if( !moCharClass || eLang != eCharClassLang )
507
0
            GetCharClass_( eLang );
508
0
        return *moCharClass;
509
0
    }
510
};
511
512
#endif
513
514
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */