diff options
author | Eike Rathke <erack@redhat.com> | 2017-07-10 12:55:23 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-07-10 12:56:03 +0200 |
commit | 5bb46252cc89b82d9579eb15068e6f01fb06f737 (patch) | |
tree | 0fe46e40808b7c751f493e062a92c8734be810ce /formula | |
parent | 804cd2bd56295c5cb039b55ac7ca880c17399bad (diff) |
Use const (I)FormulaToken* where possible
Actually only the SvTreeList::InsertEntry() needs a non-const void*
Change-Id: I63eb05ba63264efd63bfa287f0ab0bf2840b4414
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/ui/dlg/formula.cxx | 10 | ||||
-rw-r--r-- | formula/source/ui/dlg/structpg.cxx | 16 | ||||
-rw-r--r-- | formula/source/ui/dlg/structpg.hxx | 8 |
3 files changed, 18 insertions, 16 deletions
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 7326a6e568bf..09a3e86f7b90 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -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; diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx index 3fa22117145f..dff340a1825e 100644 --- a/formula/source/ui/dlg/structpg.cxx +++ b/formula/source/ui/dlg/structpg.cxx @@ -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) ) diff --git a/formula/source/ui/dlg/structpg.hxx b/formula/source/ui/dlg/structpg.hxx index d14b770c05d7..b20fa265051d 100644 --- a/formula/source/ui/dlg/structpg.hxx +++ b/formula/source/ui/dlg/structpg.hxx @@ -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; |