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