summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
commite7c6e5d2c248cfb935c91882a3a1e64fea7550b4 (patch)
treed2f45902cbd12ac6b651e486687130e01272d79f /formula
parent2484e4f7faa1f052ff48d2192ffb5931a71faa8f (diff)
parentd1886d07b439e7197f731c9d98c0b2ec31c62faa (diff)
merge commit to DEV300_m57
Diffstat (limited to 'formula')
-rw-r--r--formula/inc/formula/IFunctionDescription.hxx1
-rw-r--r--formula/source/ui/dlg/formula.cxx15
2 files changed, 11 insertions, 5 deletions
diff --git a/formula/inc/formula/IFunctionDescription.hxx b/formula/inc/formula/IFunctionDescription.hxx
index 3db1e6d49a94..5be54237a956 100644
--- a/formula/inc/formula/IFunctionDescription.hxx
+++ b/formula/inc/formula/IFunctionDescription.hxx
@@ -153,6 +153,7 @@ namespace formula
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
+ virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0;
virtual void setDispatcherLock( BOOL bLock ) = 0;
virtual void dispatch(BOOL _bOK,BOOL _bMartixChecked) = 0;
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index ed9337c4762e..37db1d2eb3cb 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -497,6 +497,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
if ( m_aTokenList.getLength() )
{
const uno::Reference< sheet::XFormulaParser > xParser(m_pHelper->getFormulaParser());
+ const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
const sheet::FormulaToken* pIter = m_aTokenList.getConstArray();
const sheet::FormulaToken* pEnd = pIter + m_aTokenList.getLength();
@@ -509,7 +510,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
const sal_Int32 eOp = pIter->OpCode;
uno::Sequence<sheet::FormulaToken> aArgs(1);
aArgs[0] = *pIter;
- const String aString = xParser->printFormula(aArgs);
+ const String aString = xParser->printFormula(aArgs, aRefPos);
const sheet::FormulaToken* pNextToken = pIter + 1;
if(!bUserMatrixFlag && FormulaCompiler::IsMatrixFunction((OpCode)eOp) )
@@ -533,7 +534,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
if ( pNextToken != pEnd )
{
aArgs[0] = *pNextToken;
- const String a2String = xParser->printFormula(aArgs);
+ const String a2String = xParser->printFormula(aArgs, aRefPos);
const xub_StrLen n3 = aFormString.Search(a2String,nXXX);
if ( n3 < nTokPos )
nTokPos = n3;
@@ -681,7 +682,8 @@ void FormulaDlg_Impl::MakeTree(IStructHelper* _pTree,SvLBoxEntry* pParent,Formul
aArgs[0] = m_aTokenMap.find(pOrigToken)->second;
try
{
- const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs);
+ const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+ const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs, aRefPos);
if ( nParas > 0 )
{
@@ -749,7 +751,8 @@ void FormulaDlg_Impl::UpdateTokenArray( const String& rStrExp)
m_aTokenList.realloc(0);
try
{
- m_aTokenList = m_pHelper->getFormulaParser()->parseFormula(rStrExp);
+ const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+ m_aTokenList = m_pHelper->getFormulaParser()->parseFormula(rStrExp, aRefPos);
}
catch(const uno::Exception&)
{
@@ -962,7 +965,8 @@ String FormulaDlg_Impl::RepairFormula(const String& aFormula)
if ( m_aTokenList.getLength() )
{
- const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList));
+ const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+ const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList, aRefPos));
if ( !sFormula.Len() || sFormula.GetChar(0) != '=' )
aResult += sFormula;
else
@@ -1601,6 +1605,7 @@ void FormulaDlg_Impl::Update()
{
FormEditData* pData = m_pHelper->getFormEditData();
const String sExpression = pMEdit->GetText();
+ aOldFormula = String();
UpdateTokenArray(sExpression);
FormulaCursorHdl(&aMEFormula);
CalcStruct(sExpression);