return std::unique_ptr from CloneSetWhich
Change-Id: I709122cb8cd7c257e7eb2bd564c529689e6d555a Reviewed-on: https://gerrit.libreoffice.org/62350 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -173,10 +173,10 @@ public:
|
||||
virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
|
||||
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const = 0;
|
||||
// clone and call SetWhich
|
||||
SfxPoolItem* CloneSetWhich( sal_uInt16 nNewWhich ) const;
|
||||
template<class T> T* CloneSetWhich( TypedWhichId<T> nId ) const
|
||||
std::unique_ptr<SfxPoolItem> CloneSetWhich( sal_uInt16 nNewWhich ) const;
|
||||
template<class T> std::unique_ptr<T> CloneSetWhich( TypedWhichId<T> nId ) const
|
||||
{
|
||||
return static_cast<T*>(CloneSetWhich(sal_uInt16(nId)));
|
||||
return std::unique_ptr<T>(static_cast<T*>(CloneSetWhich(sal_uInt16(nId)).release()));
|
||||
}
|
||||
|
||||
sal_uInt32 GetRefCount() const { return m_nRefCount; }
|
||||
|
||||
@@ -392,9 +392,9 @@ ScHeaderEditEngine& XclRoot::GetHFEditEngine() const
|
||||
// FillToEditItemSet() adjusts font height to 1/100th mm, we need twips
|
||||
std::unique_ptr<SfxPoolItem> pNewItem( aItemSet.Get( ATTR_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT));
|
||||
pEditSet->Put( *pNewItem );
|
||||
pNewItem.reset( aItemSet.Get( ATTR_CJK_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK));
|
||||
pNewItem = aItemSet.Get( ATTR_CJK_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK);
|
||||
pEditSet->Put( *pNewItem );
|
||||
pNewItem.reset( aItemSet.Get( ATTR_CTL_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL));
|
||||
pNewItem = aItemSet.Get( ATTR_CTL_FONT_HEIGHT ).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL);
|
||||
pEditSet->Put( *pNewItem );
|
||||
rEE.SetDefaults( pEditSet ); // takes ownership
|
||||
}
|
||||
|
||||
@@ -1139,9 +1139,9 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder()
|
||||
// but for header/footer twips is needed, as in the PatternAttr:
|
||||
std::unique_ptr<SfxPoolItem> pNewItem(rPattern.GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT));
|
||||
aDefaults.Put( *pNewItem );
|
||||
pNewItem.reset(rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK));
|
||||
pNewItem = rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK);
|
||||
aDefaults.Put( *pNewItem );
|
||||
pNewItem.reset(rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL));
|
||||
pNewItem = rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL);
|
||||
aDefaults.Put( *pNewItem );
|
||||
aDefaults.Put( SvxAdjustItem( meAdjust, EE_PARA_JUST ) );
|
||||
pHdrEngine->SetDefaults( aDefaults );
|
||||
|
||||
@@ -163,9 +163,9 @@ void ScEditWindow::SetFont( const ScPatternAttr& rPattern )
|
||||
// but for header/footer twips is needed, as in the PatternAttr:
|
||||
std::unique_ptr<SfxPoolItem> pNewItem(rPattern.GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT));
|
||||
pSet->Put( *pNewItem );
|
||||
pNewItem.reset(rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK));
|
||||
pNewItem = rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK);
|
||||
pSet->Put( *pNewItem );
|
||||
pNewItem.reset(rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL));
|
||||
pNewItem = rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL);
|
||||
pSet->Put( *pNewItem );
|
||||
if (mbRTL)
|
||||
pSet->Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
|
||||
|
||||
@@ -221,9 +221,9 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder()
|
||||
// but for header/footer twips is needed, as in the PatternAttr:
|
||||
std::unique_ptr<SfxPoolItem> pNewItem( rPattern.GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT) );
|
||||
aDefaults.Put( *pNewItem );
|
||||
pNewItem.reset( rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK) );
|
||||
pNewItem = rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK);
|
||||
aDefaults.Put( *pNewItem );
|
||||
pNewItem.reset( rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL) );
|
||||
pNewItem = rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL);
|
||||
aDefaults.Put( *pNewItem );
|
||||
pHdrEngine->SetDefaults( aDefaults );
|
||||
|
||||
|
||||
@@ -1726,9 +1726,9 @@ void ScPrintFunc::MakeEditEngine()
|
||||
// but for header/footer twips is needed, as in the PatternAttr:
|
||||
std::unique_ptr<SfxPoolItem> pNewItem(rPattern.GetItem(ATTR_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT));
|
||||
pEditDefaults->Put( *pNewItem );
|
||||
pNewItem.reset(rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK));
|
||||
pNewItem = rPattern.GetItem(ATTR_CJK_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CJK);
|
||||
pEditDefaults->Put( *pNewItem );
|
||||
pNewItem.reset(rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL));
|
||||
pNewItem = rPattern.GetItem(ATTR_CTL_FONT_HEIGHT).CloneSetWhich(EE_CHAR_FONTHEIGHT_CTL);
|
||||
pEditDefaults->Put( *pNewItem );
|
||||
// don't use font color, because background color is not used
|
||||
//! there's no way to set the background for note pages
|
||||
|
||||
@@ -127,11 +127,11 @@ void SfxPoolItem::dumpAsXml(xmlTextWriterPtr pWriter) const
|
||||
xmlTextWriterEndElement(pWriter);
|
||||
}
|
||||
|
||||
SfxPoolItem* SfxPoolItem::CloneSetWhich( sal_uInt16 nNewWhich ) const
|
||||
std::unique_ptr<SfxPoolItem> SfxPoolItem::CloneSetWhich( sal_uInt16 nNewWhich ) const
|
||||
{
|
||||
SfxPoolItem* pItem = Clone();
|
||||
pItem->SetWhich(nNewWhich);
|
||||
return pItem;
|
||||
return std::unique_ptr<SfxPoolItem>(pItem);
|
||||
}
|
||||
|
||||
bool SfxPoolItem::IsVoidItem() const
|
||||
|
||||
@@ -817,9 +817,9 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
|
||||
{
|
||||
std::unique_ptr<SfxPoolItem> pNewItem(rChg.GetHeight().CloneSetWhich(RES_CHRATR_CJK_FONTSIZE));
|
||||
rSet.Put( *pNewItem);
|
||||
pNewItem.reset(rChg.GetWeight().CloneSetWhich(RES_CHRATR_CJK_WEIGHT));
|
||||
pNewItem = rChg.GetWeight().CloneSetWhich(RES_CHRATR_CJK_WEIGHT);
|
||||
rSet.Put( *pNewItem);
|
||||
pNewItem.reset(rChg.GetPosture().CloneSetWhich(RES_CHRATR_CJK_POSTURE));
|
||||
pNewItem = rChg.GetPosture().CloneSetWhich(RES_CHRATR_CJK_POSTURE);
|
||||
rSet.Put( *pNewItem);
|
||||
}
|
||||
// do not insert empty CTL font
|
||||
@@ -835,9 +835,9 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
|
||||
{
|
||||
std::unique_ptr<SfxPoolItem> pNewItem(rChg.GetHeight().CloneSetWhich(RES_CHRATR_CTL_FONTSIZE));
|
||||
rSet.Put( *pNewItem);
|
||||
pNewItem.reset(rChg.GetWeight().CloneSetWhich(RES_CHRATR_CTL_WEIGHT));
|
||||
pNewItem = rChg.GetWeight().CloneSetWhich(RES_CHRATR_CTL_WEIGHT);
|
||||
rSet.Put( *pNewItem);
|
||||
pNewItem.reset(rChg.GetPosture().CloneSetWhich(RES_CHRATR_CTL_POSTURE));
|
||||
pNewItem = rChg.GetPosture().CloneSetWhich(RES_CHRATR_CTL_POSTURE);
|
||||
rSet.Put( *pNewItem);
|
||||
}
|
||||
rSet.Put( rChg.GetUnderline() );
|
||||
|
||||
@@ -138,12 +138,10 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
|
||||
rWrtShell.GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE) );
|
||||
pRet->Put(*pNewItem);
|
||||
|
||||
pNewItem.reset(
|
||||
rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE));
|
||||
pNewItem = rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE);
|
||||
pRet->Put(*pNewItem);
|
||||
|
||||
pNewItem.reset(
|
||||
rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE));
|
||||
pNewItem = rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE);
|
||||
pRet->Put(*pNewItem);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user