diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-02 15:23:28 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-06 07:52:55 +0200 |
commit | 0745982dc53cce65e63bd05a757aec8e96bcd564 (patch) | |
tree | 54a76476f85c93b2421a0e9fa22135f207784580 /filter/source/msfilter | |
parent | 0096426086e52b962ba53aed2132c2f4d0942aed (diff) |
loplugin: cstylecast
Change-Id: I88a106081b7413bff6313d1e07f53e39d8350002
Diffstat (limited to 'filter/source/msfilter')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 24 | ||||
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 55 | ||||
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 60 |
3 files changed, 71 insertions, 68 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 4a6bc3dd0964..96c114a6be4b 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -570,7 +570,7 @@ void EscherPropertyContainer::CreateFillProperties( SfxItemSet aAttr( pObj->GetMergedItemSet() ); // tranparency with gradient. Means the third setting in transparency page is set bool bTransparentGradient = ( aAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SfxItemState::SET ) && - ( (const XFillFloatTransparenceItem&) aAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled(); + static_cast<const XFillFloatTransparenceItem&>( aAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled(); CreateFillProperties( rXPropSet, bEdge, bTransparentGradient ); } } @@ -1328,7 +1328,7 @@ bool EscherPropertyContainer::CreateMediaGraphicProperties( SdrObject* pSdrMedia( GetSdrObjectFromXShape( rXShape ) ); // SJ: leaving unoapi, because currently there is if ( pSdrMedia && pSdrMedia->ISA( SdrMediaObj ) ) // no access to the native graphic object { - GraphicObject aGraphicObject( ((SdrMediaObj*)pSdrMedia)->getSnapshot() ); + GraphicObject aGraphicObject( static_cast<SdrMediaObj*>(pSdrMedia)->getSnapshot() ); bRetValue = CreateGraphicProperties( rXShape, aGraphicObject ); } } @@ -1844,7 +1844,7 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const ::com::sun::st for( b = 0; b < nInnerSequenceCount; b++) { PolyFlags ePolyFlags( *( (PolyFlags*)pFlags++ ) ); - ::com::sun::star::awt::Point aPoint( (::com::sun::star::awt::Point)*(pArray++) ); + ::com::sun::star::awt::Point aPoint( *(pArray++) ); aPolygon[ b ] = Point( aPoint.X, aPoint.Y ); aPolygon.SetFlags( b, ePolyFlags ); @@ -2577,9 +2577,9 @@ void ConvertEnhancedCustomShapeEquation( SdrObjCustomShape* pCustoShape, { uno::Sequence< OUString > sEquationSource; const OUString sEquations( "Equations" ); - SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)(const SdrCustomShapeGeometryItem&) - pCustoShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); - const uno::Any* pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sEquations ); + const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>( + pCustoShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); + const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sEquations ); if ( pAny ) *pAny >>= sEquationSource; sal_Int32 nEquationSourceCount = sEquationSource.getLength(); @@ -2726,7 +2726,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY ); if ( aXPropSet.is() ) { - SdrObjCustomShape* pCustoShape = (SdrObjCustomShape*)GetSdrObjectFromXShape( rXShape ); + SdrObjCustomShape* pCustoShape = static_cast<SdrObjCustomShape*>(GetSdrObjectFromXShape( rXShape )); if ( !pCustoShape ) return; const OUString sCustomShapeGeometry( "CustomShapeGeometry" ); uno::Any aGeoPropSet = aXPropSet->getPropertyValue( sCustomShapeGeometry ); @@ -3590,7 +3590,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT break; case drawing::TextHorizontalAdjust_BLOCK: { - SdrFitToSizeType eFTS( ((SdrTextFitToSizeTypeItem&)pCustoShape->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )).GetValue() ); + SdrFitToSizeType eFTS( static_cast<const SdrTextFitToSizeTypeItem&>(pCustoShape->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )).GetValue() ); if ( eFTS == SDRTEXTFIT_ALLLINES) { gTextAlign = mso_alignTextStretch; @@ -4742,15 +4742,15 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) SdrObject* pCustoShape( GetSdrObjectFromXShape( aXShape ) ); if ( pCustoShape && pCustoShape->ISA( SdrObjCustomShape ) ) { - SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)(const SdrCustomShapeGeometryItem&) - pCustoShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); + const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>( + pCustoShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); const OUString sPath( "Path" ); const OUString sType( "Type" ); const OUString sGluePointType( "GluePointType" ); OUString sShapeType; - uno::Any* pType = rGeometryItem.GetPropertyValueByName( sType ); + const uno::Any* pType = rGeometryItem.GetPropertyValueByName( sType ); if ( pType ) *pType >>= sShapeType; MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType ); @@ -4792,7 +4792,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) // #i74631# use explicit constructor here. Also XPolyPolygon is not necessary, // reducing to PolyPolygon - const tools::PolyPolygon aPolyPoly(((SdrPathObj*)pPoly)->GetPathPoly()); + const tools::PolyPolygon aPolyPoly(static_cast<SdrPathObj*>(pPoly)->GetPathPoly()); for ( a = 0; a < aPolyPoly.Count(); a++ ) { diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index c3efb0aaa1b2..f76de8cfab5f 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -573,7 +573,8 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) case OBJ_CUSTOMSHAPE : { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)((SdrObjCustomShape*)pO)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const SfxPoolItem& aCustomShape = static_cast<SdrObjCustomShape*>(pO)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); + SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(aCustomShape) ); const OUString sPath( "Path" ); const OUString sGluePointType( "GluePointType" ); sal_Int16 nGluePointType = EnhancedCustomShapeGluePointType::SEGMENTS; @@ -717,7 +718,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) aProp.Value <<= aGluePoints; aGeometryItem.SetPropertyValue( sPath, aProp ); bValidGluePoint = true; - ((SdrObjCustomShape*)pO)->SetMergedItem( aGeometryItem ); + static_cast<SdrObjCustomShape*>(pO)->SetMergedItem( aGeometryItem ); SdrGluePointList* pLst = pO->ForceGluePointList(); if ( pLst->GetCount() > nGluePoints ) nId = (sal_Int32)((*pLst)[ (sal_uInt16)nGluePoints ].GetId() + 3 ); @@ -2715,7 +2716,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem if ( !bRotateTextWithShape ) { const com::sun::star::uno::Any* pAny; - SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&)rSet.Get( SDRATTR_CUSTOMSHAPE_GEOMETRY )); + SdrCustomShapeGeometryItem aGeometryItem(static_cast<const SdrCustomShapeGeometryItem&>(rSet.Get( SDRATTR_CUSTOMSHAPE_GEOMETRY ))); const OUString sTextRotateAngle( "TextRotateAngle" ); pAny = aGeometryItem.GetPropertyValueByName( sTextRotateAngle ); double fExtraTextRotateAngle = 0.0; @@ -3889,7 +3890,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons { pRet = new SdrGrafObj; if( bGrfRead ) - ((SdrGrafObj*)pRet)->SetGraphic( aGraf ); + static_cast<SdrGrafObj*>(pRet)->SetGraphic( aGraf ); if( bLinkGrf && !bGrfRead ) // sj: #i55484# if the graphic was embedded ( bGrfRead == true ) then { // we do not need to set a link. TODO: not to lose the information where the graphic is linked from @@ -3935,15 +3936,15 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons if ( pRet->ISA( SdrGrafObj ) ) { if( aLinkFileName.getLength() ) - ((SdrGrafObj*)pRet)->SetGraphicLink( aLinkFileName, ""/*TODO?*/, aLinkFilterName ); + static_cast<SdrGrafObj*>(pRet)->SetGraphicLink( aLinkFileName, ""/*TODO?*/, aLinkFilterName ); if ( bLinkGrf && !bGrfRead ) { - ((SdrGrafObj*)pRet)->ForceSwapIn(); - Graphic aGraf(((SdrGrafObj*)pRet)->GetGraphic()); + static_cast<SdrGrafObj*>(pRet)->ForceSwapIn(); + Graphic aGraf(static_cast<SdrGrafObj*>(pRet)->GetGraphic()); lcl_ApplyCropping( *this, &rSet, aGraf ); } - ((SdrGrafObj*)pRet)->ForceSwapOut(); + static_cast<SdrGrafObj*>(pRet)->ForceSwapOut(); } return pRet; @@ -4032,9 +4033,9 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r return pRet; sal_Int32 nShapeId; SdrObject* pTmp = ImportGroup( aRecHd2, rSt, pClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId ); - if ( pTmp && pRet && ((SdrObjGroup*)pRet)->GetSubList() ) + if ( pTmp && pRet && static_cast<SdrObjGroup*>(pRet)->GetSubList() ) { - ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pTmp ); + static_cast<SdrObjGroup*>(pRet)->GetSubList()->NbcInsertObject( pTmp ); if( nShapeId ) insertShapeId( nShapeId, pTmp ); } @@ -4045,9 +4046,9 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r return pRet; sal_Int32 nShapeId; SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId ); - if ( pTmp && pRet && ((SdrObjGroup*)pRet)->GetSubList()) + if ( pTmp && pRet && static_cast<SdrObjGroup*>(pRet)->GetSubList()) { - ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pTmp ); + static_cast<SdrObjGroup*>(pRet)->GetSubList()->NbcInsertObject( pTmp ); if( nShapeId ) insertShapeId( nShapeId, pTmp ); } @@ -4294,7 +4295,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r // this should be replaced through "CharacterRotation" // by 90 degrees, therefore a new Item has to be // supported by svx core, api and xml file format - ((SdrObjCustomShape*)pRet)->SetVerticalWriting( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 ); + static_cast<SdrObjCustomShape*>(pRet)->SetVerticalWriting( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 ); if ( SeekToContent( DFF_Prop_gtextUNICODE, rSt ) ) { @@ -4343,14 +4344,14 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r // so we have to calculate the a text direction from string: if ( bIsFontwork ) { - OutlinerParaObject* pParaObj = ((SdrObjCustomShape*)pRet)->GetOutlinerParaObject(); + OutlinerParaObject* pParaObj = static_cast<SdrObjCustomShape*>(pRet)->GetOutlinerParaObject(); if ( pParaObj ) { - SdrOutliner& rOutliner = ((SdrObjCustomShape*)pRet)->ImpGetDrawOutliner(); + SdrOutliner& rOutliner = static_cast<SdrObjCustomShape*>(pRet)->ImpGetDrawOutliner(); bool bOldUpdateMode = rOutliner.GetUpdateMode(); SdrModel* pModel = pRet->GetModel(); if ( pModel ) - rOutliner.SetStyleSheetPool( (SfxStyleSheetPool*)pModel->GetStyleSheetPool() ); + rOutliner.SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(pModel->GetStyleSheetPool()) ); rOutliner.SetUpdateMode( false ); rOutliner.SetText( *pParaObj ); VirtualDevice aVirDev( 1 ); @@ -4375,7 +4376,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r { OutlinerParaObject* pNewText = rOutliner.CreateParaObject(); rOutliner.Init( OUTLINERMODE_TEXTOBJECT ); - ((SdrObjCustomShape*)pRet)->NbcSetOutlinerParaObject( pNewText ); + static_cast<SdrObjCustomShape*>(pRet)->NbcSetOutlinerParaObject( pNewText ); } } rOutliner.Clear(); @@ -4396,7 +4397,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r const OUString sViewBox( "ViewBox" ); const OUString sPath( "Path" ); const OUString sTextFrames( "TextFrames" ); - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)((SdrObjCustomShape*)pRet)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(static_cast<SdrObjCustomShape*>(pRet)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ) ); com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates; com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues; @@ -4561,21 +4562,21 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r aObjData.aBoundRect.Move( aP2.X() - aP1.X(), aP2.Y() - aP1.Y() ); } } - ((SdrObjCustomShape*)pRet)->SetMergedItem( aGeometryItem ); - ((SdrObjCustomShape*)pRet)->MergeDefaultAttributes(); + static_cast<SdrObjCustomShape*>(pRet)->SetMergedItem( aGeometryItem ); + static_cast<SdrObjCustomShape*>(pRet)->MergeDefaultAttributes(); // now setting a new name, so the above correction is only done once when importing from ms - SdrCustomShapeGeometryItem aGeoName( (SdrCustomShapeGeometryItem&)((SdrObjCustomShape*)pRet)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + SdrCustomShapeGeometryItem aGeoName( static_cast<const SdrCustomShapeGeometryItem&>(static_cast<SdrObjCustomShape*>(pRet)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ) ); const OUString sType( "Type" ); const OUString sName( "mso-spt100" ); PropertyValue aPropVal; aPropVal.Name = sType; aPropVal.Value <<= sName; aGeoName.SetPropertyValue( aPropVal ); - ((SdrObjCustomShape*)pRet)->SetMergedItem( aGeoName ); + static_cast<SdrObjCustomShape*>(pRet)->SetMergedItem( aGeoName ); } else - ((SdrObjCustomShape*)pRet)->MergeDefaultAttributes(); + static_cast<SdrObjCustomShape*>(pRet)->MergeDefaultAttributes(); pRet->SetSnapRect( aObjData.aBoundRect ); EnhancedCustomShape2d aCustomShape2d( pRet ); @@ -4615,8 +4616,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r // connectors MSO_ConnectorStyle eConnectorStyle = (MSO_ConnectorStyle)GetPropertyValue( DFF_Prop_cxstyle, mso_cxstyleStraight ); - ((SdrEdgeObj*)pRet)->ConnectToNode(true, NULL); - ((SdrEdgeObj*)pRet)->ConnectToNode(false, NULL); + static_cast<SdrEdgeObj*>(pRet)->ConnectToNode(true, NULL); + static_cast<SdrEdgeObj*>(pRet)->ConnectToNode(false, NULL); Point aPoint1( aObjData.aBoundRect.TopLeft() ); Point aPoint2( aObjData.aBoundRect.BottomRight() ); @@ -4681,13 +4682,13 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r aSet.Put( SdrEdgeNode2HorzDistItem( n2HorzDist ) ); aSet.Put( SdrEdgeNode2VertDistItem( n2VertDist ) ); - ((SdrEdgeObj*)pRet)->SetEdgeTrackPath( aPoly ); + static_cast<SdrEdgeObj*>(pRet)->SetEdgeTrackPath( aPoly ); pRet->SetMergedItemSet( aSet ); } if ( aObjData.eShapeType == mso_sptLine ) { pRet->SetMergedItemSet(aSet); - ((SdrObjCustomShape*)pRet)->MergeDefaultAttributes(); + static_cast<SdrObjCustomShape*>(pRet)->MergeDefaultAttributes(); } } } diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index a098b94fe6b6..841a0ef4a541 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -755,11 +755,11 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi case PPT_PST_RecolorInfoAtom : { - if ( pRet && ( pRet->ISA( SdrGrafObj ) && ((SdrGrafObj*)pRet)->HasGDIMetaFile() ) ) + if ( pRet && ( pRet->ISA( SdrGrafObj ) && static_cast<SdrGrafObj*>(pRet)->HasGDIMetaFile() ) ) { - Graphic aGraphic( ((SdrGrafObj*)pRet)->GetGraphic() ); + Graphic aGraphic( static_cast<SdrGrafObj*>(pRet)->GetGraphic() ); RecolorGraphic( rSt, aClientDataHd.nRecLen, aGraphic ); - ((SdrGrafObj*)pRet)->SetGraphic( aGraphic ); + static_cast<SdrGrafObj*>(pRet)->SetGraphic( aGraphic ); } } break; @@ -780,7 +780,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi else { // try to load some ppt text - PPTTextObj aTextObj( rSt, (SdrPowerPointImport&)*this, rPersistEntry, &rObjData ); + PPTTextObj aTextObj( rSt, static_cast<SdrPowerPointImport&>(*this), rPersistEntry, &rObjData ); if ( ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() ) ) { bool bVerticalText = false; @@ -5576,7 +5576,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, s pItemSet->GetItemState( XATTR_FILLSTYLE, false, &pFillStyleItem ); if ( pFillStyleItem ) { - drawing::FillStyle eFillStyle = ((XFillStyleItem*)pFillStyleItem)->GetValue(); + drawing::FillStyle eFillStyle = static_cast<const XFillStyleItem*>(pFillStyleItem)->GetValue(); switch( eFillStyle ) { case drawing::FillStyle_SOLID : @@ -5584,7 +5584,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, s const SfxPoolItem* pFillColorItem = NULL; pItemSet->GetItemState( XATTR_FILLCOLOR, false, &pFillColorItem ); if ( pFillColorItem ) - aDefColor = ((XColorItem*)pFillColorItem)->GetColorValue(); + aDefColor = static_cast<const XColorItem*>(pFillColorItem)->GetColorValue(); } break; case drawing::FillStyle_GRADIENT : @@ -5592,7 +5592,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, s const SfxPoolItem* pGradientItem = NULL; pItemSet->GetItemState( XATTR_FILLGRADIENT, false, &pGradientItem ); if ( pGradientItem ) - aDefColor = ((XFillGradientItem*)pGradientItem)->GetGradientValue().GetStartColor(); + aDefColor = static_cast<const XFillGradientItem*>(pGradientItem)->GetGradientValue().GetStartColor(); } break; case drawing::FillStyle_HATCH : @@ -6848,7 +6848,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport if (!(*FE)->pField1) break; - const SvxURLField* pField = (const SvxURLField*)(*FE)->pField1->GetField(); + const SvxURLField* pField = static_cast<const SvxURLField*>((*FE)->pField1->GetField()); pCurrent->mbIsHyperlink = true; pCurrent->mnHylinkOrigColor = pCurrent->pCharSet->mnColor; @@ -7006,7 +7006,9 @@ PPTTextObj& PPTTextObj::operator=( PPTTextObj& rTextObj ) bool IsLine( const SdrObject* pObj ) { - return pObj->ISA( SdrPathObj ) && ((SdrPathObj*)pObj)->IsLine() && (((SdrPathObj*)pObj)->GetPointCount() == 2 ); + return pObj->ISA( SdrPathObj ) && + static_cast<const SdrPathObj*>(pObj)->IsLine() && + static_cast<const SdrPathObj*>(pObj)->GetPointCount() == 2; } bool GetCellPosition( const SdrObject* pObj, const std::set< sal_Int32 >& rRows, const std::set< sal_Int32 >& rColumns, @@ -7142,8 +7144,8 @@ void GetLinePositions( const SdrObject* pObj, const std::set< sal_Int32 >& rRows else { sal_uInt32 nPosition = 0; - Point aPt1( ((SdrPathObj*)pObj)->GetPoint( 0 ) ); - Point aPt2( ((SdrPathObj*)pObj)->GetPoint( 1 ) ); + Point aPt1( static_cast<const SdrPathObj*>(pObj)->GetPoint( 0 ) ); + Point aPt2( static_cast<const SdrPathObj*>(pObj)->GetPoint( 1 ) ); if ( aPt1.X() < aPt2.X() ) nPosition |= aPt1.Y() < aPt2.Y() ? LinePositionTLBR : LinePositionBLTR; else @@ -7232,10 +7234,10 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) { Reference< XPropertySet > xPropSet( xCell, UNO_QUERY_THROW ); - const sal_Int32 nLeftDist(((const SdrMetricItem&)pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST)).GetValue()); - const sal_Int32 nRightDist(((const SdrMetricItem&)pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST)).GetValue()); - const sal_Int32 nUpperDist(((const SdrMetricItem&)pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST)).GetValue()); - const sal_Int32 nLowerDist(((const SdrMetricItem&)pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST)).GetValue()); + const sal_Int32 nLeftDist(static_cast<const SdrMetricItem&>(pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST)).GetValue()); + const sal_Int32 nRightDist(static_cast<const SdrMetricItem&>(pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST)).GetValue()); + const sal_Int32 nUpperDist(static_cast<const SdrMetricItem&>(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST)).GetValue()); + const sal_Int32 nLowerDist(static_cast<const SdrMetricItem&>(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST)).GetValue()); static const OUString sTopBorder( "TextUpperDistance" ); static const OUString sBottomBorder( "TextLowerDistance" ); static const OUString sLeftBorder( "TextLeftDistance" ); @@ -7246,7 +7248,7 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) xPropSet->setPropertyValue( sBottomBorder, Any( nLowerDist ) ); static const OUString sTextVerticalAdjust( "TextVerticalAdjust" ); - const SdrTextVertAdjust eTextVertAdjust(((const SdrTextVertAdjustItem&)pObj->GetMergedItem(SDRATTR_TEXT_VERTADJUST)).GetValue()); + const SdrTextVertAdjust eTextVertAdjust(static_cast<const SdrTextVertAdjustItem&>(pObj->GetMergedItem(SDRATTR_TEXT_VERTADJUST)).GetValue()); drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP ); if ( eTextVertAdjust == SDRTEXTVERTADJUST_CENTER ) eVA = drawing::TextVerticalAdjust_CENTER; @@ -7255,8 +7257,8 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) xPropSet->setPropertyValue( sTextVerticalAdjust, Any( eVA ) ); //set textHorizontalAdjust and TextWritingMode attr - const sal_Int32 eHA(((const SdrTextHorzAdjustItem&)pObj->GetMergedItem(SDRATTR_TEXT_HORZADJUST)).GetValue()); - const SvxFrameDirection eDirection = (const SvxFrameDirection)((( const SvxFrameDirectionItem&)pObj->GetMergedItem(EE_PARA_WRITINGDIR)).GetValue()); + const sal_Int32 eHA(static_cast<const SdrTextHorzAdjustItem&>(pObj->GetMergedItem(SDRATTR_TEXT_HORZADJUST)).GetValue()); + const SvxFrameDirection eDirection = (const SvxFrameDirection)(static_cast<const SvxFrameDirectionItem&>(pObj->GetMergedItem(EE_PARA_WRITINGDIR)).GetValue()); static const OUString sHorizontalAdjust( "TextHorizontalAdjust" ); static const OUString sWritingMode( "TextWritingMode" ); xPropSet->setPropertyValue( sHorizontalAdjust , Any( eHA ) ); @@ -7265,7 +7267,7 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) xPropSet->setPropertyValue( sWritingMode , Any( ::com::sun::star::text::WritingMode_TB_RL ) ); } SfxItemSet aSet( pObj->GetMergedItemSet() ); - drawing::FillStyle eFillStyle(((XFillStyleItem&)pObj->GetMergedItem( XATTR_FILLSTYLE )).GetValue()); + drawing::FillStyle eFillStyle(static_cast<const XFillStyleItem&>(pObj->GetMergedItem( XATTR_FILLSTYLE )).GetValue()); ::com::sun::star::drawing::FillStyle eFS( com::sun::star::drawing::FillStyle_NONE ); switch( eFillStyle ) { @@ -7273,7 +7275,7 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) { static const OUString sFillColor( "FillColor" ); eFS = com::sun::star::drawing::FillStyle_SOLID; - Color aFillColor( ((XFillColorItem&)pObj->GetMergedItem( XATTR_FILLCOLOR )).GetColorValue() ); + Color aFillColor( static_cast<const XFillColorItem&>(pObj->GetMergedItem( XATTR_FILLCOLOR )).GetColorValue() ); sal_Int32 nFillColor( aFillColor.GetColor() ); xPropSet->setPropertyValue( sFillColor, Any( nFillColor ) ); } @@ -7281,7 +7283,7 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) case drawing::FillStyle_GRADIENT : { eFS = com::sun::star::drawing::FillStyle_GRADIENT; - XGradient aXGradient(((const XFillGradientItem&)pObj->GetMergedItem(XATTR_FILLGRADIENT)).GetGradientValue()); + XGradient aXGradient(static_cast<const XFillGradientItem&>(pObj->GetMergedItem(XATTR_FILLGRADIENT)).GetGradientValue()); com::sun::star::awt::Gradient aGradient; aGradient.Style = (awt::GradientStyle) aXGradient.GetGradientStyle(); @@ -7306,7 +7308,7 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) { eFS = com::sun::star::drawing::FillStyle_BITMAP; - const XFillBitmapItem aXFillBitmapItem((const XFillBitmapItem&)pObj->GetMergedItem( XATTR_FILLBITMAP )); + const XFillBitmapItem aXFillBitmapItem(static_cast<const XFillBitmapItem&>(pObj->GetMergedItem( XATTR_FILLBITMAP ))); OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX); aURL += OStringToOUString( aXFillBitmapItem.GetGraphicObject().GetUniqueID(), @@ -7314,8 +7316,8 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) xPropSet->setPropertyValue("FillBitmapURL", Any( aURL ) ); - const XFillBmpStretchItem aStretchItem(( const XFillBmpStretchItem&)pObj->GetMergedItem( XATTR_FILLBMP_STRETCH )); - const XFillBmpTileItem aTileItem(( const XFillBmpTileItem&)pObj->GetMergedItem( XATTR_FILLBMP_TILE )); + const XFillBmpStretchItem aStretchItem(static_cast<const XFillBmpStretchItem&>(pObj->GetMergedItem( XATTR_FILLBMP_STRETCH ))); + const XFillBmpTileItem aTileItem(static_cast<const XFillBmpTileItem&>(pObj->GetMergedItem( XATTR_FILLBMP_TILE ))); if( aTileItem.GetValue() ) xPropSet->setPropertyValue( "FillBitmapMode", Any( com::sun::star::drawing::BitmapMode_REPEAT ) ); else if( aStretchItem.GetValue() ) @@ -7334,7 +7336,7 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) xPropSet->setPropertyValue( sFillStyle, Any( eFS ) ); if ( eFillStyle != drawing::FillStyle_NONE ) { - sal_Int16 nFillTransparence( ( (const XFillTransparenceItem&)pObj->GetMergedItem( XATTR_FILLTRANSPARENCE ) ).GetValue() ); + sal_Int16 nFillTransparence( static_cast<const XFillTransparenceItem&>(pObj->GetMergedItem( XATTR_FILLTRANSPARENCE ) ).GetValue() ); static const OUString sFillTransparence( "FillTransparence" ); xPropSet->setPropertyValue( sFillTransparence, Any( nFillTransparence ) ); } @@ -7349,17 +7351,17 @@ void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable >& xTabl try { SfxItemSet aSet( pLine->GetMergedItemSet() ); - XLineStyle eLineStyle(((XLineStyleItem&)pLine->GetMergedItem( XATTR_LINESTYLE )).GetValue()); + XLineStyle eLineStyle(static_cast<const XLineStyleItem&>(pLine->GetMergedItem( XATTR_LINESTYLE )).GetValue()); com::sun::star::table::BorderLine2 aBorderLine; switch( eLineStyle ) { case XLINE_DASH : case XLINE_SOLID : { - Color aLineColor( ((XLineColorItem&)pLine->GetMergedItem( XATTR_LINECOLOR )).GetColorValue() ); + Color aLineColor( static_cast<const XLineColorItem&>(pLine->GetMergedItem( XATTR_LINECOLOR )).GetColorValue() ); aBorderLine.Color = aLineColor.GetColor(); // Avoid width = 0, the min value should be 1. - sal_Int32 nLineWidth = std::max(sal_Int32(1), ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() / 4); + sal_Int32 nLineWidth = std::max(sal_Int32(1), static_cast<const XLineWidthItem&>(pLine->GetMergedItem(XATTR_LINEWIDTH)) .GetValue() / 4); aBorderLine.LineWidth = static_cast< sal_Int16 >( nLineWidth ); aBorderLine.LineStyle = eLineStyle == XLINE_SOLID ? table::BorderLineStyle::SOLID : table::BorderLineStyle::DASHED; } @@ -7414,7 +7416,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab sal_uInt32 nRows = pTableArry[ 1 ]; if ( nRows && pGroup->ISA( SdrObjGroup ) ) { - SdrObjList* pSubList(((SdrObjGroup*)pGroup)->GetSubList()); + SdrObjList* pSubList(static_cast<SdrObjGroup*>(pGroup)->GetSubList()); if ( pSubList ) { std::set< sal_Int32 > aRows; |