1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SwGrammarMarkUp.hxx,v $
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 ************************************************************************/
31 #ifndef _SWGRAMMARMARKUP_HXX
32 #define _SWGRAMMARMARKUP_HXX
37 /* SwGrammarMarkUp extends the functionality of a "normal" SwWrongList by memorizing
38 the start positions of sentences in the paragraph
40 The whole class is only a temporary solution without usage of virtual functions.
41 At the end the whole SwWrongList stuff should be reworked and replaced by interfaces
42 to deal with all the different wronglists like
43 spell, grammar, smarttag, sentence...
44 "MarkUpList" would be a better name than WrongList.
47 class SwGrammarMarkUp
: public SwWrongList
49 std::vector
< xub_StrLen
> maSentence
;
51 SwGrammarMarkUp() : SwWrongList( WRONGLIST_GRAMMAR
) {}
52 SwGrammarMarkUp( const SwGrammarMarkUp
* );
54 virtual ~SwGrammarMarkUp();
55 virtual SwWrongList
* Clone();
56 virtual void CopyFrom( const SwWrongList
& rCopy
);
58 /* SwWrongList::Move() + handling of maSentence */
59 void MoveGrammar( xub_StrLen nPos
, long nDiff
);
60 /* SwWrongList::SplitList() + handling of maSentence */
61 SwGrammarMarkUp
* SplitGrammarList( xub_StrLen nSplitPos
);
62 /* SwWrongList::JoinList() + handling of maSentence */
63 void JoinGrammarList( SwGrammarMarkUp
* pNext
, xub_StrLen nInsertPos
);
64 /* SwWrongList::ClearList() + handling of maSentence */
65 void ClearGrammarList( xub_StrLen nSentenceEnd
= STRING_LEN
);
66 /* setSentence to define the start positionof a sentence,
67 at the moment the end position is given by the next start position */
68 void setSentence( xub_StrLen nStart
);
69 /* getSentenceStart returns the last start position of a sentence
70 which is lower or equal to the given parameter */
71 xub_StrLen
getSentenceStart( xub_StrLen nPos
);
72 /* getSentenceEnd returns the first start position of a sentence
73 which is greater than the given parameter */
74 xub_StrLen
getSentenceEnd( xub_StrLen nPos
);
75 /* removeSentence removes all start positions in the given range */
76 void removeSentence(xub_StrLen nStart
, xub_StrLen nLength
);