xref: /trunk/main/sw/source/core/inc/acorrect.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _ACORRECT_HXX
24cdf0e10cSrcweir #define _ACORRECT_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <editeng/svxacorr.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <swundo.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class SwEditShell;
32cdf0e10cSrcweir class SwPaM;
33cdf0e10cSrcweir class SwNodeIndex;
34cdf0e10cSrcweir struct SwPosition;
35cdf0e10cSrcweir class SfxItemSet;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class SwDontExpandItem
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     SfxItemSet* pDontExpItems;
40cdf0e10cSrcweir public:
SwDontExpandItem()41cdf0e10cSrcweir     SwDontExpandItem() :
42cdf0e10cSrcweir         pDontExpItems(0){}
43cdf0e10cSrcweir     ~SwDontExpandItem();
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     void SaveDontExpandItems( const SwPosition& rPos );
46cdf0e10cSrcweir     void RestoreDontExpandItems( const SwPosition& rPos );
47cdf0e10cSrcweir 
48cdf0e10cSrcweir };
49cdf0e10cSrcweir 
50cdf0e10cSrcweir class SwAutoCorrDoc : public SvxAutoCorrDoc
51cdf0e10cSrcweir {
52cdf0e10cSrcweir     SwEditShell& rEditSh;
53cdf0e10cSrcweir     SwPaM& rCrsr;
54cdf0e10cSrcweir     SwNodeIndex* pIdx;
55cdf0e10cSrcweir     int m_nEndUndoCounter;
56cdf0e10cSrcweir     bool    bUndoIdInitialized;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     void DeleteSel( SwPaM& rDelPam );
59cdf0e10cSrcweir 
60cdf0e10cSrcweir public:
61cdf0e10cSrcweir     SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam, sal_Unicode cIns = 0 );
62cdf0e10cSrcweir     ~SwAutoCorrDoc();
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd );
65cdf0e10cSrcweir     virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt );
66cdf0e10cSrcweir     virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt );
67cdf0e10cSrcweir     virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId,
70cdf0e10cSrcweir                             SfxPoolItem& );
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     virtual sal_Bool SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     // returne den Text eines vorherigen Absatzes.
75cdf0e10cSrcweir     // Dieser darf nicht leer sein!
76cdf0e10cSrcweir     // Gibt es diesen nicht oder gibt es davor nur Leere, dann returne 0
77cdf0e10cSrcweir     // Das Flag gibt an:
78cdf0e10cSrcweir     //      sal_True: den, vor der normalen Einfuegeposition (sal_True)
79cdf0e10cSrcweir     //      sal_False: den, in den das korrigierte Wort eingfuegt wurde.
80cdf0e10cSrcweir     //              (Muss nicht der gleiche Absatz sein!!!!)
81cdf0e10cSrcweir     virtual const String* GetPrevPara( sal_Bool bAtNormalPos );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     virtual sal_Bool ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos,
84cdf0e10cSrcweir                                   SvxAutoCorrect& rACorrect,
85cdf0e10cSrcweir                                   const String** ppPara );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     // wird nach dem austauschen der Zeichen von den Funktionen
88cdf0e10cSrcweir     //  - FnCptlSttWrd
89cdf0e10cSrcweir     //  - FnCptlSttSntnc
90cdf0e10cSrcweir     // gerufen. Dann koennen die Worte ggfs. in die Ausnahmelisten
91cdf0e10cSrcweir     // aufgenommen werden.
92cdf0e10cSrcweir     virtual void SaveCpltSttWord( sal_uLong nFlag, xub_StrLen nPos,
93cdf0e10cSrcweir                                     const String& rExceptWord, sal_Unicode cChar );
94cdf0e10cSrcweir     virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara ) const;
95cdf0e10cSrcweir };
96cdf0e10cSrcweir 
97cdf0e10cSrcweir class SwAutoCorrExceptWord
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     String sWord;
100cdf0e10cSrcweir     sal_uLong nFlags, nNode;
101cdf0e10cSrcweir     xub_StrLen nCntnt;
102cdf0e10cSrcweir     sal_Unicode cChar;
103cdf0e10cSrcweir     LanguageType eLanguage;
104cdf0e10cSrcweir     sal_Bool bDeleted;
105cdf0e10cSrcweir public:
SwAutoCorrExceptWord(sal_uLong nAFlags,sal_uLong nNd,xub_StrLen nContent,const String & rWord,sal_Unicode cChr,LanguageType eLang)106cdf0e10cSrcweir     SwAutoCorrExceptWord( sal_uLong nAFlags, sal_uLong nNd, xub_StrLen nContent,
107cdf0e10cSrcweir                                         const String& rWord, sal_Unicode cChr,
108cdf0e10cSrcweir                                         LanguageType eLang )
109cdf0e10cSrcweir         : sWord(rWord), nFlags(nAFlags), nNode(nNd), nCntnt(nContent),
110cdf0e10cSrcweir         cChar(cChr), eLanguage(eLang), bDeleted(sal_False)
111cdf0e10cSrcweir     {}
112cdf0e10cSrcweir 
IsDeleted() const113cdf0e10cSrcweir     sal_Bool IsDeleted() const                          { return bDeleted; }
114cdf0e10cSrcweir     void CheckChar( const SwPosition& rPos, sal_Unicode cChar );
115cdf0e10cSrcweir     sal_Bool CheckDelChar( const SwPosition& rPos );
116cdf0e10cSrcweir };
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 
119cdf0e10cSrcweir #endif
120