Branch data 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 _SWGRAMMARMARKUP_HXX
21 : : #define _SWGRAMMARMARKUP_HXX
22 : :
23 : : #include <wrong.hxx>
24 : : #include <vector>
25 : :
26 : : /* SwGrammarMarkUp extends the functionality of a "normal" SwWrongList by memorizing
27 : : the start positions of sentences in the paragraph
28 : :
29 : : The whole class is only a temporary solution without usage of virtual functions.
30 : : At the end the whole SwWrongList stuff should be reworked and replaced by interfaces
31 : : to deal with all the different wronglists like
32 : : spell, grammar, smarttag, sentence...
33 : : "MarkUpList" would be a better name than WrongList.
34 : : */
35 : :
36 : : class SwGrammarMarkUp : public SwWrongList
37 : : {
38 : : std::vector< xub_StrLen > maSentence;
39 : :
40 : : public:
41 [ + - ]: 2396 : SwGrammarMarkUp() : SwWrongList( WRONGLIST_GRAMMAR ) {}
42 : : SwGrammarMarkUp( const SwGrammarMarkUp* );
43 : :
44 : : virtual ~SwGrammarMarkUp();
45 : : virtual SwWrongList* Clone();
46 : : virtual void CopyFrom( const SwWrongList& rCopy );
47 : :
48 : : /* SwWrongList::Move() + handling of maSentence */
49 : : void MoveGrammar( xub_StrLen nPos, long nDiff );
50 : : /* SwWrongList::SplitList() + handling of maSentence */
51 : : SwGrammarMarkUp* SplitGrammarList( xub_StrLen nSplitPos );
52 : : /* SwWrongList::JoinList() + handling of maSentence */
53 : : void JoinGrammarList( SwGrammarMarkUp* pNext, xub_StrLen nInsertPos );
54 : : /* SwWrongList::ClearList() + handling of maSentence */
55 : : void ClearGrammarList( xub_StrLen nSentenceEnd = STRING_LEN );
56 : : /* setSentence to define the start positionof a sentence,
57 : : at the moment the end position is given by the next start position */
58 : : void setSentence( xub_StrLen nStart );
59 : : /* getSentenceStart returns the last start position of a sentence
60 : : which is lower or equal to the given parameter */
61 : : xub_StrLen getSentenceStart( xub_StrLen nPos );
62 : : /* getSentenceEnd returns the first start position of a sentence
63 : : which is greater than the given parameter */
64 : : xub_StrLen getSentenceEnd( xub_StrLen nPos );
65 : : };
66 : :
67 : : #endif
68 : :
69 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|