33 #include <compiler.hxx>
34 #include <formula.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 :-/");
128 OSL_ENSURE(pData,
"FormEditData not available");
136 bool bEdit = ( aFormula.getLength() > 1 );
137 bool bMatrix =
false;
142 sal_Int32 nFStart = 0;
148 sal_Int32 PrivStart, PrivEnd;
160 OUString aNewFormula(
'=');
161 if ( aFormula.startsWith(
"=") )
162 aNewFormula = aFormula;
166 sal_Int32 PrivStart, PrivEnd;
208 if ( pInputHdl ==
nullptr )
243 SC_MOD()->SetRefInputHdl(
nullptr);
257 while ( pSh && !bAlive )
259 if (static_cast<ScTabViewShell*>(pSh)->GetInputHandler() == pHdl)
273 while( pFrame && pHdl==
nullptr)
280 if(ppViewSh!=
nullptr) *ppViewSh=pViewSh;
302 pFCell->SetLimitString(
true);
307 bool bColRowName = pFCell->HasColRowName();
311 if ( pFCell->GetCode()->GetCodeLen() <= 1 )
314 OUString aBraced =
"(" + rStrExp +
")";
317 pFCell->SetLimitString(
true);
324 if ( nErrCode == FormulaError::NONE || pFCell->IsMatrix() )
328 if (pFCell->IsMatrix())
330 rStrResult = pFCell->GetString().getString();
332 else if (pFCell->IsValue())
334 double n = pFCell->GetValue();
344 rStrResult, &pColor );
349 rStrResult =
"\"" + rStrResult.replaceAll(
"\"",
"\"\"") +
"\"";
354 rStrResult +=
" ...";
377 return std::unique_ptr<formula::FormulaCompiler>(pCompiler);
384 ::std::pair<formula::RefButton*,formula::RefEdit*> aPair =
RefInputStartBefore( pEdit, pButton );
416 eRangeFlags |= eColFlags;
418 eRangeFlags |= eRowFlags;
436 aRefStr =
"'" + aFileName +
"'#" + aTmp;
446 if ((eRangeFlags & eColFlags) == eColFlags)
451 if ((eRangeFlags & eRowFlags) == eRowFlags)
456 bool bSingle = aRefData.
Ref1 == aRefData.
Ref2;
469 aComp.CreateStringFromTokenArray(aBuf);
470 aRefStr = aBuf.makeStringAndClear();
502 if (pFuncDescP && pFuncDescP->
nFIndex!=0)
557 SfxBoolItem aMatItem( SID_DLG_MATRIX, _bMatrixChecked );
562 if ( aStrItem.
GetValue().isEmpty() )
569 GetBindings().GetDispatcher()->ExecuteList( SID_INS_FUNCTION,
570 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
571 { &aRetItem, &aStrItem, &aMatItem });
formula::FormulaToken * AddDoubleReference(const ScComplexRefData &rRef)
ScDocShell * GetDocShell() const
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
std::unique_ptr< ContentProperties > pData
void InputGetSelection(sal_Int32 &rStart, sal_Int32 &rEnd)
formula::FormulaToken * AddSingleReference(const ScSingleRefData &rRef)
ScSingleRefToken with ocPush.
#define SC_UNO_COMPILEFAP
void InitRangeRel(const ScDocument &rDoc, const ScRange &rRange, const ScAddress &rPos)
void SetAbsRow(SCROW nVal)
ScDocument & GetDocument() const
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
SC_DLLPUBLIC void GetFormula(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString &rFormula) const
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void InsertEntryToLRUList(sal_uInt16 nFIndex)
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
void SetRefInputHdl(ScInputHandler *pNew)
static SfxViewShell * Current()
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
ScViewData & GetViewData()
static css::uno::Reference< css::uno::XInterface > MakeInstance(Type nType, ScDocShell *pDocShell)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
ScFormEditData * GetFormEditData()
void SetFlag3D(bool bVal)
void SetAbsCol(SCCOL nVal)
SC_DLLPUBLIC 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...
const OUString & GetValue() const
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static ScFunctionMgr * GetStarCalcFunctionMgr()
static SC_DLLPUBLIC LanguageType eLnge
void SetAbsTab(SCTAB nVal)
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
SfxViewShell * GetViewShell() const
void SetValue(bool const bTheValue)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
SfxViewFrame * GetFrame() const
void InputReplaceSelection(const OUString &rStr)
SC_DLLPUBLIC 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)
Reference< XExecutableDialog > m_xDialog
const INetURLObject & GetURLObject() const
sal_uInt16 nFIndex
Unique function index.
void InputSetSelection(sal_Int32 nStart, sal_Int32 nEnd)
Complex reference (a range) into the sheet.
SfxDispatcher * GetDispatcher() const
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxObjectShell * GetDocumentShell() const
void InputTurnOffWinEngine()
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
const ScInputHandler * GetInputHandler() const
static OUString GetErrorString(FormulaError nErrNumber)
SfxMedium * GetMedium() const