From e9b5b299a5efa03aaa752e30afe960ef25305d62 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 13 Aug 2023 12:06:16 +0200 Subject: [PATCH] Revert "clang-tidy bugprone-parent-virtual-call in sfx2" This reverts commit 0f3b36bd2749f360df84d1594c01e619ba0f4930. There are some odd things gone in with some of these changes that I do understand. Reverting until I have worked it out. Change-Id: Ifa383ee7ed2db4f81e2b0ac593e652288a07514f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155596 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/sfx2/sfxbasemodel.hxx | 21 ++++++++++++++++++++ include/sfx2/stbitem.hxx | 3 +++ sfx2/inc/templatedefaultview.hxx | 2 ++ sfx2/source/control/templatedefaultview.cxx | 5 +++++ sfx2/source/control/templatedlglocalview.cxx | 2 +- sfx2/source/doc/SfxDocumentMetaData.cxx | 2 +- sfx2/source/doc/docundomanager.cxx | 4 ++-- sfx2/source/doc/templatedlg.cxx | 2 +- sfx2/source/doc/zoomitem.cxx | 2 +- sfx2/source/sidebar/SidebarToolBox.cxx | 2 +- sfx2/source/statbar/stbitem.cxx | 12 +++++++++++ 11 files changed, 50 insertions(+), 7 deletions(-) diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx index b134b8ac7ea7..2602387fad59 100644 --- a/include/sfx2/sfxbasemodel.hxx +++ b/include/sfx2/sfxbasemodel.hxx @@ -184,6 +184,27 @@ public: virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override ; + /**___________________________________________________________________________________________________ + @short increment refcount + @seealso XInterface + @seealso release() + @onerror A RuntimeException is thrown. + */ + + virtual void SAL_CALL acquire() noexcept override + { OWeakObject::acquire(); } + + /**___________________________________________________________________________________________________ + @short decrement refcount + @seealso XInterface + @seealso acquire() + @onerror A RuntimeException is thrown. + */ + + virtual void SAL_CALL release() noexcept override + { OWeakObject::release(); } + + // XTypeProvider diff --git a/include/sfx2/stbitem.hxx b/include/sfx2/stbitem.hxx index 7325ca0959d8..67c88c68710d 100644 --- a/include/sfx2/stbitem.hxx +++ b/include/sfx2/stbitem.hxx @@ -63,6 +63,9 @@ class SFX2_DLLPUBLIC SfxStatusBarControl: public svt::StatusbarController public: // new controller API + // XInterface + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; protected: // XEventListener diff --git a/sfx2/inc/templatedefaultview.hxx b/sfx2/inc/templatedefaultview.hxx index 07cd3d126639..1771ad3d8759 100644 --- a/sfx2/inc/templatedefaultview.hxx +++ b/sfx2/inc/templatedefaultview.hxx @@ -19,6 +19,8 @@ public: virtual void showAllTemplates() override; + virtual bool KeyInput(const KeyEvent& rKEvt) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; void createContextMenu(); diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx index b7e7c0edc4a6..17ad2ba7cbda 100644 --- a/sfx2/source/control/templatedefaultview.cxx +++ b/sfx2/source/control/templatedefaultview.cxx @@ -47,6 +47,11 @@ void TemplateDefaultView::showAllTemplates() insertItems(maAllTemplates, false); } +bool TemplateDefaultView::KeyInput( const KeyEvent& rKEvt ) +{ + return ThumbnailView::KeyInput(rKEvt); +} + bool TemplateDefaultView::MouseButtonDown( const MouseEvent& rMEvt ) { if( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) diff --git a/sfx2/source/control/templatedlglocalview.cxx b/sfx2/source/control/templatedlglocalview.cxx index a4cac457cd0e..52a12b4ef965 100644 --- a/sfx2/source/control/templatedlglocalview.cxx +++ b/sfx2/source/control/templatedlglocalview.cxx @@ -401,7 +401,7 @@ bool TemplateDlgLocalView::KeyInput(const KeyEvent& rKEvt) reload(); } - return TemplateLocalView::KeyInput(rKEvt); + return ThumbnailView::KeyInput(rKEvt); } IMPL_LINK(TemplateDlgLocalView, KeyPressHdl, const KeyEvent&, rKEvt, bool) diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 56c47315ab54..7d1f16c01fd9 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1345,7 +1345,7 @@ void SAL_CALL SfxDocumentMetaData::dispose() if (!m_isInitialized) { return; } - PartialWeakComponentImplHelper::dispose(); // superclass + WeakComponentImplHelperBase::dispose(); // superclass m_NotifyListeners.disposeAndClear(css::lang::EventObject( getXWeak())); m_isInitialized = false; diff --git a/sfx2/source/doc/docundomanager.cxx b/sfx2/source/doc/docundomanager.cxx index 2370397e267c..94f416c2d786 100644 --- a/sfx2/source/doc/docundomanager.cxx +++ b/sfx2/source/doc/docundomanager.cxx @@ -224,7 +224,7 @@ namespace sfx2 void SAL_CALL DocumentUndoManager::acquire() noexcept { - WeakImplHelper::acquire(); + OWeakObject::acquire(); SfxModelSubComponent::acquireModel(); } @@ -232,7 +232,7 @@ namespace sfx2 void SAL_CALL DocumentUndoManager::release() noexcept { SfxModelSubComponent::releaseModel(); - WeakImplHelper::release(); + OWeakObject::release(); } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 2e2c0e2d7ade..dec37dd0c406 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -1367,7 +1367,7 @@ short SfxTemplateSelectionDlg::run() maIdle.Start(); setTemplateViewMode(TemplateViewMode::eThumbnailView); - return SfxTemplateManagerDlg::run(); + return weld::GenericDialogController::run(); } IMPL_LINK_NOARG(SfxTemplateSelectionDlg, TimeOut, Timer*, void) diff --git a/sfx2/source/doc/zoomitem.cxx b/sfx2/source/doc/zoomitem.cxx index e049180c937d..a1c407aa6d72 100644 --- a/sfx2/source/doc/zoomitem.cxx +++ b/sfx2/source/doc/zoomitem.cxx @@ -54,7 +54,7 @@ SvxZoomItem* SvxZoomItem::Clone( SfxItemPool * /*pPool*/ ) const bool SvxZoomItem::operator==( const SfxPoolItem& rAttr ) const { - assert(SfxPoolItem::operator==(rAttr)); // NOLINT(bugprone-parent-virtual-call) + assert(SfxPoolItem::operator==(rAttr)); const SvxZoomItem& rItem = static_cast(rAttr); diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index a941593a2c47..349e5bef1497 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -147,7 +147,7 @@ bool SidebarToolBox::EventNotify (NotifyEvent& rEvent) // Special handling for transferring handling of KEY_TAB // that becomes necessary because of our parent that is // not the dialog but a background control. - return DockingWindow::EventNotify(rEvent); // NOLINT(bugprone-parent-virtual-call) + return DockingWindow::EventNotify(rEvent); } } return ToolBox::EventNotify(rEvent); diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 5de5b69a59b4..e9d8512fa832 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -156,6 +156,18 @@ SfxStatusBarControl::~SfxStatusBarControl() {} +// XInterface +void SAL_CALL SfxStatusBarControl::acquire() noexcept +{ + OWeakObject::acquire(); +} + +void SAL_CALL SfxStatusBarControl::release() noexcept +{ + OWeakObject::release(); +} + + // XStatusListener void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent& rEvent ) {