33#include <compiler.hxx>
35#include <formdata.hxx>
37#include <document.hxx>
44#include <tokenarray.hxx>
47#include <unonames.hxx>
50#include <com/sun/star/table/CellAddress.hpp>
51#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
52#include <com/sun/star/sheet/XFormulaParser.hpp>
63 , m_pViewShell( nullptr )
91 uno::Reference< beans::XPropertySet> xSet(
m_xParser,uno::UNO_QUERY);
99 assert(pInputHdl &&
"Missing input handler :-/");
125 pData->SetInputHandler(pInputHdl);
128 OSL_ENSURE(
pData,
"FormEditData not available");
135 bool bEdit = ( aFormula.getLength() > 1 );
136 bool bMatrix =
false;
141 sal_Int32 nFStart = 0;
147 sal_Int32 PrivStart, PrivEnd;
151 pData->SetFStart( nFStart );
159 OUString aNewFormula(
'=');
160 if ( aFormula.startsWith(
"=") )
161 aNewFormula = aFormula;
165 sal_Int32 PrivStart, PrivEnd;
169 pData->SetFStart( 1 );
207 if ( pInputHdl ==
nullptr )
217 pData->SetInputHandler(pInputHdl);
220 OUString aOldFormulaTmp(
pData->GetInputHandler()->GetFormString());
221 pData->GetInputHandler()->InputSetSelection( 0, aOldFormulaTmp.getLength());
223 rStrExp=
pData->GetUndoStr();
224 pData->GetInputHandler()->InputReplaceSelection(rStrExp);
242 SC_MOD()->SetRefInputHdl(
nullptr);
256 while ( pSh && !bAlive )
272 while( pFrame && pHdl==
nullptr)
279 if(ppViewSh!=
nullptr) *ppViewSh=pViewSh;
299 std::optional<ScSimpleFormulaCalculator> pFCell(std::in_place,
301 pFCell->SetLimitString(
true);
306 bool bColRowName = pFCell->HasColRowName();
310 if ( pFCell->GetCode()->GetCodeLen() <= 1 )
313 OUString aBraced =
"(" + rStrExp +
")";
315 pFCell->SetLimitString(
true);
322 if ( nErrCode == FormulaError::NONE || pFCell->IsMatrix() )
326 if (pFCell->IsMatrix())
328 rStrResult = pFCell->GetString().getString();
330 else if (pFCell->IsValue())
332 double n = pFCell->GetValue();
342 rStrResult, &pColor );
347 rStrResult =
"\"" + rStrResult.replaceAll(
"\"",
"\"\"") +
"\"";
352 rStrResult +=
" ...";
375 return std::unique_ptr<formula::FormulaCompiler>(pCompiler);
382 ::std::pair<formula::RefButton*,formula::RefEdit*> aPair =
RefInputStartBefore( pEdit, pButton );
414 eRangeFlags |= eColFlags;
416 eRangeFlags |= eRowFlags;
434 aRefStr =
"'" + aFileName +
"'#" + aTmp;
444 if ((eRangeFlags & eColFlags) == eColFlags)
449 if ((eRangeFlags & eRowFlags) == eRowFlags)
454 bool bSingle = aRefData.
Ref1 == aRefData.
Ref2;
468 aRefStr =
aBuf.makeStringAndClear();
500 if (pFuncDescP && pFuncDescP->
nFIndex!=0)
555 SfxBoolItem aMatItem( SID_DLG_MATRIX, _bMatrixChecked );
560 if ( aStrItem.
GetValue().isEmpty() )
568 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
569 { &aRetItem, &aStrItem, &aMatItem });
663 return pData->GetInputHandler()->GetFormString();
Reference< XExecutableDialog > m_xDialog
const OUString & GetValue() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
SfxObjectShell * GetDocumentShell() const
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
SC_DLLPUBLIC OUString GetFormula(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
sal_uInt16 nFIndex
Unique function index.
static SC_DLLPUBLIC LanguageType eLnge
static OUString GetErrorString(FormulaError nErrNumber)
static ScFunctionMgr * GetStarCalcFunctionMgr()
void InputSetSelection(sal_Int32 nStart, sal_Int32 nEnd)
void SetRefInputHdl(ScInputHandler *pNew)
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
void InputTurnOffWinEngine()
void InputGetSelection(sal_Int32 &rStart, sal_Int32 &rEnd)
void InputReplaceSelection(std::u16string_view aStr)
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
void InsertEntryToLRUList(sal_uInt16 nFIndex)
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
ScRefFlags Parse(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
static css::uno::Reference< css::uno::XInterface > MakeInstance(Type nType, ScDocShell *pDocShell)
ScFormEditData * GetFormEditData()
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
const ScInputHandler * GetInputHandler() const
ScViewData & GetViewData()
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
formula::FormulaToken * AddDoubleReference(const ScComplexRefData &rRef)
formula::FormulaToken * AddSingleReference(const ScSingleRefData &rRef)
ScSingleRefToken with ocPush.
ScDocument & GetDocument() const
ScDocShell * GetDocShell() const
SfxDispatcher * GetDispatcher() const
void SetValue(bool const bTheValue)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
SfxViewFrame * GetFrame() const
const INetURLObject & GetURLObject() const
SfxMedium * GetMedium() const
SfxViewShell * GetViewShell() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
virtual SfxBindings & GetBindings() override
std::unique_ptr< sal_Int32[]> pData
Complex reference (a range) into the sheet.
void InitRangeRel(const ScDocument &rDoc, const ScRange &rRange, const ScAddress &rPos)
void SetAbsCol(SCCOL nVal)
void SetAbsTab(SCTAB nVal)
void SetAbsRow(SCROW nVal)
void SetFlag3D(bool bVal)
constexpr OUStringLiteral SC_UNO_COMPILEFAP