merge the formfield patch from ooo-build
[ooovba.git] / sw / source / core / inc / acorrect.hxx
blob7cb24ed6b8c6305d5931837f9611921ce489fa80
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: acorrect.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _ACORRECT_HXX
31 #define _ACORRECT_HXX
33 #include <svx/svxacorr.hxx>
35 #include <swundo.hxx>
38 class SwEditShell;
39 class SwPaM;
40 class SwNodeIndex;
41 struct SwPosition;
42 class SfxItemSet;
44 class SwDontExpandItem
46 SfxItemSet* pDontExpItems;
47 public:
48 SwDontExpandItem() :
49 pDontExpItems(0){}
50 ~SwDontExpandItem();
52 void SaveDontExpandItems( const SwPosition& rPos );
53 void RestoreDontExpandItems( const SwPosition& rPos );
57 class SwAutoCorrDoc : public SvxAutoCorrDoc
59 SwEditShell& rEditSh;
60 SwPaM& rCrsr;
61 SwNodeIndex* pIdx;
62 SwUndoId nUndoId;
63 bool bUndoIdInitialized;
65 void DeleteSel( SwPaM& rDelPam );
67 public:
68 SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam, sal_Unicode cIns = 0 );
69 ~SwAutoCorrDoc();
71 virtual BOOL Delete( xub_StrLen nStt, xub_StrLen nEnd );
72 virtual BOOL Insert( xub_StrLen nPos, const String& rTxt );
73 virtual BOOL Replace( xub_StrLen nPos, const String& rTxt );
75 virtual BOOL SetAttr( xub_StrLen nStt, xub_StrLen nEnd, USHORT nSlotId,
76 SfxPoolItem& );
78 virtual BOOL SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL );
80 // returne den Text eines vorherigen Absatzes.
81 // Dieser darf nicht leer sein!
82 // Gibt es diesen nicht oder gibt es davor nur Leere, dann returne 0
83 // Das Flag gibt an:
84 // TRUE: den, vor der normalen Einfuegeposition (TRUE)
85 // FALSE: den, in den das korrigierte Wort eingfuegt wurde.
86 // (Muss nicht der gleiche Absatz sein!!!!)
87 virtual const String* GetPrevPara( BOOL bAtNormalPos );
89 virtual BOOL ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos,
90 SvxAutoCorrect& rACorrect,
91 const String** ppPara );
93 // wird nach dem austauschen der Zeichen von den Funktionen
94 // - FnCptlSttWrd
95 // - FnCptlSttSntnc
96 // gerufen. Dann koennen die Worte ggfs. in die Ausnahmelisten
97 // aufgenommen werden.
98 virtual void SaveCpltSttWord( ULONG nFlag, xub_StrLen nPos,
99 const String& rExceptWord, sal_Unicode cChar );
100 virtual LanguageType GetLanguage( xub_StrLen nPos, BOOL bPrevPara ) const;
103 class SwAutoCorrExceptWord
105 String sWord;
106 ULONG nFlags, nNode;
107 xub_StrLen nCntnt;
108 sal_Unicode cChar;
109 LanguageType eLanguage;
110 BOOL bDeleted;
111 public:
112 SwAutoCorrExceptWord( ULONG nAFlags, ULONG nNd, xub_StrLen nContent,
113 const String& rWord, sal_Unicode cChr,
114 LanguageType eLang )
115 : sWord(rWord), nFlags(nAFlags), nNode(nNd), nCntnt(nContent),
116 cChar(cChr), eLanguage(eLang), bDeleted(FALSE)
119 BOOL IsDeleted() const { return bDeleted; }
120 void CheckChar( const SwPosition& rPos, sal_Unicode cChar );
121 BOOL CheckDelChar( const SwPosition& rPos );
125 #endif