21 #include <com/sun/star/i18n/TextConversionOption.hpp>
39 #include <globstr.hrc>
51 mrViewData( rViewData ),
52 mrDocShell( *rViewData.GetDocShell() ),
53 mrDoc( rViewData.GetDocShell()->GetDocument() ),
54 maSelState( rViewData ),
55 mpUndoDoc( pUndoDoc ),
56 mpRedoDoc( pRedoDoc ),
58 mbIsAnyModified( false ),
59 mbInitialState( true ),
60 mbWrappedInTable( false ),
143 while( bLoop && !bFound )
183 if( pPattern && (pPattern != pLastPattern) )
187 pLastPattern = pPattern;
192 if(
const SvxLanguageItem* pLangItem = dynamic_cast<const SvxLanguageItem*>( pItem ) )
214 pViewShell->
SetCursor( nNewCol, nNewRow,
true );
279 css::uno::Reference< css::linguistic2::XSpellChecker1 >
const & xSpeller ) :
291 OSL_ENSURE( eState != EESpellState::NoSpeller,
"ScSpellingEngine::Convert - no spell checker" );
310 VclMessageType::Question, VclButtonsType::YesNo,
311 ScResId(STR_SPELLING_BEGIN_TAB)));
312 xBox->set_title(
ScResId(STR_MSSG_DOSUBTOTALS_0));
313 xBox->set_default_response(
RET_YES);
322 VclMessageType::Info, VclButtonsType::Ok,
323 ScResId(STR_SPELLING_STOP_OK)));
329 sal_uInt16 nWinId = ScSpellDialogChildWindow::GetChildWindowId();
340 if (pRet->get_visible())
352 meConvType( eConvType ),
356 mbUseTargetFont( false ),
357 mbIsInteractive( false )
362 LanguageType eLang, sal_Int32 nOptions,
bool bIsInteractive ) :
363 meConvType( eConvType ),
364 meSourceLang( eLang ),
365 meTargetLang( eLang ),
366 mnOptions( nOptions ),
367 mbUseTargetFont( false ),
368 mbIsInteractive( bIsInteractive )
371 mnOptions = i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
376 sal_Int32 nOptions,
bool bIsInteractive ) :
377 meConvType( eConvType ),
378 meSourceLang( eSourceLang ),
379 meTargetLang( eTargetLang ),
380 maTargetFont( rTargetFont ),
381 mnOptions( nOptions ),
382 mbUseTargetFont( true ),
383 mbIsInteractive( bIsInteractive )
386 mnOptions = i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
394 maConvParam( rConvParam )
void RestoreCursorPos()
Restores the initial cursor position.
ScMarkData & GetMarkData()
SfxViewFrame * GetViewFrame() const
ScSelectionState maSelState
OUString GetText(LineEnd eEnd=LINEEND_LF) const
void GetVars(SCCOL &nColP, SCROW &nRowP, SCTAB &nTabP) const
void SetDefaults(const SfxItemSet &rDefaults, bool bRememberCopy=true)
Creates a copy of SfxItemSet if bRememberCopy set.
bool HasConvertibleTextPortion(LanguageType nLang)
LanguageType meSourceLang
Type of the conversion.
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
SfxChildWindow * GetChildWindow(sal_uInt16)
bool mbIsAnyModified
Current row index.
LanguageType GetTargetLang() const
#define LANGUAGE_ENGLISH_US
void CopyCellToDocument(const ScAddress &rSrcPos, const ScAddress &rDestPos, ScDocument &rDestDoc)
Copy only cell, nothing but cell to another document.
const SfxItemSet & GetEmptyItemSet() const
static weld::Window * GetActiveDialogParent()
SCCOL mnStartCol
Current cell language.
LanguageType getLanguageType(bool bResolveSystem=true) const
EESpellState StartSpeller(bool bMultipleDoc=false)
void PostPaintCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
ScConversionEngineBase(SfxItemPool *pEnginePool, ScViewData &rViewData, ScDocument *pUndoDoc, ScDocument *pRedoDoc)
constexpr TypedWhichId< SvxLanguageItem > ATTR_FONT_LANGUAGE(110)
static const AllSettings & GetSettings()
virtual void ShowFinishDialog()
Derived classes may show a message box stating that the conversion is finished.
SC_DLLPUBLIC void GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt32 &rFormat) const
virtual void ConvertAll(EditView &rEditView) override
Converts all cells in the selection or sheet according to set language.
This is very similar to ScCellValue, except that it references the original value instead of copying ...
SCTAB mnStartTab
Initial row index.
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
const ESelection & GetEditSelection() const
Returns the edit engine selection.
SCROW mnCurrRow
Current column index.
No selection, simple cell cursor.
bool mbWrappedInTable
true = Not searched for a cell yet.
ScDocument * mpRedoDoc
Document stores all old cells for UNDO action.
ScSelectionType GetSelectionType() const
Returns the type of the selection this object contains.
bool GetNextSpellingCell(SCCOL &nCol, SCROW &nRow, SCTAB nTab, bool bInSel, const ScMarkData &rMark) const
Base class for special type of edit engines, i.e.
weld::Window * GetDialogParent()
Returns the spelling dialog if it is open.
Reference< XController > xController
const EditTextObject * mpEditText
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC SCTAB GetTableCount() const
SCTAB GetSelectCount() const
ScDocument * mpUndoDoc
Selection data of the document.
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
sal_Int32 mnOptions
Target font to be used if language has to be changed.
ScTextConversionEngine(SfxItemPool *pEnginePool, ScViewData &rViewData, const ScConversionParam &rConvParam, ScDocument *pUndoDoc, ScDocument *pRedoDoc)
ScConversionParam(ScConversionType eConvType)
Constructs an empty parameter struct with the passed conversion type.
void FillFromCell(SCCOL nCol, SCROW nRow, SCTAB nTab)
Fills the edit engine from a document cell.
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
EditView * GetSpellingView() const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
virtual bool SpellNextDocument() override
Callback from edit engine to check the next cell.
SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const
const LanguageTag & GetLanguageTag() const
ScTabViewShell * GetViewShell() 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 bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
LanguageType meTargetLang
Source language for conversion.
LanguageType GetSourceLang() const
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
EESpellState HasSpellErrors()
virtual bool NeedsConversion()=0
Derived classes return, if the current text needs conversion (i.e.
ScSpellingEngine(SfxItemPool *pEnginePool, ScViewData &rViewData, ScDocument *pUndoDoc, ScDocument *pRedoDoc, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller)
Parameters for conversion.
virtual bool NeedsConversion() override
Returns true, if the current text contains text to convert.
std::unique_ptr< EditTextObject > CreateTextObject()
OUString ScResId(const char *pId)
void StartTextConversion(LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont, sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc)
const vcl::Font * GetTargetFont() const
void MakeEditView(ScEditEngineDefaulter *pEngine, SCCOL nCol, SCROW nRow)
bool mbFinished
true = Already restarted at top of the sheet.
void SetDefaultLanguage(LanguageType eLang)
const ScAddress & GetCellCursor() const
Returns the position of the cell cursor.
ScDBFunc * GetView() const
bool FindNextConversionCell()
Implementation of cell iteration.
bool HasChildWindow(sal_uInt16)
ScConversionParam maConvParam
sal_Int32 GetOptions() const
ScConversionType
Specifiers for sheet conversion (functions iterating over the sheet and modifying cells)...
virtual bool ShowTableWrapDialog() override
Show a query box that asks whether to restart at top of the sheet.
bool IsInteractive() const
virtual ~ScConversionEngineBase() override
void AlignToCursor(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, const ScSplitPos *pWhich=nullptr)
void SetSpeller(css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller)
virtual bool ShowTableWrapDialog()
Derived classes may show a query box that asks whether to restart at top of the sheet.
void SetSelection(const ESelection &rNewSel)
SCROW mnStartRow
Initial column index.
virtual bool NeedsConversion() override
Returns true, if the current text contains a spelling error.
virtual void ConvertAll(EditView &rEditView) override
Checks spelling of all cells in the selection or sheet.
SCCOL mnCurrCol
Initial sheet index.
bool GetTableSelect(SCTAB nTab) const
virtual void ShowFinishDialog() override
Show a message box stating that spell checking is finished.
virtual bool ConvertNextDocument() override
Callback from edit engine to convert the next cell.
LanguageType meCurrLang
Document stores all new cells for REDO action.
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
SC_DLLPUBLIC void GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab, CellType &rCellType) const
SfxItemPool * GetEditTextObjectPool() 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...
bool mbInitialState
true = At least one cell has been changed.