sync master with lastest vba changes
[ooovba.git] / sc / source / ui / formdlg / formula.cxx
blob74518f5dbbc2bf498c90147bfe6cd6d393443c90
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: formula.cxx,v $
10 * $Revision: 1.18.30.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 //----------------------------------------------------------------------------
38 #include "scitems.hxx"
39 #include <sfx2/dispatch.hxx>
40 #include <sfx2/docfile.hxx>
41 #include <sfx2/objsh.hxx>
42 #include <svtools/zforlist.hxx>
43 #include <svtools/stritem.hxx>
44 #include <svtools/svtreebx.hxx>
45 #include <sfx2/viewfrm.hxx>
46 #include <sfx2/topfrm.hxx>
47 #include <vcl/svapp.hxx>
48 #include <vcl/mnemonic.hxx>
49 #include <unotools/charclass.hxx>
50 #include <tools/urlobj.hxx>
51 #include <formula/formulahelper.hxx>
52 #include <formula/IFunctionDescription.hxx>
54 #include "tokenuno.hxx"
55 #include "formula.hxx"
56 #include "formdata.hxx"
57 #include "globstr.hrc"
58 #include "scresid.hxx"
59 #include "reffact.hxx"
60 #include "document.hxx"
61 #include "cell.hxx"
62 #include "scmod.hxx"
63 #include "inputhdl.hxx"
64 #include "tabvwsh.hxx"
65 #include "appoptio.hxx"
66 #include "docsh.hxx"
67 #include "funcdesc.hxx"
68 #include "formula/token.hxx"
69 #include "tokenarray.hxx"
70 #include "sc.hrc"
71 #include "servuno.hxx"
72 #include "unonames.hxx"
73 #include "externalrefmgr.hxx"
75 #include <com/sun/star/table/CellAddress.hpp>
77 //============================================================================
78 using namespace formula;
79 using namespace com::sun::star;
81 ScDocument* ScFormulaDlg::pDoc = NULL;
82 ScAddress ScFormulaDlg::aCursorPos;
86 // --------------------------------------------------------------------------
87 // Initialisierung / gemeinsame Funktionen fuer Dialog
88 // --------------------------------------------------------------------------
90 ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
91 Window* pParent, ScViewData* pViewData,formula::IFunctionManager* _pFunctionMgr )
92 : formula::FormulaDlg( pB, pCW, pParent, true,true,true,this, _pFunctionMgr,this)
93 , m_aHelper(this,pB)
95 m_aHelper.SetWindow(this);
96 ScModule* pScMod = SC_MOD();
97 pScMod->InputEnterHandler();
98 ScTabViewShell* pScViewShell = NULL;
100 // title has to be from the view that opened the dialog,
101 // even if it's not the current view
103 SfxObjectShell* pParentDoc = NULL;
104 if ( pB )
106 SfxDispatcher* pMyDisp = pB->GetDispatcher();
107 if (pMyDisp)
109 SfxViewFrame* pMyViewFrm = pMyDisp->GetFrame();
110 if (pMyViewFrm)
112 pScViewShell = PTR_CAST( ScTabViewShell, pMyViewFrm->GetViewShell() );
113 if( pScViewShell )
114 pScViewShell->UpdateInputHandler(TRUE);
115 pParentDoc = pMyViewFrm->GetObjectShell();
119 //if ( !pParentDoc && pScViewShell ) // use current only if above fails
120 // pParentDoc = pScViewShell->GetObjectShell();
121 //if ( pParentDoc )
122 // aDocName = pParentDoc->GetTitle();
124 if ( pDoc == NULL )
125 pDoc = pViewData->GetDocument();
126 m_xParser.set(ScServiceProvider::MakeInstance(SC_SERVICE_FORMULAPARS,(ScDocShell*)pDoc->GetDocumentShell()),uno::UNO_QUERY);
127 uno::Reference< beans::XPropertySet> xSet(m_xParser,uno::UNO_QUERY);
128 xSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_COMPILEFAP)),uno::makeAny(sal_True));
129 xSet->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_REFERENCEPOS)),uno::makeAny(table::CellAddress(aCursorPos.Tab(),aCursorPos.Col(),aCursorPos.Row())));
131 m_xOpCodeMapper.set(ScServiceProvider::MakeInstance(SC_SERVICE_OPCODEMAPPER,(ScDocShell*)pDoc->GetDocumentShell()),uno::UNO_QUERY);
133 ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(pScViewShell);
135 DBG_ASSERT( pInputHdl, "Missing input handler :-/" );
137 if ( pInputHdl )
138 pInputHdl->NotifyChange( NULL );
140 m_aHelper.enableInput( FALSE );
141 m_aHelper.EnableSpreadsheets();
142 m_aHelper.Init();
143 m_aHelper.SetDispatcherLock( TRUE );
145 notifyChange();
146 fill();
148 ScFormEditData* pData = pScMod->GetFormEditData();
149 if (!pData)
151 //Nun wird es Zeit den Inputhandler festzulegen
152 pScMod->SetRefInputHdl(pScMod->GetInputHdl());
154 pDoc = pViewData->GetDocument();
155 SCCOL nCol = pViewData->GetCurX();
156 SCROW nRow = pViewData->GetCurY();
157 SCTAB nTab = pViewData->GetTabNo();
158 aCursorPos = ScAddress( nCol, nRow, nTab );
160 pScMod->InitFormEditData(); // neu anlegen
161 pData = pScMod->GetFormEditData();
162 pData->SetInputHandler(pScMod->GetInputHdl());
163 pData->SetDocShell(pViewData->GetDocShell());
165 DBG_ASSERT(pData,"FormEditData ist nicht da");
167 formula::FormulaDlgMode eMode = FORMULA_FORMDLG_FORMULA; // Default...
169 // Formel vorhanden? Dann editieren
171 String aFormula;
172 pDoc->GetFormula( nCol, nRow, nTab, aFormula );
173 BOOL bEdit = ( aFormula.Len() > 1 );
174 BOOL bMatrix = FALSE;
175 if ( bEdit )
177 bMatrix = CheckMatrix(aFormula);
179 xub_StrLen nFStart = 0;
180 xub_StrLen nFEnd = 0;
181 if ( GetFormulaHelper().GetNextFunc( aFormula, FALSE, nFStart, &nFEnd) )
183 pScMod->InputReplaceSelection( aFormula );
184 pScMod->InputSetSelection( nFStart, nFEnd );
185 xub_StrLen PrivStart, PrivEnd;
186 pScMod->InputGetSelection( PrivStart, PrivEnd);
188 eMode = SetMeText(pScMod->InputGetFormulaStr(),PrivStart, PrivEnd,bMatrix,TRUE,TRUE);
189 pData->SetFStart( nFStart );
191 else
192 bEdit = FALSE;
195 if ( !bEdit )
197 String aNewFormula = '=';
198 if ( aFormula.Len() > 0 && aFormula.GetChar(0) == '=' )
199 aNewFormula=aFormula;
201 pScMod->InputReplaceSelection( aNewFormula );
202 pScMod->InputSetSelection( 1, aNewFormula.Len()+1 );
203 xub_StrLen PrivStart, PrivEnd;
204 pScMod->InputGetSelection( PrivStart, PrivEnd);
205 SetMeText(pScMod->InputGetFormulaStr(),PrivStart, PrivEnd,bMatrix,FALSE,FALSE);
207 pData->SetFStart( 1 ); // hinter dem "="
210 pData->SetMode( (USHORT) eMode );
211 String rStrExp = GetMeText();
213 pCell = new ScFormulaCell( pDoc, aCursorPos, rStrExp );
215 Update(rStrExp);
216 } // if (!pData)
220 void ScFormulaDlg::notifyChange()
222 ScModule* pScMod = SC_MOD();
224 ScInputHandler* pInputHdl = pScMod->GetInputHdl();
225 if ( pInputHdl )
226 pInputHdl->NotifyChange( NULL );
228 // -----------------------------------------------------------------------------
229 void ScFormulaDlg::fill()
231 ScModule* pScMod = SC_MOD();
232 ScFormEditData* pData = pScMod->GetFormEditData();
233 notifyChange();
234 String rStrExp;
235 if (pData)
237 // Daten schon vorhanden -> Zustand wiederherstellen (nach Umschalten)
238 // pDoc und aCursorPos nicht neu initialisieren
239 //pDoc = pViewData->GetDocument();
240 if(IsInputHdl(pData->GetInputHandler()))
242 pScMod->SetRefInputHdl(pData->GetInputHandler());
244 else
246 PtrTabViewShell pTabViewShell;
247 ScInputHandler* pInputHdl = GetNextInputHandler(pData->GetDocShell(),&pTabViewShell);
249 if ( pInputHdl == NULL ) //DocShell hat keinen InputHandler mehr,
250 { //hat der Anwender halt Pech gehabt.
251 disableOk();
252 pInputHdl = pScMod->GetInputHdl();
254 else
256 pInputHdl->SetRefViewShell(pTabViewShell);
258 pScMod->SetRefInputHdl(pInputHdl);
259 pData->SetInputHandler(pInputHdl);
262 String aOldFormulaTmp(pScMod->InputGetFormulaStr());
263 pScMod->InputSetSelection( 0, aOldFormulaTmp.Len());
265 rStrExp=pData->GetUndoStr();
266 pScMod->InputReplaceSelection(rStrExp);
268 SetMeText(rStrExp);
270 pCell = new ScFormulaCell( pDoc, aCursorPos, rStrExp );
272 Update();
273 // Jetzt nochmals zurueckschalten, da evtl. neues Doc geoeffnet wurde!
274 pScMod->SetRefInputHdl(NULL);
278 __EXPORT ScFormulaDlg::~ScFormulaDlg()
280 ScModule* pScMod = SC_MOD();
281 ScFormEditData* pData = pScMod->GetFormEditData();
283 if (pData) // wird nicht ueber Close zerstoert;
285 //Referenz Inputhandler zuruecksetzen
286 pScMod->SetRefInputHdl(NULL);
287 } // if (pData) // wird nicht ueber Close zerstoert;
289 delete pCell;
292 BOOL ScFormulaDlg::IsInputHdl(ScInputHandler* pHdl)
294 BOOL bAlive = FALSE;
296 // gehoert der InputHandler zu irgendeiner ViewShell ?
298 TypeId aScType = TYPE(ScTabViewShell);
299 SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType );
300 while ( pSh && !bAlive )
302 if (((ScTabViewShell*)pSh)->GetInputHandler() == pHdl)
303 bAlive = TRUE;
304 pSh = SfxViewShell::GetNext( *pSh, &aScType );
307 return bAlive;
311 ScInputHandler* ScFormulaDlg::GetNextInputHandler(ScDocShell* pDocShell,PtrTabViewShell* ppViewSh)
313 ScInputHandler* pHdl=NULL;
315 SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell, TYPE(SfxTopViewFrame) );
316 while( pFrame && pHdl==NULL)
318 SfxViewShell* p = pFrame->GetViewShell();
319 ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p);
320 if(pViewSh!=NULL)
322 pHdl=pViewSh->GetInputHandler();
323 if(ppViewSh!=NULL) *ppViewSh=pViewSh;
325 pFrame = SfxViewFrame::GetNext(*pFrame,pDocShell, TYPE(SfxTopViewFrame) );
329 return pHdl;
333 BOOL __EXPORT ScFormulaDlg::Close()
335 DoEnter(FALSE);
336 return TRUE;
339 // --------------------------------------------------------------------------
340 // Funktionen fuer rechte Seite
341 // --------------------------------------------------------------------------
342 bool ScFormulaDlg::calculateValue( const String& rStrExp, String& rStrResult )
344 BOOL bResult = TRUE;
346 ::std::auto_ptr<ScFormulaCell> pFCell( new ScFormulaCell( pDoc, aCursorPos, rStrExp ) );
348 // #35521# HACK! um bei ColRowNames kein #REF! zu bekommen,
349 // wenn ein Name eigentlich als Bereich in die Gesamt-Formel
350 // eingefuegt wird, bei der Einzeldarstellung aber als
351 // single-Zellbezug interpretiert wird
352 BOOL bColRowName = pCell->HasColRowName();
353 if ( bColRowName )
355 // ColRowName im RPN-Code?
356 if ( pCell->GetCode()->GetCodeLen() <= 1 )
357 { // ==1: einzelner ist als Parameter immer Bereich
358 // ==0: es waere vielleicht einer, wenn..
359 String aBraced( '(' );
360 aBraced += rStrExp;
361 aBraced += ')';
362 pFCell.reset( new ScFormulaCell( pDoc, aCursorPos, aBraced ) );
364 else
365 bColRowName = FALSE;
368 USHORT nErrCode = pFCell->GetErrCode();
369 if ( nErrCode == 0 )
371 SvNumberFormatter& aFormatter = *(pDoc->GetFormatTable());
372 Color* pColor;
373 if ( pFCell->IsValue() )
375 double n = pFCell->GetValue();
376 ULONG nFormat = aFormatter.GetStandardFormat( n, 0,
377 pFCell->GetFormatType(), ScGlobal::eLnge );
378 aFormatter.GetOutputString( n, nFormat,
379 rStrResult, &pColor );
381 else
383 String aStr;
385 pFCell->GetString( aStr );
386 ULONG nFormat = aFormatter.GetStandardFormat(
387 pFCell->GetFormatType(), ScGlobal::eLnge);
388 aFormatter.GetOutputString( aStr, nFormat,
389 rStrResult, &pColor );
392 ScRange aTestRange;
393 if ( bColRowName || (aTestRange.Parse(rStrExp) & SCA_VALID) )
394 rStrResult.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " ..." ));
395 // Bereich
397 else
398 rStrResult += ScGlobal::GetErrorString(nErrCode);
400 if(!isUserMatrix() && pFCell->GetMatrixFlag())
402 CheckMatrix();
405 return bResult;
410 // virtuelle Methoden von ScAnyRefDlg:
411 void ScFormulaDlg::RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton )
413 ::std::pair<formula::RefButton*,formula::RefEdit*> aPair = RefInputStartBefore( pEdit, pButton );
414 m_aHelper.RefInputStart( aPair.second, aPair.first);
415 RefInputStartAfter( aPair.second, aPair.first );
417 void ScFormulaDlg::RefInputDone( BOOL bForced )
419 m_aHelper.RefInputDone( bForced );
420 RefInputDoneAfter( bForced );
423 void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument* pRefDoc )
425 const IFunctionDescription* pFunc = getCurrentFunctionDescription();
426 if ( pFunc && pFunc->getSuppressedArgumentCount() > 0 )
428 Selection theSel;
429 BOOL bRefNull = UpdateParaWin(theSel);
431 if ( rRef.aStart != rRef.aEnd && bRefNull )
433 RefInputStart(GetActiveEdit());
436 String aRefStr;
437 BOOL bOtherDoc = ( pRefDoc != pDoc && pRefDoc->GetDocumentShell()->HasName() );
438 if ( bOtherDoc )
440 // Referenz auf anderes Dokument - wie inputhdl.cxx
442 DBG_ASSERT(rRef.aStart.Tab()==rRef.aEnd.Tab(), "nStartTab!=nEndTab");
444 String aTmp;
445 rRef.Format( aTmp, SCA_VALID|SCA_TAB_3D, pRefDoc ); // immer 3d
447 SfxObjectShell* pObjSh = pRefDoc->GetDocumentShell();
449 // #i75893# convert escaped URL of the document to something user friendly
450 // String aFileName = pObjSh->GetMedium()->GetName();
451 String aFileName = pObjSh->GetMedium()->GetURLObject().GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
453 aRefStr = '\'';
454 aRefStr += aFileName;
455 aRefStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "'#" ));
456 aRefStr += aTmp;
458 else
460 USHORT nFmt = ( rRef.aStart.Tab() == aCursorPos.Tab() )
461 ? SCA_VALID
462 : SCA_VALID | SCA_TAB_3D;
463 rRef.Format( aRefStr, nFmt, pRefDoc, pRefDoc->GetAddressConvention() );
466 UpdateParaWin(theSel,aRefStr);
470 BOOL ScFormulaDlg::IsRefInputMode() const
472 const IFunctionDescription* pDesc = getCurrentFunctionDescription();
473 BOOL bRef = (pDesc && (pDesc->getSuppressedArgumentCount() > 0)) && (pDoc!=NULL);
474 return bRef;
477 BOOL ScFormulaDlg::IsDocAllowed(SfxObjectShell* pDocSh) const
479 // not allowed: different from this doc, and no name
480 // pDocSh is always a ScDocShell
481 if ( pDocSh && ((ScDocShell*)pDocSh)->GetDocument() != pDoc && !pDocSh->HasName() )
482 return FALSE;
484 return TRUE; // everything else is allowed
487 void ScFormulaDlg::SetActive()
489 const IFunctionDescription* pFunc = getCurrentFunctionDescription();
490 if ( pFunc && pFunc->getSuppressedArgumentCount() > 0 )
492 RefInputDone();
493 SetEdSelection();
497 void ScFormulaDlg::SaveLRUEntry(const ScFuncDesc* pFuncDescP)
499 if (pFuncDescP && pFuncDescP->nFIndex!=0)
501 ScModule* pScMod = SC_MOD();
502 pScMod->InsertEntryToLRUList(pFuncDescP->nFIndex);
506 void ScFormulaDlg::doClose(BOOL /*_bOk*/)
508 m_aHelper.DoClose( ScFormulaDlgWrapper::GetChildWindowId() );
510 void ScFormulaDlg::insertEntryToLRUList(const formula::IFunctionDescription* _pDesc)
512 const ScFuncDesc* pDesc = dynamic_cast<const ScFuncDesc*>(_pDesc);
513 SaveLRUEntry(pDesc);
515 void ScFormulaDlg::showReference(const String& _sFormula)
517 ShowReference(_sFormula);
519 void ScFormulaDlg::ShowReference(const String& _sFormula)
521 m_aHelper.ShowReference(_sFormula);
523 void ScFormulaDlg::HideReference( BOOL bDoneRefMode )
525 m_aHelper.HideReference(bDoneRefMode);
527 void ScFormulaDlg::ViewShellChanged( ScTabViewShell* pScViewShell )
529 m_aHelper.ViewShellChanged( pScViewShell );
531 void ScFormulaDlg::AddRefEntry( )
535 BOOL ScFormulaDlg::IsTableLocked( ) const
537 // per Default kann bei Referenzeingabe auch die Tabelle umgeschaltet werden
538 return FALSE;
540 void ScFormulaDlg::ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton)
542 m_aHelper.ToggleCollapsed(pEdit,pButton);
544 void ScFormulaDlg::ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton)
546 m_aHelper.ReleaseFocus(pEdit,pButton);
548 void ScFormulaDlg::dispatch(BOOL _bOK,BOOL _bMartixChecked)
550 SfxBoolItem aRetItem( SID_DLG_RETOK, _bOK );
551 SfxBoolItem aMatItem( SID_DLG_MATRIX, _bMartixChecked );
552 SfxStringItem aStrItem( SCITEM_STRING, getCurrentFormula() );
554 // Wenn durch Dokument-Umschalterei die Eingabezeile weg war/ist,
555 // ist der String leer. Dann nicht die alte Formel loeschen.
556 if ( !aStrItem.GetValue().Len() )
557 aRetItem.SetValue( FALSE ); // FALSE = Cancel
559 m_aHelper.SetDispatcherLock( FALSE ); // Modal-Modus ausschalten
561 clear();
563 GetBindings().GetDispatcher()->Execute( SID_INS_FUNCTION,
564 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
565 &aRetItem, &aStrItem, &aMatItem, 0L );
567 void ScFormulaDlg::setDispatcherLock( BOOL bLock )
569 m_aHelper.SetDispatcherLock( bLock );
571 void ScFormulaDlg::setReferenceInput(const formula::FormEditData* _pData)
573 ScModule* pScMod = SC_MOD();
574 ScFormEditData* pData = const_cast<ScFormEditData*>(dynamic_cast<const ScFormEditData*>(_pData));
575 pScMod->SetRefInputHdl(pData->GetInputHandler());
577 void ScFormulaDlg::deleteFormData()
579 ScModule* pScMod = SC_MOD();
580 pScMod->ClearFormEditData(); // pData wird ungueltig!
582 void ScFormulaDlg::clear()
584 pDoc = NULL;
586 //Referenz Inputhandler zuruecksetzen
587 ScModule* pScMod = SC_MOD();
588 pScMod->SetRefInputHdl(NULL);
590 // Enable() der Eingabezeile erzwingen:
591 ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
592 if ( pScViewShell )
593 pScViewShell->UpdateInputHandler();
595 void ScFormulaDlg::switchBack()
597 ScModule* pScMod = SC_MOD();
598 // auf das Dokument zurueckschalten
599 // (noetig, weil ein fremdes oben sein kann - #34222#)
600 ScInputHandler* pHdl = pScMod->GetInputHdl();
601 if ( pHdl )
603 pHdl->ViewShellGone(NULL); // -> aktive View neu holen
604 pHdl->ShowRefFrame();
607 // aktuelle Tabelle ggF. restaurieren (wg. Maus-RefInput)
608 ScTabViewShell* pScViewShell = PTR_CAST(ScTabViewShell, SfxViewShell::Current());
609 if ( pScViewShell )
611 ScViewData* pVD=pScViewShell->GetViewData();
612 SCTAB nExecTab = aCursorPos.Tab();
613 if ( nExecTab != pVD->GetTabNo() )
614 pScViewShell->SetTabNo( nExecTab );
616 SCROW nRow=aCursorPos.Row();
617 SCCOL nCol=aCursorPos.Col();
619 if(pVD->GetCurX()!=nCol || pVD->GetCurY()!=nRow)
620 pScViewShell->SetCursor(nCol,nRow);
623 formula::FormEditData* ScFormulaDlg::getFormEditData() const
625 ScModule* pScMod = SC_MOD();
626 return pScMod->GetFormEditData();
628 void ScFormulaDlg::setCurrentFormula(const String& _sReplacement)
630 ScModule* pScMod = SC_MOD();
631 pScMod->InputReplaceSelection(_sReplacement);
633 void ScFormulaDlg::setSelection(xub_StrLen _nStart,xub_StrLen _nEnd)
635 ScModule* pScMod = SC_MOD();
636 pScMod->InputSetSelection( _nStart, _nEnd );
638 void ScFormulaDlg::getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const
640 ScModule* pScMod = SC_MOD();
641 pScMod->InputGetSelection( _nStart, _nEnd );
643 String ScFormulaDlg::getCurrentFormula() const
645 ScModule* pScMod = SC_MOD();
646 return pScMod->InputGetFormulaStr();
648 formula::IFunctionManager* ScFormulaDlg::getFunctionManager()
650 return ScGlobal::GetStarCalcFunctionMgr();
652 uno::Reference< sheet::XFormulaParser> ScFormulaDlg::getFormulaParser() const
654 return m_xParser;
656 uno::Reference< sheet::XFormulaOpCodeMapper> ScFormulaDlg::getFormulaOpCodeMapper() const
658 return m_xOpCodeMapper;
660 ::std::auto_ptr<formula::FormulaTokenArray> ScFormulaDlg::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
662 ::std::auto_ptr<formula::FormulaTokenArray> pArray(new ScTokenArray());
663 pArray->Fill( _aTokenList, pDoc->GetExternalRefManager());
664 return pArray;