From b722989678429fbdb353737660a19ecd1db28d89 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 25 Sep 2019 13:15:32 +0200 Subject: loplugin:unnecessaryvirtual Change-Id: I866d7bd03a41260a9b4f4be87a7a02d3ceecc1c7 Reviewed-on: https://gerrit.libreoffice.org/79534 Tested-by: Jenkins Reviewed-by: Noel Grandin --- compilerplugins/clang/unnecessaryvirtual.results | 54 ++++++++++++++++-------- vcl/inc/wizdlg.hxx | 34 ++++----------- vcl/source/control/wizardmachine.cxx | 49 ++++++--------------- 3 files changed, 58 insertions(+), 79 deletions(-) diff --git a/compilerplugins/clang/unnecessaryvirtual.results b/compilerplugins/clang/unnecessaryvirtual.results index cde0a75285f8..1ad299a7ca47 100644 --- a/compilerplugins/clang/unnecessaryvirtual.results +++ b/compilerplugins/clang/unnecessaryvirtual.results @@ -20,11 +20,7 @@ basic/source/comp/codegen.cxx:526 _Bool BufferTransformer::processParams() chart2/source/inc/WeakListenerAdapter.hxx:57 void chart::WeakListenerAdapter::disposing(const struct com::sun::star::lang::EventObject &,) -desktop/source/deployment/gui/dp_gui_extlistbox.hxx:200 - int dp_gui::ExtensionBox_Impl::getItemCount()const -desktop/source/deployment/gui/dp_gui_extlistbox.hxx:208 - int dp_gui::ExtensionBox_Impl::getSelIndex()const -extensions/source/dbpilots/unoautopilot.hxx:99 +extensions/source/dbpilots/unoautopilot.hxx:98 class cppu::IPropertyArrayHelper * dbp::OUnoAutoPilot::createArrayHelper()const extensions/source/propctrlr/commoncontrol.hxx:127 short pcr::CommonBehaviourControl::getControlType() @@ -88,8 +84,8 @@ include/svl/svdde.hxx:244 _Bool DdeTopic::StartAdviseLoop() include/svl/svdde.hxx:300 void DdeService::~DdeService() -include/svtools/simptabl.hxx:79 - void SvSimpleTable::HBarClick() +include/svx/svdmodel.hxx:590 + class ImageMap * SdrModel::GetImageMapForObject(class SdrObject *,) include/toolkit/controls/geometrycontrolmodel.hxx:184 void OGeometryControlModel::fillProperties(class com::sun::star::uno::Sequence &,class com::sun::star::uno::Sequence &,)const include/vbahelper/vbacollectionimpl.hxx:290 @@ -120,6 +116,8 @@ include/vcl/weld.hxx:97 void weld::Widget::set_visible(_Bool,) include/vcl/window.hxx:1155 class rtl::OString vcl::Window::GetScreenshotId()const +include/vcl/wizardmachine.hxx:208 + _Bool vcl::OWizardMachine::prepareLeaveCurrentState(enum vcl::WizardTypes::CommitPageReason,) sc/source/core/opencl/formulagroupcl.cxx:1051 _Bool sc::opencl::DynamicKernelSlidingArgument::NeedParallelReduction()const sc/source/core/opencl/formulagroupcl.cxx:1059 @@ -216,13 +214,13 @@ slideshow/source/engine/animationfactory.cxx:447 void slideshow::internal::(anonymous namespace)::GenericAnimation::start(const class std::shared_ptr &,const class std::shared_ptr &,) sw/inc/flypos.hxx:37 void SwPosFlyFrame::~SwPosFlyFrame() -sw/source/ui/dbui/mmaddressblockpage.hxx:235 +sw/source/ui/dbui/mmaddressblockpage.hxx:242 class weld::TreeView * SwCustomizeAddressBlockDialog::get_drag_source()const vcl/inc/salframe.hxx:145 void SalFrame::SetRepresentedURL(const class rtl::OUString &,) vcl/inc/salframe.hxx:191 void SalFrame::Flush(const class tools::Rectangle &,) -vcl/inc/salinst.hxx:93 +vcl/inc/salinst.hxx:92 _Bool SalInstance::SVMainHook(int *,) vcl/inc/salmenu.hxx:80 _Bool SalMenu::AddMenuBarButton(const struct SalMenuButtonItem &,) @@ -268,15 +266,37 @@ vcl/inc/unx/salframe.h:208 void X11SalFrame::updateGraphics(_Bool,) vcl/inc/unx/salinst.h:45 class SalX11Display * X11SalInstance::CreateDisplay()const +vcl/inc/wizdlg.hxx:117 + void vcl::RoadmapWizard::ActivatePage() +vcl/inc/wizdlg.hxx:118 + _Bool vcl::RoadmapWizard::DeactivatePage() +vcl/inc/wizdlg.hxx:158 + _Bool vcl::RoadmapWizard::canAdvance()const +vcl/inc/wizdlg.hxx:166 + void vcl::RoadmapWizard::updateTravelUI() +vcl/inc/wizdlg.hxx:185 + class VclPtr vcl::RoadmapWizard::createPage(short,) +vcl/inc/wizdlg.hxx:188 + void vcl::RoadmapWizard::enterState(short,) +vcl/inc/wizdlg.hxx:200 + _Bool vcl::RoadmapWizard::prepareLeaveCurrentState(enum vcl::WizardTypes::CommitPageReason,) +vcl/inc/wizdlg.hxx:214 + _Bool vcl::RoadmapWizard::leaveState(short,) +vcl/inc/wizdlg.hxx:224 + short vcl::RoadmapWizard::determineNextState(short,)const +vcl/inc/wizdlg.hxx:229 + _Bool vcl::RoadmapWizard::onFinish() +vcl/inc/wizdlg.hxx:306 + class vcl::IWizardPageController * vcl::RoadmapWizard::getPageController(class TabPage *,)const workdir/../vcl/inc/qt5/Qt5FilePicker.hxx:145 void Qt5FilePicker::disposing(const struct com::sun::star::lang::EventObject &,) -workdir/../vcl/inc/qt5/Qt5Frame.hxx:158 +workdir/../vcl/inc/qt5/Qt5Frame.hxx:160 void Qt5Frame::registerDragSource(class Qt5DragSource *,) -workdir/../vcl/inc/qt5/Qt5Frame.hxx:159 +workdir/../vcl/inc/qt5/Qt5Frame.hxx:161 void Qt5Frame::deregisterDragSource(const class Qt5DragSource *,) -workdir/../vcl/inc/qt5/Qt5Frame.hxx:160 +workdir/../vcl/inc/qt5/Qt5Frame.hxx:162 void Qt5Frame::registerDropTarget(class Qt5DropTarget *,) -workdir/../vcl/inc/qt5/Qt5Frame.hxx:161 +workdir/../vcl/inc/qt5/Qt5Frame.hxx:163 void Qt5Frame::deregisterDropTarget(const class Qt5DropTarget *,) writerfilter/source/ooxml/OOXMLFactory.hxx:72 void writerfilter::ooxml::OOXMLFactory_ns::startAction(class writerfilter::ooxml::OOXMLFastContextHandler *,) @@ -286,12 +306,12 @@ writerfilter/source/ooxml/OOXMLFactory.hxx:74 void writerfilter::ooxml::OOXMLFactory_ns::endAction(class writerfilter::ooxml::OOXMLFastContextHandler *,) writerfilter/source/ooxml/OOXMLFactory.hxx:75 void writerfilter::ooxml::OOXMLFactory_ns::attributeAction(class writerfilter::ooxml::OOXMLFastContextHandler *,int,const class tools::SvRef &,) -xmloff/source/forms/elementimport.hxx:575 +xmloff/source/forms/elementimport.hxx:574 class rtl::Reference xmloff::OContainerImport::CreateChildContext(unsigned short,const class rtl::OUString &,const class com::sun::star::uno::Reference &,) -xmloff/source/forms/elementimport.hxx:578 +xmloff/source/forms/elementimport.hxx:577 void xmloff::OContainerImport::EndElement() -xmloff/source/forms/elementimport.hxx:583 +xmloff/source/forms/elementimport.hxx:582 class com::sun::star::uno::Reference xmloff::OContainerImport::createElement() -xmloff/source/forms/elementimport.hxx:610 +xmloff/source/forms/elementimport.hxx:609 class com::sun::star::uno::Reference xmloff::OColumnImport::createElement() diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx index 7818160ff721..68cccb507d33 100644 --- a/vcl/inc/wizdlg.hxx +++ b/vcl/inc/wizdlg.hxx @@ -114,8 +114,7 @@ namespace vcl virtual void StateChanged( StateChangedType nStateChange ) override; virtual bool EventNotify( NotifyEvent& rNEvt ) override; - virtual void ActivatePage(); - virtual bool DeactivatePage(); + void ActivatePage(); virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override; @@ -155,7 +154,7 @@ namespace vcl void setTitleBase(const OUString& _rTitleBase); /// determines whether there is a next state to which we can advance - virtual bool canAdvance() const; + bool canAdvance() const; /** updates the user interface which deals with traveling in the wizard @@ -163,7 +162,7 @@ namespace vcl itself allow to advance to the next state (canAdvance), and enables the "Next" button if and only if this is the case. */ - virtual void updateTravelUI(); + void updateTravelUI(); void SetRoadmapHelpId( const OString& _rId ); @@ -182,10 +181,10 @@ namespace vcl protected: /// to override to create new pages - virtual VclPtr createPage(WizardTypes::WizardState nState); + VclPtr createPage(WizardTypes::WizardState nState); /// will be called when a new page is about to be displayed - virtual void enterState(WizardTypes::WizardState _nState); + void enterState(WizardTypes::WizardState _nState); /** will be called when the current state is about to be left for the given reason @@ -197,21 +196,7 @@ namespace vcl @return if and only if the page is allowed to be left */ - virtual bool prepareLeaveCurrentState( WizardTypes::CommitPageReason eReason ); - - /** will be called when the given state is left - - This is the very last possibility for derived classes to veto the deactivation - of a page. - - @todo Normally, we would not need the return value here - derived classes now have - the possibility to veto page deactivations in prepareLeaveCurrentState. However, - changing this return type is too incompatible at the moment ... - - @return - if and only if the page is allowed to be left - */ - virtual bool leaveState(WizardTypes::WizardState _nState); + bool prepareLeaveCurrentState( WizardTypes::CommitPageReason eReason ); /** determine the next state to travel from the given one @@ -221,12 +206,12 @@ namespace vcl @see activatePath */ - virtual WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const; + WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const; /** called when the finish button is pressed

By default, only the base class' Finish method (which is not virtual) is called

*/ - virtual bool onFinish(); + bool onFinish(); /// travel to the next state bool travelNext(); @@ -302,8 +287,7 @@ namespace vcl */ WizardTypes::WizardState getCurrentState() const { return GetCurLevel(); } - virtual IWizardPageController* - getPageController( TabPage* _pCurrentPage ) const; + static IWizardPageController* getPageController( TabPage* _pCurrentPage ); /** retrieves a copy of the state history, i.e. all states we already visited */ diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx index 91daa8ddfb19..fc394da25c77 100644 --- a/vcl/source/control/wizardmachine.cxx +++ b/vcl/source/control/wizardmachine.cxx @@ -588,12 +588,6 @@ namespace vcl enterState( nCurrentLevel ); } - bool RoadmapWizard::DeactivatePage() - { - WizardTypes::WizardState nCurrentState = getCurrentState(); - return leaveState(nCurrentState); - } - void RoadmapWizard::defaultButton(WizardButtonFlags _nWizardButtonFlags) { // the new default button @@ -629,32 +623,22 @@ namespace vcl bool RoadmapWizard::ShowPage( sal_uInt16 nLevel ) { - if ( DeactivatePage() ) - { - mnCurLevel = nLevel; - ActivatePage(); - ImplShowTabPage( ImplGetPage( mnCurLevel ) ); - return true; - } - else - return false; + mnCurLevel = nLevel; + ActivatePage(); + ImplShowTabPage( ImplGetPage( mnCurLevel ) ); + return true; } bool RoadmapWizard::Finish( long nResult ) { - if ( DeactivatePage() ) - { - if ( mpCurTabPage ) - mpCurTabPage->DeactivatePage(); + if ( mpCurTabPage ) + mpCurTabPage->DeactivatePage(); - if ( IsInExecute() ) - EndDialog( nResult ); - else if ( GetStyle() & WB_CLOSEABLE ) - Close(); - return true; - } - else - return false; + if ( IsInExecute() ) + EndDialog( nResult ); + else if ( GetStyle() & WB_CLOSEABLE ) + Close(); + return true; } void RoadmapWizard::AddPage( TabPage* pPage ) @@ -829,15 +813,6 @@ namespace vcl m_pCancel->Enable(_bEnable); } - bool RoadmapWizard::leaveState(WizardTypes::WizardState) - { - // no need to ask the page here. - // If we reach this point, we already gave the current page the chance to commit it's data, - // and it was allowed to commit it's data - - return true; - } - bool RoadmapWizard::onFinish() { return Finish( RET_OK ); @@ -1054,7 +1029,7 @@ namespace vcl travelNext(); } - IWizardPageController* RoadmapWizard::getPageController( TabPage* _pCurrentPage ) const + IWizardPageController* RoadmapWizard::getPageController( TabPage* _pCurrentPage ) { IWizardPageController* pController = dynamic_cast< IWizardPageController* >( _pCurrentPage ); return pController; -- cgit v1.2.3