From 0d7f5e060663cb747b0dc50bb76c162484e4dae4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 2 May 2017 12:01:01 +0200 Subject: loplugin:checkunusedparams in package..reportdesign Change-Id: I8ebccc413153667269954c303e216b155ee9d1ae Reviewed-on: https://gerrit.libreoffice.org/37145 Tested-by: Jenkins Reviewed-by: Noel Grandin --- reportdesign/inc/RptObject.hxx | 2 +- reportdesign/source/core/api/Group.cxx | 8 +++++++- reportdesign/source/core/api/ReportDefinition.cxx | 8 +++++++- reportdesign/source/core/api/Section.cxx | 3 +-- reportdesign/source/core/inc/Section.hxx | 2 +- reportdesign/source/core/inc/Tools.hxx | 8 -------- reportdesign/source/core/sdr/RptObject.cxx | 18 +++++++++--------- reportdesign/source/ui/inc/DesignView.hxx | 3 +-- reportdesign/source/ui/report/DesignView.cxx | 2 +- reportdesign/source/ui/report/ReportController.cxx | 14 +++++++------- reportdesign/source/ui/report/ReportSection.cxx | 4 ++-- 11 files changed, 37 insertions(+), 35 deletions(-) (limited to 'reportdesign') diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx index e6f74e9ffeb7..fd4cba36923f 100644 --- a/reportdesign/inc/RptObject.hxx +++ b/reportdesign/inc/RptObject.hxx @@ -99,7 +99,7 @@ public: OObjectBase(const OObjectBase&) = delete; OObjectBase& operator=(const OObjectBase&) = delete; void StartListening(); - void EndListening(bool bRemoveListener = true); + void EndListening(); // PropertyChangeListener /// @throws css::uno::RuntimeException virtual void _propertyChange( const css::beans::PropertyChangeEvent& evt ); diff --git a/reportdesign/source/core/api/Group.cxx b/reportdesign/source/core/api/Group.cxx index 8a5adae887ee..637a1f56eed1 100644 --- a/reportdesign/source/core/api/Group.cxx +++ b/reportdesign/source/core/api/Group.cxx @@ -300,7 +300,13 @@ void OGroup::setSection( const OUString& _sProperty { ::osl::MutexGuard aGuard(m_aMutex); prepareSet(_sProperty, uno::makeAny(_member), uno::makeAny(_bOn), &l); - lcl_createSectionIfNeeded(_bOn ,this,_member); + + // create section if needed + if ( _bOn && !_member.is() ) + _member = OSection::createOSection(this, getContext()); + else if ( !_bOn ) + ::comphelper::disposeComponent(_member); + if ( _member.is() ) _member->setName(_sName); } diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 6d71b73c5c59..620951d2088e 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -1034,7 +1034,13 @@ void OReportDefinition::setSection( const OUString& _sProperty { ::osl::MutexGuard aGuard(m_aMutex); prepareSet(_sProperty, uno::makeAny(_member), uno::makeAny(_bOn), &l); - lcl_createSectionIfNeeded(_bOn ,this,_member,_sProperty == PROPERTY_PAGEHEADERON || _sProperty == PROPERTY_PAGEFOOTERON); + + // create section if needed + if ( _bOn && !_member.is() ) + _member = OSection::createOSection(this, getContext(), _sProperty == PROPERTY_PAGEHEADERON || _sProperty == PROPERTY_PAGEFOOTERON); + else if ( !_bOn ) + ::comphelper::disposeComponent(_member); + if ( _member.is() ) _member->setName(_sName); } diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index 24deb203928c..548a38748733 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -95,8 +95,7 @@ uno::Reference OSection::createOSection( uno::Reference OSection::createOSection( const uno::Reference< report::XGroup >& xParentGroup, - const uno::Reference< uno::XComponentContext >& context, - bool const) + const uno::Reference< uno::XComponentContext >& context) { OSection *const pNew = new OSection(nullptr, xParentGroup, context, lcl_getGroupAbsent()); diff --git a/reportdesign/source/core/inc/Section.hxx b/reportdesign/source/core/inc/Section.hxx index 2ce22531c13d..d2430820953c 100644 --- a/reportdesign/source/core/inc/Section.hxx +++ b/reportdesign/source/core/inc/Section.hxx @@ -139,7 +139,7 @@ namespace reportdesign ,const css::uno::Reference< css::uno::XComponentContext >& context,bool _bPageSection=false); static css::uno::Reference< css::report::XSection> createOSection(const css::uno::Reference< css::report::XGroup >& _xParent - ,const css::uno::Reference< css::uno::XComponentContext >& context, bool _bPageSection); + ,const css::uno::Reference< css::uno::XComponentContext >& context); DECLARE_XINTERFACE( ) diff --git a/reportdesign/source/core/inc/Tools.hxx b/reportdesign/source/core/inc/Tools.hxx index 98f6185fb460..99fb0211b9e9 100644 --- a/reportdesign/source/core/inc/Tools.hxx +++ b/reportdesign/source/core/inc/Tools.hxx @@ -35,14 +35,6 @@ namespace reportdesign { - template void lcl_createSectionIfNeeded(bool _bOn,const T& _xParent,css::uno::Reference< css::report::XSection>& _xSection/*in/out*/,bool _bPageSection = false) - { - if ( _bOn && !_xSection.is() ) - _xSection = OSection::createOSection(_xParent,_xParent->getContext(),_bPageSection); - else if ( !_bOn ) - ::comphelper::disposeComponent(_xSection); - } - /** uses the XChild interface to get the section from any child of it. * * \param _xReportComponent A report component which is a child of the section. diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 45b5dc064d30..b3dd2f550f2d 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -365,7 +365,7 @@ void OObjectBase::StartListening() } } -void OObjectBase::EndListening(bool /*bRemoveListener*/) +void OObjectBase::EndListening() { OSL_ENSURE(!m_xReportComponent.is() || isListening(), "OUnoObject::EndListening: not listening currently!"); @@ -663,7 +663,7 @@ void OUnoObject::NbcMove( const Size& rSize ) if ( m_bIsListening ) { // stop listening - OObjectBase::EndListening(false); + OObjectBase::EndListening(); bool bPositionFixed = false; Size aUndoSize(0,0); @@ -710,7 +710,7 @@ void OUnoObject::NbcResize(const Point& rRef, const Fraction& xFract, const Frac SdrUnoObj::NbcResize( rRef, xFract, yFract ); // stop listening - OObjectBase::EndListening(false); + OObjectBase::EndListening(); // set geometry properties SetPropsFromRect(GetLogicRect()); @@ -723,7 +723,7 @@ void OUnoObject::NbcSetLogicRect(const tools::Rectangle& rRect) { SdrUnoObj::NbcSetLogicRect(rRect); // stop listening - OObjectBase::EndListening(false); + OObjectBase::EndListening(); // set geometry properties SetPropsFromRect(rRect); @@ -796,7 +796,7 @@ void OUnoObject::_propertyChange( const beans::PropertyChangeEvent& evt ) Reference xControlModel(GetUnoControlModel(),uno::UNO_QUERY); if ( xControlModel.is() ) { - OObjectBase::EndListening(false); + OObjectBase::EndListening(); try { xControlModel->setPropertyValue(PROPERTY_TEXTCOLOR,evt.NewValue); @@ -823,7 +823,7 @@ void OUnoObject::_propertyChange( const beans::PropertyChangeEvent& evt ) if ( !aNewName.equals(aOldName) ) { // set old name property - OObjectBase::EndListening(false); + OObjectBase::EndListening(); if ( m_xMediator.is() ) m_xMediator.get()->stopListening(); try @@ -938,7 +938,7 @@ void OOle2Obj::NbcMove( const Size& rSize ) if ( m_bIsListening ) { // stop listening - OObjectBase::EndListening(false); + OObjectBase::EndListening(); bool bPositionFixed = false; Size aUndoSize(0,0); @@ -990,7 +990,7 @@ void OOle2Obj::NbcResize(const Point& rRef, const Fraction& xFract, const Fracti SdrOle2Obj::NbcResize( rRef, xFract, yFract ); // stop listening - OObjectBase::EndListening(false); + OObjectBase::EndListening(); // set geometry properties SetPropsFromRect(GetLogicRect()); @@ -1003,7 +1003,7 @@ void OOle2Obj::NbcSetLogicRect(const tools::Rectangle& rRect) { SdrOle2Obj::NbcSetLogicRect(rRect); // stop listening - OObjectBase::EndListening(false); + OObjectBase::EndListening(); // set geometry properties SetPropsFromRect(rRect); diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx index cd51c832a2a7..d946923dd97b 100644 --- a/reportdesign/source/ui/inc/DesignView.hxx +++ b/reportdesign/source/ui/inc/DesignView.hxx @@ -238,10 +238,9 @@ namespace rptui /** returns if the view handles the event by itself * - * \param _nId the command id * \return is the event is not handled by the view otherwise */ - bool isHandleEvent(sal_uInt16 _nId) const; + bool isHandleEvent() const; sal_uInt32 getMarkedObjectCount() const; diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index c993d46d57da..1e76941850e8 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -662,7 +662,7 @@ void ODesignView::setDragStripes(bool bOn) m_aScrollWindow->setDragStripes(bOn); } -bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const +bool ODesignView::isHandleEvent() const { return m_pPropWin && m_pPropWin->HasChildPathFocus(); } diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index cb15da1463ff..2957f39e73f7 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -519,19 +519,19 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = isEditable() && getDesignView()->HasSelection(); break; case SID_CUT: - aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId); + aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(); break; case SID_COPY: - aReturn.bEnabled = getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId); + aReturn.bEnabled = getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(); break; case SID_PASTE: - aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent(_nId) && getDesignView()->IsPasteAllowed(); + aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent() && getDesignView()->IsPasteAllowed(); break; case SID_SELECTALL: - aReturn.bEnabled = !getDesignView()->isHandleEvent(_nId); + aReturn.bEnabled = !getDesignView()->isHandleEvent(); break; case SID_SELECTALL_IN_SECTION: - aReturn.bEnabled = !getDesignView()->isHandleEvent(_nId); + aReturn.bEnabled = !getDesignView()->isHandleEvent(); if ( aReturn.bEnabled ) aReturn.bEnabled = getCurrentSectionView() != nullptr; break; @@ -552,7 +552,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const case SID_EXPAND_SECTION: case SID_NEXT_MARK: case SID_PREV_MARK: - aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent(_nId); + aReturn.bEnabled = isEditable() && !getDesignView()->isHandleEvent(); break; case SID_SELECT: case SID_SELECT_REPORT: @@ -562,7 +562,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = isConnected() && m_xReportDefinition.is(); break; case SID_DELETE: - aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId); + aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(); if ( aReturn.bEnabled ) { OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 28bf1db35f3f..580c228ccb56 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -521,7 +521,7 @@ void OReportSection::impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_I bool bChanged = false; OObjectBase& rBase = dynamic_cast(*pObject); - rBase.EndListening(false); + rBase.EndListening(); if ( aPos.X < i_nLeftMargin ) { aPos.X = i_nLeftMargin; @@ -537,7 +537,7 @@ void OReportSection::impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_I // add listener around rBase.StartListening(); xReportComponent->setSize(aSize); - rBase.EndListening(false); + rBase.EndListening(); } bChanged = true; } -- cgit