diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-16 16:16:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-20 09:43:25 +0100 |
commit | 0f0049d77a0ee6ae936922213c7290d0bc4fee29 (patch) | |
tree | 21ec8c68606453166de7557afa394054907d9c85 /svx/source/customshapes | |
parent | 21e85d591f344958c3ebee9422ba15dbd931f2cc (diff) |
TypedWhichId for XATTR* constants
Change-Id: Ie9d637d701b77a549de3b00956f9c74ee8bd08c1
Reviewed-on: https://gerrit.libreoffice.org/44830
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/customshapes')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 30 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape3d.cxx | 23 |
2 files changed, 26 insertions, 27 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index ca42063e3096..e39e85e7fa05 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -702,8 +702,8 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : nXRef ( 0x80000000 ), nYRef ( 0x80000000 ), nColorData ( 0 ), - bFilled ( static_cast<const XFillStyleItem&>(pAObj->GetMergedItem( XATTR_FILLSTYLE )).GetValue() != drawing::FillStyle_NONE ), - bStroked ( static_cast<const XLineStyleItem&>(pAObj->GetMergedItem( XATTR_LINESTYLE )).GetValue() != drawing::LineStyle_NONE ), + bFilled ( pAObj->GetMergedItem( XATTR_FILLSTYLE ).GetValue() != drawing::FillStyle_NONE ), + bStroked ( pAObj->GetMergedItem( XATTR_LINESTYLE ).GetValue() != drawing::LineStyle_NONE ), bFlipH ( false ), bFlipV ( false ) { @@ -1388,14 +1388,14 @@ bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nIndex void EnhancedCustomShape2d::SwapStartAndEndArrow( SdrObject* pObj ) //#108274 { XLineStartItem aLineStart; - aLineStart.SetLineStartValue(static_cast<const XLineEndItem&>(pObj->GetMergedItem( XATTR_LINEEND )).GetLineEndValue()); - XLineStartWidthItem aLineStartWidth(static_cast<const XLineEndWidthItem&>(pObj->GetMergedItem( XATTR_LINEENDWIDTH )).GetValue()); - XLineStartCenterItem aLineStartCenter(static_cast<const XLineEndCenterItem&>(pObj->GetMergedItem( XATTR_LINEENDCENTER )).GetValue()); + aLineStart.SetLineStartValue(pObj->GetMergedItem( XATTR_LINEEND ).GetLineEndValue()); + XLineStartWidthItem aLineStartWidth(pObj->GetMergedItem( XATTR_LINEENDWIDTH ).GetValue()); + XLineStartCenterItem aLineStartCenter(pObj->GetMergedItem( XATTR_LINEENDCENTER ).GetValue()); XLineEndItem aLineEnd; - aLineEnd.SetLineEndValue(static_cast<const XLineStartItem&>(pObj->GetMergedItem( XATTR_LINESTART )).GetLineStartValue()); - XLineEndWidthItem aLineEndWidth(static_cast<const XLineStartWidthItem&>(pObj->GetMergedItem( XATTR_LINESTARTWIDTH )).GetValue()); - XLineEndCenterItem aLineEndCenter(static_cast<const XLineStartCenterItem&>(pObj->GetMergedItem( XATTR_LINESTARTCENTER )).GetValue()); + aLineEnd.SetLineEndValue(pObj->GetMergedItem( XATTR_LINESTART ).GetLineStartValue()); + XLineEndWidthItem aLineEndWidth(pObj->GetMergedItem( XATTR_LINESTARTWIDTH ).GetValue()); + XLineEndCenterItem aLineEndCenter(pObj->GetMergedItem( XATTR_LINESTARTCENTER ).GetValue()); pObj->SetMergedItem( aLineStart ); pObj->SetMergedItem( aLineStartWidth ); @@ -2147,7 +2147,7 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC { if ( !rObj.IsLine() ) { - const drawing::FillStyle eFillStyle = static_cast<const XFillStyleItem&>(rObj.GetMergedItem(XATTR_FILLSTYLE)).GetValue(); + const drawing::FillStyle eFillStyle = rObj.GetMergedItem(XATTR_FILLSTYLE).GetValue(); switch( eFillStyle ) { default: @@ -2157,7 +2157,7 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC if ( nColorCount || rObj.GetBrightness() != 0.0 ) { aFillColor = GetColorData( - static_cast<const XFillColorItem&>(rCustomShapeSet.Get( XATTR_FILLCOLOR )).GetColorValue(), + rCustomShapeSet.Get( XATTR_FILLCOLOR ).GetColorValue(), std::min(nColorIndex, nColorCount-1), rObj.GetBrightness() ); rObj.SetMergedItem( XFillColorItem( "", aFillColor ) ); } @@ -2165,7 +2165,7 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC } case drawing::FillStyle_GRADIENT: { - XGradient aXGradient(static_cast<const XFillGradientItem&>(rObj.GetMergedItem(XATTR_FILLGRADIENT)).GetGradientValue()); + XGradient aXGradient(rObj.GetMergedItem(XATTR_FILLGRADIENT).GetGradientValue()); if ( nColorCount || rObj.GetBrightness() != 0.0 ) { aXGradient.SetStartColor( @@ -2183,7 +2183,7 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC } case drawing::FillStyle_HATCH: { - XHatch aXHatch(static_cast<const XFillHatchItem&>(rObj.GetMergedItem(XATTR_FILLHATCH)).GetHatchValue()); + XHatch aXHatch(rObj.GetMergedItem(XATTR_FILLHATCH).GetHatchValue()); if ( nColorCount || rObj.GetBrightness() != 0.0 ) { aXHatch.SetColor( @@ -2199,7 +2199,7 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC { if ( nColorCount || rObj.GetBrightness() != 0.0 ) { - Bitmap aBitmap(static_cast<const XFillBitmapItem&>(rObj.GetMergedItem(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap()); + Bitmap aBitmap(rObj.GetMergedItem(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap()); aBitmap.Adjust( static_cast< short > ( GetLuminanceChange( @@ -2251,8 +2251,8 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( bool bLineGeometryNeededOnly ) for(SdrPathObj* pObj : vObjectList) { - const drawing::LineStyle eLineStyle =static_cast<const XLineStyleItem&>(pObj->GetMergedItem(XATTR_LINESTYLE)).GetValue(); - const drawing::FillStyle eFillStyle = static_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE)).GetValue(); + const drawing::LineStyle eLineStyle = pObj->GetMergedItem(XATTR_LINESTYLE).GetValue(); + const drawing::FillStyle eFillStyle = pObj->GetMergedItem(XATTR_FILLSTYLE).GetValue(); // #i40600# if bLineGeometryNeededOnly is set, linestyle does not matter if( !bLineGeometryNeededOnly && ( drawing::LineStyle_NONE == eLineStyle ) && ( drawing::FillStyle_NONE == eFillStyle ) ) diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 9a048049c370..bbc9ad4f7320 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -57,7 +57,6 @@ #include <svx/xlntrit.hxx> #include <svx/xfltrit.hxx> -#define ITEMVALUE(ItemSet,Id,Cast) (static_cast<const Cast&>((ItemSet).Get(Id))).GetValue() using namespace com::sun::star; using namespace com::sun::star::uno; @@ -331,7 +330,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con drawing::ShadeMode eShadeMode( GetShadeMode( rGeometryItem, drawing::ShadeMode_FLAT ) ); bool bUseExtrusionColor = GetBool( rGeometryItem, "Color", false ); - drawing::FillStyle eFillStyle( ITEMVALUE( aSet, XATTR_FILLSTYLE, XFillStyleItem ) ); + drawing::FillStyle eFillStyle( aSet.Get(XATTR_FILLSTYLE).GetValue() ); pScene->GetProperties().SetObjectItem( Svx3DShadeModeItem( 0 ) ); aSet.Put( makeSvx3DPercentDiagonalItem( 0 ) ); aSet.Put( Svx3DTextureModeItem( 1 ) ); @@ -371,8 +370,8 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con while( aIter.IsMore() ) { const SdrObject* pNext = aIter.Next(); - bool bIsPlaceholderObject = (static_cast<const XFillStyleItem&>(pNext->GetMergedItem( XATTR_FILLSTYLE )).GetValue() == drawing::FillStyle_NONE ) - && (static_cast<const XLineStyleItem&>(pNext->GetMergedItem( XATTR_LINESTYLE )).GetValue() == drawing::LineStyle_NONE ); + bool bIsPlaceholderObject = (pNext->GetMergedItem( XATTR_FILLSTYLE ).GetValue() == drawing::FillStyle_NONE ) + && (pNext->GetMergedItem( XATTR_LINESTYLE ).GetValue() == drawing::LineStyle_NONE ); basegfx::B2DPolyPolygon aPolyPoly; SfxItemSet aLocalSet(aSet); drawing::FillStyle aLocalFillStyle(eFillStyle); @@ -388,7 +387,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con // invisible (all this 'hidden' logic should be migrated to primitives). if(!bMultipleSubObjects) { - const drawing::FillStyle eStyle(static_cast<const XFillStyleItem&>(rSet.Get(XATTR_FILLSTYLE)).GetValue()); + const drawing::FillStyle eStyle(rSet.Get(XATTR_FILLSTYLE).GetValue()); if(drawing::FillStyle_NONE == eStyle) { @@ -435,9 +434,9 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con // switch from line to fill, copy line attr to fill attr (color, transparence) aLocalSet.Put(XLineWidthItem(0)); aLocalSet.Put(XLineStyleItem(drawing::LineStyle_NONE)); - aLocalSet.Put(XFillColorItem(OUString(), static_cast<const XLineColorItem&>(aLocalSet.Get(XATTR_LINECOLOR)).GetColorValue())); + aLocalSet.Put(XFillColorItem(OUString(), aLocalSet.Get(XATTR_LINECOLOR).GetColorValue())); aLocalSet.Put(XFillStyleItem(drawing::FillStyle_SOLID)); - aLocalSet.Put(XFillTransparenceItem(static_cast<const XLineTransparenceItem&>(aLocalSet.Get(XATTR_LINETRANSPARENCE)).GetValue())); + aLocalSet.Put(XFillTransparenceItem(aLocalSet.Get(XATTR_LINETRANSPARENCE).GetValue())); aLocalFillStyle = drawing::FillStyle_SOLID; } } @@ -486,10 +485,10 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con else if ( bUseTwoFillStyles ) { BitmapEx aFillBmp; - bool bFillBmpTile = static_cast<const XFillBmpTileItem&>(p3DObj->GetMergedItem( XATTR_FILLBMP_TILE )).GetValue(); + bool bFillBmpTile = p3DObj->GetMergedItem( XATTR_FILLBMP_TILE ).GetValue(); if ( bFillBmpTile ) { - const XFillBitmapItem& rBmpItm = static_cast<const XFillBitmapItem&>(p3DObj->GetMergedItem(XATTR_FILLBITMAP)); + const XFillBitmapItem& rBmpItm = p3DObj->GetMergedItem(XATTR_FILLBITMAP); aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); // #i122777# old adaption of FillStyle bitmap size to 5-times the original size; this is not needed @@ -511,7 +510,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con { if ( aSnapRect != aBoundRect && aSnapRect.GetWidth() > 0 && aSnapRect.GetHeight() > 0) { - const XFillBitmapItem& rBmpItm = static_cast<const XFillBitmapItem&>(p3DObj->GetMergedItem(XATTR_FILLBITMAP)); + const XFillBitmapItem& rBmpItm = p3DObj->GetMergedItem(XATTR_FILLBITMAP); aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); Size aBmpSize( aFillBmp.GetSizePixel() ); double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth(); @@ -531,7 +530,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con p3DObj->NbcSetLayer( pShape2d->GetLayer() ); p3DObj->SetMergedItemSet( aLocalSet ); if ( bUseExtrusionColor ) - p3DObj->SetMergedItem( XFillColorItem( "", static_cast<const XSecondaryFillColorItem&>(pCustomShape->GetMergedItem( XATTR_SECONDARYFILLCOLOR )).GetColorValue() ) ); + p3DObj->SetMergedItem( XFillColorItem( "", pCustomShape->GetMergedItem( XATTR_SECONDARYFILLCOLOR ).GetColorValue() ) ); p3DObj->SetMergedItem( XFillStyleItem( drawing::FillStyle_SOLID ) ); p3DObj->SetMergedItem( Svx3DCloseFrontItem( false ) ); p3DObj->SetMergedItem( Svx3DCloseBackItem( false ) ); @@ -554,7 +553,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con } else if ( aLocalFillStyle == drawing::FillStyle_NONE ) { - const XLineColorItem& rLineColor = static_cast<const XLineColorItem&>(p3DObj->GetMergedItem( XATTR_LINECOLOR )); + const XLineColorItem& rLineColor = p3DObj->GetMergedItem( XATTR_LINECOLOR ); p3DObj->SetMergedItem( XFillColorItem( "", rLineColor.GetColorValue() ) ); p3DObj->SetMergedItem( makeSvx3DDoubleSidedItem( true ) ); p3DObj->SetMergedItem( Svx3DCloseFrontItem( false ) ); |