From 9c0049cfae49c8e4ddef9125a69db2ad134c10c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 13:48:25 +0200 Subject: Merging upstream version 4:24.2.4. Signed-off-by: Daniel Baumann --- forms/source/richtext/parametrizedattributedispatcher.cxx | 14 +++++++------- forms/source/richtext/parametrizedattributedispatcher.hxx | 6 +++--- forms/source/richtext/specialdispatchers.cxx | 14 ++++++++++---- forms/source/richtext/specialdispatchers.hxx | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) (limited to 'forms') diff --git a/forms/source/richtext/parametrizedattributedispatcher.cxx b/forms/source/richtext/parametrizedattributedispatcher.cxx index d6666e2b02..bc226decd8 100644 --- a/forms/source/richtext/parametrizedattributedispatcher.cxx +++ b/forms/source/richtext/parametrizedattributedispatcher.cxx @@ -89,7 +89,7 @@ namespace frm } - const SfxPoolItem* OParametrizedAttributeDispatcher::convertDispatchArgsToItem( const Sequence< PropertyValue >& _rArguments ) + SfxPoolItemHolder OParametrizedAttributeDispatcher::convertDispatchArgsToItem( const Sequence< PropertyValue >& _rArguments ) { // get the real slot id. This may differ from our attribute id: for instance, both // SID_ATTR_CHAR_HEIGHT and SID_ATTR_CHAR_LATIN_HEIGHT are mapped to the same which id @@ -98,16 +98,16 @@ namespace frm SfxAllItemSet aParameterSet( getEditView()->GetEmptyItemSet() ); TransformParameters( nSlotId, _rArguments, aParameterSet ); - const SfxPoolItem* pArgument = nullptr; if ( aParameterSet.Count() ) { OSL_ENSURE( aParameterSet.Count() == 1, "OParametrizedAttributeDispatcher::convertDispatchArgsToItem: Arguments which form more than 1 item? How this?" ); WhichId nAttributeWhich = aParameterSet.GetPool()->GetWhich( nSlotId ); - pArgument = aParameterSet.GetItem( nAttributeWhich ); - OSL_ENSURE( pArgument, "OParametrizedAttributeDispatcher::convertDispatchArgsToItem: suspicious: there were arguments, but they're not for my slot!" ); + SfxPoolItemHolder aArgument(*aParameterSet.GetPool(), aParameterSet.GetItem(nAttributeWhich)); + OSL_ENSURE( aArgument.getItem(), "OParametrizedAttributeDispatcher::convertDispatchArgsToItem: suspicious: there were arguments, but they're not for my slot!" ); + return aArgument; } - return pArgument; + return SfxPoolItemHolder(); } @@ -117,8 +117,8 @@ namespace frm OSL_ENSURE( _rURL.Complete == getFeatureURL().Complete, "OParametrizedAttributeDispatcher::dispatch: invalid URL!" ); if ( m_pMasterDispatcher ) { - const SfxPoolItem* pConvertedArgument = convertDispatchArgsToItem( _rArguments ); - m_pMasterDispatcher->executeAttribute( m_nAttributeId, pConvertedArgument ); + const SfxPoolItemHolder aConvertedArgument(convertDispatchArgsToItem(_rArguments)); + m_pMasterDispatcher->executeAttribute(m_nAttributeId, aConvertedArgument.getItem()); } } diff --git a/forms/source/richtext/parametrizedattributedispatcher.hxx b/forms/source/richtext/parametrizedattributedispatcher.hxx index 6984473161..8a68486c13 100644 --- a/forms/source/richtext/parametrizedattributedispatcher.hxx +++ b/forms/source/richtext/parametrizedattributedispatcher.hxx @@ -21,7 +21,7 @@ #include "attributedispatcher.hxx" -class SfxPoolItem; +class SfxPoolItemHolder; namespace frm { @@ -47,10 +47,10 @@ namespace frm protected: // own overridables - /** convert the arguments as got in a XDispatch::dispatch call into an SfxPoolItem, which can + /** convert the arguments as got in a XDispatch::dispatch call into an SfxPoolItemHolder, which can be used with a IMultiAttributeDispatcher::executeAttribute */ - virtual const SfxPoolItem* convertDispatchArgsToItem( + virtual SfxPoolItemHolder convertDispatchArgsToItem( const css::uno::Sequence< css::beans::PropertyValue >& _rArguments ); }; diff --git a/forms/source/richtext/specialdispatchers.cxx b/forms/source/richtext/specialdispatchers.cxx index d75e06590f..ab01cd9eb6 100644 --- a/forms/source/richtext/specialdispatchers.cxx +++ b/forms/source/richtext/specialdispatchers.cxx @@ -23,6 +23,7 @@ #include #include #include +#include namespace frm @@ -140,7 +141,7 @@ namespace frm } - const SfxPoolItem* OAsianFontLayoutDispatcher::convertDispatchArgsToItem( const Sequence< PropertyValue >& _rArguments ) + SfxPoolItemHolder OAsianFontLayoutDispatcher::convertDispatchArgsToItem( const Sequence< PropertyValue >& _rArguments ) { // look for the "Enable" parameter const PropertyValue* pLookup = _rArguments.getConstArray(); @@ -155,13 +156,18 @@ namespace frm { bool bEnable = true; OSL_VERIFY( pLookup->Value >>= bEnable ); + if ( m_nAttributeId == sal_uInt16(SID_ATTR_PARA_SCRIPTSPACE) ) - return new SvxScriptSpaceItem( bEnable, static_cast(m_nAttributeId) ); - return new SfxBoolItem( static_cast(m_nAttributeId), bEnable ); + return SfxPoolItemHolder( + *getEditView()->GetEmptyItemSet().GetPool(), + new SvxScriptSpaceItem(bEnable, static_cast(m_nAttributeId))); + return SfxPoolItemHolder( + *getEditView()->GetEmptyItemSet().GetPool(), + new SfxBoolItem(static_cast(m_nAttributeId), bEnable)); } OSL_FAIL( "OAsianFontLayoutDispatcher::convertDispatchArgsToItem: did not find the one and only argument!" ); - return nullptr; + return SfxPoolItemHolder(); } diff --git a/forms/source/richtext/specialdispatchers.hxx b/forms/source/richtext/specialdispatchers.hxx index 9b4bfa1b79..cca2b75cca 100644 --- a/forms/source/richtext/specialdispatchers.hxx +++ b/forms/source/richtext/specialdispatchers.hxx @@ -80,7 +80,7 @@ namespace frm protected: // OParametrizedAttributeDispatcher - virtual const SfxPoolItem* convertDispatchArgsToItem( + virtual SfxPoolItemHolder convertDispatchArgsToItem( const css::uno::Sequence< css::beans::PropertyValue >& _rArguments ) override; }; -- cgit v1.2.3