diff options
author | Noel Grandin <noel@peralex.com> | 2014-10-17 12:22:22 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-20 13:33:57 +0200 |
commit | b0509439d9fa664be8f94b557d83ea3a2891c31f (patch) | |
tree | e801f2a265b11a8abfb665f78683fc4a83ef1616 /svx | |
parent | 8c8d6f08491479c23998cbfb96201f12acbd873a (diff) |
loplugin: cstylecast
Change-Id: I2cb764db97469654f977de63e273874d43745bf8
Diffstat (limited to 'svx')
23 files changed, 182 insertions, 189 deletions
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 5fd38f9d77ae..78dfb9c16305 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -233,7 +233,7 @@ namespace sdr void CellProperties::ItemSetChanged(const SfxItemSet& rSet ) { - SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); + SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); if( mxCell.is() ) { @@ -303,9 +303,9 @@ namespace sdr { if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich)) { - bool bVertical(com::sun::star::text::WritingMode_TB_RL == ((SvxWritingModeItem*)pNewItem)->GetValue()); + bool bVertical(com::sun::star::text::WritingMode_TB_RL == static_cast<const SvxWritingModeItem*>(pNewItem)->GetValue()); - sdr::table::SdrTableObj& rObj = (sdr::table::SdrTableObj&)GetSdrObject(); + sdr::table::SdrTableObj& rObj = static_cast<sdr::table::SdrTableObj&>(GetSdrObject()); if( rObj.IsVerticalWriting() != bVertical ) rObj.SetVerticalWriting(bVertical); @@ -740,42 +740,42 @@ sal_Int32 Cell::getMinimumHeight() long Cell::GetTextLeftDistance() const { - return ((SdrMetricItem&)(GetItemSet().Get(SDRATTR_TEXT_LEFTDIST))).GetValue(); + return static_cast<const SdrMetricItem&>(GetItemSet().Get(SDRATTR_TEXT_LEFTDIST)).GetValue(); } long Cell::GetTextRightDistance() const { - return ((SdrMetricItem&)(GetItemSet().Get(SDRATTR_TEXT_RIGHTDIST))).GetValue(); + return static_cast<const SdrMetricItem&>(GetItemSet().Get(SDRATTR_TEXT_RIGHTDIST)).GetValue(); } long Cell::GetTextUpperDistance() const { - return ((SdrMetricItem&)(GetItemSet().Get(SDRATTR_TEXT_UPPERDIST))).GetValue(); + return static_cast<const SdrMetricItem&>(GetItemSet().Get(SDRATTR_TEXT_UPPERDIST)).GetValue(); } long Cell::GetTextLowerDistance() const { - return ((SdrMetricItem&)(GetItemSet().Get(SDRATTR_TEXT_LOWERDIST))).GetValue(); + return static_cast<const SdrMetricItem&>(GetItemSet().Get(SDRATTR_TEXT_LOWERDIST)).GetValue(); } SdrTextVertAdjust Cell::GetTextVerticalAdjust() const { - return ((SdrTextVertAdjustItem&)(GetItemSet().Get(SDRATTR_TEXT_VERTADJUST))).GetValue(); + return static_cast<const SdrTextVertAdjustItem&>(GetItemSet().Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); } SdrTextHorzAdjust Cell::GetTextHorizontalAdjust() const { - return ((SdrTextHorzAdjustItem&)(GetItemSet().Get(SDRATTR_TEXT_HORZADJUST))).GetValue(); + return static_cast<const SdrTextHorzAdjustItem&>(GetItemSet().Get(SDRATTR_TEXT_HORZADJUST)).GetValue(); } @@ -1423,7 +1423,7 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) th case XATTR_FILLHATCH: case XATTR_LINEDASH: { - NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID); + const NameOrIndex* pItem = static_cast<const NameOrIndex*>(rSet.GetItem((sal_uInt16)pMap->nWID)); if( ( pItem == NULL ) || pItem->GetName().isEmpty() ) eState = PropertyState_DEFAULT_VALUE; } @@ -1438,7 +1438,7 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) th case XATTR_LINESTART: case XATTR_FILLFLOATTRANSPARENCE: { - NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID); + const NameOrIndex* pItem = static_cast<const NameOrIndex*>(rSet.GetItem((sal_uInt16)pMap->nWID)); if( pItem == NULL ) eState = PropertyState_DEFAULT_VALUE; } diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 7260c0aaab42..ac5a02dd7fe6 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1361,7 +1361,7 @@ void SdrTableObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const rInfo.bTransparenceAllowed = true; // gradient depends on fillstyle - drawing::FillStyle eFillStyle = ((XFillStyleItem&)(GetObjectItem(XATTR_FILLSTYLE))).GetValue(); + drawing::FillStyle eFillStyle = static_cast<const XFillStyleItem&>(GetObjectItem(XATTR_FILLSTYLE)).GetValue(); rInfo.bGradientAllowed = (eFillStyle == drawing::FillStyle_GRADIENT); rInfo.bShearAllowed =false; rInfo.bEdgeRadiusAllowed=false; @@ -2467,7 +2467,7 @@ void SdrTableObj::SaveGeoData(SdrObjGeoData& rGeo) const DBG_ASSERT( dynamic_cast< TableObjectGeoData* >( &rGeo ), "svx::SdrTableObj::SaveGeoData(), illegal geo data!" ); SdrTextObj::SaveGeoData (rGeo); - ((TableObjectGeoData &) rGeo).maLogicRect = maLogicRect; + static_cast<TableObjectGeoData &>(rGeo).maLogicRect = maLogicRect; } @@ -2476,7 +2476,7 @@ void SdrTableObj::RestGeoData(const SdrObjGeoData& rGeo) { DBG_ASSERT( dynamic_cast< const TableObjectGeoData* >( &rGeo ), "svx::SdrTableObj::SaveGeoData(), illegal geo data!" ); - maLogicRect = ((TableObjectGeoData &) rGeo).maLogicRect; + maLogicRect = static_cast<const TableObjectGeoData &>(rGeo).maLogicRect; SdrTextObj::RestGeoData (rGeo); diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 980b72874a57..3cd25b4505b0 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -423,7 +423,7 @@ void SvxTableController::GetState( SfxItemSet& rSet ) SdrTextVertAdjust eAdj = SDRTEXTVERTADJUST_BLOCK; if( pSet->GetItemState( SDRATTR_TEXT_VERTADJUST ) != SfxItemState::DONTCARE ) - eAdj = ((SdrTextVertAdjustItem&)(pSet->Get(SDRATTR_TEXT_VERTADJUST))).GetValue(); + eAdj = static_cast<const SdrTextVertAdjustItem&>(pSet->Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); rSet.Put(SfxBoolItem(SID_TABLE_VERT_BOTTOM, eAdj == SDRTEXTVERTADJUST_BOTTOM)); rSet.Put(SfxBoolItem(SID_TABLE_VERT_CENTER, eAdj == SDRTEXTVERTADJUST_CENTER)); @@ -504,9 +504,9 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) pArgs->GetItemState(nSId, false, &pItem); if (pItem) { - nCount = ((const SfxInt16Item* )pItem)->GetValue(); + nCount = static_cast<const SfxInt16Item*>(pItem)->GetValue(); if(SfxItemState::SET == pArgs->GetItemState(SID_TABLE_PARAM_INSERT_AFTER, true, &pItem)) - bInsertAfter = ((const SfxBoolItem* )pItem)->GetValue(); + bInsertAfter = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } } @@ -868,10 +868,10 @@ void SvxTableController::onFormatTable( SfxRequest& rReq ) // merge drawing layer text distance items into SvxBoxItem used by the dialog SvxBoxItem aBoxItem( static_cast< const SvxBoxItem& >( aNewAttr.Get( SDRATTR_TABLE_BORDER ) ) ); - aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrMetricItem&)(aNewAttr.Get(SDRATTR_TEXT_LEFTDIST))).GetValue()), BOX_LINE_LEFT ); - aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrMetricItem&)(aNewAttr.Get(SDRATTR_TEXT_RIGHTDIST))).GetValue()), BOX_LINE_RIGHT ); - aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrMetricItem&)(aNewAttr.Get(SDRATTR_TEXT_UPPERDIST))).GetValue()), BOX_LINE_TOP ); - aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrMetricItem&)(aNewAttr.Get(SDRATTR_TEXT_LOWERDIST))).GetValue()), BOX_LINE_BOTTOM ); + aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(aNewAttr.Get(SDRATTR_TEXT_LEFTDIST)).GetValue()), BOX_LINE_LEFT ); + aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(aNewAttr.Get(SDRATTR_TEXT_RIGHTDIST)).GetValue()), BOX_LINE_RIGHT ); + aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(aNewAttr.Get(SDRATTR_TEXT_UPPERDIST)).GetValue()), BOX_LINE_TOP ); + aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( static_cast<const SdrMetricItem&>(aNewAttr.Get(SDRATTR_TEXT_LOWERDIST)).GetValue()), BOX_LINE_BOTTOM ); SvxBoxInfoItem aBoxInfoItem( static_cast< const SvxBoxInfoItem& >( aNewAttr.Get( SDRATTR_TABLE_BORDER_INNER ) ) ); @@ -2346,7 +2346,7 @@ void SvxTableController::ApplyBorderAttr( const SfxItemSet& rAttr ) const SvxBorderLine* pBorderLineItem = 0; if(SfxItemState::SET == rAttr.GetItemState(SID_FRAME_LINESTYLE, false) ) - pBorderLineItem = ((const SvxLineItem&)rAttr.Get( SID_FRAME_LINESTYLE )).GetLine(); + pBorderLineItem = static_cast<const SvxLineItem&>(rAttr.Get( SID_FRAME_LINESTYLE )).GetLine(); if( pBoxInfoItem && !pBoxItem ) { @@ -2380,7 +2380,7 @@ void SvxTableController::ApplyBorderAttr( const SfxItemSet& rAttr ) continue; const SfxItemSet& rSet = xCell->GetItemSet(); - const SvxBoxItem* pOldOuter = (const SvxBoxItem*) &rSet.Get( SDRATTR_TABLE_BORDER ); + const SvxBoxItem* pOldOuter = static_cast<const SvxBoxItem*>(&rSet.Get( SDRATTR_TABLE_BORDER )); SvxBoxItem aNewFrame( *pOldOuter ); diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index b3743ebda907..0c5368486386 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -1025,7 +1025,7 @@ void TableLayouter::UpdateBorderLayout() if( !xCell.is() ) continue; - const SvxBoxItem* pThisAttr = (const SvxBoxItem*)xCell->GetItemSet().GetItem( SDRATTR_TABLE_BORDER ); + const SvxBoxItem* pThisAttr = static_cast<const SvxBoxItem*>(xCell->GetItemSet().GetItem( SDRATTR_TABLE_BORDER )); OSL_ENSURE(pThisAttr,"sdr::table::TableLayouter::UpdateBorderLayout(), no border attribute?"); if( !pThisAttr ) diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 1468b293ff1b..48b30df42f42 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -132,7 +132,7 @@ namespace drawinglayer { if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { - const SdrCellPrimitive2D& rCompare = (SdrCellPrimitive2D&)rPrimitive; + const SdrCellPrimitive2D& rCompare = static_cast<const SdrCellPrimitive2D&>(rPrimitive); return (getTransform() == rCompare.getTransform() && getSdrFTAttribute() == rCompare.getSdrFTAttribute()); @@ -439,7 +439,7 @@ namespace drawinglayer { if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) { - const SdrBorderlinePrimitive2D& rCompare = (SdrBorderlinePrimitive2D&)rPrimitive; + const SdrBorderlinePrimitive2D& rCompare = static_cast<const SdrBorderlinePrimitive2D&>(rPrimitive); return (getTransform() == rCompare.getTransform() && getLeftLine() == rCompare.getLeftLine() diff --git a/svx/source/table/viewcontactoftableobj.hxx b/svx/source/table/viewcontactoftableobj.hxx index 2a78206ad7b1..849400ea3f75 100644 --- a/svx/source/table/viewcontactoftableobj.hxx +++ b/svx/source/table/viewcontactoftableobj.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVX_SOURCE_TABLE_VIEWCONTACTOFTABLEOBJ_HXX #include <svx/sdr/contact/viewcontactofsdrobj.hxx> +#include <svx/svdotable.hxx> // predeclarations @@ -29,20 +30,15 @@ namespace sdr { - namespace table - { - class SdrTableObj; - } - namespace contact { class ViewContactOfTableObj : public ViewContactOfSdrObj { protected: // internal access to SdrTextObj - ::sdr::table::SdrTableObj& GetTableObj() const + const ::sdr::table::SdrTableObj& GetTableObj() const { - return (::sdr::table::SdrTableObj&)GetSdrObject(); + return static_cast<const ::sdr::table::SdrTableObj&>(GetSdrObject()); } // This method is responsible for creating the graphical visualisation data derived ONLY from diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index ce7e2efea0a2..ca4c014c8ef7 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -88,7 +88,7 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet) if ( pDocSh ) { if ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) - pColorList = ( (SvxColorListItem*)pItem )->GetColorList(); + pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); } if ( !pColorList.is() ) diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 46aed2c55bde..530b1614024a 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -74,7 +74,7 @@ FontWorkGalleryDialog::FontWorkGalleryDialog( SdrView* pSdrView, vcl::Window* pP ModalDialog(pParent, "FontworkGalleryDialog", "svx/ui/fontworkgallerydialog.ui" ), mnThemeId ( 0xffff ), mpSdrView ( pSdrView ), - mpModel ( (FmFormModel*)pSdrView->GetModel() ), + mpModel ( static_cast<FmFormModel*>(pSdrView->GetModel()) ), mppSdrObject ( NULL ), mpDestModel ( NULL ) { diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index d0c7cf1425a1..83d36093736f 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -711,7 +711,7 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt ) { if(m_pButtons[nId] == NULL) { - m_pButtons[nId] = new MenuButton((Window*)pDevice, WB_FLATBUTTON | WB_NOPOINTERFOCUS); + m_pButtons[nId] = new MenuButton(static_cast<vcl::Window*>(pDevice), WB_FLATBUTTON | WB_NOPOINTERFOCUS); m_pButtons[nId]->SetSizePixel(Size(20, aRect.GetSize().Height())); m_pButtons[nId]->SetPopupMenu(&m_aMenu); } @@ -786,11 +786,11 @@ static bool lcl_GetDocFontList( const FontList** ppFontList, SvxFontNameBox_Impl { bool bChanged = false; const SfxObjectShell* pDocSh = SfxObjectShell::Current(); - SvxFontListItem* pFontListItem = NULL; + const SvxFontListItem* pFontListItem = NULL; if ( pDocSh ) pFontListItem = - (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); + static_cast<const SvxFontListItem*>(pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST )); else { ::std::unique_ptr<FontList> aFontList(new FontList( pBox )); @@ -1334,9 +1334,9 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co Color aColor; if ( pState->ISA( SvxColorItem ) ) - aColor = ((const SvxColorItem*)pState)->GetValue(); + aColor = static_cast<const SvxColorItem*>(pState)->GetValue(); else if ( pState->ISA( XLineColorItem ) ) - aColor = ((const XLineColorItem*)pState)->GetColorValue(); + aColor = static_cast<const XLineColorItem*>(pState)->GetColorValue(); for ( size_t i = 1; i <= mpColorSet->GetItemCount(); ++i ) { @@ -1963,7 +1963,7 @@ void SAL_CALL SvxStyleToolBoxControl::update() throw (RuntimeException, std::exc { // Do nothing, we will start binding our listener when we are visible. // See link SvxStyleToolBoxControl::VisibilityNotification. - SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() ); + SvxStyleBox_Impl* pBox = static_cast<SvxStyleBox_Impl*>(GetToolBox().GetItemWindow( GetId() )); if ( pBox->IsVisible() ) { for ( int i=0; i<MAX_FAMILIES; i++ ) @@ -1991,7 +1991,7 @@ SfxStyleFamily SvxStyleToolBoxControl::GetActFamily() void SvxStyleToolBoxControl::FillStyleBox() { - SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() ); + SvxStyleBox_Impl* pBox = static_cast<SvxStyleBox_Impl*>(GetToolBox().GetItemWindow( GetId() )); DBG_ASSERT( pStyleSheetPool, "StyleSheetPool not found!" ); DBG_ASSERT( pBox, "Control not found!" ); @@ -2106,7 +2106,7 @@ void SvxStyleToolBoxControl::FillStyleBox() void SvxStyleToolBoxControl::SelectStyle( const OUString& rStyleName ) { - SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() ); + SvxStyleBox_Impl* pBox = static_cast<SvxStyleBox_Impl*>(GetToolBox().GetItemWindow( GetId() )); DBG_ASSERT( pBox, "Control not found!" ); if ( pBox ) @@ -2190,7 +2190,7 @@ IMPL_LINK_NOARG(SvxStyleToolBoxControl, VisibilityNotification) sal_uInt16 i; // Call ReBind() && UnBind() according to visibility - SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)( GetToolBox().GetItemWindow( GetId() )); + SvxStyleBox_Impl* pBox = static_cast<SvxStyleBox_Impl*>( GetToolBox().GetItemWindow( GetId() )); if ( pBox->IsVisible() && !isBound() ) { for ( i=0; i<MAX_FAMILIES; i++ ) @@ -2213,7 +2213,7 @@ void SvxStyleToolBoxControl::StateChanged( { sal_uInt16 nId = GetId(); ToolBox& rTbx = GetToolBox(); - SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)(rTbx.GetItemWindow( nId )); + SvxStyleBox_Impl* pBox = static_cast<SvxStyleBox_Impl*>(rTbx.GetItemWindow( nId )); TriState eTri = TRISTATE_FALSE; DBG_ASSERT( pBox, "Control not found!" ); @@ -2228,7 +2228,7 @@ void SvxStyleToolBoxControl::StateChanged( switch ( eState ) { case SfxItemState::DEFAULT: - eTri = ((const SfxTemplateItem*)pState)->GetValue() + eTri = static_cast<const SfxTemplateItem*>(pState)->GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE; break; @@ -2278,7 +2278,7 @@ void SvxFontNameToolBoxControl::StateChanged( { sal_uInt16 nId = GetId(); ToolBox& rTbx = GetToolBox(); - SvxFontNameBox_Impl* pBox = (SvxFontNameBox_Impl*)(rTbx.GetItemWindow( nId )); + SvxFontNameBox_Impl* pBox = static_cast<SvxFontNameBox_Impl*>(rTbx.GetItemWindow( nId )); DBG_ASSERT( pBox, "Control not found!" ); diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index 08c52a0b47c2..70d6539a9263 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -184,7 +184,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem { if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DIRECTION ) == SfxItemState::SET ) { - sal_Int32 nSkew = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DIRECTION))->GetValue(); + sal_Int32 nSkew = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_DIRECTION))->GetValue(); Position3D aViewPoint( 3472, -3472, 25000 ); double fOriginX = 0.50; @@ -268,7 +268,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem { if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_PROJECTION ) == SfxItemState::SET ) { - sal_Int32 nProjection = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_PROJECTION))->GetValue(); + sal_Int32 nProjection = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_PROJECTION))->GetValue(); ProjectionMode eProjectionMode = nProjection == 1 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE; com::sun::star::beans::PropertyValue aPropValue; aPropValue.Name = sProjectionMode; @@ -281,7 +281,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem { if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SfxItemState::SET) { - double fDepth = ((const SvxDoubleItem*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue(); + double fDepth = static_cast<const SvxDoubleItem*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue(); double fFraction = 0.0; EnhancedCustomShapeParameterPair aDepthPropPair; aDepthPropPair.First.Value <<= fDepth; @@ -302,7 +302,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_3D_COLOR ) == SfxItemState::SET) { - Color aColor( ((const SvxColorItem&)rReq.GetArgs()->Get(SID_EXTRUSION_3D_COLOR)).GetValue() ); + Color aColor( static_cast<const SvxColorItem&>(rReq.GetArgs()->Get(SID_EXTRUSION_3D_COLOR)).GetValue() ); const bool bAuto = aColor == COL_AUTO; @@ -332,7 +332,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_SURFACE ) == SfxItemState::SET) { - sal_Int32 nSurface = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_SURFACE))->GetValue(); + sal_Int32 nSurface = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_SURFACE))->GetValue(); ShadeMode eShadeMode( ShadeMode_FLAT ); bool bMetal = false; @@ -386,7 +386,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_INTENSITY ) == SfxItemState::SET) { - sal_Int32 nLevel = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_INTENSITY))->GetValue(); + sal_Int32 nLevel = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_INTENSITY))->GetValue(); double fBrightness; bool bHarsh2 = false; @@ -446,7 +446,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem { if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_DIRECTION ) == SfxItemState::SET) { - sal_Int32 nDirection = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_DIRECTION))->GetValue(); + sal_Int32 nDirection = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_DIRECTION))->GetValue(); if((nDirection >= 0) && (nDirection < 9)) { @@ -559,7 +559,7 @@ void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rB pSdrView->BegUndo( aStr ); pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) ); } - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + SdrCustomShapeGeometryItem aGeometryItem( const_cast<SdrCustomShapeGeometryItem&>(static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )))); impl_execute( pSdrView, rReq, aGeometryItem, pObj ); pObj->SetMergedItem( aGeometryItem ); pObj->BroadcastObjectChange(); @@ -581,8 +581,8 @@ void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rB (rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SfxItemState::SET) && (rReq.GetArgs()->GetItemState( SID_ATTR_METRIC ) == SfxItemState::SET)) { - double fDepth = ((const SvxDoubleItem*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue(); - FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)rReq.GetArgs()->GetItem(SID_ATTR_METRIC))->GetValue(); + double fDepth = static_cast<const SvxDoubleItem*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue(); + FieldUnit eUnit = (FieldUnit)static_cast<const SfxUInt16Item*>(rReq.GetArgs()->GetItem(SID_ATTR_METRIC))->GetValue(); ExtrusionDepthDialog aDlg( 0L, fDepth, eUnit ); sal_uInt16 nRet = aDlg.Execute(); @@ -633,7 +633,7 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) static const OUString sSkew( "Skew" ); static const OUString sProjectionMode( "ProjectionMode" ); - com::sun::star::uno::Any* pAny; + const com::sun::star::uno::Any* pAny; double fFinalSkewAngle = -1; bool bHasCustomShape = false; @@ -643,12 +643,12 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if( pObj->ISA(SdrObjCustomShape) ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); // see if this is an extruded customshape if( !bHasCustomShape ) { - Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); + const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); if( pAny_ ) *pAny_ >>= bHasCustomShape; @@ -781,7 +781,7 @@ void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet ) static const OUString sExtrusion( "Extrusion" ); static const OUString sProjectionMode( "ProjectionMode" ); - com::sun::star::uno::Any* pAny; + const com::sun::star::uno::Any* pAny; sal_Int32 nFinalProjection = -1; bool bHasCustomShape = false; @@ -794,8 +794,8 @@ void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet ) // see if this is an extruded customshape if( !bHasCustomShape ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); + const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); if( pAny_ ) *pAny_ >>= bHasCustomShape; @@ -803,7 +803,7 @@ void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet ) continue; } - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); bool bParallel = true; pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode ); @@ -839,7 +839,7 @@ void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet ) static const OUString sSpecularity( "Specularity" ); static const OUString sMetal( "Metal" ); - com::sun::star::uno::Any* pAny; + const com::sun::star::uno::Any* pAny; sal_Int32 nFinalSurface = -1; bool bHasCustomShape = false; @@ -849,12 +849,12 @@ void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet ) SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if( pObj->ISA(SdrObjCustomShape) ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); // see if this is an extruded customshape if( !bHasCustomShape ) { - Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); + const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); if( pAny_ ) *pAny_ >>= bHasCustomShape; @@ -925,7 +925,7 @@ void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet ) static const OUString sExtrusion( "Extrusion" ); static const OUString sDepth( "Depth" ); - com::sun::star::uno::Any* pAny; + const com::sun::star::uno::Any* pAny; double fFinalDepth = -1; bool bHasCustomShape = false; @@ -935,12 +935,12 @@ void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet ) SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if( pObj->ISA(SdrObjCustomShape) ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); // see if this is an extruded customshape if( !bHasCustomShape ) { - Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); + const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); if( pAny_ ) *pAny_ >>= bHasCustomShape; @@ -1011,7 +1011,7 @@ void getExtrusionLightingDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults ); - com::sun::star::uno::Any* pAny; + const com::sun::star::uno::Any* pAny; int nFinalDirection = -1; bool bHasCustomShape = false; @@ -1021,12 +1021,12 @@ void getExtrusionLightingDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if( pObj->ISA(SdrObjCustomShape) ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); // see if this is an extruded customshape if( !bHasCustomShape ) { - Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); + const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); if( pAny_ ) *pAny_ >>= bHasCustomShape; @@ -1086,7 +1086,7 @@ void getExtrusionLightingIntensityState( SdrView* pSdrView, SfxItemSet& rSet ) static const OUString sExtrusion( "Extrusion" ); static const OUString sBrightness( "Brightness" ); - com::sun::star::uno::Any* pAny; + const com::sun::star::uno::Any* pAny; int nFinalLevel = -1; bool bHasCustomShape = false; @@ -1096,12 +1096,12 @@ void getExtrusionLightingIntensityState( SdrView* pSdrView, SfxItemSet& rSet ) SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if( pObj->ISA(SdrObjCustomShape) ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); // see if this is an extruded customshape if( !bHasCustomShape ) { - Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); + const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); if( pAny_ ) *pAny_ >>= bHasCustomShape; @@ -1154,7 +1154,7 @@ void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet ) static const OUString sExtrusion( "Extrusion" ); static const OUString sExtrusionColor( "Color" ); - com::sun::star::uno::Any* pAny; + const com::sun::star::uno::Any* pAny; bool bInit = false; bool bAmbigius = false; @@ -1166,12 +1166,12 @@ void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet ) SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if( pObj->ISA(SdrObjCustomShape) ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); // see if this is an extruded customshape if( !bHasCustomShape ) { - Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); + const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); if( pAny_ ) *pAny_ >>= bHasCustomShape; @@ -1188,7 +1188,7 @@ void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet ) if( bUseColor ) { - const XSecondaryFillColorItem& rItem = *(XSecondaryFillColorItem*)&(pObj->GetMergedItem( XATTR_SECONDARYFILLCOLOR )); + const XSecondaryFillColorItem& rItem = *static_cast<const XSecondaryFillColorItem*>(&(pObj->GetMergedItem( XATTR_SECONDARYFILLCOLOR ))); aColor = rItem.GetColorValue(); } else @@ -1234,8 +1234,8 @@ bool checkForSelectedCustomShapes( SdrView* pSdrView, bool bOnlyExtruded ) { if( bOnlyExtruded ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - Any* pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) )); + const Any* pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion ); if( pAny ) *pAny >>= bFound; } diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index 135dca78325f..e4646f6db9f5 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -60,8 +60,8 @@ void SetAlignmentState( SdrView* pSdrView, SfxItemSet& rSet ) if( pObj->ISA(SdrObjCustomShape) ) { sal_Int32 nOldAlignment = nAlignment; - SdrTextHorzAdjustItem& rTextHorzAdjustItem = (SdrTextHorzAdjustItem&)pObj->GetMergedItem( SDRATTR_TEXT_HORZADJUST ); - SdrTextFitToSizeTypeItem& rTextFitToSizeTypeItem = (SdrTextFitToSizeTypeItem&)pObj->GetMergedItem( SDRATTR_TEXT_FITTOSIZE ); + const SdrTextHorzAdjustItem& rTextHorzAdjustItem = static_cast<const SdrTextHorzAdjustItem&>(pObj->GetMergedItem( SDRATTR_TEXT_HORZADJUST )); + const SdrTextFitToSizeTypeItem& rTextFitToSizeTypeItem = static_cast<const SdrTextFitToSizeTypeItem&>(pObj->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )); switch ( rTextHorzAdjustItem.GetValue() ) { case SDRTEXTHORZADJUST_LEFT : nAlignment = 0; break; @@ -97,7 +97,7 @@ void SetCharacterSpacingState( SdrView* pSdrView, SfxItemSet& rSet ) if( pObj->ISA(SdrObjCustomShape) ) { sal_Int32 nOldCharacterSpacing = nCharacterSpacing; - SvxCharScaleWidthItem& rCharScaleWidthItem = (SvxCharScaleWidthItem&)pObj->GetMergedItem( EE_CHAR_FONTWIDTH ); + const SvxCharScaleWidthItem& rCharScaleWidthItem = static_cast<const SvxCharScaleWidthItem&>(pObj->GetMergedItem( EE_CHAR_FONTWIDTH )); nCharacterSpacing = rCharScaleWidthItem.GetValue(); if ( ( nOldCharacterSpacing != -1 ) && ( nOldCharacterSpacing != nCharacterSpacing ) ) { @@ -121,7 +121,7 @@ void SetKernCharacterPairsState( SdrView* pSdrView, SfxItemSet& rSet ) SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj(); if( pObj->ISA(SdrObjCustomShape) ) { - SvxKerningItem& rKerningItem = (SvxKerningItem&)pObj->GetMergedItem( EE_CHAR_KERNING ); + const SvxKerningItem& rKerningItem = static_cast<const SvxKerningItem&>(pObj->GetMergedItem( EE_CHAR_KERNING )); if ( rKerningItem.GetValue() ) bChecked = true; } @@ -142,8 +142,8 @@ void SetFontWorkShapeTypeState( SdrView* pSdrView, SfxItemSet& rSet ) if( pObj->ISA( SdrObjCustomShape ) ) { const OUString sType( "Type" ); - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - Any* pAny = aGeometryItem.GetPropertyValueByName( sType ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ))); + const Any* pAny = aGeometryItem.GetPropertyValueByName( sType ); if( pAny ) { OUString aType; @@ -208,7 +208,7 @@ static vcl::Window* ImpGetViewWin(SdrView* pView) if(OUTDEV_WINDOW == pOut->GetOutDevType()) { - return (vcl::Window*)pOut; + return static_cast<vcl::Window*>(pOut); } } } @@ -232,8 +232,8 @@ bool checkForSelectedFontWork( SdrView* pSdrView, sal_uInt32& nCheckStatus ) SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if( pObj->ISA(SdrObjCustomShape) ) { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath ); + const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ))); + const Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath ); if( pAny ) *pAny >>= bFound; } @@ -270,7 +270,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem { if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_FONTWORK_ALIGNMENT ) == SfxItemState::SET ) { - sal_Int32 nValue = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_ALIGNMENT))->GetValue(); + sal_Int32 nValue = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_FONTWORK_ALIGNMENT))->GetValue(); if ( ( nValue >= 0 ) && ( nValue < 5 ) ) { SdrFitToSizeType eFTS = SDRTEXTFIT_NONE; @@ -295,7 +295,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem { if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) ) { - sal_Int32 nCharSpacing = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue(); + sal_Int32 nCharSpacing = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue(); pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) ); pObj->BroadcastObjectChange(); } @@ -364,8 +364,8 @@ void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem, const if( pSourceObj ) { PropertyValue aPropVal_; - SdrCustomShapeGeometryItem& rSourceGeometry = (SdrCustomShapeGeometryItem&)pSourceObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); - com::sun::star::uno::Any* pAny = rSourceGeometry.GetPropertyValueByName( sType ); + const SdrCustomShapeGeometryItem& rSourceGeometry = static_cast<const SdrCustomShapeGeometryItem&>(pSourceObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); + const com::sun::star::uno::Any* pAny = rSourceGeometry.GetPropertyValueByName( sType ); if ( pAny ) { aPropVal_.Name = sType; @@ -443,7 +443,7 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBi const SfxItemSet* pArgs = rReq.GetArgs(); if ( pArgs ) { - const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() ); + const SfxStringItem& rItm = static_cast<const SfxStringItem&>(pArgs->Get( rReq.GetSlot() )); aCustomShape = rItm.GetValue(); } if ( !aCustomShape.isEmpty() ) @@ -463,11 +463,11 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBi pSdrView->BegUndo( aStr ); pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) ); } - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + SdrCustomShapeGeometryItem aGeometryItem( const_cast<SdrCustomShapeGeometryItem&>(static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )))); GetGeometryForCustomShape( aGeometryItem, aCustomShape ); pObj->SetMergedItem( aGeometryItem ); - Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pObj ); + Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( static_cast<SdrObjCustomShape*>(pObj) ); if ( aXShape.is() ) { Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( aXShape, UNO_QUERY ); @@ -490,7 +490,7 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBi { if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) ) { - sal_Int32 nCharSpacing = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue(); + sal_Int32 nCharSpacing = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue(); FontworkCharacterSpacingDialog aDlg( 0L, nCharSpacing ); sal_uInt16 nRet = aDlg.Execute(); if( nRet != 0 ) @@ -538,7 +538,7 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBi pSdrView->BegUndo( aStr ); pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) ); } - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + SdrCustomShapeGeometryItem aGeometryItem( const_cast<SdrCustomShapeGeometryItem&>(static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )))); impl_execute( pSdrView, rReq, aGeometryItem, pObj ); pObj->SetMergedItem( aGeometryItem ); pObj->BroadcastObjectChange(); diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index cfca6f3fdd0b..1b975d0bc10d 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -832,9 +832,9 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, if( !bVectorType ) { SdrObject* pObj = aShapes.front(); - if( pObj && pObj->ISA( SdrGrafObj ) && !( (SdrGrafObj*) pObj )->HasText() ) + if( pObj && pObj->ISA( SdrGrafObj ) && !static_cast<SdrGrafObj*>(pObj)->HasText() ) { - aGraphic = ( (SdrGrafObj*) pObj )->GetTransformedGraphic(); + aGraphic = static_cast<SdrGrafObj*>(pObj)->GetTransformedGraphic(); if ( aGraphic.GetType() == GRAPHIC_BITMAP ) { Size aSizePixel( aGraphic.GetSizePixel() ); @@ -859,14 +859,14 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, { SdrObject* pObj = aShapes.front(); if( pObj && pObj->ISA( SdrTextObj ) - && ( (SdrTextObj*) pObj )->HasText() ) + && static_cast<SdrTextObj*>(pObj)->HasText() ) { Rectangle aScrollRectangle; Rectangle aPaintRectangle; const boost::scoped_ptr< GDIMetaFile > pMtf( - ( (SdrTextObj*) pObj )->GetTextScrollMetaFileAndRectangle( - aScrollRectangle, aPaintRectangle ) ); + static_cast<SdrTextObj*>(pObj)->GetTextScrollMetaFileAndRectangle( + aScrollRectangle, aPaintRectangle ) ); // take the larger one of the two rectangles (that // should be the bound rect of the retrieved diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx index b82bec79aeb4..5cb402d6ad0f 100644 --- a/svx/source/unodraw/UnoNameItemTable.cxx +++ b/svx/source/unodraw/UnoNameItemTable.cxx @@ -128,11 +128,11 @@ void SAL_CALL SvxUnoNameItemTable::removeByName( const OUString& aApiName ) ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); - NameOrIndex *pItem; + const NameOrIndex *pItem; while( aIter != aEnd ) { - pItem = (NameOrIndex *)&((*aIter)->Get( mnWhich ) ); + pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( mnWhich ) )); if (sName.equals(pItem->GetName())) { delete (*aIter); @@ -157,11 +157,9 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, cons ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); - NameOrIndex *pItem; - while( aIter != aEnd ) { - pItem = (NameOrIndex *)&((*aIter)->Get( mnWhich ) ); + const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( mnWhich ) )); if (aName.equals(pItem->GetName())) { NameOrIndex* pNewItem = createItem(); @@ -182,7 +180,7 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, cons sal_uInt32 nCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate); + NameOrIndex *pItem = const_cast<NameOrIndex*>(static_cast<const NameOrIndex*>(mpModelPool->GetItem2( mnWhich, nSurrogate))); if (pItem && aName.equals(pItem->GetName())) { pItem->PutValue( aElement, mnMemberId ); @@ -212,13 +210,13 @@ uno::Any SAL_CALL SvxUnoNameItemTable::getByName( const OUString& aApiName ) if (mpModelPool && !aName.isEmpty()) { - NameOrIndex *pItem; + const NameOrIndex *pItem; sal_uInt32 nSurrogate; sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); + pItem = static_cast<const NameOrIndex*>(mpModelPool->GetItem2( mnWhich, nSurrogate )); if (isValid(pItem) && aName.equals(pItem->GetName())) { @@ -238,13 +236,13 @@ uno::Sequence< OUString > SAL_CALL SvxUnoNameItemTable::getElementNames( ) std::set< OUString > aNameSet; - NameOrIndex *pItem; + const NameOrIndex *pItem; const sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; sal_uInt32 nSurrogate; for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); + pItem = static_cast<const NameOrIndex*>(mpModelPool->GetItem2( mnWhich, nSurrogate )); if( !isValid( pItem ) ) continue; @@ -284,7 +282,7 @@ sal_Bool SAL_CALL SvxUnoNameItemTable::hasByName( const OUString& aApiName ) sal_uInt32 nCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); + pItem = static_cast<const NameOrIndex*>(mpModelPool->GetItem2( mnWhich, nSurrogate )); if (isValid(pItem) && aName.equals(pItem->GetName())) return sal_True; } @@ -303,7 +301,7 @@ sal_Bool SAL_CALL SvxUnoNameItemTable::hasElements( ) const sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0; for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate ); + pItem = static_cast<const NameOrIndex*>(mpModelPool->GetItem2( mnWhich, nSurrogate )); if( isValid( pItem ) ) return sal_True; diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index 15bc1ecdf35e..4e4bc7eec63f 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -275,7 +275,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPr uno::Any SvxUnoXColorTable::getAny( const XPropertyEntry* pEntry ) const throw() { uno::Any aAny; - aAny <<= (sal_Int32)((XColorEntry*)pEntry)->GetColor().GetColor(); + aAny <<= (sal_Int32)static_cast<const XColorEntry*>(pEntry)->GetColor().GetColor(); return aAny; } @@ -339,7 +339,7 @@ uno::Any SvxUnoXLineEndTable::getAny( const XPropertyEntry* pEntry ) const throw uno::Any aAny; drawing::PolyPolygonBezierCoords aBezier; - basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( ((XLineEndEntry*)pEntry)->GetLineEnd(), + basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( static_cast<const XLineEndEntry*>(pEntry)->GetLineEnd(), aBezier ); aAny <<= aBezier; return aAny; @@ -409,7 +409,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPro // SvxUnoXPropertyTable uno::Any SvxUnoXDashTable::getAny( const XPropertyEntry* pEntry ) const throw() { - const XDash& rXD = ((XDashEntry*)pEntry)->GetDash(); + const XDash& rXD = static_cast<const XDashEntry*>(pEntry)->GetDash(); drawing::LineDash aLineDash; @@ -490,7 +490,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPr // SvxUnoXPropertyTable uno::Any SvxUnoXHatchTable::getAny( const XPropertyEntry* pEntry ) const throw() { - const XHatch& aHatch = ((XHatchEntry*)pEntry)->GetHatch(); + const XHatch& aHatch = static_cast<const XHatchEntry*>(pEntry)->GetHatch(); drawing::Hatch aUnoHatch; @@ -566,7 +566,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXGradientTable_createInstance( // SvxUnoXPropertyTable uno::Any SvxUnoXGradientTable::getAny( const XPropertyEntry* pEntry ) const throw() { - const XGradient& aXGradient = ((XGradientEntry*)pEntry)->GetGradient(); + const XGradient& aXGradient = static_cast<const XGradientEntry*>(pEntry)->GetGradient(); awt::Gradient aGradient; aGradient.Style = (awt::GradientStyle) aXGradient.GetGradientStyle(); @@ -655,7 +655,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XP uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw(uno::RuntimeException) { OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX); - const GraphicObject& rGraphicObject(((XBitmapEntry*)pEntry)->GetGraphicObject()); + const GraphicObject& rGraphicObject(static_cast<const XBitmapEntry*>(pEntry)->GetGraphicObject()); aURL += OStringToOUString(rGraphicObject.GetUniqueID(), RTL_TEXTENCODING_ASCII_US); uno::Any aAny; diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 45590887cd85..892af997ab0b 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -664,7 +664,7 @@ uno::Reference< drawing::XDrawPage > SAL_CALL SvxUnoDrawPagesAccess::insertNewBy SdrPage* pPage; if( PTR_CAST( FmFormModel, mrModel.mpDoc ) ) - pPage = new FmFormPage(*(FmFormModel*)mrModel.mpDoc); + pPage = new FmFormPage(*static_cast<FmFormModel*>(mrModel.mpDoc)); else pPage = new SdrPage(*mrModel.mpDoc); @@ -719,10 +719,10 @@ uno::Sequence< OUString > SAL_CALL SvxUnoDrawPagesAccess::getSupportedServiceNam com::sun::star::uno::Reference< com::sun::star::container::XIndexReplace > SvxCreateNumRule( SdrModel* pModel ) throw() { - SvxNumRule* pDefaultRule = NULL; + const SvxNumRule* pDefaultRule = NULL; if( pModel ) { - SvxNumBulletItem* pItem = (SvxNumBulletItem*) pModel->GetItemPool().GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); + const SvxNumBulletItem* pItem = static_cast<const SvxNumBulletItem*>( pModel->GetItemPool().GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET) ); if( pItem ) { pDefaultRule = pItem->GetNumRule(); diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx index bf07bc4e889b..99e6296e63a0 100644 --- a/svx/source/unodraw/unomtabl.cxx +++ b/svx/source/unodraw/unomtabl.cxx @@ -197,12 +197,12 @@ void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName ) ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); - NameOrIndex *pItem; + const NameOrIndex *pItem; const OUString aSearchName( Name ); while( aIter != aEnd ) { - pItem = (NameOrIndex *)&((*aIter)->Get( XATTR_LINEEND ) ); + pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( XATTR_LINEEND ) )); if( pItem->GetName() == aSearchName ) { delete (*aIter); @@ -227,12 +227,11 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const ItemPoolVector::iterator aIter = maItemSetVector.begin(); const ItemPoolVector::iterator aEnd = maItemSetVector.end(); - NameOrIndex *pItem; const OUString aSearchName( aName ); while( aIter != aEnd ) { - pItem = (NameOrIndex *)&((*aIter)->Get( XATTR_LINEEND ) ); + const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( XATTR_LINEEND ) )); if( pItem->GetName() == aSearchName ) { XLineEndItem aEndMarker; @@ -259,7 +258,7 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const const sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0; for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate); + NameOrIndex *pItem = const_cast<NameOrIndex*>(static_cast<const NameOrIndex*>(mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate))); if( pItem && pItem->GetName() == aSearchName ) { pItem->PutValue( aElement ); @@ -271,7 +270,7 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const const sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0; for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate); + NameOrIndex *pItem = const_cast<NameOrIndex*>(static_cast<const NameOrIndex*>(mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate))); if( pItem && pItem->GetName() == aSearchName ) { pItem->PutValue( aElement ); @@ -288,11 +287,11 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const static bool getByNameFromPool( const OUString& rSearchName, SfxItemPool* pPool, sal_uInt16 nWhich, uno::Any& rAny ) { - NameOrIndex *pItem; + const NameOrIndex *pItem; const sal_uInt32 nSurrogateCount = pPool ? pPool->GetItemCount2( nWhich ) : 0; for( sal_uInt32 nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ ) { - pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate ); + pItem = static_cast<const NameOrIndex*>(pPool->GetItem2( nWhich, nSurrogate )); if( pItem && pItem->GetName() == rSearchName ) { @@ -338,7 +337,7 @@ static void createNamesForPool( SfxItemPool* pPool, sal_uInt16 nWhich, std::set< for(sal_uInt32 nSurrogate = 0; nSurrogate < nSuroCount; ++nSurrogate) { - NameOrIndex* pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate ); + const NameOrIndex* pItem = static_cast<const NameOrIndex*>(pPool->GetItem2( nWhich, nSurrogate )); if( pItem == NULL || pItem->GetName().isEmpty() ) continue; @@ -385,14 +384,14 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasByName( const OUString& aName ) OUString aSearchName; - NameOrIndex *pItem; + const NameOrIndex *pItem; aSearchName = SvxUnogetInternalNameForItem(XATTR_LINESTART, aName); sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0; sal_uInt32 nSurrogate; for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate); + pItem = static_cast<const NameOrIndex*>(mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate)); if( pItem && pItem->GetName() == aSearchName ) return sal_True; } @@ -401,7 +400,7 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasByName( const OUString& aName ) sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0; for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate); + pItem = static_cast<const NameOrIndex*>(mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate)); if( pItem && pItem->GetName() == aSearchName ) return sal_True; } @@ -421,13 +420,13 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasElements( ) { SolarMutexGuard aGuard; - NameOrIndex *pItem; + const NameOrIndex *pItem; const sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0; sal_uInt32 nSurrogate; for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate); + pItem = static_cast<const NameOrIndex*>(mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate)); if( pItem && !pItem->GetName().isEmpty() ) return sal_True; } @@ -435,7 +434,7 @@ sal_Bool SAL_CALL SvxUnoMarkerTable::hasElements( ) const sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0; for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ ) { - pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate); + pItem = static_cast<const NameOrIndex*>(mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate)); if( pItem && !pItem->GetName().isEmpty() ) return sal_True; } diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index cdce0f051388..b459cee4e406 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -540,7 +540,7 @@ SdrObject *SvxDrawPage::_CreateSdrObject(const Reference< drawing::XShape > & xS if( pNewObj->ISA(E3dPolyScene)) { // Szene initialisieren - E3dScene* pScene = (E3dScene*)pNewObj; + E3dScene* pScene = static_cast<E3dScene*>(pNewObj); double fW = (double)aSize.Width; double fH = (double)aSize.Height; @@ -559,7 +559,7 @@ SdrObject *SvxDrawPage::_CreateSdrObject(const Reference< drawing::XShape > & xS } else if(pNewObj->ISA(E3dExtrudeObj)) { - E3dExtrudeObj* pObj = (E3dExtrudeObj*)pNewObj; + E3dExtrudeObj* pObj = static_cast<E3dExtrudeObj*>(pNewObj); basegfx::B2DPolygon aNewPolygon; aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0)); @@ -572,7 +572,7 @@ SdrObject *SvxDrawPage::_CreateSdrObject(const Reference< drawing::XShape > & xS } else if(pNewObj->ISA(E3dLatheObj)) { - E3dLatheObj* pObj = (E3dLatheObj*)pNewObj; + E3dLatheObj* pObj = static_cast<E3dLatheObj*>(pNewObj); basegfx::B2DPolygon aNewPolygon; aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0)); diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index 6547710ac5a5..7ef783103193 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -1242,7 +1242,7 @@ void SvxShapePolyPolygon::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw( ::SolarMutexGuard aGuard; if(mpObj.is()) - ((SdrPathObj*)mpObj.get())->SetPathPoly(rNew); + static_cast<SdrPathObj*>(mpObj.get())->SetPathPoly(rNew); } @@ -1252,7 +1252,7 @@ basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw() if(mpObj.is()) { - return ((SdrPathObj*)mpObj.get())->GetPathPoly(); + return static_cast<SdrPathObj*>(mpObj.get())->GetPathPoly(); } else { @@ -1443,7 +1443,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte Reference< graphic::XGraphic> xGraphic( rValue, UNO_QUERY ); if( xGraphic.is() ) { - ((SdrGrafObj*)mpObj.get())->SetGraphic(Graphic(xGraphic)); + static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(Graphic(xGraphic)); bOk = true; } else @@ -1454,7 +1454,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte { // Bitmap einsetzen Graphic aGraphic(VCLUnoHelper::GetBitmap( xBmp )); - ((SdrGrafObj*)mpObj.get())->SetGraphic(aGraphic); + static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(aGraphic); bOk = true; } } @@ -1634,7 +1634,7 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte case OWN_ATTR_GRAFSTREAMURL: { - const OUString aStreamURL( ( (SdrGrafObj*) mpObj.get() )->GetGrafStreamURL() ); + const OUString aStreamURL( static_cast<SdrGrafObj*>( mpObj.get() )->GetGrafStreamURL() ); if( !aStreamURL.isEmpty() ) rValue <<= aStreamURL; break; @@ -1746,18 +1746,18 @@ awt::Point SAL_CALL SvxCustomShape::getPosition() throw(uno::RuntimeException, s if ( mpModel && mpObj.is() ) { SdrAShapeObjGeoData aCustomShapeGeoData; - ((SdrObjCustomShape*)mpObj.get())->SaveGeoData( aCustomShapeGeoData ); + static_cast<SdrObjCustomShape*>(mpObj.get())->SaveGeoData( aCustomShapeGeoData ); bool bMirroredX = false; bool bMirroredY = false; if ( mpObj.is() ) { - bMirroredX = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredX() ); - bMirroredY = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredY() ); + bMirroredX = static_cast<SdrObjCustomShape*>(mpObj.get())->IsMirroredX(); + bMirroredY = static_cast<SdrObjCustomShape*>(mpObj.get())->IsMirroredY(); } // get aRect, this is the unrotated snaprect - Rectangle aRect(((SdrObjCustomShape*)mpObj.get())->GetLogicRect()); + Rectangle aRect(static_cast<SdrObjCustomShape*>(mpObj.get())->GetLogicRect()); Rectangle aRectangle( aRect ); if ( bMirroredX || bMirroredY ) @@ -1857,20 +1857,20 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c if ( bCustomShapeGeometry ) { - bMirroredX = ((SdrObjCustomShape*)pObject)->IsMirroredX(); - bMirroredY = ((SdrObjCustomShape*)pObject)->IsMirroredY(); + bMirroredX = static_cast<SdrObjCustomShape*>(pObject)->IsMirroredX(); + bMirroredY = static_cast<SdrObjCustomShape*>(pObject)->IsMirroredY(); } SvxShape::setPropertyValue( aPropertyName, aValue ); if ( bCustomShapeGeometry ) { - ((SdrObjCustomShape*)pObject)->MergeDefaultAttributes(0); + static_cast<SdrObjCustomShape*>(pObject)->MergeDefaultAttributes(0); Rectangle aRect( pObject->GetSnapRect() ); // #i38892# - bool bNeedsMirrorX = ((SdrObjCustomShape*)pObject)->IsMirroredX() != bMirroredX; - bool bNeedsMirrorY = ((SdrObjCustomShape*)pObject)->IsMirroredY() != bMirroredY; + bool bNeedsMirrorX = static_cast<SdrObjCustomShape*>(pObject)->IsMirroredX() != bMirroredX; + bool bNeedsMirrorY = static_cast<SdrObjCustomShape*>(pObject)->IsMirroredY() != bMirroredY; boost::scoped_ptr< SdrGluePointList > pListCopy; if( bNeedsMirrorX || bNeedsMirrorY ) @@ -1887,7 +1887,7 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c pObject->NbcMirror( aTop, aBottom ); // NbcMirroring is flipping the current mirror state, // so we have to set the correct state again - ((SdrObjCustomShape*)pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True ); + static_cast<SdrObjCustomShape*>(pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True ); } if ( bNeedsMirrorY ) { @@ -1896,7 +1896,7 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c pObject->NbcMirror( aLeft, aRight ); // NbcMirroring is flipping the current mirror state, // so we have to set the correct state again - ((SdrObjCustomShape*)pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True ); + static_cast<SdrObjCustomShape*>(pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True ); } if( pListCopy ) @@ -1927,7 +1927,7 @@ bool SvxCustomShape::getPropertyValueImpl( const OUString& rName, const SfxItemP void SvxCustomShape::createCustomShapeDefaults( const OUString& rValueType ) throw (::com::sun::star::uno::RuntimeException, std::exception) { - ((SdrObjCustomShape*)mpObj.get())->MergeDefaultAttributes( &rValueType ); + static_cast<SdrObjCustomShape*>(mpObj.get())->MergeDefaultAttributes( &rValueType ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx index 3161c3d3fbdf..571b3c1b434a 100644 --- a/svx/source/unodraw/unoshap3.cxx +++ b/svx/source/unodraw/unoshap3.cxx @@ -337,7 +337,7 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte std::vector<basegfx::B3DHomMatrix*> aObjTrans; while(aIter.IsMore()) { - E3dObject* p3DObj = (E3dObject*)aIter.Next(); + E3dObject* p3DObj = static_cast<E3dObject*>(aIter.Next()); basegfx::B3DHomMatrix* pNew = new basegfx::B3DHomMatrix; *pNew = p3DObj->GetTransform(); aObjTrans.push_back(pNew); @@ -347,7 +347,7 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte aIter.Reset(); while(aIter.IsMore()) { - E3dObject* p3DObj = (E3dObject*)aIter.Next(); + E3dObject* p3DObj = static_cast<E3dObject*>(aIter.Next()); p3DObj->NbcSetTransform(basegfx::B3DHomMatrix()); } @@ -362,9 +362,9 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte const SfxItemSet& rSceneSet = pScene->GetMergedItemSet(); double fCamPosZ = - (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue(); + (double)static_cast<const SfxUInt32Item&>(rSceneSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue(); double fCamFocal = - (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue(); + (double)static_cast<const SfxUInt32Item&>(rSceneSet.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue(); aCam.SetAutoAdjustProjection(false); aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH); @@ -393,7 +393,7 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte sal_uInt32 nIndex(0L); while(aIter.IsMore()) { - E3dObject* p3DObj = (E3dObject*)aIter.Next(); + E3dObject* p3DObj = static_cast<E3dObject*>(aIter.Next()); basegfx::B3DHomMatrix* pMat = aObjTrans[nIndex++]; p3DObj->NbcSetTransform(*pMat); delete pMat; @@ -553,7 +553,7 @@ bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItem case OWN_ATTR_3D_VALUE_POSITION: { // Position packen - const basegfx::B3DPoint& rPos = ((E3dCubeObj*)mpObj.get())->GetCubePos(); + const basegfx::B3DPoint& rPos = static_cast<E3dCubeObj*>(mpObj.get())->GetCubePos(); drawing::Position3D aPos; aPos.PositionX = rPos.getX(); @@ -668,7 +668,7 @@ bool Svx3DSphereObject::getPropertyValueImpl( const OUString& rName, const SfxIt case OWN_ATTR_3D_VALUE_POSITION: { // Position packen - const basegfx::B3DPoint& rPos = ((E3dSphereObj*)mpObj.get())->Center(); + const basegfx::B3DPoint& rPos = static_cast<E3dSphereObj*>(mpObj.get())->Center(); drawing::Position3D aPos; aPos.PositionX = rPos.getX(); @@ -681,7 +681,7 @@ bool Svx3DSphereObject::getPropertyValueImpl( const OUString& rName, const SfxIt case OWN_ATTR_3D_VALUE_SIZE: { // Groesse packen - const basegfx::B3DVector& rSize = ((E3dSphereObj*)mpObj.get())->Size(); + const basegfx::B3DVector& rSize = static_cast<E3dSphereObj*>(mpObj.get())->Size(); drawing::Direction3D aDir; aDir.DirectionX = rSize.getX(); @@ -966,7 +966,7 @@ bool Svx3DExtrudeObject::getPropertyValueImpl( const OUString& rName, const SfxI { // Transformation in eine homogene Matrix packen drawing::HomogenMatrix aHomMat; - basegfx::B3DHomMatrix aMat = ((E3dObject*)mpObj.get())->GetTransform(); + basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform(); // pack evtl. transformed matrix to output aHomMat.Line1.Column1 = aMat.get(0, 0); diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index fc3d1fde5d8c..bbbc02e9c030 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -99,7 +99,7 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro if( (rValue >>= aVisArea) && mpObj->ISA(SdrOle2Obj)) { Size aTmp( aVisArea.X + aVisArea.Width, aVisArea.Y + aVisArea.Height ); - uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)mpObj.get())->GetObjRef(); + uno::Reference < embed::XEmbeddedObject > xObj = static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef(); if( xObj.is() ) { try @@ -269,7 +269,7 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro if( mpObj->ISA(SdrOle2Obj)) { MapMode aMapMode( MAP_100TH_MM ); // the API uses this map mode - Size aTmp = ((SdrOle2Obj*)mpObj.get())->GetOrigObjSize( &aMapMode ); // get the size in the requested map mode + Size aTmp = static_cast<SdrOle2Obj*>(mpObj.get())->GetOrigObjSize( &aMapMode ); // get the size in the requested map mode aVisArea = awt::Rectangle( 0, 0, aTmp.Width(), aTmp.Height() ); } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index cf040234bf2c..adf7770c9960 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1614,7 +1614,7 @@ bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName, for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ ) { - pItem = (NameOrIndex*)pPool->GetItem2((sal_uInt16)nWID, nSurrogate); + pItem = static_cast<const NameOrIndex*>(pPool->GetItem2((sal_uInt16)nWID, nSurrogate)); if( pItem && ( pItem->GetName() == aSearchName ) ) { rSet.Put( *pItem ); @@ -1971,7 +1971,7 @@ uno::Any SvxShape::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleE const SfxPoolItem* pPoolItem=NULL; if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,false,&pPoolItem)==SfxItemState::SET) { - sal_Int32 nAngle = ((SdrAngleItem*)pPoolItem)->GetValue(); + sal_Int32 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue(); aAny <<= nAngle; } break; @@ -1982,7 +1982,7 @@ uno::Any SvxShape::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleE const SfxPoolItem* pPoolItem=NULL; if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,false,&pPoolItem)==SfxItemState::SET) { - sal_Int32 nAngle = ((SdrAngleItem*)pPoolItem)->GetValue(); + sal_Int32 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue(); aAny <<= nAngle; } break; @@ -2096,7 +2096,7 @@ beans::PropertyState SAL_CALL SvxShape::_getPropertyState( const OUString& Prope case XATTR_FILLHATCH: case XATTR_LINEDASH: { - NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID); + const NameOrIndex* pItem = static_cast<const NameOrIndex*>(rSet.GetItem((sal_uInt16)pMap->nWID)); if( ( pItem == NULL ) || pItem->GetName().isEmpty() ) eState = beans::PropertyState_DEFAULT_VALUE; } @@ -2111,7 +2111,7 @@ beans::PropertyState SAL_CALL SvxShape::_getPropertyState( const OUString& Prope case XATTR_LINESTART: case XATTR_FILLFLOATTRANSPARENCE: { - NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID); + const NameOrIndex* pItem = static_cast<const NameOrIndex*>(rSet.GetItem((sal_uInt16)pMap->nWID)); if ( pItem == NULL ) eState = beans::PropertyState_DEFAULT_VALUE; } @@ -2150,7 +2150,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl aVclPoint += mpObj->GetAnchorPos(); } - ((SdrCaptionObj*)mpObj.get())->SetTailPos(aVclPoint); + static_cast<SdrCaptionObj*>(mpObj.get())->SetTailPos(aVclPoint); return true; } @@ -2574,7 +2574,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl { case OWN_ATTR_CAPTION_POINT: { - Point aVclPoint = ((SdrCaptionObj*)mpObj.get())->GetTailPos(); + Point aVclPoint = static_cast<SdrCaptionObj*>(mpObj.get())->GetTailPos(); // #88491# make pos relative to anchor if( mpModel->IsWriter() ) @@ -2637,7 +2637,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl case OWN_ATTR_ISFONTWORK: { - rValue <<= mpObj->ISA(SdrTextObj) && ((SdrTextObj*)mpObj.get())->IsFontwork(); + rValue <<= mpObj->ISA(SdrTextObj) && static_cast<SdrTextObj*>(mpObj.get())->IsFontwork(); break; } @@ -2703,7 +2703,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl { bool bMirror = false; if( mpObj.is() && mpObj->ISA(SdrGrafObj) ) - bMirror = ((SdrGrafObj*)mpObj.get())->IsMirrored(); + bMirror = static_cast<SdrGrafObj*>(mpObj.get())->IsMirrored(); rValue <<= bMirror; break; @@ -2799,8 +2799,8 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl { const SfxItemSet& rObjItemSet = mpObj->GetMergedItemSet(); - XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&rObjItemSet.Get(XATTR_FILLBMP_STRETCH); - XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&rObjItemSet.Get(XATTR_FILLBMP_TILE); + const XFillBmpStretchItem* pStretchItem = static_cast<const XFillBmpStretchItem*>(&rObjItemSet.Get(XATTR_FILLBMP_STRETCH)); + const XFillBmpTileItem* pTileItem = static_cast<const XFillBmpTileItem*>(&rObjItemSet.Get(XATTR_FILLBMP_TILE)); if( pTileItem && pTileItem->GetValue() ) { @@ -4059,7 +4059,7 @@ uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId() /** called from the XActionLockable interface methods on initial locking */ void SvxShapeText::lock() { - SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource(); + SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource()); if( pEditSource ) pEditSource->lock(); } @@ -4069,7 +4069,7 @@ void SvxShapeText::lock() /** called from the XActionLockable interface methods on final unlock */ void SvxShapeText::unlock() { - SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource(); + SvxTextEditSource* pEditSource = static_cast<SvxTextEditSource*>(GetEditSource()); if( pEditSource ) pEditSource->unlock(); } diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 0bbc2c1c3dd4..4155cda76830 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -659,7 +659,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() bool bVertical = pOutlinerParaObject && pOutlinerParaObject->IsVertical(); // set objects style sheet on empty outliner - SfxStyleSheetPool* pPool = (SfxStyleSheetPool*)mpObject->GetModel()->GetStyleSheetPool(); + SfxStyleSheetPool* pPool = static_cast<SfxStyleSheetPool*>(mpObject->GetModel()->GetStyleSheetPool()); if( pPool ) mpOutliner->SetStyleSheetPool( pPool ); diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 56b97927233b..4dcd264077bf 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -66,8 +66,8 @@ const MetaCommentAction* ImplCheckForEPS( GDIMetaFile& rMtf ) if ( ( rMtf.GetActionSize() >= 2 ) && ( rMtf.FirstAction()->GetType() == META_EPS_ACTION ) && ( ((const MetaAction*)rMtf.GetAction( 1 ))->GetType() == META_COMMENT_ACTION ) - && ( ((const MetaCommentAction*)rMtf.GetAction( 1 ))->GetComment() == "EPSReplacementGraphic" ) ) - pComment = (const MetaCommentAction*)rMtf.GetAction( 1 ); + && ( static_cast<const MetaCommentAction*>(rMtf.GetAction( 1 ))->GetComment() == "EPSReplacementGraphic" ) ) + pComment = static_cast<const MetaCommentAction*>(rMtf.GetAction( 1 )); return pComment; } @@ -566,7 +566,7 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName, if ( nSize && pData ) pStream->Write( pData, nSize ); - const MetaEPSAction* pAct = ( (const MetaEPSAction*)rMtf.FirstAction() ); + const MetaEPSAction* pAct = static_cast<const MetaEPSAction*>(rMtf.FirstAction()); const GfxLink& rLink = pAct->GetLink(); pStream->Write( rLink.GetData(), rLink.GetDataSize() ); |