From f019ee7cf9e278cd8a27b1c36172ad4c8124080c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 18 Oct 2016 11:55:32 +0200 Subject: loplugin:expandablemethodds in basctl..chart2 Change-Id: I96f565a974fe3e316ae2ab04f8731b8bbfb87993 Reviewed-on: https://gerrit.libreoffice.org/29998 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- basctl/source/basicide/breakpoint.cxx | 11 ++--------- basctl/source/basicide/breakpoint.hxx | 1 - basctl/source/basicide/scriptdocument.cxx | 8 +------- basctl/source/inc/scriptdocument.hxx | 6 ------ basic/inc/sbstdobj.hxx | 1 - basic/source/comp/exprgen.cxx | 6 +++--- basic/source/comp/exprnode.cxx | 4 ++-- basic/source/inc/expr.hxx | 9 --------- basic/source/runtime/stdobj1.cxx | 2 +- chart2/source/controller/main/FeatureCommandDispatchBase.cxx | 7 +------ chart2/source/controller/main/FeatureCommandDispatchBase.hxx | 3 --- chart2/source/inc/LifeTime.hxx | 5 ++--- chart2/source/tools/LifeTime.cxx | 2 +- chart2/source/view/inc/AbstractShapeFactory.hxx | 5 +---- chart2/source/view/main/AbstractShapeFactory.cxx | 4 ++-- 15 files changed, 16 insertions(+), 58 deletions(-) diff --git a/basctl/source/basicide/breakpoint.cxx b/basctl/source/basicide/breakpoint.cxx index b3e6a70e1617..3396a198a772 100644 --- a/basctl/source/basicide/breakpoint.cxx +++ b/basctl/source/basicide/breakpoint.cxx @@ -49,10 +49,8 @@ void BreakPointList::reset() void BreakPointList::transfer(BreakPointList & rList) { - reset(); - for (size_t i = 0; i < rList.size(); ++i) - maBreakPoints.push_back( rList.at( i ) ); - rList.clear(); + maBreakPoints.swap(rList.maBreakPoints); + rList.reset(); } void BreakPointList::InsertSorted(BreakPoint* pNewBrk) @@ -159,11 +157,6 @@ const BreakPoint* BreakPointList::at(size_t i) const return i < maBreakPoints.size() ? maBreakPoints[ i ] : nullptr; } -void BreakPointList::clear() -{ - maBreakPoints.clear(); -} - } // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/breakpoint.hxx b/basctl/source/basicide/breakpoint.hxx index 8431c3039af3..2ade823452bf 100644 --- a/basctl/source/basicide/breakpoint.hxx +++ b/basctl/source/basicide/breakpoint.hxx @@ -72,7 +72,6 @@ public: size_t size() const; BreakPoint* at(size_t i); const BreakPoint* at(size_t i) const; - void clear(); BreakPoint* remove(BreakPoint* ptr); }; diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 17d928d5c0b2..a99fefafe8a3 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -1100,7 +1100,7 @@ namespace basctl { const ScriptDocument aCheck = ScriptDocument( doc->xModel ); if ( _rUrlOrCaption == aCheck.getTitle() - || _rUrlOrCaption == aCheck.getURL() + || _rUrlOrCaption == aCheck.m_pImpl->getURL() ) { aDocument = aCheck; @@ -1513,12 +1513,6 @@ namespace basctl } - OUString ScriptDocument::getURL() const - { - return m_pImpl->getURL(); - } - - bool ScriptDocument::isActive() const { bool bIsActive( false ); diff --git a/basctl/source/inc/scriptdocument.hxx b/basctl/source/inc/scriptdocument.hxx index 1a024367aafb..65467998b4b8 100644 --- a/basctl/source/inc/scriptdocument.hxx +++ b/basctl/source/inc/scriptdocument.hxx @@ -471,12 +471,6 @@ namespace basctl */ OUString getTitle() const; - /** returns the URL of the document - - to be used for valid documents only - */ - OUString getURL() const; - /** determines whether the document is currently the one-and-only application-wide active document */ bool isActive() const; diff --git a/basic/inc/sbstdobj.hxx b/basic/inc/sbstdobj.hxx index b0840a84a3a6..7cc22584fab7 100644 --- a/basic/inc/sbstdobj.hxx +++ b/basic/inc/sbstdobj.hxx @@ -90,7 +90,6 @@ public: bool IsUnderline() const { return bUnderline; } void SetSize( sal_uInt16 nS ) { nSize = nS; } sal_uInt16 GetSize() const { return nSize; } - void SetFontName( const OUString& rName ) { aName = rName; } const OUString& GetFontName() const { return aName; } }; diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index 7581d6e2029c..1b0638881bce 100644 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -108,7 +108,7 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) } } // special treatment for WITH - else if( (pWithParent_ = GetWithParent()) != nullptr ) + else if( (pWithParent_ = pWithParent) != nullptr ) { eOp = SbiOpcode::ELEM_; // .-Term in WITH } @@ -141,12 +141,12 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) eOp = SbiOpcode::ELEM_; } } - else if( IsTypeOf() ) + else if( eNodeType == SbxTYPEOF ) { pLeft->Gen(rGen); rGen.Gen( SbiOpcode::TESTCLASS_, nTypeStrId ); } - else if( IsNew() ) + else if( eNodeType == SbxNEW ) { rGen.Gen( SbiOpcode::CREATE_, 0, nTypeStrId ); } diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx index 70de50941fd2..cfde488b0900 100644 --- a/basic/source/comp/exprnode.cxx +++ b/basic/source/comp/exprnode.cxx @@ -223,9 +223,9 @@ void SbiExprNode::FoldConstants(SbiParser* pParser) { if( IsOperand() || eTok == LIKE ) return; - if (IsUnary()) + if (pLeft && !pRight) FoldConstantsUnaryNode(pParser); - else if (IsBinary()) + else if (pLeft && pRight) FoldConstantsBinaryNode(pParser); if( eNodeType == SbxNUMVAL ) diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 748d6b26e400..68a7bf90be0f 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -109,10 +109,6 @@ class SbiExprNode final { // operators (and operands) void CollectBits(); // converting numbers to strings bool IsOperand() { return eNodeType != SbxNODE && eNodeType != SbxTYPEOF && eNodeType != SbxNEW; } - bool IsTypeOf() - { return eNodeType == SbxTYPEOF; } - bool IsNew() - { return eNodeType == SbxNEW; } bool IsNumber(); bool IsLvalue(); // true, if usable as Lvalue void GenElement( SbiCodeGen&, SbiOpcode ); @@ -132,12 +128,7 @@ public: { return eNodeType == SbxSTRVAL || eNodeType == SbxNUMVAL; } void ConvertToIntConstIfPossible(); bool IsVariable(); - bool IsUnary() - { return pLeft && !pRight; } - bool IsBinary() - { return pLeft && pRight; } - SbiExprNode* GetWithParent() { return pWithParent; } void SetWithParent( SbiExprNode* p ) { pWithParent = p; } SbxDataType GetType() { return eType; } diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx index cd963d12301b..a46520bbd544 100644 --- a/basic/source/runtime/stdobj1.cxx +++ b/basic/source/runtime/stdobj1.cxx @@ -202,7 +202,7 @@ void SbStdFont::PropName( SbxVariable* pVar, SbxArray*, bool bWrite ) { if( bWrite ) { - SetFontName( pVar->GetOUString() ); + aName = pVar->GetOUString(); } else { diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx index e9721f1d738e..8d02473ed58e 100644 --- a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx +++ b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx @@ -40,7 +40,7 @@ FeatureCommandDispatchBase::~FeatureCommandDispatchBase() void FeatureCommandDispatchBase::initialize() { CommandDispatch::initialize(); - fillSupportedFeatures(); + describeSupportedFeatures(); } bool FeatureCommandDispatchBase::isFeatureSupported( const OUString& rCommandURL ) @@ -95,11 +95,6 @@ void FeatureCommandDispatchBase::implDescribeSupportedFeature( const sal_Char* p m_aSupportedFeatures[ aFeature.Command ] = aFeature; } -void FeatureCommandDispatchBase::fillSupportedFeatures() -{ - describeSupportedFeatures(); -} - } // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx index f7b3dce41c35..07679b1d952f 100644 --- a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx +++ b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx @@ -95,9 +95,6 @@ protected: mutable SupportedFeatures m_aSupportedFeatures; sal_uInt16 m_nFeatureId; - -private: - void fillSupportedFeatures(); }; } // namespace chart diff --git a/chart2/source/inc/LifeTime.hxx b/chart2/source/inc/LifeTime.hxx index 870dd7c2468c..64f33af83584 100644 --- a/chart2/source/inc/LifeTime.hxx +++ b/chart2/source/inc/LifeTime.hxx @@ -75,7 +75,7 @@ class CloseableLifeTimeManager : public LifeTimeManager protected: css::util::XCloseable* m_pCloseable; - ::osl::Condition m_aEndTryClosingCondition; + ::osl::Condition m_aEndTryClosingCondition; bool volatile m_bClosed; bool volatile m_bInTryClose; //the ownership between model and controller is not clear at first @@ -100,10 +100,9 @@ OOO_DLLPUBLIC_CHARTTOOLS void g_addCloseListener( const css::uno::Referenc protected: virtual bool impl_canStartApiCall() override; - virtual void impl_apiCallCountReachedNull() override; + virtual void impl_apiCallCountReachedNull() override; void impl_setOwnership( bool bDeliverOwnership, bool bMyVeto ); - bool impl_shouldCloseAtNextChance() { return m_bOwnership;} void impl_doClose(); void impl_init() diff --git a/chart2/source/tools/LifeTime.cxx b/chart2/source/tools/LifeTime.cxx index 219b71cbc2f8..76810ce2cff1 100644 --- a/chart2/source/tools/LifeTime.cxx +++ b/chart2/source/tools/LifeTime.cxx @@ -310,7 +310,7 @@ void CloseableLifeTimeManager::impl_apiCallCountReachedNull() { //Mutex needs to be acquired exactly ones //mutex will be released inbetween in impl_doClose() - if( m_pCloseable && impl_shouldCloseAtNextChance() ) + if( m_pCloseable && m_bOwnership ) impl_doClose(); } diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx index ff2ac600694c..be0ceb56dbc3 100644 --- a/chart2/source/view/inc/AbstractShapeFactory.hxx +++ b/chart2/source/view/inc/AbstractShapeFactory.hxx @@ -58,14 +58,11 @@ class Stripe; class AbstractShapeFactory { protected: + css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory; - css::uno::Reference< css::lang::XMultiServiceFactory> - m_xShapeFactory; public: enum StackPosition { Top, Bottom }; - void setShapeFactory(css::uno::Reference< css::lang::XMultiServiceFactory> const & xFactory) - { m_xShapeFactory = xFactory; } static AbstractShapeFactory* getOrCreateShapeFactory(const css::uno::Reference< css::lang::XMultiServiceFactory>& xFactory); diff --git a/chart2/source/view/main/AbstractShapeFactory.cxx b/chart2/source/view/main/AbstractShapeFactory.cxx index 56953a9cfcbf..d1906716f6da 100644 --- a/chart2/source/view/main/AbstractShapeFactory.cxx +++ b/chart2/source/view/main/AbstractShapeFactory.cxx @@ -97,14 +97,14 @@ AbstractShapeFactory* AbstractShapeFactory::getOrCreateShapeFactory(const uno::R { pShapeFactory = reinterpret_cast(fn)(); - pShapeFactory->setShapeFactory(xFactory); + pShapeFactory->m_xShapeFactory = xFactory; } } #elif defined(IOS) || defined(ANDROID) // Library_chartopengl is not portable enough yet pShapeFactory = NULL; #else pShapeFactory = getOpenglShapeFactory(); - pShapeFactory->setShapeFactory(xFactory); + pShapeFactory->m_xShapeFactory = xFactory; #endif } -- cgit