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 | |
parent | sw: remove never read SwViewShell::mbInLibreOfficeKitCallback (diff) | |
download | core-396138a6bc7192abe0837b419283860d3331f607.tar.gz core-396138a6bc7192abe0837b419283860d3331f607.zip |
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')
-rw-r--r-- | sd/source/core/drawdoc.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod2.cxx | 2 | ||||
-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 | ||||
-rw-r--r-- | sd/source/ui/inc/tpoption.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/sdview3.cxx | 2 |
8 files changed, 26 insertions, 26 deletions
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index a507402b56c7..2b06a98c1477 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -204,7 +204,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) SetScaleFraction(Fraction(1, 1)); SetDefaultFontHeight(847); // 24p - pItemPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM); + pItemPool->SetDefaultMetric(MAP_100TH_MM); pItemPool->FreezeIdRanges(); SetTextDefaults(); diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index 1f51811a4405..1818a021cdd3 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -436,7 +436,7 @@ SfxItemSet* SdModule::CreateItemSet( sal_uInt16 nSlot ) // Pool has by default MapUnit Twips (Awgh!) SfxItemPool& rPool = GetPool(); - rPool.SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); + rPool.SetDefaultMetric( MAP_100TH_MM ); SfxItemSet* pRet = new SfxItemSet( rPool, SID_ATTR_METRIC, SID_ATTR_METRIC, 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 ); } diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx index e4edb5ef9f32..e96f5b4fe736 100644 --- a/sd/source/ui/inc/tpoption.hxx +++ b/sd/source/ui/inc/tpoption.hxx @@ -112,7 +112,7 @@ private: OUString aInfo1; OUString aInfo2; - SfxMapUnit ePoolUnit; + MapUnit ePoolUnit; static OUString GetScale( sal_Int32 nX, sal_Int32 nY ); static bool SetScale( const OUString& aScale, sal_Int32& rX, sal_Int32& rY ); diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx index 7e67f5e04cee..6bdac4a8ba78 100644 --- a/sd/source/ui/sidebar/SlideBackground.hxx +++ b/sd/source/ui/sidebar/SlideBackground.hxx @@ -114,7 +114,7 @@ private: bool mbTitle; SfxBindings* mpBindings; - SfxMapUnit meUnit; + MapUnit meUnit; DECL_LINK_TYPED(FillBackgroundHdl, ListBox&, void); DECL_LINK_TYPED(FillStyleModifyHdl, ListBox&, void); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 58d79806ca64..ec2764825c76 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -1523,7 +1523,7 @@ bool View::PasteRTFTable( const ::tools::SvRef<SotStorageStream>& xStm, SdrPage* { std::unique_ptr<SdDrawDocument> pModel(new SdDrawDocument( DOCUMENT_TYPE_IMPRESS, mpDocSh )); pModel->NewOrLoadCompleted(NEW_DOC); - pModel->GetItemPool().SetDefaultMetric(SFX_MAPUNIT_100TH_MM); + pModel->GetItemPool().SetDefaultMetric(MAP_100TH_MM); pModel->InsertPage(pModel->AllocPage(false)); Reference< XComponent > xComponent( new SdXImpressDocument( pModel.get(), true ) ); |