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 #ifndef INCLUDED_SC_SOURCE_UI_INC_SPELLENG_HXX
20 #define INCLUDED_SC_SOURCE_UI_INC_SPELLENG_HXX
21 
22 #include <editutil.hxx>
23 #include "selectionstate.hxx"
24 #include "spellparam.hxx"
25 
26 class ScViewData;
27 class ScDocShell;
28 class ScDocument;
29 class SfxItemPool;
30 
31 namespace weld { class Window; }
32 
35 {
36 public:
37  explicit ScConversionEngineBase(
38  SfxItemPool* pEnginePool, ScViewData& rViewData,
39  ScDocument* pUndoDoc, ScDocument* pRedoDoc );
40 
41  virtual ~ScConversionEngineBase() override;
42 
44  virtual void ConvertAll( EditView& rEditView ) = 0;
45 
47  bool IsAnyModified() const { return mbIsAnyModified; }
49  bool IsFinished() const { return mbFinished; }
50 
51 protected:
56  void RestoreCursorPos();
57 
60  virtual bool NeedsConversion() = 0;
61 
65  virtual bool ShowTableWrapDialog();
68  virtual void ShowFinishDialog();
69 
70 private:
72  void FillFromCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
73 
74 protected: // for usage in derived classes
78 
79 private:
92  bool mbFinished;
93 };
94 
97 {
98 public:
99  explicit ScSpellingEngine(
101  ScViewData& rViewData,
102  ScDocument* pUndoDoc,
103  ScDocument* pRedoDoc,
104  css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpeller );
105 
107  virtual void ConvertAll( EditView& rEditView ) override;
108 
109 protected:
111  virtual bool SpellNextDocument() override;
112 
114  virtual bool NeedsConversion() override;
115 
118  virtual bool ShowTableWrapDialog() override;
120  virtual void ShowFinishDialog() override;
121 
122 private:
125 };
126 
129 {
130 public:
131  explicit ScTextConversionEngine(
133  ScViewData& rViewData,
134  const ScConversionParam& rConvParam,
135  ScDocument* pUndoDoc,
136  ScDocument* pRedoDoc );
137 
139  virtual void ConvertAll( EditView& rEditView ) override;
140 
141 protected:
143  virtual bool ConvertNextDocument() override;
144 
146  virtual bool NeedsConversion() override;
147 
148 private:
150 };
151 
152 #endif
153 
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void RestoreCursorPos()
Restores the initial cursor position.
Definition: spelleng.cxx:227
ScSelectionState maSelState
Definition: spelleng.hxx:80
bool mbIsAnyModified
Current row index.
Definition: spelleng.hxx:89
ScViewData & mrViewData
Definition: spelleng.hxx:75
SCCOL mnStartCol
Current cell language.
Definition: spelleng.hxx:84
ScConversionEngineBase(SfxItemPool *pEnginePool, ScViewData &rViewData, ScDocument *pUndoDoc, ScDocument *pRedoDoc)
Definition: spelleng.cxx:47
virtual void ShowFinishDialog()
Derived classes may show a message box stating that the conversion is finished.
Definition: spelleng.cxx:239
virtual void ConvertAll(EditView &rEditView) override
Converts all cells in the selection or sheet according to set language.
Definition: spelleng.cxx:397
SCTAB mnStartTab
Initial row index.
Definition: spelleng.hxx:86
SCROW mnCurrRow
Current column index.
Definition: spelleng.hxx:88
bool mbWrappedInTable
true = Not searched for a cell yet.
Definition: spelleng.hxx:91
ScDocument * mpRedoDoc
Document stores all old cells for UNDO action.
Definition: spelleng.hxx:82
Base class for special type of edit engines, i.e.
Definition: spelleng.hxx:34
weld::Window * GetDialogParent()
Returns the spelling dialog if it is open.
Definition: spelleng.cxx:326
Edit engine for text conversion.
Definition: spelleng.hxx:128
ScDocument * mpUndoDoc
Selection data of the document.
Definition: spelleng.hxx:81
ScTextConversionEngine(SfxItemPool *pEnginePool, ScViewData &rViewData, const ScConversionParam &rConvParam, ScDocument *pUndoDoc, ScDocument *pRedoDoc)
Definition: spelleng.cxx:388
void FillFromCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Fills the edit engine from a document cell.
Definition: spelleng.cxx:246
virtual bool SpellNextDocument() override
Callback from edit engine to check the next cell.
Definition: spelleng.cxx:293
ScDocument & mrDoc
Definition: spelleng.hxx:77
Edit engine for spell checking.
Definition: spelleng.hxx:96
virtual void ConvertAll(EditView &rEditView)=0
Derived classes implement to convert all cells in the selection or sheet.
virtual bool NeedsConversion()=0
Derived classes return, if the current text needs conversion (i.e.
sal_Int16 SCCOL
Definition: types.hxx:22
ScSpellingEngine(SfxItemPool *pEnginePool, ScViewData &rViewData, ScDocument *pUndoDoc, ScDocument *pRedoDoc, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller)
Definition: spelleng.cxx:275
Parameters for conversion.
Definition: spellparam.hxx:33
virtual bool NeedsConversion() override
Returns true, if the current text contains text to convert.
Definition: spelleng.cxx:414
Contains all available data about any possible selection in a Calc document.
bool mbFinished
true = Already restarted at top of the sheet.
Definition: spelleng.hxx:92
bool IsFinished() const
Returns true, if the entire document/selection has been finished.
Definition: spelleng.hxx:49
bool FindNextConversionCell()
Implementation of cell iteration.
Definition: spelleng.cxx:78
ScDocShell & mrDocShell
Definition: spelleng.hxx:76
sal_Int32 SCROW
Definition: types.hxx:18
ScConversionParam maConvParam
Definition: spelleng.hxx:149
SfxItemPool * pEnginePool
Definition: editutil.hxx:108
virtual bool ShowTableWrapDialog() override
Show a query box that asks whether to restart at top of the sheet.
Definition: spelleng.cxx:303
virtual ~ScConversionEngineBase() override
Definition: spelleng.cxx:74
virtual bool ShowTableWrapDialog()
Derived classes may show a query box that asks whether to restart at top of the sheet.
Definition: spelleng.cxx:233
SCROW mnStartRow
Initial column index.
Definition: spelleng.hxx:85
virtual bool NeedsConversion() override
Returns true, if the current text contains a spelling error.
Definition: spelleng.cxx:298
virtual void ConvertAll(EditView &rEditView) override
Checks spelling of all cells in the selection or sheet.
Definition: spelleng.cxx:284
SCCOL mnCurrCol
Initial sheet index.
Definition: spelleng.hxx:87
bool IsAnyModified() const
Returns true, if at least one cell has been modified.
Definition: spelleng.hxx:47
virtual void ShowFinishDialog() override
Show a message box stating that spell checking is finished.
Definition: spelleng.cxx:316
virtual bool ConvertNextDocument() override
Callback from edit engine to convert the next cell.
Definition: spelleng.cxx:409
LanguageType meCurrLang
Document stores all new cells for REDO action.
Definition: spelleng.hxx:83
sal_Int16 SCTAB
Definition: types.hxx:23
bool mbInitialState
true = At least one cell has been changed.
Definition: spelleng.hxx:90