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  */
22 #include <editutil.hxx>
23 #include "selectionstate.hxx"
24 #include "spellparam.hxx"
26 class ScViewData;
27 class ScDocShell;
28 class ScDocument;
29 class SfxItemPool;
31 namespace weld { class Window; }
35 {
36 public:
37  explicit ScConversionEngineBase(
38  SfxItemPool* pEnginePool, ScViewData& rViewData,
39  ScDocument* pUndoDoc, ScDocument* pRedoDoc );
41  virtual ~ScConversionEngineBase() override;
44  virtual void ConvertAll( EditView& rEditView ) = 0;
47  bool IsAnyModified() const { return mbIsAnyModified; }
49  bool IsFinished() const { return mbFinished; }
51 protected:
56  void RestoreCursorPos();
60  virtual bool NeedsConversion() = 0;
65  virtual bool ShowTableWrapDialog();
68  virtual void ShowFinishDialog();
70 private:
72  void FillFromCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
74 protected: // for usage in derived classes
79 private:
92  bool mbFinished;
93 };
97 {
98 public:
99  explicit ScSpellingEngine(
101  ScViewData& rViewData,
102  ScDocument* pUndoDoc,
103  ScDocument* pRedoDoc,
104  css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpeller );
107  virtual void ConvertAll( EditView& rEditView ) override;
109 protected:
111  virtual bool SpellNextDocument() override;
114  virtual bool NeedsConversion() override;
118  virtual bool ShowTableWrapDialog() override;
120  virtual void ShowFinishDialog() override;
122 private:
125 };
129 {
130 public:
131  explicit ScTextConversionEngine(
133  ScViewData& rViewData,
134  const ScConversionParam& rConvParam,
135  ScDocument* pUndoDoc,
136  ScDocument* pRedoDoc );
139  virtual void ConvertAll( EditView& rEditView ) override;
141 protected:
143  virtual bool ConvertNextDocument() override;
146  virtual bool NeedsConversion() override;
148 private:
150 };
152 #endif
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void RestoreCursorPos()
Restores the initial cursor position.
Definition: spelleng.cxx:228
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:240
virtual void ConvertAll(EditView &rEditView) override
Converts all cells in the selection or sheet according to set language.
Definition: spelleng.cxx:398
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:327
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:389
void FillFromCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Fills the edit engine from a document cell.
Definition: spelleng.cxx:247
virtual bool SpellNextDocument() override
Callback from edit engine to check the next cell.
Definition: spelleng.cxx:294
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:276
Parameters for conversion.
Definition: spellparam.hxx:33
virtual bool NeedsConversion() override
Returns true, if the current text contains text to convert.
Definition: spelleng.cxx:415
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:112
virtual bool ShowTableWrapDialog() override
Show a query box that asks whether to restart at top of the sheet.
Definition: spelleng.cxx:304
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:234
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:299
virtual void ConvertAll(EditView &rEditView) override
Checks spelling of all cells in the selection or sheet.
Definition: spelleng.cxx:285
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:317
virtual bool ConvertNextDocument() override
Callback from edit engine to convert the next cell.
Definition: spelleng.cxx:410
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