update credits
[LibreOffice.git] / editeng / inc / edtspell.hxx
bloba63c395690c01679933cf8195ae53f51aabee45c
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 #pragma once
22 #include <editeng/splwrap.hxx>
23 #include <editeng/svxacorr.hxx>
24 #include <editeng/svxenum.hxx>
25 #include <editeng/misspellrange.hxx>
27 namespace com::sun::star::linguistic2 {
28 class XSpellChecker1;
32 class EditView;
33 class EditEngine;
34 class ContentNode;
36 class EditSpellWrapper final : public SvxSpellWrapper
38 private:
39 EditView* pEditView;
40 void CheckSpellTo();
42 virtual void SpellStart( SvxSpellArea eArea ) override;
43 virtual void SpellContinue() override; // Check area
44 virtual void ReplaceAll( const OUString &rNewText ) override;
45 virtual bool SpellMore() override;
47 public:
48 EditSpellWrapper(weld::Widget* pWin, bool bIsStart, EditView* pView);
51 /**
52 * Keeps track of misspelled ranges in paragraph.
54 class WrongList
56 static constexpr size_t Valid = std::numeric_limits<size_t>::max();
58 std::vector<editeng::MisspellRange> maRanges;
59 size_t mnInvalidStart;
60 size_t mnInvalidEnd;
62 bool DbgIsBuggy() const;
64 public:
65 typedef std::vector<editeng::MisspellRange>::iterator iterator;
66 typedef std::vector<editeng::MisspellRange>::const_iterator const_iterator;
68 WrongList();
70 const std::vector<editeng::MisspellRange>& GetRanges() const { return maRanges;}
71 void SetRanges( std::vector<editeng::MisspellRange>&& rRanges );
73 bool IsValid() const;
74 void SetValid();
75 void SetInvalidRange( size_t nStart, size_t nEnd );
76 void ResetInvalidRange( size_t nStart, size_t nEnd );
78 size_t GetInvalidStart() const { return mnInvalidStart; }
79 size_t GetInvalidEnd() const { return mnInvalidEnd; }
81 void TextInserted( size_t nPos, size_t nLength, bool bPosIsSep );
82 void TextDeleted( size_t nPos, size_t nLength );
84 void InsertWrong( size_t nStart, size_t nEnd );
85 bool NextWrong( size_t& rnStart, size_t& rnEnd ) const;
86 bool HasWrong( size_t nStart, size_t nEnd ) const;
87 bool HasAnyWrong( size_t nStart, size_t nEnd ) const;
88 void ClearWrongs( size_t nStart, size_t nEnd, const ContentNode* pNode );
89 void MarkWrongsInvalid();
91 WrongList* Clone() const;
93 // #i102062#
94 bool operator==(const WrongList& rCompare) const;
96 bool empty() const;
97 void push_back(const editeng::MisspellRange& rRange);
98 editeng::MisspellRange& back();
99 const editeng::MisspellRange& back() const;
101 iterator begin();
102 iterator end();
103 const_iterator begin() const;
104 const_iterator end() const;
107 class EdtAutoCorrDoc final : public SvxAutoCorrDoc
109 EditEngine* mpEditEngine;
110 ContentNode* pCurNode;
111 sal_Int32 nCursor;
113 bool bAllowUndoAction;
114 bool bUndoAction;
116 void ImplStartUndoAction();
118 public:
119 EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_Int32 nCrsr, sal_Unicode cIns);
120 virtual ~EdtAutoCorrDoc() override;
122 virtual bool Delete( sal_Int32 nStt, sal_Int32 nEnd ) override;
123 virtual bool Insert( sal_Int32 nPos, const OUString& rTxt ) override;
124 virtual bool Replace( sal_Int32 nPos, const OUString& rTxt ) override;
125 virtual bool ReplaceRange( sal_Int32 nPos, sal_Int32 nLen, const OUString& rTxt ) override;
127 virtual void SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId, SfxPoolItem& ) override;
128 virtual bool SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd, const OUString& rURL ) override;
130 virtual OUString const* GetPrevPara(bool bAtNormalPos) override;
132 virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
133 SvxAutoCorrect& rACorrect, OUString* pPara ) override;
134 virtual bool TransliterateRTLWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
135 bool bApply = false ) override;
138 virtual LanguageType GetLanguage( sal_Int32 nPos ) const override;
140 sal_Int32 GetCursor() const { return nCursor; }
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */