Kaydet (Commit) 7f83faa7 authored tarafından Noel Grandin's avatar Noel Grandin

convert the rest of the formula module from String to OUString

Change-Id: I27ee0cf3e9f97e94234c5e32080bf102b4cf0dc9
üst 41df3400
...@@ -147,7 +147,7 @@ public: ...@@ -147,7 +147,7 @@ public:
OpCodeList( sal_uInt16, FormulaCompiler::NonConstOpCodeMapPtr ); OpCodeList( sal_uInt16, FormulaCompiler::NonConstOpCodeMapPtr );
private: private:
bool getOpCodeString( String& rStr, sal_uInt16 nOp ); bool getOpCodeString( OUString& rStr, sal_uInt16 nOp );
void putDefaultOpCode( FormulaCompiler::NonConstOpCodeMapPtr xMap, sal_uInt16 nOp ); void putDefaultOpCode( FormulaCompiler::NonConstOpCodeMapPtr xMap, sal_uInt16 nOp );
private: private:
...@@ -165,7 +165,7 @@ OpCodeList::OpCodeList( sal_uInt16 nRID, FormulaCompiler::NonConstOpCodeMapPtr x ...@@ -165,7 +165,7 @@ OpCodeList::OpCodeList( sal_uInt16 nRID, FormulaCompiler::NonConstOpCodeMapPtr x
{ {
for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i) for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i)
{ {
String aOpStr; OUString aOpStr;
if ( getOpCodeString( aOpStr, i) ) if ( getOpCodeString( aOpStr, i) )
xMap->putOpCode( aOpStr, OpCode(i)); xMap->putOpCode( aOpStr, OpCode(i));
else else
...@@ -175,7 +175,7 @@ OpCodeList::OpCodeList( sal_uInt16 nRID, FormulaCompiler::NonConstOpCodeMapPtr x ...@@ -175,7 +175,7 @@ OpCodeList::OpCodeList( sal_uInt16 nRID, FormulaCompiler::NonConstOpCodeMapPtr x
FreeResource(); FreeResource();
} }
bool OpCodeList::getOpCodeString( String& rStr, sal_uInt16 nOp ) bool OpCodeList::getOpCodeString( OUString& rStr, sal_uInt16 nOp )
{ {
switch (nOp) switch (nOp)
{ {
...@@ -878,7 +878,7 @@ void FormulaCompiler::OpCodeMap::copyFrom( const OpCodeMap& r, bool bOverrideKno ...@@ -878,7 +878,7 @@ void FormulaCompiler::OpCodeMap::copyFrom( const OpCodeMap& r, bool bOverrideKno
for (sal_uInt16 i = 1; i < n; ++i) for (sal_uInt16 i = 1; i < n; ++i)
{ {
OpCode eOp = OpCode(i); OpCode eOp = OpCode(i);
const String& rSymbol = r.mpTable[i]; const OUString& rSymbol = r.mpTable[i];
putCopyOpCode( rSymbol, eOp); putCopyOpCode( rSymbol, eOp);
} }
} }
......
...@@ -175,14 +175,14 @@ void FormulaHelper::GetArgStrings( ::std::vector< OUString >& _rArgs, ...@@ -175,14 +175,14 @@ void FormulaHelper::GetArgStrings( ::std::vector< OUString >& _rArgs,
//------------------------------------------------------------------------ //------------------------------------------------------------------------
inline sal_Bool IsFormulaText( const CharClass* _pCharClass,const String& rStr, xub_StrLen nPos ) inline sal_Bool IsFormulaText( const CharClass* _pCharClass,const OUString& rStr, xub_StrLen nPos )
{ {
if( _pCharClass->isLetterNumeric( rStr, nPos ) ) if( _pCharClass->isLetterNumeric( rStr, nPos ) )
return sal_True; return sal_True;
else else
{ // In internationalized versions function names may contain a dot { // In internationalized versions function names may contain a dot
// and in every version also an underscore... ;-) // and in every version also an underscore... ;-)
sal_Unicode c = rStr.GetChar(nPos); sal_Unicode c = rStr[nPos];
return c == '.' || c == '_'; return c == '.' || c == '_';
} }
......
...@@ -92,7 +92,7 @@ namespace formula ...@@ -92,7 +92,7 @@ namespace formula
void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton ); void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton );
void RefInputDoneAfter( sal_Bool bForced ); void RefInputDoneAfter( sal_Bool bForced );
sal_Bool CalcValue( const OUString& rStrExp, OUString& rStrResult ); sal_Bool CalcValue( const OUString& rStrExp, OUString& rStrResult );
sal_Bool CalcStruct( const String& rStrExp); sal_Bool CalcStruct( const OUString& rStrExp);
void UpdateValues(); void UpdateValues();
void DeleteArgs(); void DeleteArgs();
xub_StrLen GetFunctionPos(xub_StrLen nPos); xub_StrLen GetFunctionPos(xub_StrLen nPos);
...@@ -100,8 +100,8 @@ namespace formula ...@@ -100,8 +100,8 @@ namespace formula
void MakeTree(IStructHelper* _pTree,SvTreeListEntry* pParent,FormulaToken* _pToken,long Count); void MakeTree(IStructHelper* _pTree,SvTreeListEntry* pParent,FormulaToken* _pToken,long Count);
void fillTree(IStructHelper* _pTree); void fillTree(IStructHelper* _pTree);
void UpdateTokenArray( const String& rStrExp); void UpdateTokenArray( const OUString& rStrExp);
String RepairFormula(const String& aFormula); OUString RepairFormula(const OUString& aFormula);
void FillDialog(sal_Bool nFlag=sal_True); void FillDialog(sal_Bool nFlag=sal_True);
void EditNextFunc( sal_Bool bForward, xub_StrLen nFStart=NOT_FOUND ); void EditNextFunc( sal_Bool bForward, xub_StrLen nFStart=NOT_FOUND );
void EditThisFunc(xub_StrLen nFStart); void EditThisFunc(xub_StrLen nFStart);
...@@ -110,7 +110,7 @@ namespace formula ...@@ -110,7 +110,7 @@ namespace formula
void UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 nInput ); void UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 nInput );
void Update(); void Update();
void Update(const String& _sExp); void Update(const OUString& _sExp);
void SaveArg( sal_uInt16 nEd ); void SaveArg( sal_uInt16 nEd );
void UpdateSelection(); void UpdateSelection();
...@@ -118,14 +118,14 @@ namespace formula ...@@ -118,14 +118,14 @@ namespace formula
void FillListboxes(); void FillListboxes();
void FillControls(sal_Bool &rbNext, sal_Bool &rbPrev); void FillControls(sal_Bool &rbNext, sal_Bool &rbPrev);
FormulaDlgMode SetMeText(const String& _sText,xub_StrLen PrivStart, xub_StrLen PrivEnd,sal_Bool bMatrix,sal_Bool _bSelect,sal_Bool _bUpdate); FormulaDlgMode SetMeText(const OUString& _sText,xub_StrLen PrivStart, xub_StrLen PrivEnd,sal_Bool bMatrix,sal_Bool _bSelect,sal_Bool _bUpdate);
void SetMeText(const String& _sText); void SetMeText(const OUString& _sText);
sal_Bool CheckMatrix(OUString& aFormula /*IN/OUT*/); sal_Bool CheckMatrix(OUString& aFormula /*IN/OUT*/);
void SetEdSelection(); void SetEdSelection();
sal_Bool UpdateParaWin(Selection& _rSelection); sal_Bool UpdateParaWin(Selection& _rSelection);
void UpdateParaWin(const Selection& _rSelection,const String& _sRefStr); void UpdateParaWin(const Selection& _rSelection,const OUString& _sRefStr);
void SetData(xub_StrLen nFStart,xub_StrLen nNextFStart,xub_StrLen nNextFEnd,xub_StrLen& PrivStart,xub_StrLen& PrivEnd); void SetData(xub_StrLen nFStart,xub_StrLen nNextFStart,xub_StrLen nNextFEnd,xub_StrLen& PrivStart,xub_StrLen& PrivEnd);
void PreNotify( NotifyEvent& rNEvt ); void PreNotify( NotifyEvent& rNEvt );
...@@ -198,18 +198,17 @@ namespace formula ...@@ -198,18 +198,17 @@ namespace formula
RefButton* pTheRefButton; RefButton* pTheRefButton;
FuncPage* pFuncPage; FuncPage* pFuncPage;
StructPage* pStructPage; StructPage* pStructPage;
String aOldFormula; OUString aOldFormula;
sal_Bool bStructUpdate; sal_Bool bStructUpdate;
MultiLineEdit* pMEdit; MultiLineEdit* pMEdit;
sal_Bool bUserMatrixFlag; sal_Bool bUserMatrixFlag;
Timer aTimer; Timer aTimer;
const String aTitle1; const OUString aTitle1;
const String aTitle2; const OUString aTitle2;
const String aTxtEnd; const OUString aTxtEnd;
const String aTxtOk; // behind aBtnEnd const OUString aTxtOk; // behind aBtnEnd
FormulaHelper FormulaHelper m_aFormulaHelper;
m_aFormulaHelper;
OString m_aEditHelpId; OString m_aEditHelpId;
...@@ -468,7 +467,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos) ...@@ -468,7 +467,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
xub_StrLen nFuncPos=STRING_NOTFOUND; xub_StrLen nFuncPos=STRING_NOTFOUND;
sal_Bool bFlag=sal_False; sal_Bool bFlag=sal_False;
String aFormString = m_aFormulaHelper.GetCharClass()->uppercase(pMEdit->GetText()); OUString aFormString = m_aFormulaHelper.GetCharClass()->uppercase(pMEdit->GetText());
if ( m_aTokenList.getLength() ) if ( m_aTokenList.getLength() )
{ {
...@@ -488,7 +487,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos) ...@@ -488,7 +487,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
const sal_Int32 eOp = pIter->OpCode; const sal_Int32 eOp = pIter->OpCode;
uno::Sequence<sheet::FormulaToken> aArgs(1); uno::Sequence<sheet::FormulaToken> aArgs(1);
aArgs[0] = *pIter; aArgs[0] = *pIter;
const String aString = xParser->printFormula(aArgs, aRefPos); const OUString aString = xParser->printFormula(aArgs, aRefPos);
const sheet::FormulaToken* pNextToken = pIter + 1; const sheet::FormulaToken* pNextToken = pIter + 1;
if(!bUserMatrixFlag && FormulaCompiler::IsMatrixFunction((OpCode)eOp) ) if(!bUserMatrixFlag && FormulaCompiler::IsMatrixFunction((OpCode)eOp) )
...@@ -499,9 +498,9 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos) ...@@ -499,9 +498,9 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
if ( eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::PUSH].Token.OpCode || if ( eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::PUSH].Token.OpCode ||
eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::SPACES].Token.OpCode ) eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::SPACES].Token.OpCode )
{ {
const xub_StrLen n1=aFormString.Search(sep, nTokPos); const sal_Int32 n1 = aFormString.indexOf(sep, nTokPos);
const xub_StrLen n2=aFormString.Search(')',nTokPos); const sal_Int32 n2 = aFormString.indexOf(')',nTokPos);
xub_StrLen nXXX=nTokPos; xub_StrLen nXXX = nTokPos;
if(n1<n2) if(n1<n2)
{ {
nTokPos=n1; nTokPos=n1;
...@@ -513,15 +512,15 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos) ...@@ -513,15 +512,15 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
if ( pNextToken != pEnd ) if ( pNextToken != pEnd )
{ {
aArgs[0] = *pNextToken; aArgs[0] = *pNextToken;
const String a2String = xParser->printFormula(aArgs, aRefPos); const OUString a2String = xParser->printFormula(aArgs, aRefPos);
const xub_StrLen n3 = aFormString.Search(a2String,nXXX); const sal_Int32 n3 = aFormString.indexOf(a2String,nXXX);
if ( n3 < nTokPos ) if ( n3 < nTokPos )
nTokPos = n3; nTokPos = n3;
} }
} }
else else
{ {
nTokPos = sal::static_int_cast<xub_StrLen>( nTokPos + aString.Len() ); nTokPos = sal::static_int_cast<xub_StrLen>( nTokPos + aString.getLength() );
} }
if ( eOp == m_aSeparatorsOpCodes[TOKEN_OPEN].OpCode ) if ( eOp == m_aSeparatorsOpCodes[TOKEN_OPEN].OpCode )
...@@ -609,12 +608,12 @@ void FormulaDlg_Impl::UpdateValues() ...@@ -609,12 +608,12 @@ void FormulaDlg_Impl::UpdateValues()
CalcStruct(pMEdit->GetText()); CalcStruct(pMEdit->GetText());
} }
sal_Bool FormulaDlg_Impl::CalcStruct( const String& rStrExp) sal_Bool FormulaDlg_Impl::CalcStruct( const OUString& rStrExp)
{ {
sal_Bool bResult = sal_True; sal_Bool bResult = sal_True;
xub_StrLen nLength=rStrExp.Len(); sal_Int32 nLength = rStrExp.getLength();
if ( rStrExp.Len() > 0 && aOldFormula!=rStrExp && bStructUpdate) if ( !rStrExp.isEmpty() && aOldFormula!=rStrExp && bStructUpdate)
{ {
// Only calculate the value when there isn't any more keyboard input: // Only calculate the value when there isn't any more keyboard input:
...@@ -622,10 +621,10 @@ sal_Bool FormulaDlg_Impl::CalcStruct( const String& rStrExp) ...@@ -622,10 +621,10 @@ sal_Bool FormulaDlg_Impl::CalcStruct( const String& rStrExp)
{ {
pStructPage->ClearStruct(); pStructPage->ClearStruct();
String aString=rStrExp; OUString aString=rStrExp;
if(rStrExp.GetChar(nLength-1)=='(') if(rStrExp[nLength-1] == '(')
{ {
aString.Erase((xub_StrLen)(nLength-1)); aString = aString.copy(0, nLength-1);
} }
aString = comphelper::string::remove(aString, '\n'); aString = comphelper::string::remove(aString, '\n');
...@@ -637,8 +636,8 @@ sal_Bool FormulaDlg_Impl::CalcStruct( const String& rStrExp) ...@@ -637,8 +636,8 @@ sal_Bool FormulaDlg_Impl::CalcStruct( const String& rStrExp)
UpdateTokenArray(aString); UpdateTokenArray(aString);
fillTree(pStructPage); fillTree(pStructPage);
aOldFormula=rStrExp; aOldFormula = rStrExp;
if(rStrExp.GetChar(nLength-1)=='(') if(rStrExp[nLength-1] == '(')
UpdateTokenArray(rStrExp); UpdateTokenArray(rStrExp);
} }
else else
...@@ -666,13 +665,13 @@ void FormulaDlg_Impl::MakeTree(IStructHelper* _pTree,SvTreeListEntry* pParent,Fo ...@@ -666,13 +665,13 @@ void FormulaDlg_Impl::MakeTree(IStructHelper* _pTree,SvTreeListEntry* pParent,Fo
try try
{ {
const table::CellAddress aRefPos(m_pHelper->getReferencePosition()); const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs, aRefPos); const OUString aResult = m_pHelper->getFormulaParser()->printFormula(aArgs, aRefPos);
if ( nParas > 0 ) if ( nParas > 0 )
{ {
SvTreeListEntry* pEntry; SvTreeListEntry* pEntry;
String aTest=_pTree->GetEntryText(pParent); OUString aTest=_pTree->GetEntryText(pParent);
if(aTest==aResult && if(aTest==aResult &&
(eOp==ocAdd || eOp==ocMul || (eOp==ocAdd || eOp==ocMul ||
...@@ -728,7 +727,7 @@ void FormulaDlg_Impl::fillTree(IStructHelper* _pTree) ...@@ -728,7 +727,7 @@ void FormulaDlg_Impl::fillTree(IStructHelper* _pTree)
MakeTree(_pTree,NULL,pToken,1); MakeTree(_pTree,NULL,pToken,1);
} }
} }
void FormulaDlg_Impl::UpdateTokenArray( const String& rStrExp) void FormulaDlg_Impl::UpdateTokenArray( const OUString& rStrExp)
{ {
m_aTokenMap.clear(); m_aTokenMap.clear();
m_aTokenList.realloc(0); m_aTokenList.realloc(0);
...@@ -786,7 +785,7 @@ void FormulaDlg_Impl::FillListboxes() ...@@ -786,7 +785,7 @@ void FormulaDlg_Impl::FillListboxes()
{ {
// Switch between the "Pages" // Switch between the "Pages"
FormEditData* pData = m_pHelper->getFormEditData(); FormEditData* pData = m_pHelper->getFormEditData();
String aNewTitle; OUString aNewTitle;
// 1. Page: select function // 1. Page: select function
if ( pFuncDesc && pFuncDesc->getCategory() ) if ( pFuncDesc && pFuncDesc->getCategory() )
{ {
...@@ -933,7 +932,7 @@ void FormulaDlg_Impl::ClearAllParas() ...@@ -933,7 +932,7 @@ void FormulaDlg_Impl::ClearAllParas()
aFtFuncDesc.Show(); aFtFuncDesc.Show();
} }
} }
String FormulaDlg_Impl::RepairFormula(const String& aFormula) OUString FormulaDlg_Impl::RepairFormula(const OUString& aFormula)
{ {
OUString aResult('='); OUString aResult('=');
try try
...@@ -943,8 +942,8 @@ String FormulaDlg_Impl::RepairFormula(const String& aFormula) ...@@ -943,8 +942,8 @@ String FormulaDlg_Impl::RepairFormula(const String& aFormula)
if ( m_aTokenList.getLength() ) if ( m_aTokenList.getLength() )
{ {
const table::CellAddress aRefPos(m_pHelper->getReferencePosition()); const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList, aRefPos)); const OUString sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList, aRefPos));
if ( !sFormula.Len() || sFormula.GetChar(0) != '=' ) if ( sFormula.isEmpty() || sFormula[0] != '=' )
aResult += sFormula; aResult += sFormula;
else else
aResult = sFormula; aResult = sFormula;
...@@ -964,9 +963,9 @@ void FormulaDlg_Impl::DoEnter(sal_Bool bOk) ...@@ -964,9 +963,9 @@ void FormulaDlg_Impl::DoEnter(sal_Bool bOk)
if ( bOk) if ( bOk)
{ {
// remove dummy arguments // remove dummy arguments
String aInputFormula = m_pHelper->getCurrentFormula(); OUString aInputFormula = m_pHelper->getCurrentFormula();
String aString = RepairFormula(pMEdit->GetText()); OUString aString = RepairFormula(pMEdit->GetText());
m_pHelper->setSelection(0, aInputFormula.Len()); m_pHelper->setSelection(0, aInputFormula.getLength());
m_pHelper->setCurrentFormula(aString); m_pHelper->setCurrentFormula(aString);
} }
...@@ -1093,7 +1092,7 @@ void FormulaDlg_Impl::EditThisFunc(xub_StrLen nFStart) ...@@ -1093,7 +1092,7 @@ void FormulaDlg_Impl::EditThisFunc(xub_StrLen nFStart)
FormEditData* pData = m_pHelper->getFormEditData(); FormEditData* pData = m_pHelper->getFormEditData();
if (!pData) return; if (!pData) return;
String aFormula = m_pHelper->getCurrentFormula(); OUString aFormula = m_pHelper->getCurrentFormula();
if(nFStart==NOT_FOUND) if(nFStart==NOT_FOUND)
{ {
...@@ -1114,7 +1113,7 @@ void FormulaDlg_Impl::EditThisFunc(xub_StrLen nFStart) ...@@ -1114,7 +1113,7 @@ void FormulaDlg_Impl::EditThisFunc(xub_StrLen nFStart)
{ {
xub_StrLen PrivStart, PrivEnd; xub_StrLen PrivStart, PrivEnd;
SetData(nFStart,nNextFStart,nNextFEnd,PrivStart, PrivEnd); SetData(nFStart,nNextFStart,nNextFEnd,PrivStart, PrivEnd);
m_pHelper->showReference(aFormula.Copy(PrivStart, PrivEnd-PrivStart)); m_pHelper->showReference(aFormula.copy(PrivStart, PrivEnd-PrivStart));
} }
else else
{ {
...@@ -1128,7 +1127,7 @@ void FormulaDlg_Impl::EditNextFunc( sal_Bool bForward, xub_StrLen nFStart ) ...@@ -1128,7 +1127,7 @@ void FormulaDlg_Impl::EditNextFunc( sal_Bool bForward, xub_StrLen nFStart )
if (!pData) if (!pData)
return; return;
String aFormula = m_pHelper->getCurrentFormula(); OUString aFormula = m_pHelper->getCurrentFormula();
if(nFStart==NOT_FOUND) if(nFStart==NOT_FOUND)
{ {
...@@ -1196,7 +1195,7 @@ IMPL_LINK( FormulaDlg_Impl, FxHdl, ParaWin*, pPtr ) ...@@ -1196,7 +1195,7 @@ IMPL_LINK( FormulaDlg_Impl, FxHdl, ParaWin*, pPtr )
aBtnForward.Enable(sal_True); //@ In order to be able to input another function. aBtnForward.Enable(sal_True); //@ In order to be able to input another function.
aTabCtrl.SetCurPageId(TP_FUNCTION); aTabCtrl.SetCurPageId(TP_FUNCTION);
String aUndoStr = m_pHelper->getCurrentFormula(); // it will be added before a ";" OUString aUndoStr = m_pHelper->getCurrentFormula(); // it will be added before a ";"
FormEditData* pData = m_pHelper->getFormEditData(); FormEditData* pData = m_pHelper->getFormEditData();
if (!pData) return 0; if (!pData) return 0;
...@@ -1208,7 +1207,7 @@ IMPL_LINK( FormulaDlg_Impl, FxHdl, ParaWin*, pPtr ) ...@@ -1208,7 +1207,7 @@ IMPL_LINK( FormulaDlg_Impl, FxHdl, ParaWin*, pPtr )
xub_StrLen nFormulaStrPos = pData->GetFStart(); xub_StrLen nFormulaStrPos = pData->GetFStart();
String aFormula = m_pHelper->getCurrentFormula(); OUString aFormula = m_pHelper->getCurrentFormula();
xub_StrLen n1 = m_aFormulaHelper.GetArgStart( aFormula, nFormulaStrPos, nEdFocus+pData->GetOffset() ); xub_StrLen n1 = m_aFormulaHelper.GetArgStart( aFormula, nFormulaStrPos, nEdFocus+pData->GetOffset() );
pData->SetEdFocus( nEdFocus ); pData->SetEdFocus( nEdFocus );
...@@ -1244,31 +1243,31 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaHdl) ...@@ -1244,31 +1243,31 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaHdl)
if (!pData) return 0; if (!pData) return 0;
bEditFlag=sal_True; bEditFlag=sal_True;
String aInputFormula=m_pHelper->getCurrentFormula(); OUString aInputFormula=m_pHelper->getCurrentFormula();
String aString=pMEdit->GetText(); OUString aString=pMEdit->GetText();
Selection aSel =pMEdit->GetSelection(); Selection aSel =pMEdit->GetSelection();
xub_StrLen nTest=0; xub_StrLen nTest=0;
if(aString.Len()==0) //in case everything was cleared if(aString.isEmpty()) //in case everything was cleared
{ {
aString +='='; aString += "=";
pMEdit->SetText(aString); pMEdit->SetText(aString);
aSel .Min()=1; aSel .Min() = 1;
aSel .Max()=1; aSel .Max() = 1;
pMEdit->SetSelection(aSel); pMEdit->SetSelection(aSel);
} }
else if(aString.GetChar(nTest)!='=') //in case it's replaced; else if(aString[nTest]!='=') //in case it's replaced;
{ {
aString.Insert( (sal_Unicode)'=', 0 ); aString = "=" + aString;
pMEdit->SetText(aString); pMEdit->SetText(aString);
aSel .Min()+=1; aSel .Min() += 1;
aSel .Max()+=1; aSel .Max() += 1;
pMEdit->SetSelection(aSel); pMEdit->SetSelection(aSel);
} }
m_pHelper->setSelection(0, aInputFormula.Len()); m_pHelper->setSelection(0, aInputFormula.getLength());
m_pHelper->setCurrentFormula(aString); m_pHelper->setCurrentFormula(aString);
m_pHelper->setSelection((xub_StrLen)aSel.Min(),(xub_StrLen)aSel.Max()); m_pHelper->setSelection((xub_StrLen)aSel.Min(),(xub_StrLen)aSel.Max());
...@@ -1289,7 +1288,7 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaHdl) ...@@ -1289,7 +1288,7 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaHdl)
if(nPos<aSel.Min()-1) if(nPos<aSel.Min()-1)
{ {
xub_StrLen nPos1=aString.Search('(',nPos); sal_Int32 nPos1 = aString.indexOf('(',nPos);
EditNextFunc( sal_False, nPos1); EditNextFunc( sal_False, nPos1);
} }
else else
...@@ -1310,7 +1309,7 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaCursorHdl) ...@@ -1310,7 +1309,7 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaCursorHdl)
bEditFlag=sal_True; bEditFlag=sal_True;
String aString=pMEdit->GetText(); OUString aString=pMEdit->GetText();
Selection aSel =pMEdit->GetSelection(); Selection aSel =pMEdit->GetSelection();
m_pHelper->setSelection((xub_StrLen)aSel.Min(),(xub_StrLen)aSel.Max()); m_pHelper->setSelection((xub_StrLen)aSel.Min(),(xub_StrLen)aSel.Max());
...@@ -1321,7 +1320,7 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaCursorHdl) ...@@ -1321,7 +1320,7 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaCursorHdl)
pMEdit->SetSelection(aSel); pMEdit->SetSelection(aSel);
} }
if(aSel.Min()!=aString.Len()) if(aSel.Min() != aString.getLength())
{ {
xub_StrLen nPos=(xub_StrLen)aSel.Min(); xub_StrLen nPos=(xub_StrLen)aSel.Min();
...@@ -1341,9 +1340,9 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaCursorHdl) ...@@ -1341,9 +1340,9 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FormulaCursorHdl)
short nCount=1; short nCount=1;
while(n>0) while(n>0)
{ {
if(aString.GetChar(n)==')') if(aString[n]==')')
nCount++; nCount++;
else if(aString.GetChar(n)=='(') else if(aString[n]=='(')
nCount--; nCount--;
if(nCount==0) break; if(nCount==0) break;
n--; n--;
...@@ -1382,7 +1381,7 @@ void FormulaDlg_Impl::UpdateSelection() ...@@ -1382,7 +1381,7 @@ void FormulaDlg_Impl::UpdateSelection()
nArgs = pFuncDesc->getSuppressedArgumentCount(); nArgs = pFuncDesc->getSuppressedArgumentCount();
String aFormula=pMEdit->GetText(); OUString aFormula=pMEdit->GetText();
sal_Int32 nArgPos=m_aFormulaHelper.GetArgStart( aFormula,PrivStart,0); sal_Int32 nArgPos=m_aFormulaHelper.GetArgStart( aFormula,PrivStart,0);
sal_uInt16 nPos=pParaWin->GetActiveLine(); sal_uInt16 nPos=pParaWin->GetActiveLine();
...@@ -1467,8 +1466,8 @@ RefEdit* FormulaDlg_Impl::GetCurrRefEdit() ...@@ -1467,8 +1466,8 @@ RefEdit* FormulaDlg_Impl::GetCurrRefEdit()
void FormulaDlg_Impl::Update() void FormulaDlg_Impl::Update()
{ {
FormEditData* pData = m_pHelper->getFormEditData(); FormEditData* pData = m_pHelper->getFormEditData();
const String sExpression = pMEdit->GetText(); const OUString sExpression = pMEdit->GetText();
aOldFormula = String(); aOldFormula = OUString();
UpdateTokenArray(sExpression); UpdateTokenArray(sExpression);
FormulaCursorHdl(&aMEFormula); FormulaCursorHdl(&aMEFormula);
CalcStruct(sExpression); CalcStruct(sExpression);
...@@ -1478,20 +1477,20 @@ void FormulaDlg_Impl::Update() ...@@ -1478,20 +1477,20 @@ void FormulaDlg_Impl::Update()
aTabCtrl.SetCurPageId(TP_STRUCT); aTabCtrl.SetCurPageId(TP_STRUCT);
aBtnMatrix.Check(pData->GetMatrixFlag()); aBtnMatrix.Check(pData->GetMatrixFlag());
} }
void FormulaDlg_Impl::Update(const String& _sExp) void FormulaDlg_Impl::Update(const OUString& _sExp)
{ {
CalcStruct(_sExp); CalcStruct(_sExp);
FillDialog(); FillDialog();
FuncSelHdl(NULL); FuncSelHdl(NULL);
} }
void FormulaDlg_Impl::SetMeText(const String& _sText) void FormulaDlg_Impl::SetMeText(const OUString& _sText)
{ {
FormEditData* pData = m_pHelper->getFormEditData(); FormEditData* pData = m_pHelper->getFormEditData();
pMEdit->SetText(_sText); pMEdit->SetText(_sText);
pMEdit->SetSelection( pData->GetSelection()); pMEdit->SetSelection( pData->GetSelection());
aMEFormula.UpdateOldSel(); aMEFormula.UpdateOldSel();
} }
FormulaDlgMode FormulaDlg_Impl::SetMeText(const String& _sText,xub_StrLen PrivStart, xub_StrLen PrivEnd,sal_Bool bMatrix,sal_Bool _bSelect,sal_Bool _bUpdate) FormulaDlgMode FormulaDlg_Impl::SetMeText(const OUString& _sText, xub_StrLen PrivStart, xub_StrLen PrivEnd, sal_Bool bMatrix, sal_Bool _bSelect, sal_Bool _bUpdate)
{ {
FormulaDlgMode eMode = FORMULA_FORMDLG_FORMULA; FormulaDlgMode eMode = FORMULA_FORMDLG_FORMULA;
if(!bEditFlag) if(!bEditFlag)
...@@ -1560,7 +1559,7 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FuncSelHdl) ...@@ -1560,7 +1559,7 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FuncSelHdl)
{ {
pDesc->initArgumentInfo(); // full argument info is needed pDesc->initArgumentInfo(); // full argument info is needed
String aSig = pDesc->getSignature(); OUString aSig = pDesc->getSignature();
aFtHeadLine.SetText( pDesc->getFunctionName() ); aFtHeadLine.SetText( pDesc->getFunctionName() );
aFtFuncName.SetText( aSig ); aFtFuncName.SetText( aSig );
aFtFuncDesc.SetText( pDesc->getDescription() ); aFtFuncDesc.SetText( pDesc->getDescription() );
...@@ -1568,18 +1567,18 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FuncSelHdl) ...@@ -1568,18 +1567,18 @@ IMPL_LINK_NOARG(FormulaDlg_Impl, FuncSelHdl)
} }
else else
{ {
aFtHeadLine.SetText( String() ); aFtHeadLine.SetText( OUString() );
aFtFuncName.SetText( String() ); aFtFuncName.SetText( OUString() );
aFtFuncDesc.SetText( String() ); aFtFuncDesc.SetText( OUString() );
} }
return 0; return 0;
} }
void FormulaDlg_Impl::UpdateParaWin(const Selection& _rSelection,const String& _sRefStr) void FormulaDlg_Impl::UpdateParaWin(const Selection& _rSelection, const OUString& _sRefStr)
{ {
Selection theSel = _rSelection; Selection theSel = _rSelection;
aEdRef.ReplaceSelected( _sRefStr ); aEdRef.ReplaceSelected( _sRefStr );
theSel.Max() = theSel.Min() + _sRefStr.Len(); theSel.Max() = theSel.Min() + _sRefStr.getLength();
aEdRef.SetSelection( theSel ); aEdRef.SetSelection( theSel );
//------------------------------------- //-------------------------------------
...@@ -1599,7 +1598,7 @@ sal_Bool FormulaDlg_Impl::UpdateParaWin(Selection& _rSelection) ...@@ -1599,7 +1598,7 @@ sal_Bool FormulaDlg_Impl::UpdateParaWin(Selection& _rSelection)
{ {
pParaWin->SetRefMode(sal_True); pParaWin->SetRefMode(sal_True);
String aStrEd; OUString aStrEd;
Edit* pEd = GetCurrRefEdit(); Edit* pEd = GetCurrRefEdit();
if(pEd!=NULL && pTheRefEdit==NULL) if(pEd!=NULL && pTheRefEdit==NULL)
{ {
......
...@@ -285,7 +285,7 @@ void ArgInput::SetArgName(const OUString &aArg) ...@@ -285,7 +285,7 @@ void ArgInput::SetArgName(const OUString &aArg)
#************************************************************************/ #************************************************************************/
OUString ArgInput::GetArgName() OUString ArgInput::GetArgName()
{ {
String aPrivArgName; OUString aPrivArgName;
if(pFtArg !=NULL) if(pFtArg !=NULL)
aPrivArgName=pFtArg->GetText(); aPrivArgName=pFtArg->GetText();
......
...@@ -96,18 +96,18 @@ void ParaWin::UpdateArgDesc( sal_uInt16 nArg ) ...@@ -96,18 +96,18 @@ void ParaWin::UpdateArgDesc( sal_uInt16 nArg )
if ( (nArgs > 0) && (nArg<nArgs) ) if ( (nArgs > 0) && (nArg<nArgs) )
{ {
String aArgDesc; OUString aArgDesc;
String aArgName; OUString aArgName;
SetArgumentDesc( String() ); SetArgumentDesc( OUString() );
SetArgumentText( String() ); SetArgumentText( OUString() );
if ( nArgs < VAR_ARGS ) if ( nArgs < VAR_ARGS )
{ {
sal_uInt16 nRealArg = (aVisibleArgMapping.size() < nArg) ? aVisibleArgMapping[nArg] : nArg; sal_uInt16 nRealArg = (aVisibleArgMapping.size() < nArg) ? aVisibleArgMapping[nArg] : nArg;
aArgDesc = pFuncDesc->getParameterDescription(nRealArg); aArgDesc = pFuncDesc->getParameterDescription(nRealArg);
aArgName = pFuncDesc->getParameterName(nRealArg); aArgName = pFuncDesc->getParameterName(nRealArg);
aArgName += ' '; aArgName += " ";
aArgName += (pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ; aArgName += (pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
} }
else if ( nArgs < PAIRED_VAR_ARGS ) else if ( nArgs < PAIRED_VAR_ARGS )
...@@ -120,7 +120,7 @@ void ParaWin::UpdateArgDesc( sal_uInt16 nArg ) ...@@ -120,7 +120,7 @@ void ParaWin::UpdateArgDesc( sal_uInt16 nArg )
aArgName = pFuncDesc->getParameterName(nRealArg); aArgName = pFuncDesc->getParameterName(nRealArg);
if ( nArg >= nFix ) if ( nArg >= nFix )
aArgName += OUString::number( nArg-nFix+1 ); aArgName += OUString::number( nArg-nFix+1 );
aArgName += ' '; aArgName += " ";
aArgName += (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ; aArgName += (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
} }
...@@ -138,7 +138,7 @@ void ParaWin::UpdateArgDesc( sal_uInt16 nArg ) ...@@ -138,7 +138,7 @@ void ParaWin::UpdateArgDesc( sal_uInt16 nArg )
aArgName = pFuncDesc->getParameterName(nRealArg); aArgName = pFuncDesc->getParameterName(nRealArg);
if ( nArg >= nFix ) if ( nArg >= nFix )
aArgName += OUString::number( (nArg-nFix)/2 + 1 ); aArgName += OUString::number( (nArg-nFix)/2 + 1 );
aArgName += ' '; aArgName += " ";
aArgName += (nArg > (nFix+1) || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ; aArgName += (nArg > (nFix+1) || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
} }
...@@ -172,7 +172,7 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i ) ...@@ -172,7 +172,7 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i )
aFntLight : aFntBold ); aFntLight : aFntBold );
if ( nArg >= nFix ) if ( nArg >= nFix )
{ {
String aArgName( pFuncDesc->getParameterName(nRealArg) ); OUString aArgName( pFuncDesc->getParameterName(nRealArg) );
aArgName += OUString::number(nArg-nFix+1); aArgName += OUString::number(nArg-nFix+1);
SetArgName( i, aArgName ); SetArgName( i, aArgName );
} }
...@@ -194,7 +194,7 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i ) ...@@ -194,7 +194,7 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i )
aFntLight : aFntBold ); aFntLight : aFntBold );
if ( nArg >= nFix ) if ( nArg >= nFix )
{ {
String aArgName( pFuncDesc->getParameterName(nRealArg) ); OUString aArgName( pFuncDesc->getParameterName(nRealArg) );
aArgName += OUString::number( (nArg-nFix)/2 + 1 ); aArgName += OUString::number( (nArg-nFix)/2 + 1 );
SetArgName( i, aArgName ); SetArgName( i, aArgName );
} }
...@@ -296,9 +296,9 @@ void ParaWin::SetFunctionDesc(const IFunctionDescription* pFDesc) ...@@ -296,9 +296,9 @@ void ParaWin::SetFunctionDesc(const IFunctionDescription* pFDesc)
{ {
pFuncDesc=pFDesc; pFuncDesc=pFDesc;
SetArgumentDesc( String() ); SetArgumentDesc( OUString() );
SetArgumentText( String() ); SetArgumentText( OUString() );
SetEditDesc( String() ); SetEditDesc( OUString() );
nArgs = 0; nArgs = 0;
if ( pFuncDesc!=NULL) if ( pFuncDesc!=NULL)
{ {
...@@ -417,7 +417,7 @@ void ParaWin::SetArgumentOffset(sal_uInt16 nOffset) ...@@ -417,7 +417,7 @@ void ParaWin::SetArgumentOffset(sal_uInt16 nOffset)
{ {
for ( int i=0; i<4 && i<nArgs; i++ ) for ( int i=0; i<4 && i<nArgs; i++ )
{ {
String aString; OUString aString;
aArgInput[i].SetArgVal(aString); aArgInput[i].SetArgVal(aString);
aArgInput[i].GetArgEdPtr()->Init( aArgInput[i].GetArgEdPtr()->Init(
(i==0) ? (ArgEdit *)NULL : aArgInput[i-1].GetArgEdPtr(), (i==0) ? (ArgEdit *)NULL : aArgInput[i-1].GetArgEdPtr(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment