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 INCLUDED_SW_SOURCE_CORE_INC_ACORRECT_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_INC_ACORRECT_HXX
22 :
23 : #include <editeng/svxacorr.hxx>
24 : #include <swundo.hxx>
25 :
26 : class SwEditShell;
27 : class SwPaM;
28 : class SwNodeIndex;
29 : struct SwPosition;
30 : class SfxItemSet;
31 :
32 : class SwDontExpandItem
33 : {
34 : SfxItemSet* pDontExpItems;
35 :
36 : public:
37 0 : SwDontExpandItem() :
38 0 : pDontExpItems(0){}
39 : ~SwDontExpandItem();
40 :
41 : void SaveDontExpandItems( const SwPosition& rPos );
42 : void RestoreDontExpandItems( const SwPosition& rPos );
43 :
44 : };
45 :
46 : class SwAutoCorrDoc : public SvxAutoCorrDoc
47 : {
48 : SwEditShell& rEditSh;
49 : SwPaM& rCrsr;
50 : SwNodeIndex* pIdx;
51 : int m_nEndUndoCounter;
52 : bool bUndoIdInitialized;
53 :
54 : void DeleteSel( SwPaM& rDelPam );
55 :
56 : public:
57 : SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam, sal_Unicode cIns = 0 );
58 : virtual ~SwAutoCorrDoc();
59 :
60 : virtual bool Delete( sal_Int32 nStt, sal_Int32 nEnd ) SAL_OVERRIDE;
61 : virtual bool Insert( sal_Int32 nPos, const OUString& rTxt ) SAL_OVERRIDE;
62 : virtual bool Replace( sal_Int32 nPos, const OUString& rTxt ) SAL_OVERRIDE;
63 : virtual bool ReplaceRange( sal_Int32 nPos, sal_Int32 nLen, const OUString& rTxt ) SAL_OVERRIDE;
64 :
65 : virtual bool SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId,
66 : SfxPoolItem& ) SAL_OVERRIDE;
67 :
68 : virtual bool SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL ) SAL_OVERRIDE;
69 :
70 : // return text of a previous paragraph
71 : // If it does not exist or if there is nothing before, return blank.
72 : // - sal_True: paragraph before "normal" insertion position
73 : // - sal_False: paragraph in that the corrected word was inserted
74 : // (does not need to be the same paragraph)
75 : virtual OUString const* GetPrevPara(bool bAtNormalPos) SAL_OVERRIDE;
76 :
77 : virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
78 : SvxAutoCorrect& rACorrect,
79 : OUString* pPara ) SAL_OVERRIDE;
80 :
81 : // Will be called after swapping characters by the functions
82 : // - FnCptlSttWrd and
83 : // - FnCptlSttSntnc.
84 : // Afterwards the words can be added into exception list if needed.
85 : virtual void SaveCpltSttWord( sal_uLong nFlag, sal_Int32 nPos,
86 : const OUString& rExceptWord, sal_Unicode cChar ) SAL_OVERRIDE;
87 : virtual LanguageType GetLanguage( sal_Int32 nPos, bool bPrevPara ) const SAL_OVERRIDE;
88 : };
89 :
90 0 : class SwAutoCorrExceptWord
91 : {
92 : OUString sWord;
93 : sal_uLong nFlags, nNode;
94 : sal_Int32 nCntnt;
95 : sal_Unicode cChar;
96 : LanguageType eLanguage;
97 : sal_Bool bDeleted;
98 :
99 : public:
100 0 : SwAutoCorrExceptWord( sal_uLong nAFlags, sal_uLong nNd, sal_Int32 nContent,
101 : const OUString& rWord, sal_Unicode cChr,
102 : LanguageType eLang )
103 : : sWord(rWord), nFlags(nAFlags), nNode(nNd), nCntnt(nContent),
104 0 : cChar(cChr), eLanguage(eLang), bDeleted(sal_False)
105 0 : {}
106 :
107 0 : sal_Bool IsDeleted() const { return bDeleted; }
108 : void CheckChar( const SwPosition& rPos, sal_Unicode cChar );
109 : sal_Bool CheckDelChar( const SwPosition& rPos );
110 : };
111 :
112 : #endif
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|