From 0f0049d77a0ee6ae936922213c7290d0bc4fee29 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 16 Nov 2017 16:16:22 +0200 Subject: TypedWhichId for XATTR* constants Change-Id: Ie9d637d701b77a549de3b00956f9c74ee8bd08c1 Reviewed-on: https://gerrit.libreoffice.org/44830 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/tabpages/tparea.cxx | 2 +- cui/source/tabpages/tpbitmap.cxx | 20 ++++++++++---------- cui/source/tabpages/tpcolor.cxx | 2 +- cui/source/tabpages/tpgradnt.cxx | 2 +- cui/source/tabpages/tphatch.cxx | 10 +++++----- cui/source/tabpages/tpline.cxx | 26 +++++++++++++------------- cui/source/tabpages/tplnedef.cxx | 2 +- cui/source/tabpages/tppattern.cxx | 2 +- cui/source/tabpages/tpshadow.cxx | 16 ++++------------ cui/source/tabpages/tptrans.cxx | 14 +++++++------- 10 files changed, 44 insertions(+), 52 deletions(-) (limited to 'cui') diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index 6f19bc50e4bb..aa45639d1e14 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -199,7 +199,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) } case drawing::FillStyle_HATCH: { - m_rXFSet.Put( static_cast( rSet.Get(XATTR_FILLHATCH) ) ); + m_rXFSet.Put( rSet.Get(XATTR_FILLHATCH) ); SelectFillTypeHdl_Impl( m_pBtnHatch ); break; } diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 192297547949..00897f4848b9 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -179,7 +179,7 @@ void SvxBitmapTabPage::Construct() void SvxBitmapTabPage::ActivatePage( const SfxItemSet& rSet ) { - XFillBitmapItem aItem( static_cast(rSet.Get(XATTR_FILLBITMAP)) ); + XFillBitmapItem aItem( rSet.Get(XATTR_FILLBITMAP) ); sal_Int32 nPos = SearchBitmapList( aItem.GetName() ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) @@ -298,7 +298,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) double fTmpHeight((OutputDevice::LogicToLogic(static_cast(m_fObjectHeight), mePoolUnit, MapUnit::Map100thMM )) / fUIScale); m_fObjectHeight = fTmpHeight; - XFillBitmapItem aItem( static_cast(rAttrs->Get(XATTR_FILLBITMAP)) ); + XFillBitmapItem aItem( rAttrs->Get(XATTR_FILLBITMAP) ); if(!aItem.isPattern()) { @@ -323,7 +323,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if(rAttrs->GetItemState( XATTR_FILLBMP_TILE ) != SfxItemState::DONTCARE) { - if( static_cast( rAttrs->Get( XATTR_FILLBMP_TILE ) ).GetValue() ) + if( rAttrs->Get( XATTR_FILLBMP_TILE ).GetValue() ) { m_pBitmapStyleLB->SelectEntryPos(static_cast(TILED)); } @@ -331,7 +331,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if( m_pBitmapStyleLB->GetSelectedEntryPos() == 0 && rAttrs->GetItemState( XATTR_FILLBMP_STRETCH ) != SfxItemState::DONTCARE) { - if( static_cast( rAttrs->Get( XATTR_FILLBMP_STRETCH ) ).GetValue() ) + if( rAttrs->Get( XATTR_FILLBMP_STRETCH ).GetValue() ) { m_pBitmapStyleLB->SelectEntryPos( static_cast(STRETCHED) ); } @@ -355,7 +355,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if(rAttrs->GetItemState( XATTR_FILLBMP_SIZEY ) != SfxItemState::DONTCARE) { - nHeight = static_cast( rAttrs->Get( XATTR_FILLBMP_SIZEY ) ).GetValue(); + nHeight = rAttrs->Get( XATTR_FILLBMP_SIZEY ).GetValue(); if(nHeight == 0) nHeight = rBitmapSize.Height(); else if(nHeight < 0) @@ -402,13 +402,13 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if( rAttrs->GetItemState( XATTR_FILLBMP_POS ) != SfxItemState::DONTCARE ) { - RectPoint eValue = static_cast( rAttrs->Get( XATTR_FILLBMP_POS ) ).GetValue(); + RectPoint eValue = rAttrs->Get( XATTR_FILLBMP_POS ).GetValue(); m_pPositionLB->SelectEntryPos( static_cast< sal_Int32 >(eValue) ); } if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SfxItemState::DONTCARE ) { - sal_Int32 nValue = static_cast( rAttrs->Get( XATTR_FILLBMP_POSOFFSETX ) ).GetValue(); + sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_POSOFFSETX ).GetValue(); m_pPositionOffX->SetValue( nValue ); } else @@ -416,7 +416,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if( rAttrs->GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SfxItemState::DONTCARE ) { - sal_Int32 nValue = static_cast( rAttrs->Get( XATTR_FILLBMP_POSOFFSETY ) ).GetValue(); + sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_POSOFFSETY ).GetValue(); m_pPositionOffY->SetValue( nValue ); } else @@ -424,7 +424,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SfxItemState::DONTCARE) { - sal_Int32 nValue = static_cast( rAttrs->Get( XATTR_FILLBMP_TILEOFFSETX ) ).GetValue(); + sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_TILEOFFSETX ).GetValue(); if(nValue > 0) { m_pTileOffLB->SelectEntryPos(static_cast(ROW)); @@ -434,7 +434,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) if( rAttrs->GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SfxItemState::DONTCARE ) { - sal_Int32 nValue = static_cast( rAttrs->Get( XATTR_FILLBMP_TILEOFFSETY ) ).GetValue(); + sal_Int32 nValue = rAttrs->Get( XATTR_FILLBMP_TILEOFFSETY ).GetValue(); if(nValue > 0) { m_pTileOffLB->SelectEntryPos(static_cast(COLUMN)); diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 8b43dd6830bc..185f28fcfcc4 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -292,7 +292,7 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet ) if ( nState >= SfxItemState::DEFAULT ) { - XFillColorItem aColorItem( static_cast(rSet->Get( XATTR_FILLCOLOR )) ); + XFillColorItem aColorItem( rSet->Get( XATTR_FILLCOLOR ) ); aPreviousColor = aColorItem.GetColorValue(); aNewColor = aColorItem.GetColorValue(); } diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index 36a05915a6e5..86cb408c1a01 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -201,7 +201,7 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& rSet ) else aString += aURL.getBase(); - sal_Int32 nPos = SearchGradientList( static_cast( rSet.Get(XATTR_FILLGRADIENT) ).GetName() ); + sal_Int32 nPos = SearchGradientList( rSet.Get(XATTR_FILLGRADIENT).GetName() ); if ( nPos != LISTBOX_ENTRY_NOTFOUND ) { sal_uInt16 nId = m_pGradientLB->GetItemId( static_cast( nPos ) ); diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index bcab052260aa..922418d8c358 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -188,7 +188,7 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) else aString += aURL.getBase(); - sal_Int32 nPos = SearchHatchList( static_cast( rSet.Get(XATTR_FILLHATCH) ).GetName() ); + sal_Int32 nPos = SearchHatchList( rSet.Get(XATTR_FILLHATCH).GetName() ); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { sal_uInt16 nId = m_pHatchLB->GetItemId( static_cast( nPos ) ); @@ -198,13 +198,13 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) ChangeHatchHdl_Impl(); } - XFillBackgroundItem aBckItem( static_cast(rSet.Get(XATTR_FILLBACKGROUND))); + XFillBackgroundItem aBckItem( rSet.Get(XATTR_FILLBACKGROUND)); m_rXFSet.Put( aBckItem ); if(aBckItem.GetValue()) { m_pCbBackgroundColor->SetState(TRISTATE_TRUE); - XFillColorItem aColorItem( static_cast(rSet.Get(XATTR_FILLCOLOR)) ); + XFillColorItem aColorItem( rSet.Get(XATTR_FILLCOLOR) ); Color aColor(aColorItem.GetColorValue()); m_pLbBackgroundColor->Enable(); m_pLbBackgroundColor->SelectEntry(aColor); @@ -282,14 +282,14 @@ void SvxHatchTabPage::Reset( const SfxItemSet* rSet ) { ChangeHatchHdl_Impl(); - XFillBackgroundItem aBckItem( static_cast(rSet->Get(XATTR_FILLBACKGROUND)) ); + XFillBackgroundItem aBckItem( rSet->Get(XATTR_FILLBACKGROUND) ); if(aBckItem.GetValue()) m_pCbBackgroundColor->SetState(TRISTATE_TRUE); else m_pCbBackgroundColor->SetState(TRISTATE_FALSE); m_rXFSet.Put( aBckItem ); - XFillColorItem aColItem( static_cast(rSet->Get(XATTR_FILLCOLOR)) ); + XFillColorItem aColItem( rSet->Get(XATTR_FILLCOLOR) ); m_pLbBackgroundColor->SelectEntry(aColItem.GetColorValue()); m_rXFSet.Put( aColItem ); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 7c238dfeeba6..c2da4dcca633 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -1209,7 +1209,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) if( rAttrs->GetItemState( XATTR_LINESTYLE ) != SfxItemState::DONTCARE ) { - eXLS = (drawing::LineStyle) static_cast( rAttrs->Get( XATTR_LINESTYLE ) ).GetValue(); + eXLS = (drawing::LineStyle) rAttrs->Get( XATTR_LINESTYLE ).GetValue(); switch( eXLS ) { @@ -1222,7 +1222,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) case drawing::LineStyle_DASH: m_pLbLineStyle->SetNoSelection(); - m_pLbLineStyle->SelectEntry( static_cast( rAttrs->Get( XATTR_LINEDASH ) ).GetName() ); + m_pLbLineStyle->SelectEntry( rAttrs->Get( XATTR_LINEDASH ).GetName() ); break; default: @@ -1237,7 +1237,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) // Line strength if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) { - SetMetricValue( *m_pMtrLineWidth, static_cast( rAttrs->Get( XATTR_LINEWIDTH ) ).GetValue(), m_ePoolUnit ); + SetMetricValue( *m_pMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit ); } else m_pMtrLineWidth->SetText( "" ); @@ -1247,7 +1247,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::DONTCARE ) { - Color aCol = static_cast( rAttrs->Get( XATTR_LINECOLOR ) ).GetColorValue(); + Color aCol = rAttrs->Get( XATTR_LINECOLOR ).GetColorValue(); m_pLbColor->SelectEntry( aCol ); } @@ -1260,7 +1260,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { // #86265# select entry using list and polygon, not string bool bSelected(false); - const basegfx::B2DPolyPolygon& rItemPolygon = static_cast(rAttrs->Get(XATTR_LINESTART)).GetLineStartValue(); + const basegfx::B2DPolyPolygon& rItemPolygon = rAttrs->Get(XATTR_LINESTART).GetLineStartValue(); for(long a(0);!bSelected && a < m_pLineEndList->Count(); a++) { @@ -1292,7 +1292,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { // #86265# select entry using list and polygon, not string bool bSelected(false); - const basegfx::B2DPolyPolygon& rItemPolygon = static_cast(rAttrs->Get(XATTR_LINEEND)).GetLineEndValue(); + const basegfx::B2DPolyPolygon& rItemPolygon = rAttrs->Get(XATTR_LINEEND).GetLineEndValue(); for(long a(0);!bSelected && a < m_pLineEndList->Count(); a++) { @@ -1323,7 +1323,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::DONTCARE ) { SetMetricValue( *m_pMtrStartWidth, - static_cast( rAttrs->Get( XATTR_LINESTARTWIDTH ) ).GetValue(), + rAttrs->Get( XATTR_LINESTARTWIDTH ).GetValue(), m_ePoolUnit ); } else @@ -1337,7 +1337,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::DONTCARE ) { SetMetricValue( *m_pMtrEndWidth, - static_cast( rAttrs->Get( XATTR_LINEENDWIDTH ) ).GetValue(), + rAttrs->Get( XATTR_LINEENDWIDTH ).GetValue(), m_ePoolUnit ); } else @@ -1352,7 +1352,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_pTsbCenterStart->EnableTriState( false ); - if( static_cast( rAttrs->Get( XATTR_LINESTARTCENTER ) ).GetValue() ) + if( rAttrs->Get( XATTR_LINESTARTCENTER ).GetValue() ) m_pTsbCenterStart->SetState( TRISTATE_TRUE ); else m_pTsbCenterStart->SetState( TRISTATE_FALSE ); @@ -1371,7 +1371,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) { m_pTsbCenterEnd->EnableTriState( false ); - if( static_cast( rAttrs->Get( XATTR_LINEENDCENTER ) ).GetValue() ) + if( rAttrs->Get( XATTR_LINEENDCENTER ).GetValue() ) m_pTsbCenterEnd->SetState( TRISTATE_TRUE ); else m_pTsbCenterEnd->SetState( TRISTATE_FALSE ); @@ -1384,7 +1384,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) // Transparency if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::DONTCARE ) { - sal_uInt16 nTransp = static_cast( rAttrs->Get( XATTR_LINETRANSPARENCE ) ).GetValue(); + sal_uInt16 nTransp = rAttrs->Get( XATTR_LINETRANSPARENCE ).GetValue(); m_pMtrTransparent->SetValue( nTransp ); ChangeTransparentHdl_Impl( *m_pMtrTransparent ); } @@ -1414,7 +1414,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) } else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINEJOINT)) { - const css::drawing::LineJoint eLineJoint = static_cast(rAttrs->Get(XATTR_LINEJOINT)).GetValue(); + const css::drawing::LineJoint eLineJoint = rAttrs->Get(XATTR_LINEJOINT).GetValue(); switch(eLineJoint) { @@ -1439,7 +1439,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) } else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINECAP)) { - const css::drawing::LineCap eLineCap(static_cast(rAttrs->Get(XATTR_LINECAP)).GetValue()); + const css::drawing::LineCap eLineCap(rAttrs->Get(XATTR_LINECAP).GetValue()); switch(eLineCap) { diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index 70f8bc9fd7af..dd2936a3acae 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -310,7 +310,7 @@ void SvxLineDefTabPage::Reset( const SfxItemSet* rAttrs ) case drawing::LineStyle_DASH: { - const XLineDashItem& rDashItem = static_cast( rAttrs->Get( XATTR_LINEDASH ) ); + const XLineDashItem& rDashItem = rAttrs->Get( XATTR_LINEDASH ); aDash = rDashItem.GetDashValue(); m_pLbLineStyles->SetNoSelection(); diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index 618858fdbf0b..c974cc605c97 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -187,7 +187,7 @@ void SvxPatternTabPage::ActivatePage( const SfxItemSet& rSet ) else aString += aURL.getBase(); - sal_Int32 nPos = SearchPatternList( static_cast( rSet.Get(XATTR_FILLBITMAP)).GetName() ); + sal_Int32 nPos = SearchPatternList( rSet.Get(XATTR_FILLBITMAP).GetName() ); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { sal_uInt16 nId = m_pPatternLB->GetItemId( static_cast( nPos ) ); diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index a9b0880f4dde..c77b4375d307 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -99,27 +99,21 @@ SvxShadowTabPage::SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInA case drawing::FillStyle_SOLID: if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLCOLOR ) ) { - XFillColorItem aColorItem( static_cast( - m_rOutAttrs.Get( XATTR_FILLCOLOR ) ) ); - m_rXFSet.Put( aColorItem ); + m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLCOLOR ) ); } break; case drawing::FillStyle_GRADIENT: if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) ) { - XFillGradientItem aGradientItem( static_cast( - m_rOutAttrs.Get( XATTR_FILLGRADIENT ) ) ); - m_rXFSet.Put( aGradientItem ); + m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLGRADIENT ) ); } break; case drawing::FillStyle_HATCH: if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLHATCH ) ) { - XFillHatchItem aHatchItem( static_cast( - m_rOutAttrs.Get( XATTR_FILLHATCH ) ) ); - m_rXFSet.Put( aHatchItem ); + m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLHATCH ) ); } break; @@ -127,9 +121,7 @@ SvxShadowTabPage::SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInA { if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLBITMAP ) ) { - XFillBitmapItem aBitmapItem( static_cast( - m_rOutAttrs.Get( XATTR_FILLBITMAP ) ) ); - m_rXFSet.Put( aBitmapItem ); + m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLBITMAP ) ); } } break; diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx index 04944de8b95b..4e54d74cc28a 100644 --- a/cui/source/tabpages/tptrans.cxx +++ b/cui/source/tabpages/tptrans.cxx @@ -507,17 +507,17 @@ bool SvxTransparenceTabPage::InitPreview ( const SfxItemSet& rSet ) } // Get fillstyle for preview - rXFSet.Put ( static_cast( rSet.Get(XATTR_FILLSTYLE)) ); - rXFSet.Put ( static_cast( rSet.Get(XATTR_FILLCOLOR)) ); - rXFSet.Put ( static_cast( rSet.Get(XATTR_FILLGRADIENT)) ); - rXFSet.Put ( static_cast( rSet.Get(XATTR_FILLHATCH)) ); - rXFSet.Put ( static_cast(rSet.Get(XATTR_FILLBACKGROUND)) ); - rXFSet.Put ( static_cast( rSet.Get(XATTR_FILLBITMAP)) ); + rXFSet.Put ( rSet.Get(XATTR_FILLSTYLE) ); + rXFSet.Put ( rSet.Get(XATTR_FILLCOLOR) ); + rXFSet.Put ( rSet.Get(XATTR_FILLGRADIENT) ); + rXFSet.Put ( rSet.Get(XATTR_FILLHATCH) ); + rXFSet.Put ( rSet.Get(XATTR_FILLBACKGROUND) ); + rXFSet.Put ( rSet.Get(XATTR_FILLBITMAP) ); m_pCtlXRectPreview->SetAttributes( aXFillAttr.GetItemSet() ); m_pCtlBitmapPreview->SetAttributes( aXFillAttr.GetItemSet() ); - bBitmap = static_cast( rSet.Get(XATTR_FILLSTYLE) ).GetValue() == drawing::FillStyle_BITMAP; + bBitmap = rSet.Get(XATTR_FILLSTYLE).GetValue() == drawing::FillStyle_BITMAP; // show the right preview window if ( bBitmap ) -- cgit v1.2.3