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
36class SwGrammarMarkUp final : public SwWrongList
37{
38 std::vector<sal_Int32> maSentence;
39
40public:
43 {
44 }
45
46 virtual ~SwGrammarMarkUp() override;
47 virtual SwWrongList* Clone() override;
48 virtual void CopyFrom(const SwWrongList& rCopy) override;
49
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);
67};
68
69#endif
70
71/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< sal_Int32 > maSentence
virtual ~SwGrammarMarkUp() override
void MoveGrammar(sal_Int32 nPos, sal_Int32 nDiff)
virtual SwWrongList * Clone() override
void ClearGrammarList(sal_Int32 nSentenceEnd=COMPLETE_STRING)
void setSentence(sal_Int32 nStart)
virtual void CopyFrom(const SwWrongList &rCopy) override
void JoinGrammarList(SwGrammarMarkUp *pNext, sal_Int32 nInsertPos)
sal_Int32 getSentenceEnd(sal_Int32 nPos)
sal_Int32 getSentenceStart(sal_Int32 nPos)
std::unique_ptr< SwGrammarMarkUp > SplitGrammarList(sal_Int32 nSplitPos)
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
@ WRONGLIST_GRAMMAR
Definition: wrong.hxx:59