Kaydet (Commit) 5bb46252 authored tarafından Eike Rathke's avatar Eike Rathke

Use const (I)FormulaToken* where possible

Actually only the SvTreeList::InsertEntry() needs a non-const void*

Change-Id: I63eb05ba63264efd63bfa287f0ab0bf2840b4414
üst 804cd2bd
......@@ -86,7 +86,7 @@ public:
sal_Int32 GetFunctionPos(sal_Int32 nPos);
void ClearAllParas();
void MakeTree(StructPage* _pTree,SvTreeListEntry* pParent,FormulaToken* _pToken,long Count);
void MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, const FormulaToken* _pToken, long Count );
void fillTree(StructPage* _pTree);
void UpdateTokenArray( const OUString& rStrExp);
OUString RepairFormula(const OUString& aFormula);
......@@ -145,7 +145,7 @@ public:
mutable const sheet::FormulaOpCodeMapEntry* m_pFunctionOpCodesEnd;
mutable uno::Sequence< sheet::FormulaOpCodeMapEntry > m_aUnaryOpCodes;
mutable uno::Sequence< sheet::FormulaOpCodeMapEntry > m_aBinaryOpCodes;
::std::map<FormulaToken*,sheet::FormulaToken> m_aTokenMap;
::std::map<const FormulaToken*,sheet::FormulaToken> m_aTokenMap;
IFormulaEditorHelper* m_pHelper;
VclPtr<Dialog> m_pParent;
VclPtr<TabControl> m_pTabCtrl;
......@@ -619,7 +619,7 @@ bool FormulaDlg_Impl::CalcStruct( const OUString& rStrExp, bool bForceRecalcStru
}
void FormulaDlg_Impl::MakeTree(StructPage* _pTree,SvTreeListEntry* pParent,FormulaToken* _pToken,long Count)
void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, const FormulaToken* _pToken, long Count )
{
if( _pToken != nullptr && Count > 0 )
{
......@@ -627,9 +627,9 @@ void FormulaDlg_Impl::MakeTree(StructPage* _pTree,SvTreeListEntry* pParent,Formu
OpCode eOp = _pToken->GetOpCode();
// #i101512# for output, the original token is needed
FormulaToken* pOrigToken = (_pToken->GetType() == svFAP) ? _pToken->GetFAPOrigToken() : _pToken;
const FormulaToken* pOrigToken = (_pToken->GetType() == svFAP) ? _pToken->GetFAPOrigToken() : _pToken;
uno::Sequence<sheet::FormulaToken> aArgs(1);
::std::map<FormulaToken*,sheet::FormulaToken>::const_iterator itr = m_aTokenMap.find(pOrigToken);
::std::map<const FormulaToken*,sheet::FormulaToken>::const_iterator itr = m_aTokenMap.find(pOrigToken);
if (itr == m_aTokenMap.end())
return;
......
......@@ -48,9 +48,10 @@ StructListBox::StructListBox(vcl::Window* pParent, WinBits nBits ):
SvTreeListEntry* StructListBox::InsertStaticEntry(
const OUString& rText,
const Image& rEntryImg,
SvTreeListEntry* pParent, sal_uLong nPos, IFormulaToken* pToken )
SvTreeListEntry* pParent, sal_uLong nPos, const IFormulaToken* pToken )
{
SvTreeListEntry* pEntry = InsertEntry( rText, rEntryImg, rEntryImg, pParent, false, nPos, pToken );
SvTreeListEntry* pEntry = InsertEntry( rText, rEntryImg, rEntryImg, pParent, false, nPos,
const_cast<IFormulaToken*>(pToken) );
return pEntry;
}
......@@ -119,7 +120,7 @@ void StructPage::ClearStruct()
}
SvTreeListEntry* StructPage::InsertEntry( const OUString& rText, SvTreeListEntry* pParent,
sal_uInt16 nFlag,sal_uLong nPos,IFormulaToken* pIFormulaToken)
sal_uInt16 nFlag, sal_uLong nPos, const IFormulaToken* pIFormulaToken )
{
m_pTlbStruct->SetActiveFlag( false );
......@@ -127,7 +128,8 @@ SvTreeListEntry* StructPage::InsertEntry( const OUString& rText, SvTreeListEntry
switch( nFlag )
{
case STRUCT_FOLDER:
pEntry = m_pTlbStruct->InsertEntry( rText, pParent, false, nPos, pIFormulaToken );
pEntry = m_pTlbStruct->InsertEntry( rText, pParent, false, nPos,
const_cast<IFormulaToken*>(pIFormulaToken));
break;
case STRUCT_END:
pEntry = m_pTlbStruct->InsertStaticEntry( rText, maImgEnd, pParent, nPos, pIFormulaToken );
......@@ -150,11 +152,11 @@ OUString StructPage::GetEntryText(SvTreeListEntry* pEntry) const
return aString;
}
IFormulaToken* StructPage::GetFunctionEntry(SvTreeListEntry* pEntry)
const IFormulaToken* StructPage::GetFunctionEntry(SvTreeListEntry* pEntry)
{
if(pEntry!=nullptr)
{
IFormulaToken * pToken=static_cast<IFormulaToken *>(pEntry->GetUserData());
const IFormulaToken * pToken=static_cast<const IFormulaToken *>(pEntry->GetUserData());
if(pToken!=nullptr)
{
if ( !(pToken->isFunction() || pToken->getArgumentCount() > 1 ) )
......@@ -179,7 +181,7 @@ IMPL_LINK( StructPage, SelectHdl, SvTreeListBox*, pTlb, void )
SvTreeListEntry* pCurEntry=m_pTlbStruct->GetCurEntry();
if(pCurEntry!=nullptr)
{
pSelectedToken=static_cast<IFormulaToken *>(pCurEntry->GetUserData());
pSelectedToken=static_cast<const IFormulaToken *>(pCurEntry->GetUserData());
if(pSelectedToken!=nullptr)
{
if ( !(pSelectedToken->isFunction() || pSelectedToken->getArgumentCount() > 1) )
......
......@@ -53,7 +53,7 @@ public:
const Image& rEntryImg,
SvTreeListEntry* pParent,
sal_uLong nPos,
IFormulaToken* pToken );
const IFormulaToken* pToken );
void SetActiveFlag(bool bFlag);
bool GetActiveFlag() { return bActiveFlag;}
......@@ -72,7 +72,7 @@ private:
Image maImgEnd;
Image maImgError;
IFormulaToken* pSelectedToken;
const IFormulaToken* pSelectedToken;
DECL_LINK( SelectHdl, SvTreeListBox*, void );
......@@ -80,7 +80,7 @@ private:
protected:
IFormulaToken* GetFunctionEntry(SvTreeListEntry* pEntry);
const IFormulaToken* GetFunctionEntry(SvTreeListEntry* pEntry);
public:
......@@ -90,7 +90,7 @@ public:
void ClearStruct();
SvTreeListEntry* InsertEntry(const OUString& rText, SvTreeListEntry* pParent,
sal_uInt16 nFlag,sal_uLong nPos,IFormulaToken* pScToken);
sal_uInt16 nFlag, sal_uLong nPos, const IFormulaToken* pScToken);
OUString GetEntryText(SvTreeListEntry* pEntry) const;
......
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