Branch libreoffice-24-8-3
[LibreOffice.git] / sc / inc / spellcheckcontext.hxx
blobf068d91f51812c499d07036e2fe84fd55b2997a2
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/.
8 */
10 #pragma once
12 #include <i18nlangtag/lang.h>
13 #include <editeng/misspellrange.hxx>
14 #include "types.hxx"
16 #include <memory>
17 #include <vector>
19 class ScDocument;
20 class ScTabEditEngine;
22 namespace sc
24 /**
25 * Class shared between grid windows to cache
26 * spelling results.
28 class SpellCheckContext
30 class SpellCheckCache;
31 struct SpellCheckStatus;
32 struct SpellCheckResult;
34 std::unique_ptr<SpellCheckCache> mpCache;
35 std::unique_ptr<SpellCheckResult> mpResult;
36 ScDocument* pDoc;
37 std::unique_ptr<ScTabEditEngine> mpEngine;
38 std::unique_ptr<SpellCheckStatus> mpStatus;
39 SCTAB mnTab;
40 LanguageType meLanguage;
42 public:
43 SpellCheckContext(ScDocument* pDocument, SCTAB nTab);
44 ~SpellCheckContext();
45 void dispose();
47 bool isMisspelled(SCCOL nCol, SCROW nRow) const;
48 const std::vector<editeng::MisspellRanges>* getMisspellRanges(SCCOL nCol, SCROW nRow) const;
49 void setMisspellRanges(SCCOL nCol, SCROW nRow,
50 const std::vector<editeng::MisspellRanges>* pRanges);
52 void reset();
53 void resetForContentChange();
54 void setTabNo(SCTAB nTab);
56 private:
57 void ensureResults(SCCOL nCol, SCROW nRow);
58 void resetCache(bool bContentChangeOnly = false);
59 void setup();
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */