diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-08-19 09:31:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-08-19 11:25:18 +0000 |
commit | 396138a6bc7192abe0837b419283860d3331f607 (patch) | |
tree | f80818ba86220abb8db205b402429e3d45aa62d1 /sd/source/ui/dlg | |
parent | 8b4705e0e0c76503b1ca61cb567d222f49466fc5 (diff) |
Resolves: coverity#705366 Mixing enum types
and
coverity#705367 Mixing enum types
coverity#705371 Mixing enum types
coverity#982694 Mixing enum types
coverity#1027717 Mixing enum types
coverity#1371228 Mixing enum types
coverity#1371242 Mixing enum types
coverity#1371280 Mixing enum types
coverity#1371310 Mixing enum types
MapUnit and SfxMapUnit share the same values and
are freely cast from one to the other.
Now that
commit d30a4298bdb5ba53cd1fe659f2b742f218a2e527
Date: Thu Aug 11 15:02:19 2016 +0200
loplugin:unusedenumconstants in package..svtools
removed the SfxMapUnit entries that were directly unused, they
don't match anymore and casting from one to the other is dangerous.
Why there was two of these anyway escapes me, get rid of SfxMapUnit
and just use MapUnit universally
Change-Id: I4db5dcd04b59be2f85b62b728f96c90afe00c57e
Reviewed-on: https://gerrit.libreoffice.org/28234
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source/ui/dlg')
-rw-r--r-- | sd/source/ui/dlg/copydlg.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/dlg/dlgsnap.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/dlg/tpoption.cxx | 4 |
3 files changed, 21 insertions, 21 deletions
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index f4bd4e14b2b5..f062b1f674ed 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -118,12 +118,12 @@ void CopyDlg::Reset() long nMoveX = 500L; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) ) nMoveX = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldMoveX, Fraction(nMoveX) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveX, Fraction(nMoveX) / maUIScale, MAP_100TH_MM); long nMoveY = 500L; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) ) nMoveY = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldMoveY, Fraction(nMoveY) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveY, Fraction(nMoveY) / maUIScale, MAP_100TH_MM); if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) ) m_pMtrFldAngle->SetValue( static_cast<const SfxInt32Item*>( pPoolItem )->GetValue() ); @@ -133,12 +133,12 @@ void CopyDlg::Reset() long nWidth = 0L; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) ) nWidth = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldWidth, Fraction(nWidth) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldWidth, Fraction(nWidth) / maUIScale, MAP_100TH_MM); long nHeight = 0L; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, true, &pPoolItem ) ) nHeight = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldHeight, Fraction(nHeight) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldHeight, Fraction(nHeight) / maUIScale, MAP_100TH_MM); if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) ) { @@ -189,10 +189,10 @@ void CopyDlg::Reset() */ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) { - long nMoveX = Fraction( GetCoreValue( *m_pMtrFldMoveX, SFX_MAPUNIT_100TH_MM) ) * maUIScale; - long nMoveY = Fraction( GetCoreValue( *m_pMtrFldMoveY, SFX_MAPUNIT_100TH_MM) ) * maUIScale; - long nHeight = Fraction( GetCoreValue( *m_pMtrFldHeight, SFX_MAPUNIT_100TH_MM) ) * maUIScale; - long nWidth = Fraction( GetCoreValue( *m_pMtrFldWidth, SFX_MAPUNIT_100TH_MM) ) * maUIScale; + long nMoveX = Fraction( GetCoreValue( *m_pMtrFldMoveX, MAP_100TH_MM) ) * maUIScale; + long nMoveY = Fraction( GetCoreValue( *m_pMtrFldMoveY, MAP_100TH_MM) ) * maUIScale; + long nHeight = Fraction( GetCoreValue( *m_pMtrFldHeight, MAP_100TH_MM) ) * maUIScale; + long nWidth = Fraction( GetCoreValue( *m_pMtrFldWidth, MAP_100TH_MM) ) * maUIScale; rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, (sal_uInt16) m_pNumFldCopies->GetValue() ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) ); @@ -239,9 +239,9 @@ IMPL_LINK_NOARG_TYPED(CopyDlg, SetViewData, Button*, void) Rectangle aRect = mpView->GetAllMarkedRect(); SetMetricValue( *m_pMtrFldMoveX, Fraction( aRect.GetWidth() ) / - maUIScale, SFX_MAPUNIT_100TH_MM); + maUIScale, MAP_100TH_MM); SetMetricValue( *m_pMtrFldMoveY, Fraction( aRect.GetHeight() ) / - maUIScale, SFX_MAPUNIT_100TH_MM); + maUIScale, MAP_100TH_MM); // sets color attribute const SfxPoolItem* pPoolItem = nullptr; @@ -260,13 +260,13 @@ IMPL_LINK_NOARG_TYPED(CopyDlg, SetDefault, Button*, void) m_pNumFldCopies->SetValue( 1L ); long nValue = 500L; - SetMetricValue( *m_pMtrFldMoveX, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); - SetMetricValue( *m_pMtrFldMoveY, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldMoveX, Fraction(nValue) / maUIScale, MAP_100TH_MM); + SetMetricValue( *m_pMtrFldMoveY, Fraction(nValue) / maUIScale, MAP_100TH_MM); nValue = 0L; m_pMtrFldAngle->SetValue( nValue ); - SetMetricValue( *m_pMtrFldWidth, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); - SetMetricValue( *m_pMtrFldHeight, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldWidth, Fraction(nValue) / maUIScale, MAP_100TH_MM); + SetMetricValue( *m_pMtrFldHeight, Fraction(nValue) / maUIScale, MAP_100TH_MM); // set color attribute const SfxPoolItem* pPoolItem = nullptr; diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx index 61c190586adf..7d945dd91e0e 100644 --- a/sd/source/ui/dlg/dlgsnap.cxx +++ b/sd/source/ui/dlg/dlgsnap.cxx @@ -64,7 +64,7 @@ SdSnapLineDlg::SdSnapLineDlg( // determine PoolUnit SfxItemPool* pPool = rInAttrs.GetPool(); DBG_ASSERT( pPool, "Where's the Pool?" ); - SfxMapUnit ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH ); + MapUnit ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH ); // #i48497# Consider page origin SdrPageView* pPV = pView->GetSdrPageView(); @@ -105,8 +105,8 @@ SdSnapLineDlg::SdSnapLineDlg( nYValue = static_cast<const SfxInt32Item&>( rInAttrs.Get(ATTR_SNAPLINE_Y)).GetValue(); nXValue = Fraction(nXValue) / aUIScale; nYValue = Fraction(nYValue) / aUIScale; - SetMetricValue( *m_pMtrFldX, nXValue, SFX_MAPUNIT_100TH_MM); - SetMetricValue( *m_pMtrFldY, nYValue, SFX_MAPUNIT_100TH_MM); + SetMetricValue( *m_pMtrFldX, nXValue, MAP_100TH_MM); + SetMetricValue( *m_pMtrFldY, nYValue, MAP_100TH_MM); m_pRbPoint->Check(); } @@ -152,8 +152,8 @@ void SdSnapLineDlg::GetAttr(SfxItemSet& rOutAttrs) else if ( m_pRbVert->IsChecked() ) eKind = SK_VERTICAL; else eKind = SK_POINT; - nXValue = Fraction( GetCoreValue( *m_pMtrFldX, SFX_MAPUNIT_100TH_MM) ) * aUIScale; - nYValue = Fraction( GetCoreValue( *m_pMtrFldY, SFX_MAPUNIT_100TH_MM) ) * aUIScale; + nXValue = Fraction( GetCoreValue( *m_pMtrFldX, MAP_100TH_MM) ) * aUIScale; + nYValue = Fraction( GetCoreValue( *m_pMtrFldY, MAP_100TH_MM) ) * aUIScale; rOutAttrs.Put(SfxAllEnumItem(ATTR_SNAPLINE_KIND, (sal_uInt16)eKind)); rOutAttrs.Put(SfxUInt32Item(ATTR_SNAPLINE_X, nXValue)); diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index df55b9652ae7..06f49290ae97 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -433,7 +433,7 @@ bool SdTpOptionsMisc::FillItemSet( SfxItemSet* rAttrs ) if( m_pMtrFldTabstop->IsValueChangedFromSaved() ) { sal_uInt16 nWh = GetWhich( SID_ATTR_DEFTABSTOP ); - SfxMapUnit eUnit = rAttrs->GetPool()->GetMetric( nWh ); + MapUnit eUnit = rAttrs->GetPool()->GetMetric( nWh ); SfxUInt16Item aDef( nWh,(sal_uInt16)GetCoreValue( *m_pMtrFldTabstop, eUnit ) ); rAttrs->Put( aDef ); bModified = true; @@ -501,7 +501,7 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs ) nWhich = GetWhich( SID_ATTR_DEFTABSTOP ); if( rAttrs->GetItemState( nWhich ) >= SfxItemState::DEFAULT ) { - SfxMapUnit eUnit = rAttrs->GetPool()->GetMetric( nWhich ); + MapUnit eUnit = rAttrs->GetPool()->GetMetric( nWhich ); const SfxUInt16Item& rItem = static_cast<const SfxUInt16Item&>(rAttrs->Get( nWhich )); SetMetricValue( *m_pMtrFldTabstop, rItem.GetValue(), eUnit ); } |