LibreOffice Module sw (master)  1
SwGrammarMarkUp.hxx
Go to the documentation of this file.
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 
37 {
38  std::vector< sal_Int32 > maSentence;
39 
40 public:
42 
43  virtual ~SwGrammarMarkUp() override;
44  virtual SwWrongList* Clone() override;
45  virtual void CopyFrom( const SwWrongList& rCopy ) override;
46 
47  /* SwWrongList::Move() + handling of maSentence */
48  void MoveGrammar( sal_Int32 nPos, sal_Int32 nDiff );
49  /* SwWrongList::SplitList() + handling of maSentence */
50  SwGrammarMarkUp* SplitGrammarList( sal_Int32 nSplitPos );
51  /* SwWrongList::JoinList() + handling of maSentence */
52  void JoinGrammarList( SwGrammarMarkUp* pNext, sal_Int32 nInsertPos );
53  /* SwWrongList::ClearList() + handling of maSentence */
54  void ClearGrammarList( sal_Int32 nSentenceEnd = COMPLETE_STRING );
55  /* setSentence to define the start position of a sentence,
56  at the moment the end position is given by the next start position */
57  void setSentence( sal_Int32 nStart );
58  /* getSentenceStart returns the last start position of a sentence
59  which is lower or equal to the given parameter */
60  sal_Int32 getSentenceStart( sal_Int32 nPos );
61  /* getSentenceEnd returns the first start position of a sentence
62  which is greater than the given parameter */
63  sal_Int32 getSentenceEnd( sal_Int32 nPos );
64 };
65 
66 #endif
67 
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~SwGrammarMarkUp() override
void MoveGrammar(sal_Int32 nPos, sal_Int32 nDiff)
virtual SwWrongList * Clone() override
virtual void CopyFrom(const SwWrongList &rCopy) override
void JoinGrammarList(SwGrammarMarkUp *pNext, sal_Int32 nInsertPos)
SwGrammarMarkUp * SplitGrammarList(sal_Int32 nSplitPos)
sal_Int32 getSentenceStart(sal_Int32 nPos)
sal_Int32 getSentenceEnd(sal_Int32 nPos)
void ClearGrammarList(sal_Int32 nSentenceEnd=COMPLETE_STRING)
void setSentence(sal_Int32 nStart)
std::vector< sal_Int32 > maSentence
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61