[Libreoffice-commits] core.git: cui/source editeng/source sfx2/source sw/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Sun Nov 12 13:47:34 UTC 2017


 cui/source/options/connpoolsettings.cxx   |    2 +-
 cui/source/options/dbregistersettings.cxx |    2 +-
 editeng/source/items/paraitem.cxx         |   10 +++++-----
 editeng/source/items/textitem.cxx         |   18 ++++++------------
 sfx2/source/doc/objitem.cxx               |    4 ++--
 sfx2/source/view/frame.cxx                |    4 ++--
 sfx2/source/view/viewfrm.cxx              |    2 +-
 sw/source/core/graphic/grfatr.cxx         |    2 +-
 sw/source/core/layout/atrfrm.cxx          |   20 ++++++++------------
 9 files changed, 27 insertions(+), 37 deletions(-)

New commits:
commit d73225119476de1826f648acca9e93bf6797e813
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sun Nov 12 11:55:28 2017 +0100

    use copy constructor to clone PoolItems
    
    Change-Id: I2a45a62fd56cc5a768406c7a6e4c72456f962367
    Reviewed-on: https://gerrit.libreoffice.org/44648
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/options/connpoolsettings.cxx b/cui/source/options/connpoolsettings.cxx
index 6bc676cfbe39..8dd0e483f673 100644
--- a/cui/source/options/connpoolsettings.cxx
+++ b/cui/source/options/connpoolsettings.cxx
@@ -77,7 +77,7 @@ namespace offapp
 
     SfxPoolItem* DriverPoolingSettingsItem::Clone( SfxItemPool * ) const
     {
-        return new DriverPoolingSettingsItem(Which(), m_aSettings);
+        return new DriverPoolingSettingsItem(*this);
     }
 
 
diff --git a/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx
index cd612bd78635..dc67c27f1ec3 100644
--- a/cui/source/options/dbregistersettings.cxx
+++ b/cui/source/options/dbregistersettings.cxx
@@ -48,7 +48,7 @@ namespace svx
 
     SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool* ) const
     {
-        return new DatabaseMapItem( Which(), m_aRegistrations );
+        return new DatabaseMapItem( *this );
     }
 
 
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 52a8287cfecd..09b7e34106e8 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -1097,7 +1097,7 @@ SvxScriptSpaceItem::SvxScriptSpaceItem( bool bOn, const sal_uInt16 nId )
 
 SfxPoolItem* SvxScriptSpaceItem::Clone( SfxItemPool * ) const
 {
-    return new SvxScriptSpaceItem( GetValue(), Which() );
+    return new SvxScriptSpaceItem( *this );
 }
 
 sal_uInt16  SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer ) const
@@ -1130,7 +1130,7 @@ SvxHangingPunctuationItem::SvxHangingPunctuationItem(
 
 SfxPoolItem* SvxHangingPunctuationItem::Clone( SfxItemPool * ) const
 {
-    return new SvxHangingPunctuationItem( GetValue(), Which() );
+    return new SvxHangingPunctuationItem( *this );
 }
 
 sal_uInt16 SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer ) const
@@ -1163,7 +1163,7 @@ SvxForbiddenRuleItem::SvxForbiddenRuleItem(
 
 SfxPoolItem* SvxForbiddenRuleItem::Clone( SfxItemPool * ) const
 {
-    return new SvxForbiddenRuleItem( GetValue(), Which() );
+    return new SvxForbiddenRuleItem( *this );
 }
 
 sal_uInt16 SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer ) const
@@ -1199,7 +1199,7 @@ SvxParaVertAlignItem::SvxParaVertAlignItem( Align nValue,
 
 SfxPoolItem* SvxParaVertAlignItem::Clone( SfxItemPool* ) const
 {
-    return new SvxParaVertAlignItem( GetValue(), Which() );
+    return new SvxParaVertAlignItem( *this );
 }
 
 sal_uInt16 SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer ) const
@@ -1259,7 +1259,7 @@ SvxParaGridItem::SvxParaGridItem( bool bOn, const sal_uInt16 nId )
 
 SfxPoolItem* SvxParaGridItem::Clone( SfxItemPool * ) const
 {
-    return new SvxParaGridItem( GetValue(), Which() );
+    return new SvxParaGridItem( *this );
 }
 
 sal_uInt16  SvxParaGridItem::GetVersion( sal_uInt16 nFFVer ) const
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 8623ef42b061..54d065f48c8c 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1116,9 +1116,7 @@ void SvxTextLineItem::SetBoolValue( bool bVal )
 
 SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) const
 {
-    SvxTextLineItem* pNew = new SvxTextLineItem( *this );
-    pNew->SetColor( GetColor() );
-    return pNew;
+    return new SvxTextLineItem( *this );
 }
 
 
@@ -1244,9 +1242,7 @@ SvxUnderlineItem::SvxUnderlineItem( const FontLineStyle eSt, const sal_uInt16 nI
 
 SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const
 {
-    SvxUnderlineItem* pNew = new SvxUnderlineItem( *this );
-    pNew->SetColor( GetColor() );
-    return pNew;
+    return new SvxUnderlineItem( *this );
 }
 
 
@@ -1297,9 +1293,7 @@ SvxOverlineItem::SvxOverlineItem( const FontLineStyle eSt, const sal_uInt16 nId
 
 SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const
 {
-    SvxOverlineItem* pNew = new SvxOverlineItem( *this );
-    pNew->SetColor( GetColor() );
-    return pNew;
+    return new SvxOverlineItem( *this );
 }
 
 
@@ -2590,7 +2584,7 @@ SvxTextRotateItem::SvxTextRotateItem(sal_uInt16 nValue, const sal_uInt16 nW)
 
 SfxPoolItem* SvxTextRotateItem::Clone(SfxItemPool*) const
 {
-    return new SvxTextRotateItem(GetValue(), Which());
+    return new SvxTextRotateItem(*this);
 }
 
 sal_uInt16 SvxTextRotateItem::GetVersion(sal_uInt16 nFFVer) const
@@ -2680,7 +2674,7 @@ SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue,
 
 SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const
 {
-    return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() );
+    return new SvxCharRotateItem( *this );
 }
 
 sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const
@@ -2774,7 +2768,7 @@ SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue,
 
 SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const
 {
-    return new SvxCharScaleWidthItem( GetValue(), Which() );
+    return new SvxCharScaleWidthItem( *this );
 }
 
 
diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx
index 88760eac5e0d..65fb4a6472dc 100644
--- a/sfx2/source/doc/objitem.cxx
+++ b/sfx2/source/doc/objitem.cxx
@@ -36,7 +36,7 @@ bool SfxObjectShellItem::operator==( const SfxPoolItem &rItem ) const
 
 SfxPoolItem* SfxObjectShellItem::Clone( SfxItemPool *) const
 {
-    return new SfxObjectShellItem( Which(), pObjSh );
+    return new SfxObjectShellItem( *this );
 }
 
 bool SfxObjectShellItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
@@ -97,7 +97,7 @@ bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const
 
 SfxPoolItem* SfxObjectItem::Clone( SfxItemPool *) const
 {
-    return new SfxObjectItem( Which(), _pSh );
+    return new SfxObjectItem( *this );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 481011ba7d3b..8d940ba05bac 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -473,7 +473,7 @@ bool SfxUsrAnyItem::operator==( const SfxPoolItem& /*rItem*/ ) const
 
 SfxPoolItem* SfxUsrAnyItem::Clone( SfxItemPool *) const
 {
-    return new SfxUsrAnyItem( Which(), aValue );
+    return new SfxUsrAnyItem( *this );
 }
 
 bool SfxUsrAnyItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
@@ -507,7 +507,7 @@ bool SfxUnoFrameItem::operator==( const SfxPoolItem& i_rItem ) const
 
 SfxPoolItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const
 {
-    return new SfxUnoFrameItem( Which(), m_xFrame );
+    return new SfxUnoFrameItem( *this );
 }
 
 bool SfxUnoFrameItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 6c2f5fb37757..816a0aafbca3 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1499,7 +1499,7 @@ bool SfxViewFrameItem::operator==( const SfxPoolItem &rItem ) const
 
 SfxPoolItem* SfxViewFrameItem::Clone( SfxItemPool *) const
 {
-    return new SfxViewFrameItem( pFrame);
+    return new SfxViewFrameItem( *this );
 }
 
 void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh )
diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx
index 07f1b980db6b..545ee807ea0c 100644
--- a/sw/source/core/graphic/grfatr.cxx
+++ b/sw/source/core/graphic/grfatr.cxx
@@ -149,7 +149,7 @@ SfxPoolItem* SwCropGrf::Clone( SfxItemPool* ) const
 
 SfxPoolItem* SwRotationGrf::Clone( SfxItemPool * ) const
 {
-    return new SwRotationGrf( GetValue(), aUnrotatedSize );
+    return new SwRotationGrf( *this );
 }
 
 bool SwRotationGrf::operator==( const SfxPoolItem& rCmp ) const
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index dcf2458da246..ab52c310ec93 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1315,7 +1315,7 @@ bool SwFormatVertOrient::operator==( const SfxPoolItem& rAttr ) const
 
 SfxPoolItem*  SwFormatVertOrient::Clone( SfxItemPool* ) const
 {
-    return new SwFormatVertOrient( m_nYPos, m_eOrient, m_eRelation );
+    return new SwFormatVertOrient( *this );
 }
 
 bool SwFormatVertOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1409,7 +1409,7 @@ bool SwFormatHoriOrient::operator==( const SfxPoolItem& rAttr ) const
 
 SfxPoolItem*  SwFormatHoriOrient::Clone( SfxItemPool* ) const
 {
-    return new SwFormatHoriOrient( m_nXPos, m_eOrient, m_eRelation, m_bPosToggle );
+    return new SwFormatHoriOrient( *this );
 }
 
 bool SwFormatHoriOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
@@ -1870,22 +1870,22 @@ bool SwFormatURL::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 
 SfxPoolItem* SwFormatEditInReadonly::Clone( SfxItemPool* ) const
 {
-    return new SwFormatEditInReadonly( Which(), GetValue() );
+    return new SwFormatEditInReadonly( *this );
 }
 
 SfxPoolItem* SwFormatLayoutSplit::Clone( SfxItemPool* ) const
 {
-    return new SwFormatLayoutSplit( GetValue() );
+    return new SwFormatLayoutSplit( *this );
 }
 
 SfxPoolItem* SwFormatRowSplit::Clone( SfxItemPool* ) const
 {
-    return new SwFormatRowSplit( GetValue() );
+    return new SwFormatRowSplit( *this );
 }
 
 SfxPoolItem* SwFormatNoBalancedColumns::Clone( SfxItemPool* ) const
 {
-    return new SwFormatNoBalancedColumns( GetValue() );
+    return new SwFormatNoBalancedColumns( *this );
 }
 
 void SwFormatNoBalancedColumns::dumpAsXml(xmlTextWriterPtr pWriter) const
@@ -2024,18 +2024,14 @@ bool SwFormatFootnoteEndAtTextEnd::PutValue( const uno::Any& rVal, sal_uInt8 nMe
 
 SfxPoolItem* SwFormatFootnoteAtTextEnd::Clone( SfxItemPool* ) const
 {
-    SwFormatFootnoteAtTextEnd* pNew = new SwFormatFootnoteAtTextEnd;
-    *pNew = *this;
-    return pNew;
+    return new SwFormatFootnoteAtTextEnd(*this);
 }
 
 // class SwFormatEndAtTextEnd
 
 SfxPoolItem* SwFormatEndAtTextEnd::Clone( SfxItemPool* ) const
 {
-    SwFormatEndAtTextEnd* pNew = new SwFormatEndAtTextEnd;
-    *pNew = *this;
-    return pNew;
+    return new SwFormatEndAtTextEnd(*this);
 }
 
 //class SwFormatChain


More information about the Libreoffice-commits mailing list