include/sfx2/bindings.hxx | 6 +++--- sfx2/source/appl/childwin.cxx | 1 + sfx2/source/control/bindings.cxx | 28 ++++++---------------------- sfx2/source/view/viewsh.cxx | 2 +- svx/source/form/tabwin.cxx | 1 + 5 files changed, 12 insertions(+), 26 deletions(-)
New commits: commit c9c2d46acf651bfc4327f8a08caa467b3140e4f7 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Jan 31 14:23:13 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Jan 31 11:56:48 2025 +0100 Simplify SfxBindings::ExecuteSynchron ... by making SfxBindings::Execute return SfxPoolItemHolder. Change-Id: Idd62a5eae791a6a4fec283c0c80fdac19c3526d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180982 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx index 9a0f5ab183b7..4266cbea8fa4 100644 --- a/include/sfx2/bindings.hxx +++ b/include/sfx2/bindings.hxx @@ -158,7 +158,7 @@ public: SfxPoolItemHolder ExecuteSynchron( sal_uInt16 nSlot, const SfxPoolItem **pArgs = nullptr); - bool Execute( sal_uInt16 nSlot, + SfxPoolItemHolder Execute( sal_uInt16 nSlot, const SfxPoolItem **pArgs = nullptr, SfxCallMode nCall = SfxCallMode::SLOT); diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 24b114a706b3..82dc3f3a66fc 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -26,6 +26,7 @@ #include <comphelper/string.hxx> #include <cppuhelper/implbase.hxx> #include <sal/log.hxx> +#include <svl/itemset.hxx> #include <tools/debug.hxx> #include <vcl/svapp.hxx> diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 54fd85142b21..89da50718b37 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -864,19 +864,15 @@ void SfxBindings::Release( SfxControllerItem& rItem ) SfxPoolItemHolder SfxBindings::ExecuteSynchron( sal_uInt16 nId, const SfxPoolItem** ppItems ) { - if( !nId || !pDispatcher ) - return SfxPoolItemHolder(); - - return Execute_Impl(nId, ppItems, SfxCallMode::SYNCHRON); + return Execute(nId, ppItems, SfxCallMode::SYNCHRON); } -bool SfxBindings::Execute( sal_uInt16 nId, const SfxPoolItem** ppItems, SfxCallMode nCallMode ) +SfxPoolItemHolder SfxBindings::Execute( sal_uInt16 nId, const SfxPoolItem** ppItems, SfxCallMode nCallMode ) { if( !nId || !pDispatcher ) - return false; + return SfxPoolItemHolder(); - const SfxPoolItemHolder aRet(Execute_Impl(nId, ppItems, nCallMode)); - return aRet.is(); + return Execute_Impl(nId, ppItems, nCallMode); } SfxPoolItemHolder SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem** ppItems, SfxCallMode nCallMode ) diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 10dcb366eefc..8a276a5927ac 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -3942,7 +3942,7 @@ bool SfxViewShell::HasMouseClickListeners_Impl() const bool SfxViewShell::Escape() { - return GetViewFrame().GetBindings().Execute(SID_TERMINATE_INPLACEACTIVATION); + return GetViewFrame().GetBindings().Execute(SID_TERMINATE_INPLACEACTIVATION).is(); } Reference< view::XRenderable > SfxViewShell::GetRenderable() diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx index 62163accfd8b..bd48a784173c 100644 --- a/svx/source/form/tabwin.cxx +++ b/svx/source/form/tabwin.cxx @@ -21,6 +21,7 @@ #include <tabwin.hxx> #include <fmservs.hxx> +#include <svl/itemset.hxx> #include <svx/strings.hrc> #include <svx/svxids.hrc> #include <com/sun/star/sdb/CommandType.hpp> commit e6d50480a15f7b673a17eafa3db542f8ace7e731 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Jan 31 14:13:11 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Jan 31 11:56:38 2025 +0100 Drop unused arguments from Execute_Impl Unused since commit db93b92d78714ed193b3cbe52b18e3cfd9da99b8 (loplugin:constantparam in sfx2, 2016-03-17) and commit 20c14c812ccc00692d42d294d3b8dea1774e3511 (loplugin:constantparam in sfx2, 2016-09-09). Change-Id: Iebe4bdda87bb6f8472389a676cd394039588249a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180981 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx index 2fac9d1048ef..9a0f5ab183b7 100644 --- a/include/sfx2/bindings.hxx +++ b/include/sfx2/bindings.hxx @@ -100,8 +100,8 @@ friend class SfxBindings_Impl; sal_uInt16 nRegLevel; // Lock-Level while Reconfig private: - SAL_DLLPRIVATE SfxPoolItemHolder Execute_Impl( sal_uInt16 nSlot, const SfxPoolItem **pArgs, sal_uInt16 nModi, - SfxCallMode nCall, const SfxPoolItem **pInternalArgs); + SAL_DLLPRIVATE SfxPoolItemHolder Execute_Impl(sal_uInt16 nSlot, const SfxPoolItem** pArgs, + SfxCallMode nCall); SAL_DLLPRIVATE void SetSubBindings_Impl( SfxBindings* ); SAL_DLLPRIVATE void UpdateSlotServer_Impl(); // Update SlotServer SAL_DLLPRIVATE std::optional<SfxItemSet> CreateSet_Impl(SfxStateCache& rCache, const SfxSlot* &pRealSlot, diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 718df9bd9887..54fd85142b21 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -867,7 +867,7 @@ SfxPoolItemHolder SfxBindings::ExecuteSynchron( sal_uInt16 nId, const SfxPoolIte if( !nId || !pDispatcher ) return SfxPoolItemHolder(); - return Execute_Impl( nId, ppItems, 0, SfxCallMode::SYNCHRON, nullptr ); + return Execute_Impl(nId, ppItems, SfxCallMode::SYNCHRON); } bool SfxBindings::Execute( sal_uInt16 nId, const SfxPoolItem** ppItems, SfxCallMode nCallMode ) @@ -875,12 +875,11 @@ bool SfxBindings::Execute( sal_uInt16 nId, const SfxPoolItem** ppItems, SfxCallM if( !nId || !pDispatcher ) return false; - const SfxPoolItemHolder aRet(Execute_Impl(nId, ppItems, 0, nCallMode, nullptr)); + const SfxPoolItemHolder aRet(Execute_Impl(nId, ppItems, nCallMode)); return aRet.is(); } -SfxPoolItemHolder SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem** ppItems, sal_uInt16 nModi, SfxCallMode nCallMode, - const SfxPoolItem **ppInternalArgs ) +SfxPoolItemHolder SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem** ppItems, SfxCallMode nCallMode ) { SfxStateCache *pCache = GetStateCache( nId ); if ( !pCache ) @@ -889,7 +888,7 @@ SfxPoolItemHolder SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem** while ( pBind ) { if ( pBind->GetStateCache( nId ) ) - return pBind->Execute_Impl( nId, ppItems, nModi, nCallMode, ppInternalArgs ); + return pBind->Execute_Impl(nId, ppItems, nCallMode); pBind = pBind->pImpl->pSubBindings; } } @@ -910,11 +909,8 @@ SfxPoolItemHolder SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem** pCache->GetSlotServer( rDispatcher, pImpl->xProv ); // make pCache->GetDispatch() up to date if ( pCache->GetDispatch().is() ) { - DBG_ASSERT( !ppInternalArgs, "Internal args get lost when dispatched!" ); - SfxItemPool &rPool = GetDispatcher()->GetFrame()->GetObjectShell()->GetPool(); SfxRequest aReq( nId, nCallMode, rPool ); - aReq.SetModifier( nModi ); if( ppItems ) while( *ppItems ) aReq.AppendItem( **ppItems++ ); @@ -953,17 +949,9 @@ SfxPoolItemHolder SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem** SfxItemPool &rPool = pShell->GetPool(); SfxRequest aReq( nId, nCallMode, rPool ); - aReq.SetModifier( nModi ); if( ppItems ) while( *ppItems ) aReq.AppendItem( **ppItems++ ); - if ( ppInternalArgs ) - { - SfxAllItemSet aSet( rPool ); - for ( const SfxPoolItem **pArg = ppInternalArgs; *pArg; ++pArg ) - aSet.Put( **pArg ); - aReq.SetInternalArgs_Impl( aSet ); - } Execute_Impl( aReq, pSlot, pShell );