LibreOffice Module sc (master) 1
spelleng.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#pragma once
20
21#include <editutil.hxx>
22#include "selectionstate.hxx"
23#include "spellparam.hxx"
24
25class ScViewData;
26class ScDocShell;
27class ScDocument;
28class SfxItemPool;
29
30namespace weld { class Widget; }
31
34{
35public:
38 ScDocument* pUndoDoc, ScDocument* pRedoDoc );
39
40 virtual ~ScConversionEngineBase() override;
41
43 virtual void ConvertAll(weld::Widget* pDialogParent, EditView& rEditView) = 0;
44
46 bool IsAnyModified() const { return mbIsAnyModified; }
48 bool IsFinished() const { return mbFinished; }
49
50protected:
55 void RestoreCursorPos();
56
59 virtual bool NeedsConversion() = 0;
60
64 virtual bool ShowTableWrapDialog();
67 virtual void ShowFinishDialog();
68
69private:
71 void FillFromCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
72
73protected: // for usage in derived classes
77
78private:
92};
93
96{
97public:
98 explicit ScSpellingEngine(
100 ScViewData& rViewData,
101 ScDocument* pUndoDoc,
102 ScDocument* pRedoDoc,
103 css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpeller );
104
106 virtual void ConvertAll(weld::Widget* pDialogParent, EditView& rEditView) override;
107
108protected:
110 virtual bool SpellNextDocument() override;
111
113 virtual bool NeedsConversion() override;
114
117 virtual bool ShowTableWrapDialog() override;
119 virtual void ShowFinishDialog() override;
120
121private:
124};
125
128{
129public:
130 explicit ScTextConversionEngine(
132 ScViewData& rViewData,
133 const ScConversionParam& rConvParam,
134 ScDocument* pUndoDoc,
135 ScDocument* pRedoDoc );
136
138 virtual void ConvertAll(weld::Widget* pDialogParent, EditView& rEditView) override;
139
140protected:
142 virtual bool ConvertNextDocument() override;
143
145 virtual bool NeedsConversion() override;
146
147private:
149};
150
151/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class for special type of edit engines, i.e.
Definition: spelleng.hxx:34
ScDocShell & mrDocShell
Definition: spelleng.hxx:75
virtual void ShowFinishDialog()
Derived classes may show a message box stating that the conversion is finished.
Definition: spelleng.cxx:268
ScConversionEngineBase(SfxItemPool *pEnginePool, ScViewData &rViewData, ScDocument *pUndoDoc, ScDocument *pRedoDoc)
Definition: spelleng.cxx:50
ScViewData & mrViewData
Definition: spelleng.hxx:74
bool FindNextConversionCell()
Implementation of cell iteration.
Definition: spelleng.cxx:81
SCTAB mnStartTab
Initial row index.
Definition: spelleng.hxx:85
bool IsAnyModified() const
Returns true, if at least one cell has been modified.
Definition: spelleng.hxx:46
ScDocument * mpUndoDoc
Selection data of the document.
Definition: spelleng.hxx:80
bool mbWrappedInTable
true = Not searched for a cell yet.
Definition: spelleng.hxx:90
ScSelectionState maSelState
Definition: spelleng.hxx:79
SCROW mnCurrRow
Current column index.
Definition: spelleng.hxx:87
ScDocument & mrDoc
Definition: spelleng.hxx:76
SCCOL mnStartCol
Current cell language.
Definition: spelleng.hxx:83
bool mbInitialState
true = At least one cell has been changed.
Definition: spelleng.hxx:89
bool mbFinished
true = Already restarted at top of the sheet.
Definition: spelleng.hxx:91
LanguageType meCurrLang
Document stores all new cells for REDO action.
Definition: spelleng.hxx:82
virtual bool NeedsConversion()=0
Derived classes return, if the current text needs conversion (i.e.
virtual bool ShowTableWrapDialog()
Derived classes may show a query box that asks whether to restart at top of the sheet.
Definition: spelleng.cxx:262
virtual ~ScConversionEngineBase() override
Definition: spelleng.cxx:77
bool mbIsAnyModified
Current row index.
Definition: spelleng.hxx:88
void RestoreCursorPos()
Restores the initial cursor position.
Definition: spelleng.cxx:256
SCROW mnStartRow
Initial column index.
Definition: spelleng.hxx:84
SCCOL mnCurrCol
Initial sheet index.
Definition: spelleng.hxx:86
ScDocument * mpRedoDoc
Document stores all old cells for UNDO action.
Definition: spelleng.hxx:81
virtual void ConvertAll(weld::Widget *pDialogParent, EditView &rEditView)=0
Derived classes implement to convert all cells in the selection or sheet.
bool IsFinished() const
Returns true, if the entire document/selection has been finished.
Definition: spelleng.hxx:48
void FillFromCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Fills the edit engine from a document cell.
Definition: spelleng.cxx:275
Parameters for conversion.
Definition: spellparam.hxx:33
rtl::Reference< SfxItemPool > pEnginePool
Definition: editutil.hxx:111
Contains all available data about any possible selection in a Calc document.
Edit engine for spell checking.
Definition: spelleng.hxx:96
virtual bool SpellNextDocument() override
Callback from edit engine to check the next cell.
Definition: spelleng.cxx:321
virtual void ConvertAll(weld::Widget *pDialogParent, EditView &rEditView) override
Checks spelling of all cells in the selection or sheet.
Definition: spelleng.cxx:312
virtual bool ShowTableWrapDialog() override
Show a query box that asks whether to restart at top of the sheet.
Definition: spelleng.cxx:331
virtual void ShowFinishDialog() override
Show a message box stating that spell checking is finished.
Definition: spelleng.cxx:344
weld::Widget * GetDialogParent()
Returns the spelling dialog if it is open.
Definition: spelleng.cxx:354
virtual bool NeedsConversion() override
Returns true, if the current text contains a spelling error.
Definition: spelleng.cxx:326
ScSpellingEngine(SfxItemPool *pEnginePool, ScViewData &rViewData, ScDocument *pUndoDoc, ScDocument *pRedoDoc, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller)
Definition: spelleng.cxx:303
Edit engine for text conversion.
Definition: spelleng.hxx:128
virtual bool NeedsConversion() override
Returns true, if the current text contains text to convert.
Definition: spelleng.cxx:442
virtual bool ConvertNextDocument() override
Callback from edit engine to convert the next cell.
Definition: spelleng.cxx:437
ScTextConversionEngine(SfxItemPool *pEnginePool, ScViewData &rViewData, const ScConversionParam &rConvParam, ScDocument *pUndoDoc, ScDocument *pRedoDoc)
Definition: spelleng.cxx:416
ScConversionParam maConvParam
Definition: spelleng.hxx:148
virtual void ConvertAll(weld::Widget *pDialogParent, EditView &rEditView) override
Converts all cells in the selection or sheet according to set language.
Definition: spelleng.cxx:425
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17