Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / SwGrammarMarkUp.hxx
blobefefadf83a309229348c46fbe545dc6eda6a4dcb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_SWGRAMMARMARKUP_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_SWGRAMMARMARKUP_HXX
23 #include "wrong.hxx"
24 #include <vector>
26 /* SwGrammarMarkUp extends the functionality of a "normal" SwWrongList by memorizing
27 the start positions of sentences in the paragraph
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.
36 class SwGrammarMarkUp final : public SwWrongList
38 std::vector<sal_Int32> maSentence;
40 public:
41 SwGrammarMarkUp()
42 : SwWrongList(WRONGLIST_GRAMMAR)
46 virtual ~SwGrammarMarkUp() override;
47 virtual SwWrongList* Clone() override;
48 virtual void CopyFrom(const SwWrongList& rCopy) override;
50 /* SwWrongList::Move() + handling of maSentence */
51 void MoveGrammar(sal_Int32 nPos, sal_Int32 nDiff);
52 /* SwWrongList::SplitList() + handling of maSentence */
53 std::unique_ptr<SwGrammarMarkUp> SplitGrammarList(sal_Int32 nSplitPos);
54 /* SwWrongList::JoinList() + handling of maSentence */
55 void JoinGrammarList(SwGrammarMarkUp* pNext, sal_Int32 nInsertPos);
56 /* SwWrongList::ClearList() + handling of maSentence */
57 void ClearGrammarList(sal_Int32 nSentenceEnd = COMPLETE_STRING);
58 /* setSentence to define the start position of a sentence,
59 at the moment the end position is given by the next start position */
60 void setSentence(sal_Int32 nStart);
61 /* getSentenceStart returns the last start position of a sentence
62 which is lower or equal to the given parameter */
63 sal_Int32 getSentenceStart(sal_Int32 nPos);
64 /* getSentenceEnd returns the first start position of a sentence
65 which is greater than the given parameter */
66 sal_Int32 getSentenceEnd(sal_Int32 nPos);
69 #endif
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */