Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _ACORRECT_HXX
30 : : #define _ACORRECT_HXX
31 : :
32 : : #include <editeng/svxacorr.hxx>
33 : : #include <swundo.hxx>
34 : :
35 : : class SwEditShell;
36 : : class SwPaM;
37 : : class SwNodeIndex;
38 : : struct SwPosition;
39 : : class SfxItemSet;
40 : :
41 : : class SwDontExpandItem
42 : : {
43 : : SfxItemSet* pDontExpItems;
44 : :
45 : : public:
46 : 8 : SwDontExpandItem() :
47 : 8 : pDontExpItems(0){}
48 : : ~SwDontExpandItem();
49 : :
50 : : void SaveDontExpandItems( const SwPosition& rPos );
51 : : void RestoreDontExpandItems( const SwPosition& rPos );
52 : :
53 : : };
54 : :
55 : : class SwAutoCorrDoc : public SvxAutoCorrDoc
56 : : {
57 : : SwEditShell& rEditSh;
58 : : SwPaM& rCrsr;
59 : : SwNodeIndex* pIdx;
60 : : int m_nEndUndoCounter;
61 : : bool bUndoIdInitialized;
62 : :
63 : : void DeleteSel( SwPaM& rDelPam );
64 : :
65 : : public:
66 : : SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam, sal_Unicode cIns = 0 );
67 : : ~SwAutoCorrDoc();
68 : :
69 : : virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd );
70 : : virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt );
71 : : virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt );
72 : : virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt );
73 : :
74 : : virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId,
75 : : SfxPoolItem& );
76 : :
77 : : virtual sal_Bool SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL );
78 : :
79 : : // return text of a previous paragraph
80 : : // This must not be empty/blank!
81 : : // If it does not exist or if there is nothing before, return 0.
82 : : // - sal_True: paragraph before "normal" insertion position
83 : : // - sal_False: paragraph in that the corrected word was inserted
84 : : // (does not need to be the same paragraph)
85 : : virtual const String* GetPrevPara( sal_Bool bAtNormalPos );
86 : :
87 : : virtual sal_Bool ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos,
88 : : SvxAutoCorrect& rACorrect,
89 : : const String** ppPara );
90 : :
91 : : // Will be called after swapping characters by the functions
92 : : // - FnCptlSttWrd and
93 : : // - FnCptlSttSntnc.
94 : : // Afterwards the words can be added into exception list if needed.
95 : : virtual void SaveCpltSttWord( sal_uLong nFlag, xub_StrLen nPos,
96 : : const String& rExceptWord, sal_Unicode cChar );
97 : : virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara ) const;
98 : : };
99 : :
100 : 0 : class SwAutoCorrExceptWord
101 : : {
102 : : String sWord;
103 : : sal_uLong nFlags, nNode;
104 : : xub_StrLen nCntnt;
105 : : sal_Unicode cChar;
106 : : LanguageType eLanguage;
107 : : sal_Bool bDeleted;
108 : :
109 : : public:
110 : 0 : SwAutoCorrExceptWord( sal_uLong nAFlags, sal_uLong nNd, xub_StrLen nContent,
111 : : const String& rWord, sal_Unicode cChr,
112 : : LanguageType eLang )
113 : : : sWord(rWord), nFlags(nAFlags), nNode(nNd), nCntnt(nContent),
114 : 0 : cChar(cChr), eLanguage(eLang), bDeleted(sal_False)
115 : 0 : {}
116 : :
117 : 0 : sal_Bool IsDeleted() const { return bDeleted; }
118 : : void CheckChar( const SwPosition& rPos, sal_Unicode cChar );
119 : : sal_Bool CheckDelChar( const SwPosition& rPos );
120 : : };
121 : :
122 : : #endif
123 : :
124 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|