diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-08-07 11:53:30 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-08-07 11:53:42 +0200 |
commit | 7fb48e7e3aa76ba48174d74da7b603b25ef68f56 (patch) | |
tree | 35b693ac4b4e3e39e6311112e48790bd4c4fe5c0 | |
parent | ff929ad45cdd803db0da49423648256f8380b3a1 (diff) |
Consistency around SdrMetricItem in svx/sxmlhitm.hxx
...similar to what has been done for svx/sdtmfitm.hxx in
6a2ea81ca1622d2c2ad55bea8ddc28167fcc2794 "Remove unused ctors" and
68969cc61adecac481ae9656978ef952f435b310 "Consistency around SdrMetricItem."
Change-Id: I65c36bde166c5f78db8c76364fd057017982fed6
-rw-r--r-- | cui/source/tabpages/measure.cxx | 30 | ||||
-rw-r--r-- | include/svx/sxmlhitm.hxx | 40 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx | 10 | ||||
-rw-r--r-- | svx/source/svdraw/svdattr.cxx | 10 | ||||
-rw-r--r-- | svx/source/svdraw/svdomeas.cxx | 16 |
5 files changed, 48 insertions, 58 deletions
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx index f5d274956109..319f5582590f 100644 --- a/cui/source/tabpages/measure.cxx +++ b/cui/source/tabpages/measure.cxx @@ -178,7 +178,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASURELINEDIST ); if( pItem ) { - long nValue = ( ( const SdrMeasureLineDistItem* )pItem )->GetValue(); + long nValue = ( ( const SdrMetricItem* )pItem )->GetValue(); SetMetricValue( *m_pMtrFldLineDist, nValue, eUnit ); } else @@ -193,7 +193,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEOVERHANG ); if( pItem ) { - long nValue = ( ( const SdrMeasureHelplineOverhangItem* )pItem )->GetValue(); + long nValue = ( ( const SdrMetricItem* )pItem )->GetValue(); SetMetricValue( *m_pMtrFldHelplineOverhang, nValue, eUnit ); } else @@ -208,7 +208,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEDIST ); if( pItem ) { - long nValue = ( ( const SdrMeasureHelplineDistItem* )pItem )->GetValue(); + long nValue = ( ( const SdrMetricItem* )pItem )->GetValue(); SetMetricValue( *m_pMtrFldHelplineDist, nValue, eUnit ); } else @@ -223,7 +223,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE1LEN ); if( pItem ) { - long nValue = ( ( const SdrMeasureHelpline1LenItem* )pItem )->GetValue(); + long nValue = ( ( const SdrMetricItem* )pItem )->GetValue(); SetMetricValue( *m_pMtrFldHelpline1Len, nValue, eUnit ); } else @@ -238,7 +238,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE2LEN ); if( pItem ) { - long nValue = ( ( const SdrMeasureHelpline2LenItem* )pItem )->GetValue(); + long nValue = ( ( const SdrMetricItem* )pItem )->GetValue(); SetMetricValue( *m_pMtrFldHelpline2Len, nValue, eUnit ); } else @@ -428,35 +428,35 @@ bool SvxMeasurePage::FillItemSet( SfxItemSet* rAttrs) if( m_pMtrFldLineDist->IsValueChangedFromSaved() ) { nValue = GetCoreValue( *m_pMtrFldLineDist, eUnit ); - rAttrs->Put( SdrMeasureLineDistItem( nValue ) ); + rAttrs->Put( makeSdrMeasureLineDistItem( nValue ) ); bModified = true; } if( m_pMtrFldHelplineOverhang->IsValueChangedFromSaved() ) { nValue = GetCoreValue( *m_pMtrFldHelplineOverhang, eUnit ); - rAttrs->Put( SdrMeasureHelplineOverhangItem( nValue ) ); + rAttrs->Put( makeSdrMeasureHelplineOverhangItem( nValue ) ); bModified = true; } if( m_pMtrFldHelplineDist->IsValueChangedFromSaved() ) { nValue = GetCoreValue( *m_pMtrFldHelplineDist, eUnit ); - rAttrs->Put( SdrMeasureHelplineDistItem( nValue ) ); + rAttrs->Put( makeSdrMeasureHelplineDistItem( nValue ) ); bModified = true; } if( m_pMtrFldHelpline1Len->IsValueChangedFromSaved() ) { nValue = GetCoreValue( *m_pMtrFldHelpline1Len, eUnit ); - rAttrs->Put( SdrMeasureHelpline1LenItem( nValue ) ); + rAttrs->Put( makeSdrMeasureHelpline1LenItem( nValue ) ); bModified = true; } if( m_pMtrFldHelpline2Len->IsValueChangedFromSaved() ) { nValue = GetCoreValue( *m_pMtrFldHelpline2Len, eUnit ); - rAttrs->Put( SdrMeasureHelpline2LenItem( nValue ) ); + rAttrs->Put( makeSdrMeasureHelpline2LenItem( nValue ) ); bModified = true; } @@ -665,31 +665,31 @@ IMPL_LINK( SvxMeasurePage, ChangeAttrHdl_Impl, void *, p ) if( p == m_pMtrFldLineDist ) { sal_Int32 nValue = GetCoreValue( *m_pMtrFldLineDist, eUnit ); - aAttrSet.Put( SdrMeasureLineDistItem( nValue ) ); + aAttrSet.Put( makeSdrMeasureLineDistItem( nValue ) ); } if( p == m_pMtrFldHelplineOverhang ) { sal_Int32 nValue = GetCoreValue( *m_pMtrFldHelplineOverhang, eUnit ); - aAttrSet.Put( SdrMeasureHelplineOverhangItem( nValue) ); + aAttrSet.Put( makeSdrMeasureHelplineOverhangItem( nValue) ); } if( p == m_pMtrFldHelplineDist ) { sal_Int32 nValue = GetCoreValue( *m_pMtrFldHelplineDist, eUnit ); - aAttrSet.Put( SdrMeasureHelplineDistItem( nValue) ); + aAttrSet.Put( makeSdrMeasureHelplineDistItem( nValue) ); } if( p == m_pMtrFldHelpline1Len ) { sal_Int32 nValue = GetCoreValue( *m_pMtrFldHelpline1Len, eUnit ); - aAttrSet.Put( SdrMeasureHelpline1LenItem( nValue ) ); + aAttrSet.Put( makeSdrMeasureHelpline1LenItem( nValue ) ); } if( p == m_pMtrFldHelpline2Len ) { sal_Int32 nValue = GetCoreValue( *m_pMtrFldHelpline2Len, eUnit ); - aAttrSet.Put( SdrMeasureHelpline2LenItem( nValue ) ); + aAttrSet.Put( makeSdrMeasureHelpline2LenItem( nValue ) ); } if( p == m_pTsbBelowRefEdge ) diff --git a/include/svx/sxmlhitm.hxx b/include/svx/sxmlhitm.hxx index 9d5168ec796c..6b5ca4e1ef6e 100644 --- a/include/svx/sxmlhitm.hxx +++ b/include/svx/sxmlhitm.hxx @@ -39,40 +39,30 @@ // Abstand der Masslinie zur Bezugskante (Norm=8mm) // laesst sich auch draggen an den beiden Handles // die auf den Pfeilspitzen liegen -class SdrMeasureLineDistItem: public SdrMetricItem { -public: - SdrMeasureLineDistItem(long nVal=0): SdrMetricItem(SDRATTR_MEASURELINEDIST,nVal) {} - SdrMeasureLineDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASURELINEDIST,rIn) {} -}; +inline SdrMetricItem makeSdrMeasureLineDistItem(long nVal) { + return SdrMetricItem(SDRATTR_MEASURELINEDIST, nVal); +} // Ueberhang der Masshilfslinien an der Masslinie (Norm=2mm) -class SdrMeasureHelplineOverhangItem: public SdrMetricItem { -public: - SdrMeasureHelplineOverhangItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG,nVal) {} - SdrMeasureHelplineOverhangItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG,rIn) {} -}; +inline SdrMetricItem makeSdrMeasureHelplineOverhangItem(long nVal) { + return SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG, nVal); +} // Abstand der der Masshilfslinienenden zur Bezugskante // Damit die Masshilfslinien nicht das Objekt beruehren -class SdrMeasureHelplineDistItem: public SdrMetricItem { -public: - SdrMeasureHelplineDistItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST,nVal) {} - SdrMeasureHelplineDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST,rIn) {} -}; +inline SdrMetricItem makeSdrMeasureHelplineDistItem(long nVal) { + return SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST, nVal); +} // Ueberlaenge der Hilfslinien ueber die Bezugskante // laesst sich auch draggen an den beiden runden Handles, // die sich default unter den beiden Referenzpunkten befinden -class SdrMeasureHelpline1LenItem: public SdrMetricItem { -public: - SdrMeasureHelpline1LenItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN,nVal) {} - SdrMeasureHelpline1LenItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN,rIn) {} -}; -class SdrMeasureHelpline2LenItem: public SdrMetricItem { -public: - SdrMeasureHelpline2LenItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN,nVal) {} - SdrMeasureHelpline2LenItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN,rIn) {} -}; +inline SdrMetricItem makeSdrMeasureHelpline1LenItem(long nVal) { + return SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN, nVal); +} +inline SdrMetricItem makeSdrMeasureHelpline2LenItem(long nVal) { + return SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN, nVal); +} #endif diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx index 275e28b741d3..462d32f56f4a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx @@ -55,11 +55,11 @@ namespace sdr // take properties which are the model data. const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); - const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); - const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); - const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); - const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); - const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); + const double fDistance(((SdrMetricItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); + const double fUpperDistance(((SdrMetricItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); + const double fLowerDistance(((SdrMetricItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); + const double fLeftDelta(((SdrMetricItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); + const double fRightDelta(((SdrMetricItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 188668a387d1..c11106e26d98 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -186,11 +186,11 @@ SdrItemPool::SdrItemPool( mppLocalPoolDefaults[SDRATTR_MEASUREKIND -SDRATTR_START]=new SdrMeasureKindItem; mppLocalPoolDefaults[SDRATTR_MEASURETEXTHPOS -SDRATTR_START]=new SdrMeasureTextHPosItem; mppLocalPoolDefaults[SDRATTR_MEASURETEXTVPOS -SDRATTR_START]=new SdrMeasureTextVPosItem; - mppLocalPoolDefaults[SDRATTR_MEASURELINEDIST -SDRATTR_START]=new SdrMeasureLineDistItem(800); - mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINEOVERHANG -SDRATTR_START]=new SdrMeasureHelplineOverhangItem(200); - mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINEDIST -SDRATTR_START]=new SdrMeasureHelplineDistItem(100); - mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINE1LEN -SDRATTR_START]=new SdrMeasureHelpline1LenItem; - mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINE2LEN -SDRATTR_START]=new SdrMeasureHelpline2LenItem; + mppLocalPoolDefaults[SDRATTR_MEASURELINEDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASURELINEDIST, 800); + mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINEOVERHANG -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG, 200); + mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINEDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST, 100); + mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINE1LEN -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN, 0); + mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINE2LEN -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN, 0); mppLocalPoolDefaults[SDRATTR_MEASUREBELOWREFEDGE -SDRATTR_START]=new SdrMeasureBelowRefEdgeItem; mppLocalPoolDefaults[SDRATTR_MEASURETEXTROTA90 -SDRATTR_START]=new SdrMeasureTextRota90Item; mppLocalPoolDefaults[SDRATTR_MEASURETEXTUPSIDEDOWN -SDRATTR_START]=new SdrMeasureTextUpsideDownItem; diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 3ca3b1bcce83..a106396c04e9 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -338,11 +338,11 @@ void SdrMeasureObj::ImpTakeAttr(ImpMeasureRec& rRec) const rRec.eKind =((SdrMeasureKindItem& )rSet.Get(SDRATTR_MEASUREKIND )).GetValue(); rRec.eWantTextHPos =((SdrMeasureTextHPosItem& )rSet.Get(SDRATTR_MEASURETEXTHPOS )).GetValue(); rRec.eWantTextVPos =((SdrMeasureTextVPosItem& )rSet.Get(SDRATTR_MEASURETEXTVPOS )).GetValue(); - rRec.nLineDist =((SdrMeasureLineDistItem& )rSet.Get(SDRATTR_MEASURELINEDIST )).GetValue(); - rRec.nHelplineOverhang=((SdrMeasureHelplineOverhangItem&)rSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue(); - rRec.nHelplineDist =((SdrMeasureHelplineDistItem& )rSet.Get(SDRATTR_MEASUREHELPLINEDIST )).GetValue(); - rRec.nHelpline1Len =((SdrMeasureHelpline1LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE1LEN )).GetValue(); - rRec.nHelpline2Len =((SdrMeasureHelpline2LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE2LEN )).GetValue(); + rRec.nLineDist =((SdrMetricItem& )rSet.Get(SDRATTR_MEASURELINEDIST )).GetValue(); + rRec.nHelplineOverhang=((SdrMetricItem&)rSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue(); + rRec.nHelplineDist =((SdrMetricItem& )rSet.Get(SDRATTR_MEASUREHELPLINEDIST )).GetValue(); + rRec.nHelpline1Len =((SdrMetricItem& )rSet.Get(SDRATTR_MEASUREHELPLINE1LEN )).GetValue(); + rRec.nHelpline2Len =((SdrMetricItem& )rSet.Get(SDRATTR_MEASUREHELPLINE2LEN )).GetValue(); rRec.bBelowRefEdge =((SdrMeasureBelowRefEdgeItem& )rSet.Get(SDRATTR_MEASUREBELOWREFEDGE )).GetValue(); rRec.bTextRota90 =((SdrMeasureTextRota90Item& )rSet.Get(SDRATTR_MEASURETEXTROTA90 )).GetValue(); rRec.bTextUpsideDown =((SdrMeasureTextUpsideDownItem& )rSet.Get(SDRATTR_MEASURETEXTUPSIDEDOWN )).GetValue(); @@ -860,12 +860,12 @@ bool SdrMeasureObj::applySpecialDrag(SdrDragStat& rDrag) if(aMeasureRec.nHelpline1Len != aOrigMeasureRec.nHelpline1Len) { - SetObjectItem(SdrMeasureHelpline1LenItem(aMeasureRec.nHelpline1Len)); + SetObjectItem(makeSdrMeasureHelpline1LenItem(aMeasureRec.nHelpline1Len)); } if(aMeasureRec.nHelpline2Len != aOrigMeasureRec.nHelpline2Len) { - SetObjectItem(SdrMeasureHelpline2LenItem(aMeasureRec.nHelpline2Len)); + SetObjectItem(makeSdrMeasureHelpline2LenItem(aMeasureRec.nHelpline2Len)); } break; @@ -879,7 +879,7 @@ bool SdrMeasureObj::applySpecialDrag(SdrDragStat& rDrag) if(aMeasureRec.nLineDist != aOrigMeasureRec.nLineDist) { - SetObjectItem(SdrMeasureLineDistItem(aMeasureRec.nLineDist)); + SetObjectItem(makeSdrMeasureLineDistItem(aMeasureRec.nLineDist)); } if(aMeasureRec.bBelowRefEdge != aOrigMeasureRec.bBelowRefEdge) |