diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-16 10:05:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-18 08:37:57 +0200 |
commit | 346b900594a84581056ba56061ea513f4e6f101d (patch) | |
tree | cf617262c91c9b8f94f02b6ada55b6994a70eb9b | |
parent | 2bc84658cce1df5050fe788dd0c8a0906a1ca2c3 (diff) |
loplugin:mergeclasses merge IFormulaToken into FormulaToken
Change-Id: I5dbf870ff27f1039e24f4350787cf5bfc5f4ccaf
Reviewed-on: https://gerrit.libreoffice.org/57487
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 2 | ||||
-rw-r--r-- | formula/source/core/api/token.cxx | 2 | ||||
-rw-r--r-- | formula/source/ui/dlg/structpg.cxx | 19 | ||||
-rw-r--r-- | formula/source/ui/dlg/structpg.hxx | 10 | ||||
-rw-r--r-- | include/formula/IFunctionDescription.hxx | 10 | ||||
-rw-r--r-- | include/formula/token.hxx | 14 |
6 files changed, 19 insertions, 38 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index ac42bd3df588..5d4c3e76ec5b 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -2193,7 +2193,7 @@ const FormulaToken* FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuf // shall separate a function-name from the left parenthesis (() // that follows it." and Excel even chokes on it. const FormulaToken* p = maArrIterator.PeekPrevNoSpaces(); - if (p && p->isFunction()) + if (p && p->IsFunction()) { p = maArrIterator.PeekNextNoSpaces(); if (p && p->GetOpCode() == ocOpen) diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index a8fb0b42541d..37b19d3b21f3 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -71,7 +71,7 @@ FormulaToken::FormulaToken( StackVar eTypeP, OpCode e ) : } FormulaToken::FormulaToken( const FormulaToken& r ) : - IFormulaToken(), eOp(r.eOp), eType( r.eType ), mnRefCnt(0) + eOp(r.eOp), eType( r.eType ), mnRefCnt(0) { } diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx index e63ed7420c46..56a94d40a8fb 100644 --- a/formula/source/ui/dlg/structpg.cxx +++ b/formula/source/ui/dlg/structpg.cxx @@ -26,6 +26,7 @@ #include <formula/formdata.hxx> #include <formula/formula.hxx> #include <formula/IFunctionDescription.hxx> +#include <formula/token.hxx> #include <bitmaps.hlst> namespace formula @@ -45,10 +46,10 @@ StructListBox::StructListBox(vcl::Window* pParent, WinBits nBits ): SvTreeListEntry* StructListBox::InsertStaticEntry( const OUString& rText, const Image& rEntryImg, - SvTreeListEntry* pParent, sal_uLong nPos, const IFormulaToken* pToken ) + SvTreeListEntry* pParent, sal_uLong nPos, const FormulaToken* pToken ) { SvTreeListEntry* pEntry = InsertEntry( rText, rEntryImg, rEntryImg, pParent, false, nPos, - const_cast<IFormulaToken*>(pToken) ); + const_cast<FormulaToken*>(pToken) ); return pEntry; } @@ -117,7 +118,7 @@ void StructPage::ClearStruct() } SvTreeListEntry* StructPage::InsertEntry( const OUString& rText, SvTreeListEntry* pParent, - sal_uInt16 nFlag, sal_uLong nPos, const IFormulaToken* pIFormulaToken ) + sal_uInt16 nFlag, sal_uLong nPos, const FormulaToken* pIFormulaToken ) { m_pTlbStruct->SetActiveFlag( false ); @@ -126,7 +127,7 @@ SvTreeListEntry* StructPage::InsertEntry( const OUString& rText, SvTreeListEntry { case STRUCT_FOLDER: pEntry = m_pTlbStruct->InsertEntry( rText, pParent, false, nPos, - const_cast<IFormulaToken*>(pIFormulaToken)); + const_cast<FormulaToken*>(pIFormulaToken)); break; case STRUCT_END: pEntry = m_pTlbStruct->InsertStaticEntry( rText, maImgEnd, pParent, nPos, pIFormulaToken ); @@ -149,14 +150,14 @@ OUString StructPage::GetEntryText(SvTreeListEntry* pEntry) const return aString; } -const IFormulaToken* StructPage::GetFunctionEntry(SvTreeListEntry* pEntry) +const FormulaToken* StructPage::GetFunctionEntry(SvTreeListEntry* pEntry) { if (pEntry != nullptr) { - const IFormulaToken * pToken = static_cast<const IFormulaToken *>(pEntry->GetUserData()); + const FormulaToken * pToken = static_cast<const FormulaToken *>(pEntry->GetUserData()); if (pToken != nullptr) { - if ( !(pToken->isFunction() || pToken->getArgumentCount() > 1 ) ) + if ( !(pToken->IsFunction() || pToken->GetParamCount() > 1 ) ) { return GetFunctionEntry(m_pTlbStruct->GetParent(pEntry)); } @@ -178,10 +179,10 @@ IMPL_LINK( StructPage, SelectHdl, SvTreeListBox*, pTlb, void ) SvTreeListEntry* pCurEntry = m_pTlbStruct->GetCurEntry(); if (pCurEntry != nullptr) { - pSelectedToken = static_cast<const IFormulaToken *>(pCurEntry->GetUserData()); + pSelectedToken = static_cast<const FormulaToken *>(pCurEntry->GetUserData()); if (pSelectedToken != nullptr) { - if ( !(pSelectedToken->isFunction() || pSelectedToken->getArgumentCount() > 1) ) + if ( !(pSelectedToken->IsFunction() || pSelectedToken->GetParamCount() > 1) ) { pSelectedToken = GetFunctionEntry(pCurEntry); } diff --git a/formula/source/ui/dlg/structpg.hxx b/formula/source/ui/dlg/structpg.hxx index 7d1992798924..25e8fec9f6a1 100644 --- a/formula/source/ui/dlg/structpg.hxx +++ b/formula/source/ui/dlg/structpg.hxx @@ -31,7 +31,7 @@ namespace formula { -class IFormulaToken; +class FormulaToken; class StructListBox : public SvTreeListBox { private: @@ -51,7 +51,7 @@ public: const Image& rEntryImg, SvTreeListEntry* pParent, sal_uLong nPos, - const IFormulaToken* pToken ); + const FormulaToken* pToken ); void SetActiveFlag(bool bFlag); bool GetActiveFlag() { return bActiveFlag;} @@ -69,13 +69,13 @@ private: Image maImgEnd; Image maImgError; - const IFormulaToken* pSelectedToken; + const FormulaToken* pSelectedToken; DECL_LINK( SelectHdl, SvTreeListBox*, void ); using Window::GetParent; - const IFormulaToken* GetFunctionEntry(SvTreeListEntry* pEntry); + const FormulaToken* GetFunctionEntry(SvTreeListEntry* pEntry); public: @@ -85,7 +85,7 @@ public: void ClearStruct(); SvTreeListEntry* InsertEntry(const OUString& rText, SvTreeListEntry* pParent, - sal_uInt16 nFlag, sal_uLong nPos, const IFormulaToken* pScToken); + sal_uInt16 nFlag, sal_uLong nPos, const FormulaToken* pScToken); OUString GetEntryText(SvTreeListEntry* pEntry) const; diff --git a/include/formula/IFunctionDescription.hxx b/include/formula/IFunctionDescription.hxx index b0211aa2cd88..3d03d4e6c069 100644 --- a/include/formula/IFunctionDescription.hxx +++ b/include/formula/IFunctionDescription.hxx @@ -108,16 +108,6 @@ namespace formula ~IFunctionDescription() {} }; - class SAL_NO_VTABLE IFormulaToken - { - public: - virtual bool isFunction() const = 0; - virtual sal_uInt32 getArgumentCount() const = 0; - - protected: - ~IFormulaToken() {} - }; - class SAL_NO_VTABLE IFormulaEditorHelper { public: diff --git a/include/formula/token.hxx b/include/formula/token.hxx index d464ec67d39e..6d2851e4edfe 100644 --- a/include/formula/token.hxx +++ b/include/formula/token.hxx @@ -121,7 +121,7 @@ inline std::string StackVarEnumToString(StackVar const e) return os.str(); } -class FORMULA_DLLPUBLIC FormulaToken : public IFormulaToken +class FORMULA_DLLPUBLIC FormulaToken { OpCode eOp; FormulaToken& operator=( const FormulaToken& ) = delete; @@ -139,7 +139,7 @@ public: void Delete() { delete this; } void DeleteIfZeroRef() { if (mnRefCnt == 0) delete this; } StackVar GetType() const { return eType; } - bool IsFunction() const; // pure functions, no operators + bool IsFunction() const; // pure functions, no operators bool IsExternalRef() const; bool IsRef() const; @@ -214,16 +214,6 @@ public: virtual bool TextEqual( const formula::FormulaToken& rToken ) const; virtual bool operator==( const FormulaToken& rToken ) const; - virtual bool isFunction() const override - { - return IsFunction(); - } - - virtual sal_uInt32 getArgumentCount() const override - { - return GetParamCount(); - } - /** This is dirty and only the compiler should use it! */ struct PrivateAccess { friend class FormulaCompiler; private: PrivateAccess() { } }; void NewOpCode( OpCode e, const PrivateAccess& ) { eOp = e; } |