summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-07-29 14:46:52 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-07-29 14:46:52 +0000
commit68683aee7be3e449032f71b0b9e90338f3a87fc9 (patch)
treed79d274ab5c51b4e5bf472bfb960485094c7f9fd /formula
parentec4d71ddcf07740aef057540acea4ec34dfbe1ac (diff)
CWS-TOOLING: integrate CWS dr71
2009-07-07 16:26:00 +0200 dr r273805 : #i10000# unused variables 2009-07-07 10:27:14 +0200 dr r273780 : CWS-TOOLING: rebase CWS dr71 to trunk@273468 (milestone: DEV300:m51) 2009-07-01 11:28:24 +0200 dr r273559 : #101471# special handling for XL library functions in ODF formulas (EUROCONVERT) 2009-06-29 17:48:46 +0200 dr r273478 : #i101471# typo 2009-06-29 17:35:16 +0200 dr r273477 : #i101471# import msoxl: formulas from conditional formatting and data validation 2009-06-18 13:45:17 +0200 dr r273115 : #101471# changed interface css.sheet.XFormulaParser 2009-06-18 13:44:43 +0200 dr r273114 : #101471# changed interface css.sheet.XFormulaParser 2009-06-17 17:29:23 +0200 dr r273089 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter, make rel-refs from msoxl: namespace working 2009-06-17 17:28:39 +0200 dr r273088 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter 2009-06-17 17:28:19 +0200 dr r273087 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter 2009-06-17 17:27:19 +0200 dr r273086 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter, remove that property from FormulaParser service 2009-06-17 12:52:20 +0200 dr r273059 : #i101471# import cell formulas from msoxl: namespace 2009-06-16 11:40:50 +0200 dr r273013 : #i101471# import formula namespace from xml elements 2009-06-12 18:34:13 +0200 dr r272935 : #i101471# external formula parser for oox in odf 2009-06-12 18:33:13 +0200 dr r272934 : #i101471# external formula parsers 2009-06-12 18:29:46 +0200 dr r272933 : #i101471# external formula parsers 2009-06-05 15:53:47 +0200 dr r272705 : #i101471# provide OOX formula parser as UNO service
Diffstat (limited to 'formula')
-rw-r--r--formula/inc/formula/IFunctionDescription.hxx5
-rw-r--r--formula/source/ui/dlg/formula.cxx58
2 files changed, 34 insertions, 29 deletions
diff --git a/formula/inc/formula/IFunctionDescription.hxx b/formula/inc/formula/IFunctionDescription.hxx
index 2ed4b705c9..90f736bdc5 100644
--- a/formula/inc/formula/IFunctionDescription.hxx
+++ b/formula/inc/formula/IFunctionDescription.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -143,7 +143,7 @@ namespace formula
virtual bool calculateValue(const String& _sExpression,String& _rResult) = 0;
virtual void switchBack() = 0;
-
+
virtual void clear() = 0;
virtual void deleteFormData() = 0;
virtual void setReferenceInput(const FormEditData* _pData) = 0;
@@ -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 86bb6dcd1c..f8869986a4 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -66,7 +66,7 @@
#include "formula/formulahelper.hxx"
#include "structpg.hxx"
#include "parawin.hxx"
-#include "ModuleHelper.hxx"
+#include "ModuleHelper.hxx"
#include "ForResId.hrc"
#include <com/sun/star/sheet/FormulaToken.hpp>
#include <com/sun/star/sheet/FormulaLanguage.hpp>
@@ -88,7 +88,7 @@ namespace formula
{
sal_Int32 m_nParaCount;
bool m_bIsFunction;
-
+
public:
OFormulaToken(bool _bFunction,sal_Int32 _nParaCount) : m_nParaCount(_nParaCount),m_bIsFunction(_bFunction){}
@@ -110,7 +110,7 @@ namespace formula
void DeleteArgs();
xub_StrLen GetFunctionPos(xub_StrLen nPos);
void ClearAllParas();
-
+
void MakeTree(IStructHelper* _pTree,SvLBoxEntry* pParent,FormulaToken* _pToken,long Count);
void fillTree(IStructHelper* _pTree);
void UpdateTokenArray( const String& rStrExp);
@@ -124,7 +124,7 @@ namespace formula
void UpdateArgInput( USHORT nOffset, USHORT nInput );
void Update();
void Update(const String& _sExp);
-
+
void SaveArg( USHORT nEd );
void UpdateSelection();
@@ -227,7 +227,7 @@ namespace formula
const String aTitle2;
const String aTxtEnd;
const String aTxtOk; // hinter aBtnEnd
- FormulaHelper
+ FormulaHelper
m_aFormulaHelper;
SmartId m_aSmartEditHelpId;
@@ -311,7 +311,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
nArgs (0)
{
pParaWin = new ParaWin( pParent,_pDlg, aGEdit.GetPosPixel());
- aGEdit.Hide();
+ aGEdit.Hide();
pParaWin->Hide();
aFtEditName.Hide();
aEdRef.Hide();
@@ -320,7 +320,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
pMEdit = aMEFormula.GetEdit();
m_aSmartEditHelpId = pMEdit->GetSmartHelpId();
pMEdit->SetSmartUniqueId(m_aSmartEditHelpId);
-
+
bEditFlag=FALSE;
bStructUpdate=TRUE;
Point aPos=aGEdit.GetPosPixel();
@@ -427,7 +427,7 @@ void FormulaDlg_Impl::PreNotify( NotifyEvent& rNEvt )
}
if(nActivWinId!=0)
{
-
+
FormEditData* pData = m_pHelper->getFormEditData();
if (pData && !aTimer.IsActive()) // wird nicht ueber Close zerstoert;
@@ -469,7 +469,7 @@ void FormulaDlg_Impl::DeleteArgs()
::std::vector< ::rtl::OUString>().swap(m_aArguments);
nArgs = 0;
}
-namespace
+namespace
{
// comparing two property instances
struct OpCodeCompare : public ::std::binary_function< sheet::FormulaOpCodeMapEntry, sal_Int32 , bool >
@@ -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&)
{
@@ -820,7 +823,7 @@ void FormulaDlg_Impl::FillListboxes()
// ResizeArgArr jetzt schon in UpdateFunctionDesc
-
+
m_pHelper->setDispatcherLock( TRUE);// Modal-Modus einschalten
aNewTitle = aTitle1;
@@ -962,12 +965,13 @@ 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
aResult = sFormula;
-
+
}
}
catch(const uno::Exception& )
@@ -994,7 +998,7 @@ void FormulaDlg_Impl::DoEnter(BOOL bOk)
m_pHelper->dispatch(bOk,aBtnMatrix.IsChecked());
// Daten loeschen
m_pHelper->deleteFormData();
-
+
// Dialog schliessen
m_pHelper->doClose(bOk);
}
@@ -1060,14 +1064,14 @@ void FormulaDlg_Impl::ResizeArgArr( const IFunctionDescription* pNewFunc )
void FormulaDlg_Impl::UpdateFunctionDesc()
{
FormEditData* pData = m_pHelper->getFormEditData();
- if (!pData)
+ if (!pData)
return;
USHORT nCat = pFuncPage->GetCategory();
- if ( nCat == LISTBOX_ENTRY_NOTFOUND )
+ if ( nCat == LISTBOX_ENTRY_NOTFOUND )
nCat = 0;
pData->SetCatSel( nCat );
USHORT nFunc = pFuncPage->GetFunction();
- if ( nFunc == LISTBOX_ENTRY_NOTFOUND )
+ if ( nFunc == LISTBOX_ENTRY_NOTFOUND )
nFunc = 0;
pData->SetFuncSel( nFunc );
@@ -1150,7 +1154,7 @@ void FormulaDlg_Impl::SetData(xub_StrLen nFStart,xub_StrLen nNextFStart,xub_StrL
if(!bEditFlag)
pMEdit->SetText(m_pHelper->getCurrentFormula());
-
+
m_pHelper->getSelection( PrivStart, PrivEnd);
if(!bEditFlag)
{
@@ -1167,7 +1171,7 @@ void FormulaDlg_Impl::SetData(xub_StrLen nFStart,xub_StrLen nNextFStart,xub_StrL
}
// -----------------------------------------------------------------------------
void FormulaDlg_Impl::EditThisFunc(xub_StrLen nFStart)
-{
+{
FormEditData* pData = m_pHelper->getFormEditData();
if (!pData) return;
@@ -1205,7 +1209,7 @@ void FormulaDlg_Impl::EditThisFunc(xub_StrLen nFStart)
void FormulaDlg_Impl::EditNextFunc( BOOL bForward, xub_StrLen nFStart )
{
FormEditData* pData = m_pHelper->getFormEditData();
- if (!pData)
+ if (!pData)
return;
String aFormula = m_pHelper->getCurrentFormula();
@@ -1324,7 +1328,7 @@ IMPL_LINK( FormulaDlg_Impl, FxHdl, ParaWin*, pPtr )
{
aBtnForward.Enable(TRUE); //@ Damit eine neue Fkt eingegeben werden kann.
aTabCtrl.SetCurPageId(TP_FUNCTION);
-
+
String aUndoStr = m_pHelper->getCurrentFormula(); // bevor unten ein ";" eingefuegt wird
FormEditData* pData = m_pHelper->getFormEditData();
if (!pData) return 0;
@@ -1368,7 +1372,7 @@ IMPL_LINK( FormulaDlg_Impl, ModifyHdl, ParaWin*, pPtr )
IMPL_LINK( FormulaDlg_Impl, FormulaHdl, MultiLineEdit*, EMPTYARG )
{
-
+
FormEditData* pData = m_pHelper->getFormEditData();
if (!pData) return 0;
@@ -1951,7 +1955,7 @@ void FormulaModalDialog::SetFocusWin(Window *pWin,ULONG nUniqueId)
long FormulaModalDialog::PreNotify( NotifyEvent& rNEvt )
{
m_pImpl->PreNotify( rNEvt );
-
+
return ModalDialog::PreNotify(rNEvt);
}