diff --git a/include/svl/stritem.hxx b/include/svl/stritem.hxx index 8e3f0614b145..8d6da4fdcc01 100644 --- a/include/svl/stritem.hxx +++ b/include/svl/stritem.hxx @@ -29,7 +29,7 @@ class SVL_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem public: TYPEINFO_OVERRIDE(); - SfxStringItem() {} + SfxStringItem(sal_uInt16 which = 0): CntUnencodedStringItem(which) {} SfxStringItem(sal_uInt16 which, const OUString & rValue): CntUnencodedStringItem(which, rValue) {} diff --git a/svx/inc/sxonitm.hxx b/svx/inc/sxonitm.hxx index 6c3916edc07d..820e398130a0 100644 --- a/svx/inc/sxonitm.hxx +++ b/svx/inc/sxonitm.hxx @@ -22,12 +22,9 @@ #include #include -class SdrObjectNameItem: public SfxStringItem { -public: - SdrObjectNameItem() : SfxStringItem() { SetWhich(SDRATTR_OBJECTNAME); } - SdrObjectNameItem(const OUString& rStr) : SfxStringItem(SDRATTR_OBJECTNAME,rStr) {} - SdrObjectNameItem(SvStream& rIn) : SfxStringItem(SDRATTR_OBJECTNAME,rIn) {} -}; +inline SfxStringItem makeSdrObjectNameItem(const OUString& rStr) { + return SfxStringItem(SDRATTR_OBJECTNAME,rStr); +} #endif diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 08da659fb542..cb790e5e2b00 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -207,7 +207,7 @@ SdrItemPool::SdrItemPool( mppLocalPoolDefaults[SDRATTR_OBJVISIBLE -SDRATTR_START]=new SdrObjVisibleItem; mppLocalPoolDefaults[SDRATTR_LAYERID -SDRATTR_START]=new SdrLayerIdItem; mppLocalPoolDefaults[SDRATTR_LAYERNAME -SDRATTR_START]=new SdrLayerNameItem; - mppLocalPoolDefaults[SDRATTR_OBJECTNAME -SDRATTR_START]=new SdrObjectNameItem; + mppLocalPoolDefaults[SDRATTR_OBJECTNAME -SDRATTR_START]=new SfxStringItem(SDRATTR_OBJECTNAME); mppLocalPoolDefaults[SDRATTR_ALLPOSITIONX -SDRATTR_START]=new SdrAllPositionXItem; mppLocalPoolDefaults[SDRATTR_ALLPOSITIONY -SDRATTR_START]=new SdrAllPositionYItem; mppLocalPoolDefaults[SDRATTR_ALLSIZEWIDTH -SDRATTR_START]=new SdrAllSizeWidthItem; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index c7a8b9610308..8f02887371df 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2245,7 +2245,7 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr) } if (rAttr.GetItemState(SDRATTR_OBJECTNAME,true,&pPoolItem)==SFX_ITEM_SET) { - OUString aName=((const SdrObjectNameItem*)pPoolItem)->GetValue(); + OUString aName=((const SfxStringItem*)pPoolItem)->GetValue(); SetName(aName); } Rectangle aNewLogic(rLogic); @@ -2303,7 +2303,7 @@ void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr, bool bMerge) const if (!aName.isEmpty()) { - lcl_SetItem(rAttr, bMerge, SdrObjectNameItem(aName)); + lcl_SetItem(rAttr, bMerge, makeSdrObjectNameItem(aName)); } lcl_SetItem(rAttr,bMerge,SdrLayerIdItem(GetLayer()));