21#include <com/sun/star/i18n/TextConversionOption.hpp>
34#include <osl/diagnose.h>
55 mrViewData( rViewData ),
56 mrDocShell( *rViewData.GetDocShell() ),
57 mrDoc( rViewData.GetDocShell()->GetDocument() ),
58 maSelState( rViewData ),
59 mpUndoDoc( pUndoDoc ),
60 mpRedoDoc( pRedoDoc ),
62 mbIsAnyModified( false ),
63 mbInitialState( true ),
64 mbWrappedInTable( false ),
105 aLang.
nEnd == aNewStr.getLength();
109 OUString aVisibleStr;
139 std::unique_ptr<ScPatternAttr> pNewAttr;
142 pNewAttr = std::make_unique<ScPatternAttr>(*pAttr);
144 pNewAttr = std::make_unique<ScPatternAttr>(
mrDoc.
GetPool());
172 while( bLoop && !bFound )
212 if( pPattern && (pPattern != pLastPattern) )
216 pLastPattern = pPattern;
243 pViewShell->
SetCursor( nNewCol, nNewRow,
true );
307 css::uno::Reference< css::linguistic2::XSpellChecker1 >
const & xSpeller ) :
319 OSL_ENSURE( eState != EESpellState::NoSpeller,
"ScSpellingEngine::Convert - no spell checker" );
338 VclMessageType::Question, VclButtonsType::YesNo,
339 ScResId(STR_SPELLING_BEGIN_TAB)));
340 xBox->set_title(
ScResId(STR_MSSG_DOSUBTOTALS_0));
341 xBox->set_default_response(
RET_YES);
350 VclMessageType::Info, VclButtonsType::Ok,
351 ScResId(STR_SPELLING_STOP_OK)));
357 sal_uInt16 nWinId = ScSpellDialogChildWindow::GetChildWindowId();
368 if (pRet->get_visible())
380 meConvType( eConvType ),
384 mbUseTargetFont( false ),
385 mbIsInteractive( false )
390 LanguageType eLang, sal_Int32 nOptions,
bool bIsInteractive ) :
391 meConvType( eConvType ),
392 meSourceLang( eLang ),
393 meTargetLang( eLang ),
394 mnOptions( nOptions ),
395 mbUseTargetFont( false ),
396 mbIsInteractive( bIsInteractive )
399 mnOptions = i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
404 sal_Int32 nOptions,
bool bIsInteractive ) :
405 meConvType( eConvType ),
406 meSourceLang( eSourceLang ),
407 meTargetLang( eTargetLang ),
408 maTargetFont(
std::move( aTargetFont )),
409 mnOptions( nOptions ),
410 mbUseTargetFont( true ),
411 mbIsInteractive( bIsInteractive )
414 mnOptions = i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
422 maConvParam(
std::move( aConvParam ))
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
bool HasConvertibleTextPortion(LanguageType nLang)
OUString GetText(LineEnd eEnd=LINEEND_LF) const
std::unique_ptr< EditTextObject > CreateTextObject()
SfxItemPool * GetEditTextObjectPool() const
editeng::LanguageSpan GetLanguage(const EditPaM &rPaM) const
sal_Int32 GetParagraphCount() const
const SfxItemSet & GetEmptyItemSet() const
EESpellState HasSpellErrors()
void SetDefaultLanguage(LanguageType eLang)
void SetSpeller(css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller)
EESpellState StartSpeller(weld::Widget *pDialogParent, bool bMultipleDoc=false)
void SetSelection(const ESelection &rNewSel)
void StartTextConversion(weld::Widget *pDialogParent, LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc)
LanguageType getLanguageType(bool bResolveSystem=true) const
void GetVars(SCCOL &nColP, SCROW &nRowP, SCTAB &nTabP) const
Base class for special type of edit engines, i.e.
virtual void ShowFinishDialog()
Derived classes may show a message box stating that the conversion is finished.
ScConversionEngineBase(SfxItemPool *pEnginePool, ScViewData &rViewData, ScDocument *pUndoDoc, ScDocument *pRedoDoc)
bool FindNextConversionCell()
Implementation of cell iteration.
SCTAB mnStartTab
Initial row index.
ScDocument * mpUndoDoc
Selection data of the document.
bool mbWrappedInTable
true = Not searched for a cell yet.
ScSelectionState maSelState
SCROW mnCurrRow
Current column index.
SCCOL mnStartCol
Current cell language.
bool mbInitialState
true = At least one cell has been changed.
bool mbFinished
true = Already restarted at top of the sheet.
LanguageType meCurrLang
Document stores all new cells for REDO action.
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.
virtual ~ScConversionEngineBase() override
bool mbIsAnyModified
Current row index.
void RestoreCursorPos()
Restores the initial cursor position.
SCROW mnStartRow
Initial column index.
SCCOL mnCurrCol
Initial sheet index.
ScDocument * mpRedoDoc
Document stores all old cells for UNDO action.
void FillFromCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Fills the edit engine from a document cell.
Parameters for conversion.
ScConversionParam(ScConversionType eConvType)
Constructs an empty parameter struct with the passed conversion type.
LanguageType meTargetLang
Source language for conversion.
LanguageType GetSourceLang() const
sal_Int32 mnOptions
Target font to be used if language has to be changed.
bool IsInteractive() const
LanguageType GetTargetLang() const
const vcl::Font * GetTargetFont() const
LanguageType meSourceLang
Type of the conversion.
sal_Int32 GetOptions() const
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
static weld::Window * GetActiveDialogParent()
SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const
SC_DLLPUBLIC bool SetEditText(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
This method manages the lifecycle of the passed edit text object.
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC ScDocumentPool * GetPool()
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
SC_DLLPUBLIC void SetPattern(const ScAddress &, const ScPatternAttr &rAttr)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
void CopyCellToDocument(const ScAddress &rSrcPos, const ScAddress &rDestPos, ScDocument &rDestDoc)
Copy only cell, nothing but cell to another document.
bool GetNextSpellingCell(SCCOL &nCol, SCROW &nRow, SCTAB nTab, bool bInSel, const ScMarkData &rMark) const
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC SCTAB GetTableCount() const
void SetDefaults(const SfxItemSet &rDefaults, bool bRememberCopy=true)
Creates a copy of SfxItemSet if bRememberCopy set.
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
bool GetTableSelect(SCTAB nTab) const
SCTAB GetSelectCount() const
void FillEditItemSet(SfxItemSet *pEditSet, const SfxItemSet *pCondSet=nullptr) const
Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSe...
ScSelectionType GetSelectionType() const
Returns the type of the selection this object contains.
const ScAddress & GetCellCursor() const
Returns the position of the cell cursor.
const ESelection & GetEditSelection() const
Returns the edit engine selection.
virtual bool SpellNextDocument() override
Callback from edit engine to check the next cell.
virtual void ConvertAll(weld::Widget *pDialogParent, EditView &rEditView) override
Checks spelling of all cells in the selection or sheet.
virtual bool ShowTableWrapDialog() override
Show a query box that asks whether to restart at top of the sheet.
virtual void ShowFinishDialog() override
Show a message box stating that spell checking is finished.
weld::Widget * GetDialogParent()
Returns the spelling dialog if it is open.
virtual bool NeedsConversion() override
Returns true, if the current text contains a spelling error.
ScSpellingEngine(SfxItemPool *pEnginePool, ScViewData &rViewData, ScDocument *pUndoDoc, ScDocument *pRedoDoc, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller)
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
void MakeEditView(ScEditEngineDefaulter *pEngine, SCCOL nCol, SCROW nRow)
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
virtual bool NeedsConversion() override
Returns true, if the current text contains text to convert.
virtual bool ConvertNextDocument() override
Callback from edit engine to convert the next cell.
ScConversionParam maConvParam
ScTextConversionEngine(SfxItemPool *pEnginePool, ScViewData &rViewData, ScConversionParam aConvParam, ScDocument *pUndoDoc, ScDocument *pRedoDoc)
virtual void ConvertAll(weld::Widget *pDialogParent, EditView &rEditView) override
Converts all cells in the selection or sheet according to set language.
ScMarkData & GetMarkData()
ScTabViewShell * GetViewShell() const
ScDBFunc * GetView() const
EditView * GetSpellingView() const
bool HasChildWindow(sal_uInt16)
SfxChildWindow * GetChildWindow(sal_uInt16)
SfxViewFrame & GetViewFrame() const
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
#define LANGUAGE_DONTKNOW
#define LANGUAGE_ENGLISH_US
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< SvxLanguageItem > ATTR_FONT_LANGUAGE(110)
@ SC_SELECTTYPE_SHEET
No selection, simple cell cursor.
ScConversionType
Specifiers for sheet conversion (functions iterating over the sheet and modifying cells).
This is very similar to ScCellValue, except that it references the original value instead of copying ...
const EditTextObject * getEditText() const
Reference< XController > xController