include/svl/poolitem.hxx                      |    6 +++---
 sc/source/filter/excel/xlroot.cxx             |    4 ++--
 sc/source/ui/Accessibility/AccessibleText.cxx |    4 ++--
 sc/source/ui/pagedlg/tphfedit.cxx             |    4 ++--
 sc/source/ui/unoobj/textuno.cxx               |    4 ++--
 sc/source/ui/view/printfun.cxx                |    4 ++--
 svl/source/items/poolitem.cxx                 |    4 ++--
 sw/source/core/doc/tblafmt.cxx                |    8 ++++----
 sw/source/uibase/app/appopt.cxx               |    6 ++----
 9 files changed, 21 insertions(+), 23 deletions(-)

New commits:
commit d4dff7dc148080da437ed2e46cd08ded044e64a7
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Oct 25 12:21:25 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Oct 25 14:25:30 2018 +0200

    return std::unique_ptr from CloneSetWhich
    
    Change-Id: I709122cb8cd7c257e7eb2bd564c529689e6d555a
    Reviewed-on: https://gerrit.libreoffice.org/62350
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index 25a5a83a2d05..6964f776c63d 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -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; }
diff --git a/sc/source/filter/excel/xlroot.cxx 
b/sc/source/filter/excel/xlroot.cxx
index c114d859a54e..358e89b89333 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -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
    }
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx 
b/sc/source/ui/Accessibility/AccessibleText.cxx
index 33ee6abac74a..54b254dc3d03 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -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 );
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx 
b/sc/source/ui/pagedlg/tphfedit.cxx
index fbb75dfacfe7..d55e0d5fc359 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -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 ) );
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 6f138bd2024e..43e4a639e8ba 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -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 );
 
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 0d9e18bd2a00..f1a7d957a9f0 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -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
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 5fe5c480ff07..40e9ef895d42 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -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
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 3483b3fc5955..cacd3b268f71 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -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() );
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index 2da5febfa372..595e2e992d83 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to