[Libreoffice-commits] core.git: cui/source include/svx sd/source svx/source

Stephan Bergmann sbergman at redhat.com
Wed Aug 6 03:58:53 PDT 2014


 cui/source/tabpages/connect.cxx |   18 +++++++++---------
 include/svx/sxelditm.hxx        |   25 +++++++++----------------
 sd/source/ui/view/drviewsj.cxx  |    6 +++---
 svx/source/svdraw/svdattr.cxx   |   11 +++--------
 svx/source/svdraw/svdoedge.cxx  |   18 +++++++++---------
 5 files changed, 33 insertions(+), 45 deletions(-)

New commits:
commit 14ac70c74a9abd62936db74d825ab9d3375f2504
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Aug 6 12:54:53 2014 +0200

    Consistency around SdrMetricItem in svx/sxelditm.hxx
    
    ...similar to what has been done for svx/sdtmfitm.hxx in
    6a2ea81ca1622d2c2ad55bea8ddc28167fcc2794 "Remove unused ctors" and
    68969cc61adecac481ae9656978ef952f435b310 "Consistency around SdrMetricItem."
    
    (SdrEdgeLine1DeltaItem::Clone had been recently---and in retrospect needlessly
    ---introduced in 596ec6f52fe3a8d56d5c20df568633cfbcadc74d "Missing
    SdrEdgeLine1DeltaItem::Clone override" before
    3efa3ad7b6de78c291f49858e50e6bedbd6a2173 "SdrEdgreLine*DeltaItem::Put/QueryValue
    are same as underlying" revealed that SdrEdgeLine1DeltaItem was a needless
    derivation of SdrMetricItem.)
    
    Change-Id: I154d32d46a7c01c792aa4e812cf576d4d749e0c9

diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx
index 97cc1c2..59a0dbd 100644
--- a/cui/source/tabpages/connect.cxx
+++ b/cui/source/tabpages/connect.cxx
@@ -224,7 +224,7 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
         pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE1DELTA );
     if( pItem )
     {
-        long nValue = ( ( const SdrEdgeLine1DeltaItem* )pItem )->GetValue();
+        long nValue = ( ( const SdrMetricItem* )pItem )->GetValue();
         SetMetricValue( *m_pMtrFldLine1, nValue, eUnit );
     }
     else
@@ -238,7 +238,7 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
         pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE2DELTA );
     if( pItem )
     {
-        long nValue = ( ( const SdrEdgeLine2DeltaItem* )pItem )->GetValue();
+        long nValue = ( ( const SdrMetricItem* )pItem )->GetValue();
         SetMetricValue( *m_pMtrFldLine2, nValue, eUnit );
     }
     else
@@ -252,7 +252,7 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
         pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE3DELTA );
     if( pItem )
     {
-        long nValue = ( ( const SdrEdgeLine3DeltaItem* )pItem )->GetValue();
+        long nValue = ( ( const SdrMetricItem* )pItem )->GetValue();
         SetMetricValue( *m_pMtrFldLine3, nValue, eUnit );
     }
     else
@@ -343,21 +343,21 @@ bool SvxConnectionPage::FillItemSet( SfxItemSet* rAttrs)
     if( m_pMtrFldLine1->IsValueChangedFromSaved() )
     {
         nValue = GetCoreValue( *m_pMtrFldLine1, eUnit );
-        rAttrs->Put( SdrEdgeLine1DeltaItem( nValue ) );
+        rAttrs->Put( makeSdrEdgeLine1DeltaItem( nValue ) );
         bModified = true;
     }
 
     if( m_pMtrFldLine2->IsValueChangedFromSaved() )
     {
         nValue = GetCoreValue( *m_pMtrFldLine2, eUnit );
-        rAttrs->Put( SdrEdgeLine2DeltaItem( nValue ) );
+        rAttrs->Put( makeSdrEdgeLine2DeltaItem( nValue ) );
         bModified = true;
     }
 
     if( m_pMtrFldLine3->IsValueChangedFromSaved() )
     {
         nValue = GetCoreValue( *m_pMtrFldLine3, eUnit );
-        rAttrs->Put( SdrEdgeLine3DeltaItem( nValue ) );
+        rAttrs->Put( makeSdrEdgeLine3DeltaItem( nValue ) );
         bModified = true;
     }
 
@@ -429,19 +429,19 @@ IMPL_LINK( SvxConnectionPage, ChangeAttrHdl_Impl, void *, p )
     if( p == m_pMtrFldLine1 )
     {
         sal_Int32 nValue = GetCoreValue( *m_pMtrFldLine1, eUnit );
-        aAttrSet.Put( SdrEdgeLine1DeltaItem( nValue ) );
+        aAttrSet.Put( makeSdrEdgeLine1DeltaItem( nValue ) );
     }
 
     if( p == m_pMtrFldLine2 )
     {
         sal_Int32 nValue = GetCoreValue( *m_pMtrFldLine2, eUnit );
-        aAttrSet.Put( SdrEdgeLine2DeltaItem( nValue ) );
+        aAttrSet.Put( makeSdrEdgeLine2DeltaItem( nValue ) );
     }
 
     if( p == m_pMtrFldLine3 )
     {
         sal_Int32 nValue = GetCoreValue( *m_pMtrFldLine3, eUnit );
-        aAttrSet.Put( SdrEdgeLine3DeltaItem( nValue ) );
+        aAttrSet.Put( makeSdrEdgeLine3DeltaItem( nValue ) );
     }
 
 
diff --git a/include/svx/sxelditm.hxx b/include/svx/sxelditm.hxx
index b3491d1..7fdf25d 100644
--- a/include/svx/sxelditm.hxx
+++ b/include/svx/sxelditm.hxx
@@ -29,24 +29,17 @@ public:
     SdrEdgeLineDeltaAnzItem(SvStream& rIn): SfxUInt16Item(SDRATTR_EDGELINEDELTAANZ,rIn)  {}
 };
 
-class SVX_DLLPUBLIC SdrEdgeLine1DeltaItem: public SdrMetricItem {
-public:
-    SdrEdgeLine1DeltaItem(long nVal=0): SdrMetricItem(SDRATTR_EDGELINE1DELTA,nVal)  {}
-    SdrEdgeLine1DeltaItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGELINE1DELTA,rIn) {}
-    virtual SfxPoolItem * Clone(SfxItemPool *) const SAL_OVERRIDE;
-};
+inline SdrMetricItem makeSdrEdgeLine1DeltaItem(long nVal) {
+    return SdrMetricItem(SDRATTR_EDGELINE1DELTA, nVal);
+}
 
-class SVX_DLLPUBLIC SdrEdgeLine2DeltaItem: public SdrMetricItem {
-public:
-    SdrEdgeLine2DeltaItem(long nVal=0): SdrMetricItem(SDRATTR_EDGELINE2DELTA,nVal)  {}
-    SdrEdgeLine2DeltaItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGELINE2DELTA,rIn) {}
-};
+inline SdrMetricItem makeSdrEdgeLine2DeltaItem(long nVal) {
+    return SdrMetricItem(SDRATTR_EDGELINE2DELTA, nVal);
+}
 
-class SVX_DLLPUBLIC SdrEdgeLine3DeltaItem: public SdrMetricItem {
-public:
-    SdrEdgeLine3DeltaItem(long nVal=0): SdrMetricItem(SDRATTR_EDGELINE3DELTA,nVal)  {}
-    SdrEdgeLine3DeltaItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGELINE3DELTA,rIn) {}
-};
+inline SdrMetricItem makeSdrEdgeLine3DeltaItem(long nVal) {
+    return SdrMetricItem(SDRATTR_EDGELINE3DELTA, nVal);
+}
 
 #endif
 
diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx
index 6cd3955..d3bec95 100644
--- a/sd/source/ui/view/drviewsj.cxx
+++ b/sd/source/ui/view/drviewsj.cxx
@@ -205,9 +205,9 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
                     aAttrSet.GetItemState( SDRATTR_EDGELINE2DELTA ) >= SFX_ITEM_AVAILABLE &&
                     aAttrSet.GetItemState( SDRATTR_EDGELINE3DELTA ) >= SFX_ITEM_AVAILABLE )
                 {
-                    long nVal1 = ( ( const SdrEdgeLine1DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE1DELTA ) ).GetValue();
-                    long nVal2 = ( ( const SdrEdgeLine2DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE2DELTA ) ).GetValue();
-                    long nVal3 = ( ( const SdrEdgeLine3DeltaItem& ) aAttrSet.Get( SDRATTR_EDGELINE3DELTA ) ).GetValue();
+                    long nVal1 = ( ( const SdrMetricItem& ) aAttrSet.Get( SDRATTR_EDGELINE1DELTA ) ).GetValue();
+                    long nVal2 = ( ( const SdrMetricItem& ) aAttrSet.Get( SDRATTR_EDGELINE2DELTA ) ).GetValue();
+                    long nVal3 = ( ( const SdrMetricItem& ) aAttrSet.Get( SDRATTR_EDGELINE3DELTA ) ).GetValue();
                     {
                         if( nVal1 != 0 || nVal2 != 0 || nVal3 != 0 )
                             bDisable = false;
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 37e89ee..bf296e0 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -180,9 +180,9 @@ SdrItemPool::SdrItemPool(
     mppLocalPoolDefaults[SDRATTR_EDGENODE1GLUEDIST-SDRATTR_START]=new SdrEdgeNode1GlueDistItem;
     mppLocalPoolDefaults[SDRATTR_EDGENODE2GLUEDIST-SDRATTR_START]=new SdrEdgeNode2GlueDistItem;
     mppLocalPoolDefaults[SDRATTR_EDGELINEDELTAANZ -SDRATTR_START]=new SdrEdgeLineDeltaAnzItem;
-    mppLocalPoolDefaults[SDRATTR_EDGELINE1DELTA   -SDRATTR_START]=new SdrEdgeLine1DeltaItem;
-    mppLocalPoolDefaults[SDRATTR_EDGELINE2DELTA   -SDRATTR_START]=new SdrEdgeLine2DeltaItem;
-    mppLocalPoolDefaults[SDRATTR_EDGELINE3DELTA   -SDRATTR_START]=new SdrEdgeLine3DeltaItem;
+    mppLocalPoolDefaults[SDRATTR_EDGELINE1DELTA   -SDRATTR_START]=new SdrMetricItem(SDRATTR_EDGELINE1DELTA, 0);
+    mppLocalPoolDefaults[SDRATTR_EDGELINE2DELTA   -SDRATTR_START]=new SdrMetricItem(SDRATTR_EDGELINE2DELTA, 0);
+    mppLocalPoolDefaults[SDRATTR_EDGELINE3DELTA   -SDRATTR_START]=new SdrMetricItem(SDRATTR_EDGELINE3DELTA, 0);
     mppLocalPoolDefaults[SDRATTR_MEASUREKIND             -SDRATTR_START]=new SdrMeasureKindItem;
     mppLocalPoolDefaults[SDRATTR_MEASURETEXTHPOS         -SDRATTR_START]=new SdrMeasureTextHPosItem;
     mppLocalPoolDefaults[SDRATTR_MEASURETEXTVPOS         -SDRATTR_START]=new SdrMeasureTextVPosItem;
@@ -1747,11 +1747,6 @@ bool SdrEdgeNode2VertDistItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemb
     return true;
 }
 
-SfxPoolItem * SdrEdgeLine1DeltaItem::Clone(SfxItemPool *) const
-{
-    return new SdrEdgeLine1DeltaItem(*this);
-}
-
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 // Measure
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index c25513d..caca40f 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -194,9 +194,9 @@ void SdrEdgeObj::ImpSetAttrToEdgeInfo()
 {
     const SfxItemSet& rSet = GetObjectItemSet();
     SdrEdgeKind eKind = ((SdrEdgeKindItem&)(rSet.Get(SDRATTR_EDGEKIND))).GetValue();
-    sal_Int32 nVal1 = ((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
-    sal_Int32 nVal2 = ((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
-    sal_Int32 nVal3 = ((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
+    sal_Int32 nVal1 = ((SdrMetricItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
+    sal_Int32 nVal2 = ((SdrMetricItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
+    sal_Int32 nVal3 = ((SdrMetricItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
 
     if(eKind == SDREDGE_ORTHOLINES || eKind == SDREDGE_BEZIER)
     {
@@ -265,9 +265,9 @@ void SdrEdgeObj::ImpSetEdgeInfoToAttr()
     const SfxItemSet& rSet = GetObjectItemSet();
     SdrEdgeKind eKind = ((SdrEdgeKindItem&)(rSet.Get(SDRATTR_EDGEKIND))).GetValue();
     sal_Int32 nValAnz = ((SdrEdgeLineDeltaAnzItem&)rSet.Get(SDRATTR_EDGELINEDELTAANZ)).GetValue();
-    sal_Int32 nVal1 = ((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
-    sal_Int32 nVal2 = ((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
-    sal_Int32 nVal3 = ((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
+    sal_Int32 nVal1 = ((SdrMetricItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
+    sal_Int32 nVal2 = ((SdrMetricItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
+    sal_Int32 nVal3 = ((SdrMetricItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
     sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 };
     sal_uInt16 n = 0;
 
@@ -323,17 +323,17 @@ void SdrEdgeObj::ImpSetEdgeInfoToAttr()
 
         if(nVals[0] != nVal1)
         {
-            GetProperties().SetObjectItemDirect(SdrEdgeLine1DeltaItem(nVals[0]));
+            GetProperties().SetObjectItemDirect(makeSdrEdgeLine1DeltaItem(nVals[0]));
         }
 
         if(nVals[1] != nVal2)
         {
-            GetProperties().SetObjectItemDirect(SdrEdgeLine2DeltaItem(nVals[1]));
+            GetProperties().SetObjectItemDirect(makeSdrEdgeLine2DeltaItem(nVals[1]));
         }
 
         if(nVals[2] != nVal3)
         {
-            GetProperties().SetObjectItemDirect(SdrEdgeLine3DeltaItem(nVals[2]));
+            GetProperties().SetObjectItemDirect(makeSdrEdgeLine3DeltaItem(nVals[2]));
         }
 
         if(n < 3)


More information about the Libreoffice-commits mailing list