Bug 34465 - get rid of all calls to virtual const SfxPoolItem* Put( const SfxPoolItem&, USHORT nWhich)

Maciej Rumianowski maciej.rumianowski at gmail.com
Wed Nov 7 07:41:04 PST 2012


Hi Björn,

I've started to work on the *Bug
34465*<https://bugs.freedesktop.org/show_bug.cgi?id=34465>and I have
some questions:

1) What do you suggest to find all places where Put( const SfxPoolItem&,
USHORT nWhich) is used?
    I came up with idea to make function private and fix all places where
g++ gives error. Do you have better idea?

2) Is it a good idea to make a special clone method in SfxPoolItem, such as

virtual SfxPoolItem*     CloneAtWhich( sal_uInt16 nNewWhich, SfxItemPool
> *pPool = 0 ) const
>                              { SfxPoolItem *pItem = Clone( pPool );
> pItem->SetWhich( nNewWhich );
>                                  return pItem; }
>
Which is used for example in:

diff --git a/sc/source/core/tool/autoform.cxx
> b/sc/source/core/tool/autoform.cxx
> index 14be99e..1dd481c 100644
> --- a/sc/source/core/tool/autoform.cxx
> +++ b/sc/source/core/tool/autoform.cxx
> @@ -672,9 +672,9 @@ void ScAutoFormatData::FillToItemSet( sal_uInt16
> nIndex, SfxItemSet& rItemSet, S
>          }
>          else
>          {
> -            rItemSet.Put( rField.GetHeight(), ATTR_CJK_FONT_HEIGHT );
> -            rItemSet.Put( rField.GetWeight(), ATTR_CJK_FONT_WEIGHT );
> -            rItemSet.Put( rField.GetPosture(), ATTR_CJK_FONT_POSTURE );
> +            rItemSet.Put( *(rField.GetHeight().CloneAtWhich(
> ATTR_CJK_FONT_HEIGHT )) );
> +            rItemSet.Put( *(rField.GetWeight().CloneAtWhich(
> ATTR_CJK_FONT_WEIGHT )) );
> +            rItemSet.Put( *(rField.GetPosture().CloneAtWhich(
> ATTR_CJK_FONT_POSTURE )) );
>          }
>          // do not insert empty CTL font
>          const SvxFontItem& rCTLFont = rField.GetCTLFont();
>

>

Best Regards,
   Maciek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20121107/2588a0a6/attachment.html>


More information about the LibreOffice mailing list