diff options
Diffstat (limited to 'forms/source/richtext')
4 files changed, 21 insertions, 15 deletions
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 <editeng/editview.hxx> #include <editeng/scriptspaceitem.hxx> #include <osl/diagnose.h> +#include <svl/itemset.hxx> 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<WhichId>(m_nAttributeId) ); - return new SfxBoolItem( static_cast<WhichId>(m_nAttributeId), bEnable ); + return SfxPoolItemHolder( + *getEditView()->GetEmptyItemSet().GetPool(), + new SvxScriptSpaceItem(bEnable, static_cast<WhichId>(m_nAttributeId))); + return SfxPoolItemHolder( + *getEditView()->GetEmptyItemSet().GetPool(), + new SfxBoolItem(static_cast<WhichId>(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; }; |