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 INCLUDED_SW_SOURCE_CORE_INC_SWGRAMMARMARKUP_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_INC_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< sal_Int32 > maSentence;
39 :
40 : public:
41 0 : SwGrammarMarkUp() : SwWrongList( WRONGLIST_GRAMMAR ) {}
42 : SwGrammarMarkUp( const SwGrammarMarkUp* );
43 :
44 : virtual ~SwGrammarMarkUp();
45 : virtual SwWrongList* Clone() SAL_OVERRIDE;
46 : virtual void CopyFrom( const SwWrongList& rCopy ) SAL_OVERRIDE;
47 :
48 : /* SwWrongList::Move() + handling of maSentence */
49 : void MoveGrammar( sal_Int32 nPos, sal_Int32 nDiff );
50 : /* SwWrongList::SplitList() + handling of maSentence */
51 : SwGrammarMarkUp* SplitGrammarList( sal_Int32 nSplitPos );
52 : /* SwWrongList::JoinList() + handling of maSentence */
53 : void JoinGrammarList( SwGrammarMarkUp* pNext, sal_Int32 nInsertPos );
54 : /* SwWrongList::ClearList() + handling of maSentence */
55 : void ClearGrammarList( sal_Int32 nSentenceEnd = COMPLETE_STRING );
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( sal_Int32 nStart );
59 : /* getSentenceStart returns the last start position of a sentence
60 : which is lower or equal to the given parameter */
61 : sal_Int32 getSentenceStart( sal_Int32 nPos );
62 : /* getSentenceEnd returns the first start position of a sentence
63 : which is greater than the given parameter */
64 : sal_Int32 getSentenceEnd( sal_Int32 nPos );
65 : };
66 :
67 : #endif
68 :
69 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|