diff options
Diffstat (limited to 'sc/source')
43 files changed, 471 insertions, 471 deletions
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 6a745588fc16..a4b345d1a90b 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -218,7 +218,7 @@ getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() ); ScDocShell* pDocShell = NULL; if ( pModel ) - pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); + pDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject()); return pDocShell; } diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 685292338ea5..3cc6dd764da6 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -468,7 +468,7 @@ ScVbaApplication::wait( double time ) throw (uno::RuntimeException, std::excepti SbxVariableRef aRef = new SbxVariable; aRef->PutDouble( time ); aArgs->Put( aRef, 1 ); - SbMethod* pMeth = (SbMethod*)pBasic->GetRtl()->Find( OUString("WaitUntil"), SbxCLASS_METHOD ); + SbMethod* pMeth = static_cast<SbMethod*>(pBasic->GetRtl()->Find( OUString("WaitUntil"), SbxCLASS_METHOD )); if ( pMeth ) { @@ -563,7 +563,7 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) thro uno::Reference< sheet::XSpreadsheet > xDoc = xSpreadsheet->getActiveSheet(); ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext ); - ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow(); + ScGridWindow* gridWindow = static_cast<ScGridWindow*>(pShell->GetWindow()); try { uno::Reference< excel::XRange > xVbaSheetRange = ScVbaRange::getRangeObjectForName( @@ -605,7 +605,7 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) thro { uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY ); ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext ); - ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow(); + ScGridWindow* gridWindow = static_cast<ScGridWindow*>(pShell->GetWindow()); if ( xVbaRange.is() ) { //TODO bScroll should be using, In this time, it doesenot have effection @@ -1245,7 +1245,7 @@ ScVbaApplication::getDisplayFormulaBar() pViewShell->GetState( reqList ); const SfxPoolItem *pItem=0; if ( reqList.GetItemState( FID_TOGGLEINPUTLINE, false, &pItem ) == SfxItemState::SET ) - bRes = ((SfxBoolItem*)pItem)->GetValue(); + bRes = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } return bRes; } @@ -1268,7 +1268,7 @@ uno::Any SAL_CALL ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeException, std::exception ) { StarBASIC* pBasic = SfxGetpApp()->GetBasic(); - SbMethod* pMeth = (SbMethod*)pBasic->GetRtl()->Find( OUString("FuncCaller"), SbxCLASS_METHOD ); + SbMethod* pMeth = static_cast<SbMethod*>(pBasic->GetRtl()->Find( OUString("FuncCaller"), SbxCLASS_METHOD )); uno::Any aRet; if ( pMeth ) { diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx index 5d92e7025939..7d3cde109188 100644 --- a/sc/source/ui/vba/vbafont.cxx +++ b/sc/source/ui/vba/vbafont.cxx @@ -104,8 +104,8 @@ ScVbaFont::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeExceptio nValue = SUPERSCRIPT; nValue2 = SUPERSCRIPTHEIGHT; } - xProps->setPropertyValue("CharEscapement", ( uno::Any )nValue ); - xProps->setPropertyValue("CharEscapementHeight", ( uno::Any )nValue2 ); + xProps->setPropertyValue("CharEscapement", uno::Any(nValue) ); + xProps->setPropertyValue("CharEscapementHeight", uno::Any(nValue2) ); } uno::Any SAL_CALL @@ -177,8 +177,8 @@ ScVbaFont::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException, nValue2 = SUBSCRIPTHEIGHT; } - xProps->setPropertyValue("CharEscapementHeight", ( uno::Any )nValue2 ); - xProps->setPropertyValue("CharEscapement", ( uno::Any )nValue ); + xProps->setPropertyValue("CharEscapementHeight", uno::Any(nValue2) ); + xProps->setPropertyValue("CharEscapement", uno::Any(nValue) ); } @@ -372,7 +372,7 @@ ScVbaFont::setUnderline( const uno::Any& aValue ) throw ( uno::RuntimeException, throw uno::RuntimeException("Unknown value for Underline" ); } - mxFont->setPropertyValue("CharUnderline", ( uno::Any )nValue ); + mxFont->setPropertyValue("CharUnderline", uno::Any(nValue) ); } diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx index 7edec3fd0e52..e2cff4b168ef 100644 --- a/sc/source/ui/vba/vbaformat.cxx +++ b/sc/source/ui/vba/vbaformat.cxx @@ -554,7 +554,7 @@ ScVbaFormat<Ifc1>::getLocked( ) throw (script::BasicErrorException, uno::Runtim SfxItemSet* pDataSet = getCurrentDataSet(); if ( pDataSet ) { - const ScProtectionAttr& rProtAttr = (const ScProtectionAttr &) pDataSet->Get(ATTR_PROTECTION, true); + const ScProtectionAttr& rProtAttr = static_cast<const ScProtectionAttr &>( pDataSet->Get(ATTR_PROTECTION, true) ); SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION, true, NULL); if(eState != SfxItemState::DONTCARE) aCellProtection = uno::makeAny(rProtAttr.GetProtection()); @@ -587,7 +587,7 @@ ScVbaFormat<Ifc1>::getFormulaHidden( ) throw (script::BasicErrorException, uno: SfxItemSet* pDataSet = getCurrentDataSet(); if ( pDataSet ) { - const ScProtectionAttr& rProtAttr = (const ScProtectionAttr &) pDataSet->Get(ATTR_PROTECTION, true); + const ScProtectionAttr& rProtAttr = static_cast<const ScProtectionAttr &>( pDataSet->Get(ATTR_PROTECTION, true) ); SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION, true, NULL); if(eState != SfxItemState::DONTCARE) aBoolRet = uno::makeAny(rProtAttr.GetHideFormula()); diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index b5daf6cf87d3..d6090a877a1e 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -102,7 +102,7 @@ public: ScModelObj* pModel = static_cast< ScModelObj* >( m_xModel.get() ); if ( !pModel ) throw uno::RuntimeException("Cannot obtain current document" ); - ScDocShell* pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); + ScDocShell* pDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject()); if ( !pDocShell ) throw uno::RuntimeException("Cannot obtain docshell" ); ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); @@ -411,7 +411,7 @@ ScVbaWindow::getWindowState() throw (uno::RuntimeException, std::exception) // !! TODO !! get view shell from controller ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); - WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame().GetSystemWindow(); + WorkWindow* pWork = static_cast<WorkWindow*>( pViewFrame->GetFrame().GetSystemWindow() ); if ( pWork ) { if ( pWork -> IsMaximized()) @@ -430,7 +430,7 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE // !! TODO !! get view shell from controller ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); - WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame().GetSystemWindow(); + WorkWindow* pWork = static_cast<WorkWindow*>( pViewFrame->GetFrame().GetSystemWindow() ); if ( pWork ) { if ( nwindowState == xlMaximized) diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx index ac5b37f777c5..80ccc5f3acc5 100644 --- a/sc/source/ui/view/auditsh.cxx +++ b/sc/source/ui/view/auditsh.cxx @@ -97,8 +97,8 @@ void ScAuditingShell::Execute( SfxRequest& rReq ) { OSL_ENSURE( pXItem->ISA(SfxInt16Item) && pYItem->ISA(SfxInt32Item), "wrong items" ); - SCsCOL nCol = static_cast<SCsCOL>(((const SfxInt16Item*) pXItem)->GetValue()); - SCsROW nRow = static_cast<SCsROW>(((const SfxInt32Item*) pYItem)->GetValue()); + SCsCOL nCol = static_cast<SCsCOL>(static_cast<const SfxInt16Item*>(pXItem)->GetValue()); + SCsROW nRow = static_cast<SCsROW>(static_cast<const SfxInt32Item*>(pYItem)->GetValue()); ScViewFunc* pView = pViewData->GetView(); pView->MoveCursorAbs( nCol, nRow, SC_FOLLOW_LINE, false, false ); switch ( nFunction ) diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 4440f9cf919e..32c237daa2ad 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -181,7 +181,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) OUString aFlags; if( pReqArgs->HasItem( FID_INS_CELL, &pItem ) ) - aFlags = ((const SfxStringItem*)pItem)->GetValue(); + aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( !aFlags.isEmpty() ) { switch( aFlags[0] ) @@ -250,7 +250,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) OUString aFlags; if( pReqArgs->HasItem( FID_DELETE_CELL, &pItem ) ) - aFlags = ((const SfxStringItem*)pItem)->GetValue(); + aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( !aFlags.isEmpty() ) { switch( aFlags[0] ) @@ -330,7 +330,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) OUString aFlags('A'); if( pReqArgs->HasItem( SID_DELETE, &pItem ) ) - aFlags = ((const SfxStringItem*)pItem)->GetValue(); + aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue(); aFlags = aFlags.toAsciiUpperCase(); bool bCont = true; @@ -441,7 +441,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) OUString aFlags('A'); if( pReqArgs->HasItem( FID_FILL_TAB, &pItem ) ) - aFlags = ((const SfxStringItem*)pItem)->GetValue(); + aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue(); aFlags = aFlags.toAsciiUpperCase(); bool bCont = true; @@ -559,17 +559,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) bDoIt=false; if( pReqArgs->HasItem( FID_FILL_SERIES, &pItem ) ) - aFillDir = ((const SfxStringItem*)pItem)->GetValue(); + aFillDir = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( pReqArgs->HasItem( FN_PARAM_1, &pItem ) ) - aFillCmd = ((const SfxStringItem*)pItem)->GetValue(); + aFillCmd = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( pReqArgs->HasItem( FN_PARAM_2, &pItem ) ) - aFillDateCmd = ((const SfxStringItem*)pItem)->GetValue(); + aFillDateCmd = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( pReqArgs->HasItem( FN_PARAM_3, &pItem ) ) - aFillStep = ((const SfxStringItem*)pItem)->GetValue(); + aFillStep = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( pReqArgs->HasItem( FN_PARAM_4, &pItem ) ) - aFillStart = ((const SfxStringItem*)pItem)->GetValue(); + aFillStart = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( pReqArgs->HasItem( FN_PARAM_5, &pItem ) ) - aFillMax = ((const SfxStringItem*)pItem)->GetValue(); + aFillMax = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( !aFillDir.isEmpty() ) switch( aFillDir[0] ) @@ -808,7 +808,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( pReqArgs->HasItem( FID_FILL_AUTO, &pItem ) ) { ScAddress aScAddress; - OUString aArg = ((const SfxStringItem*)pItem)->GetValue(); + OUString aArg = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( aScAddress.Parse( aArg, pDoc, pDoc->GetAddressConvention() ) & SCA_VALID ) { @@ -1106,7 +1106,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( pReqArgs->HasItem( SID_OUTLINE_MAKE, &pItem ) ) { - OUString aCol = ((const SfxStringItem*)pItem)->GetValue(); + OUString aCol = static_cast<const SfxStringItem*>(pItem)->GetValue(); aCol = aCol.toAsciiUpperCase(); switch( aCol[0] ) @@ -1167,7 +1167,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if( pReqArgs->HasItem( SID_OUTLINE_REMOVE, &pItem ) ) { - OUString aCol = ((const SfxStringItem*)pItem)->GetValue(); + OUString aCol = static_cast<const SfxStringItem*>(pItem)->GetValue(); aCol = aCol.toAsciiUpperCase(); switch (aCol[0]) @@ -1255,7 +1255,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET && pItem->ISA(SfxUInt32Item) ) { - nFormat = ((const SfxUInt32Item*)pItem)->GetValue(); + nFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue(); } if ( nFormat ) @@ -1303,7 +1303,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) OUString aFlags('A'); if( pReqArgs->HasItem( FID_INS_CELL_CONTENTS, &pItem ) ) - aFlags = ((const SfxStringItem*)pItem)->GetValue(); + aFlags = static_cast<const SfxStringItem*>(pItem)->GetValue(); aFlags = aFlags.toAsciiUpperCase(); bool bCont = true; @@ -1509,7 +1509,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET && pItem->ISA(SfxUInt32Item) ) { - sal_uLong nFormat = ((const SfxUInt32Item*)pItem)->GetValue(); + sal_uLong nFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue(); bool bRet=true; { WaitObject aWait( GetViewData()->GetDialogParent() ); @@ -1802,7 +1802,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pReqArgs->GetItemState( SCITEM_CONSOLIDATEDATA, true, &pItem ) ) { const ScConsolidateParam& rParam = - ((const ScConsolidateItem*)pItem)->GetData(); + static_cast<const ScConsolidateItem*>(pItem)->GetData(); pTabViewShell->Consolidate( rParam ); GetViewData()->GetDocument()->SetConsolidateDlgData( &rParam ); @@ -1818,13 +1818,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_INS_FUNCTION: { - const SfxBoolItem* pOkItem = (const SfxBoolItem*)&pReqArgs->Get( SID_DLG_RETOK ); + const SfxBoolItem* pOkItem = static_cast<const SfxBoolItem*>(&pReqArgs->Get( SID_DLG_RETOK )); if ( pOkItem->GetValue() ) // OK { OUString aFormula; - const SfxStringItem* pSItem = (const SfxStringItem*)&pReqArgs->Get( SCITEM_STRING ); - const SfxBoolItem* pMatrixItem = (const SfxBoolItem*) &pReqArgs->Get( SID_DLG_MATRIX ); + const SfxStringItem* pSItem = static_cast<const SfxStringItem*>(&pReqArgs->Get( SCITEM_STRING )); + const SfxBoolItem* pMatrixItem = static_cast<const SfxBoolItem*>(&pReqArgs->Get( SID_DLG_MATRIX )); aFormula += pSItem->GetValue(); pScMod->ActivateInputWindow( &aFormula, pMatrixItem->GetValue() ); @@ -1844,13 +1844,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) OUString aName, aSymbol, aAttrib; if( pReqArgs->HasItem( FID_DEFINE_NAME, &pItem ) ) - aName = ((const SfxStringItem*)pItem)->GetValue(); + aName = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( pReqArgs->HasItem( FN_PARAM_1, &pItem ) ) - aSymbol = ((const SfxStringItem*)pItem)->GetValue(); + aSymbol = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( pReqArgs->HasItem( FN_PARAM_2, &pItem ) ) - aAttrib = ((const SfxStringItem*)pItem)->GetValue(); + aAttrib = static_cast<const SfxStringItem*>(pItem)->GetValue(); if ( !aName.isEmpty() && !aSymbol.isEmpty() ) { @@ -2043,7 +2043,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const SfxPoolItem* pItem; if( pReqArgs->HasItem( SID_UPDATECHART, &pItem ) ) - bAll = ((const SfxBoolItem*)pItem)->GetValue(); + bAll = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } pTabViewShell->UpdateCharts( bAll ); @@ -2060,8 +2060,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if (pReqArgs) { const ScTabOpItem& rItem = - (const ScTabOpItem&) - pReqArgs->Get( SID_TABOP ); + static_cast<const ScTabOpItem&>( + pReqArgs->Get( SID_TABOP )); pTabViewShell->TabOp( rItem.GetData() ); @@ -2073,8 +2073,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if (pReqArgs) { const ScSolveItem& rItem = - (const ScSolveItem&) - pReqArgs->Get( SCITEM_SOLVEDATA ); + static_cast<const ScSolveItem&>( + pReqArgs->Get( SCITEM_SOLVEDATA )); pTabViewShell->Solve( rItem.GetData() ); @@ -2123,7 +2123,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_RANGE_NOTETEXT: if (pReqArgs) { - const SfxStringItem& rTextItem = (const SfxStringItem&)pReqArgs->Get( SID_RANGE_NOTETEXT ); + const SfxStringItem& rTextItem = static_cast<const SfxStringItem&>(pReqArgs->Get( SID_RANGE_NOTETEXT )); // always cursor position ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); @@ -2135,9 +2135,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_INSERT_POSTIT: if ( pReqArgs ) { - const SvxPostItAuthorItem& rAuthorItem = (const SvxPostItAuthorItem&)pReqArgs->Get( SID_ATTR_POSTIT_AUTHOR ); - const SvxPostItDateItem& rDateItem = (const SvxPostItDateItem&) pReqArgs->Get( SID_ATTR_POSTIT_DATE ); - const SvxPostItTextItem& rTextItem = (const SvxPostItTextItem&) pReqArgs->Get( SID_ATTR_POSTIT_TEXT ); + const SvxPostItAuthorItem& rAuthorItem = static_cast<const SvxPostItAuthorItem&>(pReqArgs->Get( SID_ATTR_POSTIT_AUTHOR )); + const SvxPostItDateItem& rDateItem = static_cast<const SvxPostItDateItem&>(pReqArgs->Get( SID_ATTR_POSTIT_DATE )); + const SvxPostItTextItem& rTextItem = static_cast<const SvxPostItTextItem&>(pReqArgs->Get( SID_ATTR_POSTIT_TEXT )); ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); pTabViewShell->ReplaceNote( aPos, rTextItem.GetValue(), &rAuthorItem.GetValue(), &rDateItem.GetValue() ); @@ -2158,7 +2158,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) bool bShow; const SfxPoolItem* pItem; if ( pReqArgs && (pReqArgs->GetItemState( FID_NOTE_VISIBLE, true, &pItem ) == SfxItemState::SET) ) - bShow = ((const SfxBoolItem*) pItem)->GetValue(); + bShow = static_cast<const SfxBoolItem*>(pItem)->GetValue(); else bShow = !pNote->IsCaptionShown(); @@ -2320,7 +2320,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( pReqArgs ) { const SfxStringItem* pItem = - (const SfxStringItem*)&pReqArgs->Get( SID_SELECT_SCENARIO ); + static_cast<const SfxStringItem*>(&pReqArgs->Get( SID_SELECT_SCENARIO )); if( pItem ) { @@ -2343,7 +2343,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const SfxPoolItem* pItem; if( pReqArgs->HasItem( SID_HYPERLINK_SETLINK, &pItem ) ) { - const SvxHyperlinkItem* pHyper = (const SvxHyperlinkItem*) pItem; + const SvxHyperlinkItem* pHyper = static_cast<const SvxHyperlinkItem*>(pItem); const OUString& rName = pHyper->GetName(); const OUString& rURL = pHyper->GetURL(); const OUString& rTarget = pHyper->GetTargetFrame(); @@ -2706,7 +2706,7 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) const SfxItemSet* pArgs = rReq.GetArgs(); if ( pArgs ) { - pTabViewShell->DoSubTotals( ((const ScSubTotalItem&) pArgs->Get( SCITEM_SUBTDATA )). + pTabViewShell->DoSubTotals( static_cast<const ScSubTotalItem&>( pArgs->Get( SCITEM_SUBTDATA )). GetSubTotalData() ); rReq.Done(); return; @@ -2749,7 +2749,7 @@ void ScCellShell::ExecuteSubtotals(SfxRequest& rReq) { pOutSet = pDlg->GetOutputItemSet(); aSubTotalParam = - ((const ScSubTotalItem&) + static_cast<const ScSubTotalItem&>( pOutSet->Get( SCITEM_SUBTDATA )). GetSubTotalData(); } diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 68c0bcbb5d91..a6771012e842 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -490,7 +490,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pDlg->Execute() == RET_OK ) { const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - const ScSortParam& rOutParam = ((const ScSortItem&) + const ScSortParam& rOutParam = static_cast<const ScSortItem&>( pOutSet->Get( SCITEM_SORTDATA )).GetSortData(); // subtotal when needed new @@ -549,7 +549,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pArgs ) { OSL_FAIL("SID_FILTER with arguments?"); - pTabViewShell->Query( ((const ScQueryItem&) + pTabViewShell->Query( static_cast<const ScQueryItem&>( pArgs->Get( SCITEM_QUERYDATA )).GetQueryData(), NULL, true ); rReq.Done(); } @@ -570,7 +570,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pArgs ) { OSL_FAIL("SID_SPECIAL_FILTER with arguments?"); - pTabViewShell->Query( ((const ScQueryItem&) + pTabViewShell->Query( static_cast<const ScQueryItem&>( pArgs->Get( SCITEM_QUERYDATA )).GetQueryData(), NULL, true ); rReq.Done(); } @@ -661,7 +661,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) const ScDPObject* pDPObject = pTabViewShell->GetDialogDPObject(); if ( pDPObject ) { - const ScPivotItem* pPItem = (const ScPivotItem*)pItem; + const ScPivotItem* pPItem = static_cast<const ScPivotItem*>(pItem); bool bSuccess = pTabViewShell->MakePivotTable( pPItem->GetData(), pPItem->GetDestRange(), pPItem->IsNewSheet(), *pDPObject ); SfxBoolItem aRet(0, bSuccess); @@ -696,7 +696,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pReqArgs ) { const SfxStringItem* pItem = - (const SfxStringItem*)&pReqArgs->Get( SID_SELECT_DB ); + static_cast<const SfxStringItem*>(&pReqArgs->Get( SID_SELECT_DB )); if( pItem ) { @@ -803,7 +803,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) SCROW nCurY = GetViewData()->GetCurY(); SCTAB nTab = GetViewData()->GetTabNo(); ScAddress aCursorPos( nCurX, nCurY, nTab ); - sal_uLong nIndex = ((SfxUInt32Item*)pDoc->GetAttr( + sal_uLong nIndex = static_cast<const SfxUInt32Item*>(pDoc->GetAttr( nCurX, nCurY, nTab, ATTR_VALIDDATA ))->GetValue(); if ( nIndex ) { @@ -854,12 +854,12 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); if ( pOutSet->GetItemState( FID_VALID_MODE, true, &pItem ) == SfxItemState::SET ) - eMode = (ScValidationMode) ((const SfxAllEnumItem*)pItem)->GetValue(); + eMode = (ScValidationMode) static_cast<const SfxAllEnumItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_CONDMODE, true, &pItem ) == SfxItemState::SET ) - eOper = (ScConditionMode) ((const SfxAllEnumItem*)pItem)->GetValue(); + eOper = (ScConditionMode) static_cast<const SfxAllEnumItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_VALUE1, true, &pItem ) == SfxItemState::SET ) { - OUString aTemp1 = ((const SfxStringItem*)pItem)->GetValue(); + OUString aTemp1 = static_cast<const SfxStringItem*>(pItem)->GetValue(); if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME) { sal_uInt32 nNumIndex = 0; @@ -876,7 +876,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } if ( pOutSet->GetItemState( FID_VALID_VALUE2, true, &pItem ) == SfxItemState::SET ) { - OUString aTemp2 = ((const SfxStringItem*)pItem)->GetValue(); + OUString aTemp2 = static_cast<const SfxStringItem*>(pItem)->GetValue(); if (eMode == SC_VALID_DATE || eMode == SC_VALID_TIME) { sal_uInt32 nNumIndex = 0; @@ -893,25 +893,25 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } if ( pOutSet->GetItemState( FID_VALID_BLANK, true, &pItem ) == SfxItemState::SET ) - bBlank = ((const SfxBoolItem*)pItem)->GetValue(); + bBlank = static_cast<const SfxBoolItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_LISTTYPE, true, &pItem ) == SfxItemState::SET ) - nListType = ((const SfxInt16Item*)pItem)->GetValue(); + nListType = static_cast<const SfxInt16Item*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_SHOWHELP, true, &pItem ) == SfxItemState::SET ) - bShowHelp = ((const SfxBoolItem*)pItem)->GetValue(); + bShowHelp = static_cast<const SfxBoolItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_HELPTITLE, true, &pItem ) == SfxItemState::SET ) - aHelpTitle = ((const SfxStringItem*)pItem)->GetValue(); + aHelpTitle = static_cast<const SfxStringItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_HELPTEXT, true, &pItem ) == SfxItemState::SET ) - aHelpText = ((const SfxStringItem*)pItem)->GetValue(); + aHelpText = static_cast<const SfxStringItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_SHOWERR, true, &pItem ) == SfxItemState::SET ) - bShowError = ((const SfxBoolItem*)pItem)->GetValue(); + bShowError = static_cast<const SfxBoolItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_ERRSTYLE, true, &pItem ) == SfxItemState::SET ) - eErrStyle = (ScValidErrorStyle) ((const SfxAllEnumItem*)pItem)->GetValue(); + eErrStyle = (ScValidErrorStyle) static_cast<const SfxAllEnumItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_ERRTITLE, true, &pItem ) == SfxItemState::SET ) - aErrTitle = ((const SfxStringItem*)pItem)->GetValue(); + aErrTitle = static_cast<const SfxStringItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_ERRTEXT, true, &pItem ) == SfxItemState::SET ) - aErrText = ((const SfxStringItem*)pItem)->GetValue(); + aErrText = static_cast<const SfxStringItem*>(pItem)->GetValue(); ScValidationData aData( eMode, eOper, aExpr1, aExpr2, pDoc, aCursorPos ); aData.SetIgnoreBlank( bBlank ); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 99353aacc9ef..a94de11007cc 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -117,7 +117,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) * 1: ER Click extends selection * 2: ERG Click defines further selection */ - sal_uInt16 nMode = ((const SfxUInt16Item&)pReqArgs->Get( nSlot )).GetValue(); + sal_uInt16 nMode = static_cast<const SfxUInt16Item&>(pReqArgs->Get( nSlot )).GetValue(); switch ( nMode ) { @@ -178,7 +178,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if ( pReqArgs ) { - OUString aStr( ((const SfxStringItem&)pReqArgs-> + OUString aStr( static_cast<const SfxStringItem&>(pReqArgs-> Get( SID_ENTER_STRING )).GetValue() ); pTabViewShell->EnterData( GetViewData()->GetCurX(), @@ -209,7 +209,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if ( pReqArgs ) { - OUString aStr = ((const SfxStringItem&)pReqArgs-> + OUString aStr = static_cast<const SfxStringItem&>(pReqArgs-> Get( SID_INSERT_MATRIX )).GetValue(); ScDocument* pDoc = GetViewData()->GetDocument(); pTabViewShell->EnterMatrix( aStr, pDoc->GetGrammar() ); @@ -226,8 +226,8 @@ void ScCellShell::Execute( SfxRequest& rReq ) break; const ScInputStatusItem* pStatusItem - = (const ScInputStatusItem*)&pReqArgs-> - Get( FID_INPUTLINE_STATUS ); + = static_cast<const ScInputStatusItem*>(&pReqArgs-> + Get( FID_INPUTLINE_STATUS )); ScAddress aCursorPos = pStatusItem->GetPos(); OUString aString = pStatusItem->GetString(); @@ -476,9 +476,9 @@ void ScCellShell::Execute( SfxRequest& rReq ) OUString aArgComment; const SfxPoolItem* pItem; if ( pReqArgs->GetItemState( SID_SCENARIOS, true, &pItem ) == SfxItemState::SET ) - aArgName = ((const SfxStringItem*)pItem)->GetValue(); + aArgName = static_cast<const SfxStringItem*>(pItem)->GetValue(); if ( pReqArgs->GetItemState( SID_NEW_TABLENAME, true, &pItem ) == SfxItemState::SET ) - aArgComment = ((const SfxStringItem*)pItem)->GetValue(); + aArgComment = static_cast<const SfxStringItem*>(pItem)->GetValue(); aColor = Color( COL_LIGHTGRAY ); // Default nFlags = 0; // not-TwoWay @@ -525,7 +525,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if ( pReqArgs ) { - const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_ROW_HEIGHT ); + const SfxUInt16Item& rUInt16Item = static_cast<const SfxUInt16Item&>(pReqArgs->Get( FID_ROW_HEIGHT )); // #101390#; the value of the macro is in HMM so use HMMToTwips to convert pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, @@ -567,7 +567,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if ( pReqArgs ) { - const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_ROW_OPT_HEIGHT ); + const SfxUInt16Item& rUInt16Item = static_cast<const SfxUInt16Item&>(pReqArgs->Get( FID_ROW_OPT_HEIGHT )); // #101390#; the value of the macro is in HMM so use HMMToTwips to convert pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_OPTIMAL, @@ -608,7 +608,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if ( pReqArgs ) { - const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_COL_WIDTH ); + const SfxUInt16Item& rUInt16Item = static_cast<const SfxUInt16Item&>(pReqArgs->Get( FID_COL_WIDTH )); // #101390#; the value of the macro is in HMM so use HMMToTwips to convert pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_DIRECT, @@ -649,7 +649,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if ( pReqArgs ) { - const SfxUInt16Item& rUInt16Item = (const SfxUInt16Item&)pReqArgs->Get( FID_COL_OPT_WIDTH ); + const SfxUInt16Item& rUInt16Item = static_cast<const SfxUInt16Item&>(pReqArgs->Get( FID_COL_OPT_WIDTH )); // #101390#; the value of the macro is in HMM so use HMMToTwips to convert pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_OPTIMAL, @@ -752,7 +752,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET ) { OSL_ENSURE(pItem && pItem->ISA(SfxBoolItem), "falsches Item"); - bMoveContents = ((const SfxBoolItem*)pItem)->GetValue(); + bMoveContents = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } if (pTabViewShell->MergeCells( bApi, bMoveContents, true, bCenter )) @@ -799,7 +799,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if ( pReqArgs ) { - const SfxStringItem& rNameItem = (const SfxStringItem&)pReqArgs->Get( SID_AUTOFORMAT ); + const SfxStringItem& rNameItem = static_cast<const SfxStringItem&>(pReqArgs->Get( SID_AUTOFORMAT )); ScAutoFormat* pFormat = ScGlobal::GetOrCreateAutoFormat(); ScAutoFormat::const_iterator it = pFormat->find(rNameItem.GetValue()); ScAutoFormat::const_iterator itBeg = pFormat->begin(); diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx index 5c6640b64408..0cd2a9fd64f7 100644 --- a/sc/source/ui/view/cellsh4.cxx +++ b/sc/source/ui/view/cellsh4.cxx @@ -44,9 +44,9 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq ) { const SfxPoolItem* pItem; if (pReqArgs->HasItem(FN_PARAM_1, &pItem)) - nRepeat = static_cast<SCsCOLROW>(((const SfxInt16Item*)pItem)->GetValue()); + nRepeat = static_cast<SCsCOLROW>(static_cast<const SfxInt16Item*>(pItem)->GetValue()); if (pReqArgs->HasItem(FN_PARAM_2, &pItem)) - bSel = ((const SfxBoolItem*)pItem)->GetValue(); + bSel = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } else { @@ -212,7 +212,7 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq ) { const SfxPoolItem* pItem; if (pReqArgs->HasItem(FN_PARAM_1, &pItem)) - nRepeat = static_cast<SCsCOLROW>(((const SfxInt16Item*)pItem)->GetValue()); + nRepeat = static_cast<SCsCOLROW>(static_cast<const SfxInt16Item*>(pItem)->GetValue()); } SCsROW nMovY = nRepeat; @@ -400,7 +400,7 @@ void ScCellShell::ExecutePage( SfxRequest& rReq ) { const SfxPoolItem* pItem; if (pReqArgs->HasItem(FN_PARAM_2, &pItem)) - bSel = ((const SfxBoolItem*)pItem)->GetValue(); + bSel = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } else { diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 06b0f3120ba0..b2099de5cb7b 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -304,7 +304,7 @@ void ScDBFunc::ToggleAutoFilter() for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++) { - nFlag = ((ScMergeFlagAttr*) pDoc-> + nFlag = static_cast<const ScMergeFlagAttr*>( pDoc-> GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); if ( (nFlag & SC_MF_AUTO) == 0 ) @@ -317,7 +317,7 @@ void ScDBFunc::ToggleAutoFilter() for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++) { - nFlag = ((ScMergeFlagAttr*) pDoc-> + nFlag = static_cast<const ScMergeFlagAttr*>( pDoc-> GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); } @@ -373,7 +373,7 @@ void ScDBFunc::ToggleAutoFilter() for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++) { - nFlag = ((ScMergeFlagAttr*) pDoc-> + nFlag = static_cast<const ScMergeFlagAttr*>( pDoc-> GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | SC_MF_AUTO ) ); } @@ -418,7 +418,7 @@ void ScDBFunc::HideAutoFilter() for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++) { - sal_Int16 nFlag = ((ScMergeFlagAttr*) rDoc. + sal_Int16 nFlag = static_cast<const ScMergeFlagAttr*>( rDoc. GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue(); rDoc.ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); } diff --git a/sc/source/ui/view/dbfunc4.cxx b/sc/source/ui/view/dbfunc4.cxx index 08ae2b8c6a88..13da170b07c5 100644 --- a/sc/source/ui/view/dbfunc4.cxx +++ b/sc/source/ui/view/dbfunc4.cxx @@ -47,7 +47,7 @@ sal_uInt16 ScDBFunc::DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, bo { if ( pObject->GetObjIdentifier() == OBJ_OLE2 && pDoc->IsChart( pObject ) ) { - OUString aName = ((SdrOle2Obj*)pObject)->GetPersistName(); + OUString aName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName(); bool bHit = true; if ( !bAllCharts ) { diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx index 2d23728a16e4..d4bc93a1d29b 100644 --- a/sc/source/ui/view/drawvie3.cxx +++ b/sc/source/ui/view/drawvie3.cxx @@ -164,7 +164,7 @@ void ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if (dynamic_cast<const ScTabDeletedHint*>(&rHint)) // Tabelle geloescht { - SCTAB nDelTab = ((ScTabDeletedHint&)rHint).GetTab(); + SCTAB nDelTab = static_cast<const ScTabDeletedHint&>(rHint).GetTab(); if (ValidTab(nDelTab)) { // used to be: HidePagePgNum(nDelTab) - hide only if the deleted sheet is shown here @@ -174,7 +174,7 @@ void ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if (dynamic_cast<const ScTabSizeChangedHint*>(&rHint)) // Groesse geaendert { - if ( nTab == ((ScTabSizeChangedHint&)rHint).GetTab() ) + if ( nTab == static_cast<const ScTabSizeChangedHint&>(rHint).GetTab() ) UpdateWorkArea(); } else if ( const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint ) ) @@ -204,7 +204,7 @@ void ScDrawView::UpdateIMap( SdrObject* pObj ) // Grafik vom Objekt besorgen if ( pObj->ISA( SdrGrafObj ) ) - aGraphic = ( (SdrGrafObj*) pObj )->GetGraphic(); + aGraphic = static_cast<SdrGrafObj*>(pObj)->GetGraphic(); else { const Graphic* pGraphic = static_cast<const SdrOle2Obj*>(pObj)->GetGraphic(); diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 08a3565d28ca..b3b6e849d20a 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -474,24 +474,24 @@ void ScDrawView::SetMarkedOriginalSize() if (nIdent == OBJ_OLE2) { // TODO/LEAN: working with visual area can switch object to running state - uno::Reference < embed::XEmbeddedObject > xObj( ((SdrOle2Obj*)pObj)->GetObjRef(), uno::UNO_QUERY ); + uno::Reference < embed::XEmbeddedObject > xObj( static_cast<SdrOle2Obj*>(pObj)->GetObjRef(), uno::UNO_QUERY ); if ( xObj.is() ) // NULL for an invalid object that couldn't be loaded { - sal_Int64 nAspect = ((SdrOle2Obj*)pObj)->GetAspect(); + sal_Int64 nAspect = static_cast<SdrOle2Obj*>(pObj)->GetAspect(); if ( nAspect == embed::Aspects::MSOLE_ICON ) { MapMode aMapMode( MAP_100TH_MM ); - aOriginalSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize( &aMapMode ); + aOriginalSize = static_cast<SdrOle2Obj*>(pObj)->GetOrigObjSize( &aMapMode ); bDo = true; } else { - MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( ((SdrOle2Obj*)pObj)->GetAspect() ) ); + MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( static_cast<SdrOle2Obj*>(pObj)->GetAspect() ) ); awt::Size aSz; try { - aSz = xObj->getVisualAreaSize( ((SdrOle2Obj*)pObj)->GetAspect() ); + aSz = xObj->getVisualAreaSize( static_cast<SdrOle2Obj*>(pObj)->GetAspect() ); aOriginalSize = OutputDevice::LogicToLogic( Size( aSz.Width, aSz.Height ), aUnit, MAP_100TH_MM ); @@ -505,7 +505,7 @@ void ScDrawView::SetMarkedOriginalSize() } else if (nIdent == OBJ_GRAF) { - const Graphic& rGraphic = ((SdrGrafObj*)pObj)->GetGraphic(); + const Graphic& rGraphic = static_cast<SdrGrafObj*>(pObj)->GetGraphic(); MapMode aSourceMap = rGraphic.GetPrefMapMode(); MapMode aDestMap( MAP_100TH_MM ); diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 718091033af3..65e4572daf00 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -369,7 +369,7 @@ void ScDrawView::MarkListHasChanged() ScModule* pScMod = SC_MOD(); bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF; - ScClient* pClient = (ScClient*) pViewSh->GetIPClient(); + ScClient* pClient = static_cast<ScClient*>( pViewSh->GetIPClient() ); if ( pClient && pClient->IsObjectInPlaceActive() && !bUnoRefDialog ) { // beim ViewShell::Activate aus dem Reset2Open nicht die Handles anzeigen @@ -398,7 +398,7 @@ void ScDrawView::MarkListHasChanged() SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); if (pObj->GetObjIdentifier() == OBJ_OLE2) { - pOle2Obj = (SdrOle2Obj*) pObj; + pOle2Obj = static_cast<SdrOle2Obj*>(pObj); if (!pDoc->IsChart(pObj) ) pViewSh->SetOleObjectShell(true); else @@ -407,7 +407,7 @@ void ScDrawView::MarkListHasChanged() } else if (pObj->GetObjIdentifier() == OBJ_GRAF) { - pGrafObj = (SdrGrafObj*) pObj; + pGrafObj = static_cast<SdrGrafObj*>(pObj); pViewSh->SetGraphicShell(true); bSubShellSet = true; } @@ -432,7 +432,7 @@ void ScDrawView::MarkListHasChanged() SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if ( pObj->ISA( SdrObjGroup ) ) { - const SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList(); + const SdrObjList *pLst = static_cast<SdrObjGroup*>(pObj)->GetSubList(); const size_t nListCount = pLst->GetObjCount(); if ( nListCount == 0 ) { @@ -509,7 +509,7 @@ void ScDrawView::MarkListHasChanged() if(OUTDEV_WINDOW == rOutDev.GetOutDevType()) { - ((vcl::Window&)rOutDev).Update(); + static_cast<vcl::Window&>(rOutDev).Update(); } } @@ -901,7 +901,7 @@ void ScDrawView::SyncForGrid( SdrObject* pObj ) // process members of a group shape separately if ( pObj->ISA( SdrObjGroup ) ) { - SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList(); + SdrObjList *pLst = static_cast<SdrObjGroup*>(pObj)->GetSubList(); for ( size_t i = 0, nCount = pLst->GetObjCount(); i < nCount; ++i ) SyncForGrid( pLst->GetObj( i ) ); } @@ -957,7 +957,7 @@ SdrObject* ScDrawView::ApplyGraphicToObject( { if(dynamic_cast< SdrGrafObj* >(&rHitObject)) { - SdrGrafObj* pNewGrafObj = (SdrGrafObj*)rHitObject.Clone(); + SdrGrafObj* pNewGrafObj = static_cast<SdrGrafObj*>(rHitObject.Clone()); pNewGrafObj->SetGraphic(rGraphic); BegUndo(rBeginUndoText); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 956cea9ccd59..c91c1cb885b4 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -197,7 +197,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) case SID_ATTR_INSERT: if ( pReqArgs ) { - bIsInsertMode = ((const SfxBoolItem&)pReqArgs->Get(nSlot)).GetValue(); + bIsInsertMode = static_cast<const SfxBoolItem&>(pReqArgs->Get(nSlot)).GetValue(); pTableView->SetInsertMode( bIsInsertMode ); if (pTopView) pTopView->SetInsertMode( bIsInsertMode ); @@ -253,7 +253,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET && pItem->ISA(SfxUInt32Item) ) { - nFormat = ((const SfxUInt32Item*)pItem)->GetValue(); + nFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue(); } if ( nFormat ) @@ -337,8 +337,8 @@ void ScEditShell::Execute( SfxRequest& rReq ) sal_uInt16 nFontWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? EE_CHAR_FONTINFO_CJK : ( ( nScript == SCRIPTTYPE_COMPLEX ) ? EE_CHAR_FONTINFO_CTL : EE_CHAR_FONTINFO ); - const SvxFontItem& rItem = (const SvxFontItem&) - pTableView->GetAttribs().Get(nFontWhich); + const SvxFontItem& rItem = static_cast<const SvxFontItem&>( + pTableView->GetAttribs().Get(nFontWhich)); OUString aString; SvxFontItem aNewItem( EE_CHAR_FONTINFO ); @@ -350,7 +350,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) if ( pItem ) { - aString = ((const SfxStringItem*)pItem)->GetValue(); + aString = static_cast<const SfxStringItem*>(pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem); const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); @@ -512,7 +512,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs->GetItemState( SID_HYPERLINK_SETLINK, true, &pItem ) == SfxItemState::SET ) { - const SvxHyperlinkItem* pHyper = (const SvxHyperlinkItem*) pItem; + const SvxHyperlinkItem* pHyper = static_cast<const SvxHyperlinkItem*>(pItem); const OUString& rName = pHyper->GetName(); const OUString& rURL = pHyper->GetURL(); const OUString& rTarget = pHyper->GetTargetFrame(); @@ -752,7 +752,7 @@ const SvxURLField* ScEditShell::GetURLField() { const SvxFieldData* pField = pFieldItem->GetField(); if ( pField && pField->ISA(SvxURLField) ) - return (const SvxURLField*)pField; + return static_cast<const SvxURLField*>(pField); } } @@ -885,7 +885,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) SvxScriptSetItem aOldSetItem( nSlot, rPool ); aOldSetItem.GetItemSet().Put( pEditView->GetAttribs(), false ); const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript ); - if ( pCore && ((const SvxWeightItem*)pCore)->GetWeight() > WEIGHT_NORMAL ) + if ( pCore && static_cast<const SvxWeightItem*>(pCore)->GetWeight() > WEIGHT_NORMAL ) bOld = true; SvxScriptSetItem aSetItem( nSlot, rPool ); @@ -908,7 +908,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) SvxScriptSetItem aOldSetItem( nSlot, rPool ); aOldSetItem.GetItemSet().Put( pEditView->GetAttribs(), false ); const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript ); - if ( pCore && ((const SvxPostureItem*)pCore)->GetValue() != ITALIC_NONE ) + if ( pCore && static_cast<const SvxPostureItem*>(pCore)->GetValue() != ITALIC_NONE ) bOld = true; SvxScriptSetItem aSetItem( nSlot, rPool ); @@ -930,7 +930,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) case SID_ULINE_VAL_DOUBLE: case SID_ULINE_VAL_DOTTED: { - FontUnderline eOld = ((const SvxUnderlineItem&) pEditView-> + FontUnderline eOld = static_cast<const SvxUnderlineItem&>( pEditView-> GetAttribs().Get(EE_CHAR_UNDERLINE)).GetLineStyle(); FontUnderline eNew = eOld; switch (nSlot) @@ -963,7 +963,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) case SID_ATTR_CHAR_OVERLINE: { - FontUnderline eOld = ((const SvxOverlineItem&) pEditView-> + FontUnderline eOld = static_cast<const SvxOverlineItem&>( pEditView-> GetAttribs().Get(EE_CHAR_OVERLINE)).GetLineStyle(); FontUnderline eNew = ( eOld != UNDERLINE_NONE ) ? UNDERLINE_NONE : UNDERLINE_SINGLE; aSet.Put( SvxOverlineItem( eNew, EE_CHAR_OVERLINE ) ); @@ -973,7 +973,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) case SID_ATTR_CHAR_STRIKEOUT: { - bool bOld = ((const SvxCrossedOutItem&)pEditView->GetAttribs(). + bool bOld = static_cast<const SvxCrossedOutItem&>( pEditView->GetAttribs(). Get(EE_CHAR_STRIKEOUT)).GetValue() != STRIKEOUT_NONE; aSet.Put( SvxCrossedOutItem( bOld ? STRIKEOUT_NONE : STRIKEOUT_SINGLE, EE_CHAR_STRIKEOUT ) ); rBindings.Invalidate( nSlot ); @@ -982,7 +982,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) case SID_ATTR_CHAR_SHADOWED: { - bool bOld = ((const SvxShadowedItem&)pEditView->GetAttribs(). + bool bOld = static_cast<const SvxShadowedItem&>(pEditView->GetAttribs(). Get(EE_CHAR_SHADOW)).GetValue(); aSet.Put( SvxShadowedItem( !bOld, EE_CHAR_SHADOW ) ); rBindings.Invalidate( nSlot ); @@ -991,7 +991,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) case SID_ATTR_CHAR_CONTOUR: { - bool bOld = ((const SvxContourItem&)pEditView->GetAttribs(). + bool bOld = static_cast<const SvxContourItem&>(pEditView->GetAttribs(). Get(EE_CHAR_OUTLINE)).GetValue(); aSet.Put( SvxContourItem( !bOld, EE_CHAR_OUTLINE ) ); rBindings.Invalidate( nSlot ); @@ -1000,7 +1000,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) case SID_SET_SUPER_SCRIPT: { - SvxEscapement eOld = (SvxEscapement) ((const SvxEscapementItem&) + SvxEscapement eOld = (SvxEscapement) static_cast<const SvxEscapementItem&>( pEditView->GetAttribs().Get(EE_CHAR_ESCAPEMENT)).GetEnumValue(); SvxEscapement eNew = (eOld == SVX_ESCAPEMENT_SUPERSCRIPT) ? SVX_ESCAPEMENT_OFF : SVX_ESCAPEMENT_SUPERSCRIPT; @@ -1010,7 +1010,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) break; case SID_SET_SUB_SCRIPT: { - SvxEscapement eOld = (SvxEscapement) ((const SvxEscapementItem&) + SvxEscapement eOld = (SvxEscapement) static_cast<const SvxEscapementItem&>( pEditView->GetAttribs().Get(EE_CHAR_ESCAPEMENT)).GetEnumValue(); SvxEscapement eNew = (eOld == SVX_ESCAPEMENT_SUBSCRIPT) ? SVX_ESCAPEMENT_OFF : SVX_ESCAPEMENT_SUBSCRIPT; @@ -1093,7 +1093,7 @@ void ScEditShell::GetAttrState(SfxItemSet &rSet) } else { - FontUnderline eUnderline = ((const SvxUnderlineItem&) + FontUnderline eUnderline = static_cast<const SvxUnderlineItem&>( aAttribs.Get(EE_CHAR_UNDERLINE)).GetLineStyle(); sal_uInt16 nId = SID_ULINE_VAL_NONE; switch (eUnderline) @@ -1112,7 +1112,7 @@ void ScEditShell::GetAttrState(SfxItemSet &rSet) if ( pHdl && pHdl->IsFormulaMode() ) rSet.ClearItem( EE_CHAR_WEIGHT ); // hervorgehobene Klammern hier nicht - SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + SvxEscapement eEsc = (SvxEscapement) static_cast<const SvxEscapementItem&>( aAttribs.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) { @@ -1183,7 +1183,7 @@ void ScEditShell::ExecuteUndo(SfxRequest& rReq) sal_uInt16 nCount = 1; const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET ) - nCount = ((const SfxUInt16Item*)pItem)->GetValue(); + nCount = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); for (sal_uInt16 i=0; i<nCount; i++) { diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 70e03372811b..067a6d6c062c 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -193,8 +193,8 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet ) { SCTAB nCurTab = GetViewData()->GetTabNo(); OUString aPageStyle = pDoc->GetPageStyle( nCurTab ); - SfxStyleSheet* pStyleSheet = pStylePool ? (SfxStyleSheet*)pStylePool-> - Find( aPageStyle, SFX_STYLE_FAMILY_PAGE ) : NULL; + SfxStyleSheet* pStyleSheet = pStylePool ? static_cast<SfxStyleSheet*>(pStylePool-> + Find( aPageStyle, SFX_STYLE_FAMILY_PAGE )) : NULL; if ( pStyleSheet ) rSet.Put( SfxTemplateItem( nSlotId, aPageStyle ) ); @@ -277,11 +277,11 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) SfxStyleFamily eFamily = SFX_STYLE_FAMILY_PARA; const SfxPoolItem* pFamItem; if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, true, &pFamItem ) ) - eFamily = (SfxStyleFamily)((const SfxUInt16Item*)pFamItem)->GetValue(); + eFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pFamItem)->GetValue(); const SfxPoolItem* pNameItem; OUString aStyleName; if (pArgs && SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pNameItem )) - aStyleName = ((const SfxStringItem*)pNameItem)->GetValue(); + aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue(); if ( eFamily == SFX_STYLE_FAMILY_PARA ) // CellStyles { ScMarkData aFuncMark( pViewData->GetMarkData() ); @@ -357,10 +357,10 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) SfxStyleFamily eFamily = SFX_STYLE_FAMILY_PARA; const SfxPoolItem* pFamItem; if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, true, &pFamItem ) ) - eFamily = (SfxStyleFamily)((const SfxUInt16Item*)pFamItem)->GetValue(); + eFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pFamItem)->GetValue(); else if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME, true, &pFamItem ) ) { - OUString sFamily = ((const SfxStringItem*)pFamItem)->GetValue(); + OUString sFamily = static_cast<const SfxStringItem*>(pFamItem)->GetValue(); if (sFamily.equalsAscii("CellStyles")) eFamily = SFX_STYLE_FAMILY_PARA; else if (sFamily.equalsAscii("PageStyles")) @@ -378,13 +378,13 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) { const SfxPoolItem* pNameItem; if (pArgs && SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pNameItem )) - aStyleName = ((const SfxStringItem*)pNameItem)->GetValue(); + aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue(); const SfxPoolItem* pRefItem=NULL; if (pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_REFERENCE, true, &pRefItem )) { if(pRefItem!=NULL) - aRefName = ((const SfxStringItem*)pRefItem)->GetValue(); + aRefName = static_cast<const SfxStringItem*>(pRefItem)->GetValue(); } pStyleSheet = &(pStylePool->Make( aStyleName, eFamily, @@ -428,7 +428,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) { const SfxPoolItem* pNameItem; if (pArgs && SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pNameItem )) - aStyleName = ((const SfxStringItem*)pNameItem)->GetValue(); + aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue(); pStyleSheet = pStylePool->Find( aStyleName, eFamily ); aOldData.InitFromStyle( pStyleSheet ); @@ -454,7 +454,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( pStyleSheet ) { - ((ScStyleSheetPool*)pStylePool)-> + static_cast<ScStyleSheetPool*>(pStylePool)-> SetActualStyleSheet( pStyleSheet ); rReq.Done(); } @@ -483,7 +483,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // set new style for WaterCan-Mode if ( nSlotId == SID_STYLE_APPLY && pScMod->GetIsWaterCan() && pStyleSheet ) - ((ScStyleSheetPool*)pStylePool)->SetActualStyleSheet( pStyleSheet ); + static_cast<ScStyleSheetPool*>(pStylePool)->SetActualStyleSheet( pStyleSheet ); switch ( eFamily ) { @@ -526,7 +526,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( pStyleSheet && !pScMod->GetIsWaterCan() ) { // apply style sheet to document - pTabViewShell->SetStyleSheetToMarked( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->SetStyleSheetToMarked( static_cast<SfxStyleSheet*>(pStyleSheet) ); pTabViewShell->InvalidateAttribs(); rReq.Done(); } @@ -801,9 +801,9 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) // NumberFormat Value aus Value und Language // erzeugen und eintueten sal_uLong nFormat = - ((SfxUInt32Item*)pItem)->GetValue(); + static_cast<const SfxUInt32Item*>(pItem)->GetValue(); LanguageType eLang = - ((SvxLanguageItem*)&rSet.Get( + static_cast<const SvxLanguageItem*>(&rSet.Get( ATTR_LANGUAGE_FORMAT ))->GetLanguage(); sal_uLong nLangFormat = rDoc.GetFormatTable()-> GetFormatForLanguageIfBuiltIn( nFormat, eLang ); @@ -891,9 +891,9 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if (rDoc.IsStreamValid(nTab)) rDoc.SetStreamValid(nTab, false); - sal_uLong nOldFormat = ((const SfxUInt32Item&)aOldSet. + sal_uLong nOldFormat = static_cast<const SfxUInt32Item&>(aOldSet. Get( ATTR_VALUE_FORMAT )).GetValue(); - sal_uLong nNewFormat = ((const SfxUInt32Item&)rNewSet. + sal_uLong nNewFormat = static_cast<const SfxUInt32Item&>(rNewSet. Get( ATTR_VALUE_FORMAT )).GetValue(); if ( nNewFormat != nOldFormat ) { @@ -928,8 +928,8 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) if ( SFX_STYLE_FAMILY_PARA == eFam ) { pTabViewShell->UpdateNumberFormatter( - (const SvxNumberInfoItem&) - *(pDocSh->GetItem(SID_ATTR_NUMBERFORMAT_INFO)) ); + static_cast<const SvxNumberInfoItem&>( + *(pDocSh->GetItem(SID_ATTR_NUMBERFORMAT_INFO)) )); pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); pTabViewShell->InvalidateAttribs(); @@ -963,7 +963,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) { // call SetStyleSheetToMarked after adding the ScUndoModifyStyle, // so redo will find the modified style - pTabViewShell->SetStyleSheetToMarked( (SfxStyleSheet*)pStyleSheet ); + pTabViewShell->SetStyleSheetToMarked( static_cast<SfxStyleSheet*>(pStyleSheet) ); pTabViewShell->InvalidateAttribs(); } @@ -1131,7 +1131,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) if(SfxItemState::SET == pReqArgs->GetItemState(nSlot, true, &pItem) && eType != -1) { - OUString aCode = ((const SfxStringItem*)pItem)->GetValue(); + OUString aCode = static_cast<const SfxStringItem*>(pItem)->GetValue(); sal_uInt16 aLen = aCode.getLength(); OUString* sFormat = new OUString[4]; OUString sTmpStr = ""; @@ -1202,7 +1202,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET ) { - sal_uInt16 nFormat = ((SfxInt16Item *)pItem)->GetValue(); + sal_uInt16 nFormat = static_cast<const SfxInt16Item *>(pItem)->GetValue(); switch(nFormat) { case 0: @@ -1297,14 +1297,14 @@ void ScFormatShell::ExecuteAlignment( SfxRequest& rReq ) case SID_H_ALIGNCELL: { - SvxCellHorJustify eJust = (SvxCellHorJustify)((const SvxHorJustifyItem*)pItem)->GetValue(); + SvxCellHorJustify eJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem*>(pItem)->GetValue(); // #i78476# update alignment of text in cell edit mode pTabViewShell->UpdateInputHandlerCellAdjust( eJust ); pTabViewShell->ApplyAttr( SvxHorJustifyItem( eJust, ATTR_HOR_JUSTIFY ) ); } break; case SID_V_ALIGNCELL: - pTabViewShell->ApplyAttr( SvxVerJustifyItem( (SvxCellVerJustify)((const SvxVerJustifyItem*)pItem)->GetValue(), ATTR_VER_JUSTIFY ) ); + pTabViewShell->ApplyAttr( SvxVerJustifyItem( (SvxCellVerJustify)static_cast<const SvxVerJustifyItem*>(pItem)->GetValue(), ATTR_VER_JUSTIFY ) ); break; default: OSL_FAIL( "ExecuteAlignment: invalid slot" ); @@ -1382,7 +1382,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) SvxScriptSetItem aOldSetItem( nSlot, rPool ); aOldSetItem.GetItemSet().Put( pAttrs->GetItemSet(), false ); const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript ); - if ( pCore && ((const SvxWeightItem*)pCore)->GetWeight() == WEIGHT_BOLD ) + if ( pCore && static_cast<const SvxWeightItem*>(pCore)->GetWeight() == WEIGHT_BOLD ) eWeight = WEIGHT_NORMAL; aSetItem.PutItemForScriptType( nScript, SvxWeightItem( eWeight, ATTR_FONT_WEIGHT ) ); @@ -1409,7 +1409,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) SvxScriptSetItem aOldSetItem( nSlot, rPool ); aOldSetItem.GetItemSet().Put( pAttrs->GetItemSet(), false ); const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript ); - if ( pCore && ((const SvxPostureItem*)pCore)->GetPosture() == ITALIC_NORMAL ) + if ( pCore && static_cast<const SvxPostureItem*>(pCore)->GetPosture() == ITALIC_NORMAL ) eItalic = ITALIC_NONE; aSetItem.PutItemForScriptType( nScript, SvxPostureItem( eItalic, ATTR_FONT_POSTURE ) ); @@ -1444,9 +1444,9 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) } else { - SvxUnderlineItem aUnderline( (const SvxUnderlineItem&) + SvxUnderlineItem aUnderline( static_cast<const SvxUnderlineItem&>( pAttrs->GetItem( - ATTR_FONT_UNDERLINE ) ); + ATTR_FONT_UNDERLINE ) ) ); eUnderline = (UNDERLINE_NONE != aUnderline.GetLineStyle()) ? UNDERLINE_NONE : UNDERLINE_SINGLE; @@ -1464,7 +1464,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) case SID_ULINE_VAL_DOUBLE: case SID_ULINE_VAL_DOTTED: { - FontUnderline eOld = ((const SvxUnderlineItem&) + FontUnderline eOld = static_cast<const SvxUnderlineItem&>( pAttrs->GetItem(ATTR_FONT_UNDERLINE)).GetLineStyle(); FontUnderline eNew = eOld; switch (nSlot) @@ -1505,12 +1505,12 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) if (rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, true,&pItem ) == SfxItemState::SET) { - pHorJustify = (const SvxHorJustifyItem*)pItem; + pHorJustify = static_cast<const SvxHorJustifyItem*>(pItem); eHorJustify = SvxCellHorJustify( pHorJustify->GetValue() ); } if (rAttrSet.GetItemState(ATTR_VER_JUSTIFY, true,&pItem ) == SfxItemState::SET) { - pVerJustify = (const SvxVerJustifyItem*)pItem; + pVerJustify = static_cast<const SvxVerJustifyItem*>(pItem); eVerJustify = SvxCellVerJustify( pVerJustify->GetValue() ); } @@ -1626,8 +1626,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_BACKGROUND_COLOR: { - SvxBrushItem aBrushItem( (const SvxBrushItem&) - pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) ); + SvxBrushItem aBrushItem( static_cast<const SvxBrushItem&>( + pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) ) ); aBrushItem.SetColor( COL_TRANSPARENT ); pTabViewShell->ApplyAttr( aBrushItem ); } @@ -1636,7 +1636,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_ATTR_ALIGN_LINEBREAK: // ohne Parameter als Toggle { const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern(); - bool bOld = ((const SfxBoolItem&)pAttrs->GetItem(ATTR_LINEBREAK)).GetValue(); + bool bOld = static_cast<const SfxBoolItem&>(pAttrs->GetItem(ATTR_LINEBREAK)).GetValue(); SfxBoolItem aBreakItem( ATTR_LINEBREAK, !bOld ); pTabViewShell->ApplyAttr( aBreakItem ); @@ -1657,7 +1657,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) { SfxItemPool& rPool = GetPool(); sal_uInt16 nWhich = rPool.GetWhich( nSlot ); - const SvxFontItem& rFont = ( const SvxFontItem&)pNewAttrs->Get( nWhich ); + const SvxFontItem& rFont = static_cast<const SvxFontItem&>(pNewAttrs->Get( nWhich )); SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, rPool ); sal_uInt8 nScript = pTabViewShell->GetSelectionScriptType(); aSetItem.PutItemForScriptType( nScript, rFont ); @@ -1716,7 +1716,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) { // Default-Linie aktualisieren const ::editeng::SvxBorderLine* pLine = - ((const SvxLineItem&) + static_cast<const SvxLineItem&>( pNewAttrs->Get( SID_FRAME_LINESTYLE )). GetLine(); @@ -1752,7 +1752,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_FRAME_LINECOLOR: { ::editeng::SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine(); - const Color& rColor = ((const SvxColorItem&) + const Color& rColor = static_cast<const SvxColorItem&>( pNewAttrs->Get( SID_FRAME_LINECOLOR )). GetValue(); @@ -1802,7 +1802,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) // Macro recording uses a SvxBoxItem with the real values (OutWidth > 0) // or NULL pointers for no lines. // -> Substitute existing lines with pDefLine only if widths are 0. - SvxBoxItem aBoxItem ( *(const SvxBoxItem*)pItem ); + SvxBoxItem aBoxItem ( *static_cast<const SvxBoxItem*>(pItem )); if ( aBoxItem.GetTop() && aBoxItem.GetTop()->GetOutWidth() == 0 ) aBoxItem.SetLine( pDefLine, BOX_LINE_TOP ); if ( aBoxItem.GetBottom() && aBoxItem.GetBottom()->GetOutWidth() == 0 ) @@ -1818,7 +1818,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) if ( pNewAttrs->GetItemState( ATTR_BORDER_INNER, true, &pItem ) == SfxItemState::SET ) { - SvxBoxInfoItem aBoxInfoItem( *(const SvxBoxInfoItem*)pItem ); + SvxBoxInfoItem aBoxInfoItem( *static_cast<const SvxBoxInfoItem*>(pItem) ); if ( aBoxInfoItem.GetHori() && aBoxInfoItem.GetHori()->GetOutWidth() == 0 ) aBoxInfoItem.SetLine( pDefLine, BOXINFO_LINE_HORI ); if ( aBoxInfoItem.GetVert() && aBoxInfoItem.GetVert()->GetOutWidth() == 0 ) @@ -1852,7 +1852,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) if(SfxItemState::SET == pNewAttrs->GetItemState(ATTR_BORDER_TLBR, true, &pItem)) { SvxLineItem aItem(ATTR_BORDER_TLBR); - aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_TLBR)).GetLine()); + aItem.SetLine(static_cast<const SvxLineItem&>(pNewAttrs->Get(ATTR_BORDER_TLBR)).GetLine()); pNewSet->Put(aItem); rReq.AppendItem(aItem); pTabViewShell->ApplyAttributes(pNewSet.get(), pOldSet.get()); @@ -1863,7 +1863,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) if(SfxItemState::SET == pNewAttrs->GetItemState(ATTR_BORDER_BLTR, true, &pItem )) { SvxLineItem aItem(ATTR_BORDER_BLTR); - aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_BLTR)).GetLine()); + aItem.SetLine(static_cast<const SvxLineItem&>(pNewAttrs->Get(ATTR_BORDER_BLTR)).GetLine()); pNewSet->Put(aItem); rReq.AppendItem(aItem); pTabViewShell->ApplyAttributes(pNewSet.get(), pOldSet.get()); @@ -1878,12 +1878,12 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) // gesetzt werden: case SID_BACKGROUND_COLOR: { - const SvxColorItem rNewColorItem = (const SvxColorItem&) - pNewAttrs->Get( SID_BACKGROUND_COLOR ); + const SvxColorItem rNewColorItem = static_cast<const SvxColorItem&>( + pNewAttrs->Get( SID_BACKGROUND_COLOR ) ); - SvxBrushItem aBrushItem( (const SvxBrushItem&) + SvxBrushItem aBrushItem( static_cast<const SvxBrushItem&>( pTabViewShell->GetSelectionPattern()-> - GetItem( ATTR_BACKGROUND ) ); + GetItem( ATTR_BACKGROUND ) ) ); aBrushItem.SetColor( rNewColorItem.GetValue() ); @@ -1893,11 +1893,11 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_ATTR_BRUSH: { - SvxBrushItem aBrushItem( (const SvxBrushItem&) + SvxBrushItem aBrushItem( static_cast<const SvxBrushItem&>( pTabViewShell->GetSelectionPattern()-> - GetItem( ATTR_BACKGROUND ) ); - const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&) - pNewAttrs->Get( GetPool().GetWhich(nSlot) ); + GetItem( ATTR_BACKGROUND ) ) ); + const SvxBrushItem& rNewBrushItem = static_cast<const SvxBrushItem&>( + pNewAttrs->Get( GetPool().GetWhich(nSlot) ) ); aBrushItem.SetColor(rNewBrushItem.GetColor()); pTabViewShell->ApplyAttr( aBrushItem ); } @@ -1905,8 +1905,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_ATTR_BORDER_SHADOW: { - const SvxShadowItem& rNewShadowItem = (const SvxShadowItem&) - pNewAttrs->Get( ATTR_SHADOW ); + const SvxShadowItem& rNewShadowItem = static_cast<const SvxShadowItem&>( + pNewAttrs->Get( ATTR_SHADOW ) ); pTabViewShell->ApplyAttr( rNewShadowItem ); } break; @@ -1926,7 +1926,7 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); //const ::editeng::SvxBorderLine* pLine = pTabViewShell->GetDefaultFrameLine(); - const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rAttrSet.Get( ATTR_BACKGROUND ); + const SvxBrushItem& rBrushItem = static_cast<const SvxBrushItem&>(rAttrSet.Get( ATTR_BACKGROUND )); SfxWhichIter aIter( rSet ); sal_uInt16 nWhich = aIter.FirstWhich(); @@ -2173,7 +2173,7 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) } else { - FontUnderline eUnderline = ((const SvxUnderlineItem&) + FontUnderline eUnderline = static_cast<const SvxUnderlineItem&>( rAttrSet.Get(ATTR_FONT_UNDERLINE)).GetLineStyle(); sal_uInt16 nId = SID_ULINE_VAL_NONE; switch (eUnderline) @@ -2343,12 +2343,12 @@ void ScFormatShell::GetAlignState( SfxItemSet& rSet ) SvxCellHorJustify eHAlign = SVX_HOR_JUSTIFY_STANDARD; bool bHasHAlign = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY ) != SfxItemState::DONTCARE; if( bHasHAlign ) - eHAlign = (SvxCellHorJustify)((const SvxHorJustifyItem&) rAttrSet.Get( ATTR_HOR_JUSTIFY )).GetValue(); + eHAlign = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(rAttrSet.Get( ATTR_HOR_JUSTIFY )).GetValue(); SvxCellVerJustify eVAlign = SVX_VER_JUSTIFY_STANDARD; bool bHasVAlign = rAttrSet.GetItemState( ATTR_VER_JUSTIFY ) != SfxItemState::DONTCARE; if( bHasVAlign ) - eVAlign = (SvxCellVerJustify)((const SvxVerJustifyItem&) rAttrSet.Get( ATTR_VER_JUSTIFY )).GetValue(); + eVAlign = (SvxCellVerJustify)static_cast<const SvxVerJustifyItem&>(rAttrSet.Get( ATTR_VER_JUSTIFY )).GetValue(); while ( nWhich ) { @@ -2420,7 +2420,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) if(SfxItemState::DONTCARE != rAttrSet.GetItemState(ATTR_VALUE_FORMAT)) { SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - sal_uInt32 nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue(); + sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue(); bool bThousand(false); bool bNegRed(false); sal_uInt16 nPrecision(0); @@ -2599,15 +2599,15 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet ) (rAttrSet.GetItemState( ATTR_VERTICAL_ASIAN ) == SfxItemState::DONTCARE) || (rAttrSet.GetItemState( ATTR_STACKED ) == SfxItemState::DONTCARE); bool bLeftRight = !bVertDontCare && - !((const SfxBoolItem&) rAttrSet.Get( ATTR_STACKED )).GetValue(); + !static_cast<const SfxBoolItem&>(rAttrSet.Get( ATTR_STACKED )).GetValue(); bool bTopBottom = !bVertDontCare && !bLeftRight && - ((const SfxBoolItem&) rAttrSet.Get( ATTR_VERTICAL_ASIAN )).GetValue(); + static_cast<const SfxBoolItem&>(rAttrSet.Get( ATTR_VERTICAL_ASIAN )).GetValue(); bool bBidiDontCare = (rAttrSet.GetItemState( ATTR_WRITINGDIR ) == SfxItemState::DONTCARE); EEHorizontalTextDirection eBidiDir = EE_HTEXTDIR_DEFAULT; if ( !bBidiDontCare ) { - SvxFrameDirection eCellDir = (SvxFrameDirection)((const SvxFrameDirectionItem&) + SvxFrameDirection eCellDir = (SvxFrameDirection)static_cast<const SvxFrameDirectionItem&>( rAttrSet.Get( ATTR_WRITINGDIR )).GetValue(); if ( eCellDir == FRMDIR_ENVIRONMENT ) eBidiDir = (EEHorizontalTextDirection)GetViewData()->GetDocument()-> diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 60f0c7e289b2..4e0fb78b4b34 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -403,9 +403,9 @@ static bool lcl_GetHyperlinkCell( else { const ScPatternAttr* pPattern = pDoc->GetPattern(aPos); - if ( !((SfxStringItem&)pPattern->GetItem(ATTR_HYPERLINK)).GetValue().isEmpty() ) + if ( !static_cast<const SfxStringItem&>(pPattern->GetItem(ATTR_HYPERLINK)).GetValue().isEmpty() ) { - rURL = ((SfxStringItem&)pPattern->GetItem(ATTR_HYPERLINK)).GetValue(); + rURL = static_cast<const SfxStringItem&>(pPattern->GetItem(ATTR_HYPERLINK)).GetValue(); bFound = true; } else if (rCell.meType == CELLTYPE_EDIT) @@ -1136,7 +1136,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec const size_t nDefCount = SAL_N_ELEMENTS(nDefIDs); for (i=0; i<nDefCount; i++) { - OUString aEntry( (ScResId) nDefIDs[i] ); + OUString aEntry( static_cast<ScResId>(nDefIDs[i]) ); pFilterBox->InsertEntry( aEntry ); long nTextWidth = pFilterBox->GetTextWidth( aEntry ); if ( nTextWidth > nMaxText ) @@ -1254,7 +1254,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec else { - sal_uLong nIndex = ((SfxUInt32Item*)pDoc->GetAttr( + sal_uLong nIndex = static_cast<const SfxUInt32Item*>(pDoc->GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA ))->GetValue(); if ( nIndex ) { @@ -1850,10 +1850,10 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta SCsCOL nRealPosX; SCsROW nRealPosY; pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nRealPosX, nRealPosY, false );//the real row/col - ScMergeFlagAttr* pRealPosAttr = (ScMergeFlagAttr*) - pDoc->GetAttr( nRealPosX, nRealPosY, nTab, ATTR_MERGE_FLAG ); - ScMergeFlagAttr* pAttr = (ScMergeFlagAttr*) - pDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG ); + const ScMergeFlagAttr* pRealPosAttr = static_cast<const ScMergeFlagAttr*>( + pDoc->GetAttr( nRealPosX, nRealPosY, nTab, ATTR_MERGE_FLAG )); + const ScMergeFlagAttr* pAttr = static_cast<const ScMergeFlagAttr*>( + pDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG )); if( pRealPosAttr->HasAutoFilter() ) { SC_MOD()->InputEnterHandler(); @@ -2158,8 +2158,8 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) GetStyleSheetPool()); if ( pStylePool ) { - SfxStyleSheet* pStyleSheet = (SfxStyleSheet*) - pStylePool->GetActualStyleSheet(); + SfxStyleSheet* pStyleSheet = static_cast<SfxStyleSheet*>( + pStylePool->GetActualStyleSheet()); if ( pStyleSheet ) { @@ -5215,10 +5215,10 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, if (pPattern->GetCellOrientation() != SVX_ORIENTATION_STANDARD) return false; - bool bBreak = ((SfxBoolItem&)pPattern->GetItem(ATTR_LINEBREAK)).GetValue() || - ((SvxCellHorJustify)((const SvxHorJustifyItem&)pPattern-> + bool bBreak = static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() || + ((SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern-> GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_BLOCK); - SvxCellHorJustify eHorJust = (SvxCellHorJustify)((SvxHorJustifyItem&)pPattern-> + SvxCellHorJustify eHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern-> GetItem(ATTR_HOR_JUSTIFY)).GetValue(); // EditEngine @@ -5750,7 +5750,7 @@ void ScGridWindow::UpdateCursorOverlay() ScDocument* pDoc = pViewData->GetDocument(); const ScPatternAttr* pPattern = pDoc->GetPattern(nX,nY,nTab); - const ScMergeFlagAttr& rMergeFlag = (const ScMergeFlagAttr&) pPattern->GetItem(ATTR_MERGE_FLAG); + const ScMergeFlagAttr& rMergeFlag = static_cast<const ScMergeFlagAttr&>( pPattern->GetItem(ATTR_MERGE_FLAG) ); bool bOverlapped = rMergeFlag.IsOverlapped(); // left or above of the screen? @@ -5760,7 +5760,7 @@ void ScGridWindow::UpdateCursorOverlay() { SCCOL nEndX = nX; SCROW nEndY = nY; - const ScMergeAttr& rMerge = (const ScMergeAttr&) pPattern->GetItem(ATTR_MERGE); + const ScMergeAttr& rMerge = static_cast<const ScMergeAttr&>( pPattern->GetItem(ATTR_MERGE) ); if (rMerge.GetColMerge() > 1) nEndX += rMerge.GetColMerge()-1; if (rMerge.GetRowMerge() > 1) diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 0991b7e5bed5..545e071d4086 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -103,7 +103,7 @@ static void lcl_DrawOneFrame( OutputDevice* pDev, const Rectangle& rInnerPixel, // use ScPatternAttr::GetFont only for font size vcl::Font aAttrFont; - ((const ScPatternAttr&)pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)). + static_cast<const ScPatternAttr&>(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)). GetFont(aAttrFont,SC_AUTOCOL_BLACK,pDev,&rZoomY); // everything else from application font @@ -130,7 +130,7 @@ static void lcl_DrawOneFrame( OutputDevice* pDev, const Rectangle& rInnerPixel, long nButtonY = bTextBelow ? aInner.Bottom() : aOuter.Top(); - ScDDComboBoxButton aComboButton((vcl::Window*)pDev); + ScDDComboBoxButton aComboButton(static_cast<vcl::Window*>(pDev)); aComboButton.SetOptSizePixel(); long nBWidth = ( aComboButton.GetSizePixel().Width() * rZoomY.GetNumerator() ) / rZoomY.GetDenominator(); @@ -930,7 +930,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::Font aFont; boost::scoped_ptr<ScEditEngineDefaulter> pEditEng; - const ScPatternAttr& rDefPattern = ((const ScPatternAttr&)pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)); + const ScPatternAttr& rDefPattern = static_cast<const ScPatternAttr&>(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)); if ( nPageScript == SCRIPTTYPE_LATIN ) { // use single font and call DrawText directly @@ -1438,7 +1438,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) if (nX2 < nX1) // Rest von zusammengefasst { SCCOL nStartX = nX1; - while ( ((const ScMergeFlagAttr*)pDoc-> + while ( static_cast<const ScMergeFlagAttr*>(pDoc-> GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG))->IsHorOverlapped() ) --nStartX; if (nStartX <= nX2) @@ -1457,8 +1457,8 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) { SCROW nThisY = nY; const ScPatternAttr* pPattern = pDoc->GetPattern( nX, nY, nTab ); - const ScMergeFlagAttr* pMergeFlag = (const ScMergeFlagAttr*) &pPattern-> - GetItem(ATTR_MERGE_FLAG); + const ScMergeFlagAttr* pMergeFlag = static_cast<const ScMergeFlagAttr*>( &pPattern-> + GetItem(ATTR_MERGE_FLAG) ); if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) ) { while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 && @@ -1466,7 +1466,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) { --nThisY; pPattern = pDoc->GetPattern( nX, nThisY, nTab ); - pMergeFlag = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); + pMergeFlag = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem(ATTR_MERGE_FLAG) ); } } @@ -1478,7 +1478,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) { --nThisX; pPattern = pDoc->GetPattern( nThisX, nThisY, nTab ); - pMergeFlag = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); + pMergeFlag = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem(ATTR_MERGE_FLAG) ); } } @@ -1486,7 +1486,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ) { if ( !pMergeFlag->IsOverlapped() ) { - ScMergeAttr* pMerge = (ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE); + const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0) { Point aEndPos = pViewData->GetScrPos( diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx index 632e79afe7be..9453104a63b3 100644 --- a/sc/source/ui/view/gridwin5.cxx +++ b/sc/source/ui/view/gridwin5.cxx @@ -114,7 +114,7 @@ bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard ) if ( eType == SC_CAT_MOVE ) { ScRange aRange = - ((const ScChangeActionMove*)pAction)-> + static_cast<const ScChangeActionMove*>(pAction)-> GetFromRange().MakeRange(); if ( aRange.In( aCellPos ) ) { @@ -415,7 +415,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt) SdrPageView* pPV = pDrView->GetSdrPageView(); OSL_ENSURE( pPV, "SdrPageView* ist NULL" ); if (pPV) - bDone = ((ScDrawPage*)pPV->GetPage())->RequestHelp( this, pDrView, rHEvt ); + bDone = static_cast<ScDrawPage*>(pPV->GetPage())->RequestHelp( this, pDrView, rHEvt ); } // Wenn QuickHelp fuer AutoFill angezeigt wird, nicht wieder wegnehmen lassen diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 1e94298dc046..03048ad750a2 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -430,11 +430,11 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage ) if (nVisX <= nX2) bHOver = pThisRowInfo->pCellInfo[nVisX+1].bHOverlapped; else - bHOver = ((ScMergeFlagAttr*)mpDoc->GetAttr( + bHOver = static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( nVisX,pThisRowInfo->nRowNo,nTab,ATTR_MERGE_FLAG)) ->IsHorOverlapped(); if (bHOver) - bHOver = ((ScMergeFlagAttr*)mpDoc->GetAttr( + bHOver = static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( nXplus1,pThisRowInfo->nRowNo,nTab,ATTR_MERGE_FLAG)) ->IsHorOverlapped(); } @@ -527,10 +527,10 @@ void ScOutputData::DrawGrid( bool bGrid, bool bPage ) bVOver = pRowInfo[nArrYplus1].pCellInfo[i+1].bVOverlapped; else { - bVOver = ((ScMergeFlagAttr*)mpDoc->GetAttr( + bVOver = static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( i,nYplus1,nTab,ATTR_MERGE_FLAG)) ->IsVerOverlapped() - && ((ScMergeFlagAttr*)mpDoc->GetAttr( + && static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( i,nVisY,nTab,ATTR_MERGE_FLAG)) ->IsVerOverlapped(); //! nVisY from Array ?? @@ -637,7 +637,7 @@ static sal_uInt16 lcl_GetRotateDir( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SC long nAttrRotate = pPattern->GetRotateVal( pCondSet ); if ( nAttrRotate ) { - SvxRotateMode eRotMode = (SvxRotateMode)((const SvxRotateModeItem&) + SvxRotateMode eRotMode = (SvxRotateMode)static_cast<const SvxRotateModeItem&>( pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue(); if ( eRotMode == SVX_ROTATE_MODE_STANDARD ) @@ -664,8 +664,8 @@ static const SvxBrushItem* lcl_FindBackground( ScDocument* pDoc, SCCOL nCol, SCR { const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab ); const SfxItemSet* pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); - const SvxBrushItem* pBackground = (const SvxBrushItem*) - &pPattern->GetItem( ATTR_BACKGROUND, pCondSet ); + const SvxBrushItem* pBackground = static_cast<const SvxBrushItem*>( + &pPattern->GetItem( ATTR_BACKGROUND, pCondSet )); sal_uInt16 nDir = lcl_GetRotateDir( pDoc, nCol, nRow, nTab ); @@ -679,7 +679,7 @@ static const SvxBrushItem* lcl_FindBackground( ScDocument* pDoc, SCCOL nCol, SCR --nCol; pPattern = pDoc->GetPattern( nCol, nRow, nTab ); pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); - pBackground = (const SvxBrushItem*)&pPattern->GetItem( ATTR_BACKGROUND, pCondSet ); + pBackground = static_cast<const SvxBrushItem*>(&pPattern->GetItem( ATTR_BACKGROUND, pCondSet )); } } else if ( nDir == SC_ROTDIR_LEFT ) @@ -691,7 +691,7 @@ static const SvxBrushItem* lcl_FindBackground( ScDocument* pDoc, SCCOL nCol, SCR ++nCol; pPattern = pDoc->GetPattern( nCol, nRow, nTab ); pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); - pBackground = (const SvxBrushItem*)&pPattern->GetItem( ATTR_BACKGROUND, pCondSet ); + pBackground = static_cast<const SvxBrushItem*>(&pPattern->GetItem( ATTR_BACKGROUND, pCondSet )); } } @@ -1017,8 +1017,8 @@ void ScOutputData::DrawBackground() const ScPatternAttr* pP = pInfo->pPatternAttr; if (pP) { - const ScProtectionAttr& rProt = (const ScProtectionAttr&) - pP->GetItem(ATTR_PROTECTION); + const ScProtectionAttr& rProt = static_cast<const ScProtectionAttr&>( + pP->GetItem(ATTR_PROTECTION)); if (rProt.GetProtection() || rProt.GetHideCell()) pBackground = ScGlobal::GetProtectedBrushItem(); else @@ -1415,7 +1415,7 @@ static const ::editeng::SvxBorderLine* lcl_FindHorLine( ScDocument* pDoc, const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab ); const SfxItemSet* pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); if ( !pPattern->GetRotateVal( pCondSet ) || - ((const SvxRotateModeItem&)pPattern->GetItem( + static_cast<const SvxRotateModeItem&>(pPattern->GetItem( ATTR_ROTATE_MODE, pCondSet)).GetValue() == SVX_ROTATE_MODE_STANDARD ) bFound = true; } @@ -1424,12 +1424,12 @@ static const ::editeng::SvxBorderLine* lcl_FindHorLine( ScDocument* pDoc, --nRow; const ::editeng::SvxBorderLine* pThisBottom; if ( ValidRow(nRow) ) - pThisBottom = ((const SvxBoxItem*)pDoc->GetAttr( nCol, nRow, nTab, ATTR_BORDER ))->GetBottom(); + pThisBottom = static_cast<const SvxBoxItem*>(pDoc->GetAttr( nCol, nRow, nTab, ATTR_BORDER ))->GetBottom(); else pThisBottom = NULL; const ::editeng::SvxBorderLine* pNextTop; if ( nRow < MAXROW ) - pNextTop = ((const SvxBoxItem*)pDoc->GetAttr( nCol, nRow+1, nTab, ATTR_BORDER ))->GetTop(); + pNextTop = static_cast<const SvxBoxItem*>(pDoc->GetAttr( nCol, nRow+1, nTab, ATTR_BORDER ))->GetTop(); else pNextTop = NULL; @@ -1531,7 +1531,7 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) //! LastPattern etc. long nAttrRotate = pPattern->GetRotateVal( pCondSet ); - SvxRotateMode eRotMode = (SvxRotateMode)((const SvxRotateModeItem&) + SvxRotateMode eRotMode = (SvxRotateMode)static_cast<const SvxRotateModeItem&>( pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue(); if ( nAttrRotate ) @@ -1596,8 +1596,8 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) const SvxBrushItem* pBackground = pInfo->pBackground; if (!pBackground) - pBackground = (const SvxBrushItem*) &pPattern->GetItem( - ATTR_BACKGROUND, pCondSet ); + pBackground = static_cast<const SvxBrushItem*>( &pPattern->GetItem( + ATTR_BACKGROUND, pCondSet )); if (bCellContrast) { // high contrast for cell borders and backgrounds -> empty background @@ -2248,10 +2248,10 @@ void ScOutputData::DrawChangeTrack() } } if ( eActionType == SC_CAT_MOVE && - ((const ScChangeActionMove*)pAction)-> + static_cast<const ScChangeActionMove*>(pAction)-> GetFromRange().aStart.Tab() == nTab ) { - ScRange aRange = ((const ScChangeActionMove*)pAction)-> + ScRange aRange = static_cast<const ScChangeActionMove*>(pAction)-> GetFromRange().MakeRange(); if ( aRange.Intersects( aViewRange ) && ScViewUtil::IsActionShown( *pAction, *pSettings, *mpDoc ) ) @@ -2467,14 +2467,14 @@ void ScOutputData::DrawClipMarks() long nStartPosX = nPosX; long nStartPosY = nPosY; - while ( nOverX > 0 && ( ((const ScMergeFlagAttr*)mpDoc->GetAttr( + while ( nOverX > 0 && ( static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & SC_MF_HOR ) ) { --nOverX; nStartPosX -= nLayoutSign * (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX ); } - while ( nOverY > 0 && ( ((const ScMergeFlagAttr*)mpDoc->GetAttr( + while ( nOverY > 0 && ( static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & SC_MF_VER ) ) { --nOverY; @@ -2484,8 +2484,8 @@ void ScOutputData::DrawClipMarks() long nOutWidth = (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX ); long nOutHeight = (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY ); - const ScMergeAttr* pMerge = (const ScMergeAttr*) - mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE ); + const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>( + mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE )); SCCOL nCountX = pMerge->GetColMerge(); for (SCCOL i=1; i<nCountX; i++) nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX ); @@ -2506,7 +2506,7 @@ void ScOutputData::DrawClipMarks() SCCOL nOverX = nX; SCROW nOverY = nY; const ScMergeAttr* pMerge = - (ScMergeAttr*)&pInfo->pPatternAttr->GetItem(ATTR_MERGE); + static_cast<const ScMergeAttr*>(&pInfo->pPatternAttr->GetItem(ATTR_MERGE)); SCCOL nCountX = pMerge->GetColMerge(); for (SCCOL i=1; i<nCountX; i++) nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX ); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 9f7e48ff2276..b4666dd9b4ce 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -324,9 +324,9 @@ void ScDrawStringsVars::SetPattern( // alignment - eAttrHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&)pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet )).GetValue(); + eAttrHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>(pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet )).GetValue(); - eAttrVerJust = (SvxCellVerJustify)((const SvxVerJustifyItem&)pPattern->GetItem( ATTR_VER_JUSTIFY, pCondSet )).GetValue(); + eAttrVerJust = (SvxCellVerJustify)static_cast<const SvxVerJustifyItem&>(pPattern->GetItem( ATTR_VER_JUSTIFY, pCondSet )).GetValue(); if ( eAttrVerJust == SVX_VER_JUSTIFY_STANDARD ) eAttrVerJust = SVX_VER_JUSTIFY_BOTTOM; @@ -337,7 +337,7 @@ void ScDrawStringsVars::SetPattern( // line break - bLineBreak = ((const SfxBoolItem&)pPattern->GetItem( ATTR_LINEBREAK, pCondSet )).GetValue(); + bLineBreak = static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_LINEBREAK, pCondSet )).GetValue(); // handle "repeat" alignment @@ -357,7 +357,7 @@ void ScDrawStringsVars::SetPattern( { case SVX_ORIENTATION_STANDARD: nRot = 0; - bRotated = (((const SfxInt32Item&)pPattern->GetItem( ATTR_ROTATE_VALUE, pCondSet )).GetValue() != 0) && + bRotated = static_cast<const SfxInt32Item&>(pPattern->GetItem( ATTR_ROTATE_VALUE, pCondSet )).GetValue() != 0 && !bRepeat; break; case SVX_ORIENTATION_STACKED: @@ -407,10 +407,10 @@ void ScDrawStringsVars::SetPattern( if ( bPixelToLogic ) nAscentPixel = pRefDevice->LogicToPixel( Size( 0, nAscentPixel ) ).Height(); - Color aULineColor( ((const SvxUnderlineItem&)pPattern->GetItem( ATTR_FONT_UNDERLINE, pCondSet )).GetColor() ); + Color aULineColor( static_cast<const SvxUnderlineItem&>(pPattern->GetItem( ATTR_FONT_UNDERLINE, pCondSet )).GetColor() ); pDev->SetTextLineColor( aULineColor ); - Color aOLineColor( ((const SvxOverlineItem&)pPattern->GetItem( ATTR_FONT_OVERLINE, pCondSet )).GetColor() ); + Color aOLineColor( static_cast<const SvxOverlineItem&>(pPattern->GetItem( ATTR_FONT_OVERLINE, pCondSet )).GetColor() ); pDev->SetOverlineColor( aOLineColor ); // Zahlenformat @@ -419,9 +419,9 @@ void ScDrawStringsVars::SetPattern( // Raender - pMargin = (const SvxMarginItem*)&pPattern->GetItem( ATTR_MARGIN, pCondSet ); + pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem( ATTR_MARGIN, pCondSet )); if ( eAttrHorJust == SVX_HOR_JUSTIFY_LEFT || eAttrHorJust == SVX_HOR_JUSTIFY_RIGHT ) - nIndent = ((const SfxUInt16Item&)pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue(); + nIndent = static_cast<const SfxUInt16Item&>(pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue(); else nIndent = 0; @@ -456,18 +456,18 @@ void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxIt if ( !pCondSet || pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT,true,&pLangItem) != SfxItemState::SET ) pLangItem = &pPattern->GetItem(ATTR_LANGUAGE_FORMAT); nValueFormat = pOutput->mpDoc->GetFormatTable()->GetFormatForLanguageIfBuiltIn( - ((SfxUInt32Item*)pFormItem)->GetValue(), - ((SvxLanguageItem*)pLangItem)->GetLanguage() ); + static_cast<const SfxUInt32Item*>(pFormItem)->GetValue(), + static_cast<const SvxLanguageItem*>(pLangItem)->GetLanguage() ); if (nValueFormat != nOld) maLastCell.clear(); // immer neu formatieren // Raender - pMargin = (const SvxMarginItem*)&pPattern->GetItem( ATTR_MARGIN, pCondSet ); + pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem( ATTR_MARGIN, pCondSet )); if ( eAttrHorJust == SVX_HOR_JUSTIFY_LEFT ) - nIndent = ((const SfxUInt16Item&)pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue(); + nIndent = static_cast<const SfxUInt16Item&>(pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue(); else nIndent = 0; @@ -931,7 +931,7 @@ bool ScOutputData::GetMergeOrigin( SCCOL nX, SCROW nY, SCSIZE nArrY, } else { - sal_uInt16 nOverlap = ((ScMergeFlagAttr*)mpDoc->GetAttr( + sal_uInt16 nOverlap = static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( rOverX, rOverY, nTab, ATTR_MERGE_FLAG ))->GetValue(); bHOver = ((nOverlap & SC_MF_HOR) != 0); bVOver = ((nOverlap & SC_MF_VER) != 0); @@ -957,7 +957,7 @@ bool ScOutputData::GetMergeOrigin( SCCOL nX, SCROW nY, SCSIZE nArrY, } else { - sal_uInt16 nOverlap = ((ScMergeFlagAttr*)mpDoc->GetAttr( + sal_uInt16 nOverlap = static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( rOverX, rOverY, nTab, ATTR_MERGE_FLAG ))->GetValue(); bVOver = ((nOverlap & SC_MF_VER) != 0); } @@ -1083,8 +1083,8 @@ bool ScOutputData::IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY ) if ( bIsPrint || bTabProtected ) { - const ScProtectionAttr* pAttr = (const ScProtectionAttr*) - mpDoc->GetEffItem( nX, nY, nTab, ATTR_PROTECTION ); + const ScProtectionAttr* pAttr = static_cast<const ScProtectionAttr*>( + mpDoc->GetEffItem( nX, nY, nTab, ATTR_PROTECTION )); if ( bIsPrint && pAttr->GetHidePrint() ) bEmpty = true; else if ( bTabProtected ) @@ -1121,8 +1121,8 @@ bool ScOutputData::IsAvailable( SCCOL nX, SCROW nY ) return false; const ScPatternAttr* pPattern = mpDoc->GetPattern( nX, nY, nTab ); - if ( ((const ScMergeAttr&)pPattern->GetItem(ATTR_MERGE)).IsMerged() || - ((const ScMergeFlagAttr&)pPattern->GetItem(ATTR_MERGE_FLAG)).IsOverlapped() ) + if ( static_cast<const ScMergeAttr&>(pPattern->GetItem(ATTR_MERGE)).IsMerged() || + static_cast<const ScMergeFlagAttr&>(pPattern->GetItem(ATTR_MERGE_FLAG)).IsOverlapped() ) { return false; } @@ -1194,7 +1194,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY } nCellPosY -= (long) mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY ); - const ScMergeAttr* pMerge = (const ScMergeAttr*)&rPattern.GetItem( ATTR_MERGE ); + const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(&rPattern.GetItem( ATTR_MERGE )); bool bMerged = pMerge->IsMerged(); long nMergeCols = pMerge->GetColMerge(); if ( nMergeCols == 0 ) @@ -1616,11 +1616,11 @@ void ScOutputData::DrawStrings( bool bPixelToLogic ) { const SfxPoolItem* pItem; if ( pFontSet->GetItemState( ATTR_FONT, true, &pItem ) == SfxItemState::SET ) - pAltPattern->GetItemSet().Put( (const SvxFontItem&)*pItem ); + pAltPattern->GetItemSet().Put( static_cast<const SvxFontItem&>(*pItem) ); if ( pFontSet->GetItemState( ATTR_CJK_FONT, true, &pItem ) == SfxItemState::SET ) - pAltPattern->GetItemSet().Put( (const SvxFontItem&)*pItem ); + pAltPattern->GetItemSet().Put( static_cast<const SvxFontItem&>(*pItem) ); if ( pFontSet->GetItemState( ATTR_CTL_FONT, true, &pItem ) == SfxItemState::SET ) - pAltPattern->GetItemSet().Put( (const SvxFontItem&)*pItem ); + pAltPattern->GetItemSet().Put( static_cast<const SvxFontItem&>(*pItem) ); } pPattern = pAltPattern; } @@ -2380,19 +2380,19 @@ void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor) if ( mpPreviewFontSet->GetItemState( ATTR_FONT, true, &pItem ) == SfxItemState::SET ) { SvxFontItem aFontItem(EE_CHAR_FONTINFO); - aFontItem = (const SvxFontItem&)*pItem; + aFontItem = static_cast<const SvxFontItem&>(*pItem); pSet->Put( aFontItem ); } if ( mpPreviewFontSet->GetItemState( ATTR_CJK_FONT, true, &pItem ) == SfxItemState::SET ) { SvxFontItem aCjkFontItem(EE_CHAR_FONTINFO_CJK); - aCjkFontItem = (const SvxFontItem&)*pItem; + aCjkFontItem = static_cast<const SvxFontItem&>(*pItem); pSet->Put( aCjkFontItem ); } if ( mpPreviewFontSet->GetItemState( ATTR_CTL_FONT, true, &pItem ) == SfxItemState::SET ) { SvxFontItem aCtlFontItem(EE_CHAR_FONTINFO_CTL); - aCtlFontItem = (const SvxFontItem&)*pItem; + aCtlFontItem = static_cast<const SvxFontItem&>(*pItem); pSet->Put( aCtlFontItem ); } } @@ -2408,7 +2408,7 @@ void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor) nControl &= ~EE_CNTRL_ONECHARPERLINE; mpEngine->SetControlWord( nControl ); - if ( !mbHyphenatorSet && ((const SfxBoolItem&)pSet->Get(EE_PARA_HYPHENATE)).GetValue() ) + if ( !mbHyphenatorSet && static_cast<const SfxBoolItem&>(pSet->Get(EE_PARA_HYPHENATE)).GetValue() ) { // set hyphenator the first time it is needed com::sun::star::uno::Reference<com::sun::star::linguistic2::XHyphenator> xXHyphenator( LinguMgr::GetHyphenator() ); @@ -2416,7 +2416,7 @@ void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor) mbHyphenatorSet = true; } - Color aBackCol = ((const SvxBrushItem&)mpPattern->GetItem( ATTR_BACKGROUND, mpCondSet )).GetColor(); + Color aBackCol = static_cast<const SvxBrushItem&>(mpPattern->GetItem( ATTR_BACKGROUND, mpCondSet )).GetColor(); if ( bUseStyleColor && ( aBackCol.GetTransparency() > 0 || bCellContrast ) ) aBackCol.SetColor( nConfBackColor ); mpEngine->SetBackgroundColor( aBackCol ); @@ -2976,7 +2976,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) if ( nEngineHeight >= aCellSize.Height() + aRefOne.Height() ) { const ScMergeAttr* pMerge = - (ScMergeAttr*)&rParam.mpPattern->GetItem(ATTR_MERGE); + static_cast<const ScMergeAttr*>(&rParam.mpPattern->GetItem(ATTR_MERGE)); bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; // Don't clip for text height when printing rows with optimal height, @@ -3190,7 +3190,7 @@ bool ScOutputData::Clip( DrawEditParam& rParam, const Size& aCellSize, if ( nEngineHeight >= aCellSize.Height() + aRefOne.Height() ) { const ScMergeAttr* pMerge = - (ScMergeAttr*)&rParam.mpPattern->GetItem(ATTR_MERGE); + static_cast<const ScMergeAttr*>(&rParam.mpPattern->GetItem(ATTR_MERGE)); const bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; // Don't clip for text height when printing rows with optimal height, @@ -3952,7 +3952,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) if ( nEngineHeight >= aCellSize.Height() + aRefOne.Height() ) { const ScMergeAttr* pMerge = - (ScMergeAttr*)&rParam.mpPattern->GetItem(ATTR_MERGE); + static_cast<const ScMergeAttr*>(&rParam.mpPattern->GetItem(ATTR_MERGE)); bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; // Don't clip for text height when printing rows with optimal height, @@ -4300,7 +4300,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) if ( nEngineHeight >= aCellSize.Height() + aRefOne.Height() ) { const ScMergeAttr* pMerge = - (ScMergeAttr*)&rParam.mpPattern->GetItem(ATTR_MERGE); + static_cast<const ScMergeAttr*>(&rParam.mpPattern->GetItem(ATTR_MERGE)); bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; // Don't clip for text height when printing rows with optimal height, @@ -4691,17 +4691,17 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) long nCellWidth = (long) pRowInfo[0].pCellInfo[nX+1].nWidth; - SvxCellHorJustify eHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&) + SvxCellHorJustify eHorJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>( pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet)).GetValue(); bool bBreak = ( eHorJust == SVX_HOR_JUSTIFY_BLOCK ) || - ((const SfxBoolItem&)pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue(); + static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue(); bool bRepeat = ( eHorJust == SVX_HOR_JUSTIFY_REPEAT && !bBreak ); bool bShrink = !bBreak && !bRepeat && static_cast<const SfxBoolItem&> (pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet )).GetValue(); SvxCellOrientation eOrient = pPattern->GetCellOrientation( pCondSet ); const ScMergeAttr* pMerge = - (ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE); + static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; long nStartX = nPosX; @@ -4739,7 +4739,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) nOutHeight += (long) mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY); } - SvxCellVerJustify eVerJust = (SvxCellVerJustify)((const SvxVerJustifyItem&) + SvxCellVerJustify eVerJust = (SvxCellVerJustify)static_cast<const SvxVerJustifyItem&>( pPattern->GetItem(ATTR_VER_JUSTIFY, pCondSet)).GetValue(); // Syntax-Modus wird hier ignoriert... @@ -4768,7 +4768,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) nControl &= ~EE_CNTRL_ONECHARPERLINE; pEngine->SetControlWord( nControl ); - if ( !bHyphenatorSet && ((const SfxBoolItem&)pSet->Get(EE_PARA_HYPHENATE)).GetValue() ) + if ( !bHyphenatorSet && static_cast<const SfxBoolItem&>(pSet->Get(EE_PARA_HYPHENATE)).GetValue() ) { // set hyphenator the first time it is needed com::sun::star::uno::Reference<com::sun::star::linguistic2::XHyphenator> xXHyphenator( LinguMgr::GetHyphenator() ); @@ -4776,7 +4776,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) bHyphenatorSet = true; } - Color aBackCol = ((const SvxBrushItem&) + Color aBackCol = static_cast<const SvxBrushItem&>( pPattern->GetItem( ATTR_BACKGROUND, pCondSet )).GetColor(); if ( mbUseStyleColor && ( aBackCol.GetTransparency() > 0 || bCellContrast ) ) aBackCol.SetColor( nConfBackColor ); @@ -4787,11 +4787,11 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) //! Position und Papersize auf EditUtil umstellen !!! - const SvxMarginItem* pMargin = (const SvxMarginItem*) - &pPattern->GetItem(ATTR_MARGIN, pCondSet); + const SvxMarginItem* pMargin = static_cast<const SvxMarginItem*>( + &pPattern->GetItem(ATTR_MARGIN, pCondSet)); sal_uInt16 nIndent = 0; if ( eHorJust == SVX_HOR_JUSTIFY_LEFT ) - nIndent = ((const SfxUInt16Item&)pPattern-> + nIndent = static_cast<const SfxUInt16Item&>(pPattern-> GetItem(ATTR_INDENT, pCondSet)).GetValue(); long nTotalHeight = nOutHeight; // ohne Rand abzuziehen @@ -4814,11 +4814,11 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) SvxRotateMode eRotMode = SVX_ROTATE_MODE_STANDARD; if ( eOrient == SVX_ORIENTATION_STANDARD ) { - nAttrRotate = ((const SfxInt32Item&)pPattern-> + nAttrRotate = static_cast<const SfxInt32Item&>(pPattern-> GetItem(ATTR_ROTATE_VALUE, pCondSet)).GetValue(); if ( nAttrRotate ) { - eRotMode = (SvxRotateMode)((const SvxRotateModeItem&) + eRotMode = (SvxRotateMode)static_cast<const SvxRotateModeItem&>( pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue(); if ( nAttrRotate == 18000 ) diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 786711ec9e95..e7977eacfa29 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -791,7 +791,7 @@ static Size lcl_GetDocPageSize( ScDocument* pDoc, SCTAB nTab ) if ( pStyleSheet ) { SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - return ((const SvxSizeItem&) rStyleSet.Get(ATTR_PAGE_SIZE)).GetSize(); + return static_cast<const SvxSizeItem&>( rStyleSet.Get(ATTR_PAGE_SIZE)).GetSize(); } else { @@ -1072,7 +1072,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - SvxLRSpaceItem aLRItem = ( const SvxLRSpaceItem& ) rStyleSet.Get( ATTR_LRSPACE ); + SvxLRSpaceItem aLRItem = static_cast<const SvxLRSpaceItem&>( rStyleSet.Get( ATTR_LRSPACE ) ); if(( bLeftRulerChange || bRightRulerChange ) && ( aButtonUpPt.X() <= ( 0 - aOffset.X() ) || aButtonUpPt.X() > nWidth * HMM_PER_TWIPS - aOffset.X() ) ) { @@ -1167,7 +1167,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - SvxULSpaceItem aULItem = ( const SvxULSpaceItem&)rStyleSet.Get( ATTR_ULSPACE ); + SvxULSpaceItem aULItem = static_cast<const SvxULSpaceItem&>( rStyleSet.Get( ATTR_ULSPACE ) ); if( bTopRulerMove && bTopRulerChange ) { @@ -1186,11 +1186,11 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) const SfxPoolItem* pItem = NULL; if ( rStyleSet.GetItemState( ATTR_PAGE_HEADERSET, false, &pItem ) == SfxItemState::SET ) { - SfxItemSet& pHeaderSet = ((SvxSetItem*)pItem)->GetItemSet(); - Size aHeaderSize = ((const SvxSizeItem&)pHeaderSet.Get(ATTR_PAGE_SIZE)).GetSize(); + const SfxItemSet& pHeaderSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); + Size aHeaderSize = static_cast<const SvxSizeItem&>(pHeaderSet.Get(ATTR_PAGE_SIZE)).GetSize(); aHeaderSize.Height() = (long)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - aULItem.GetUpper()); aHeaderSize.Height() = aHeaderSize.Height() * 100 / mnScale; - SvxSetItem aNewHeader( (const SvxSetItem&)rStyleSet.Get(ATTR_PAGE_HEADERSET) ); + SvxSetItem aNewHeader( static_cast<const SvxSetItem&>(rStyleSet.Get(ATTR_PAGE_HEADERSET)) ); aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) ); rStyleSet.Put( aNewHeader ); pDocShell->SetModified(true); @@ -1201,11 +1201,11 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) const SfxPoolItem* pItem = NULL; if( rStyleSet.GetItemState( ATTR_PAGE_FOOTERSET, false, &pItem ) == SfxItemState::SET ) { - SfxItemSet& pFooterSet = ((SvxSetItem*)pItem)->GetItemSet(); - Size aFooterSize = ((const SvxSizeItem&)pFooterSet.Get(ATTR_PAGE_SIZE)).GetSize(); + const SfxItemSet& pFooterSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); + Size aFooterSize = static_cast<const SvxSizeItem&>(pFooterSet.Get(ATTR_PAGE_SIZE)).GetSize(); aFooterSize.Height() = (long)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - aULItem.GetLower() ); aFooterSize.Height() = aFooterSize.Height() * 100 / mnScale; - SvxSetItem aNewFooter( (const SvxSetItem&)rStyleSet.Get(ATTR_PAGE_FOOTERSET) ); + SvxSetItem aNewFooter( static_cast<const SvxSetItem&>(rStyleSet.Get(ATTR_PAGE_FOOTERSET)) ); aNewFooter.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aFooterSize ) ); rStyleSet.Put( aNewFooter ); pDocShell->SetModified(true); diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index be99e685bc82..12ec7d032f8e 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -150,7 +150,7 @@ void ScPreviewShell::Construct( vcl::Window* pParent ) ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, SfxViewShell* pOldSh ) : SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), - pDocShell( (ScDocShell*)pViewFrame->GetObjectShell() ), + pDocShell( static_cast<ScDocShell*>(pViewFrame->GetObjectShell()) ), mpFrameWindow(NULL), nSourceDesignMode( SC_FORCEMODE_NONE ), nMaxVertPos(0), @@ -164,7 +164,7 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, //! store live ScViewData instead, and update on ScTablesHint? //! or completely forget aSourceData on ScTablesHint? - ScTabViewShell* pTabViewShell = ((ScTabViewShell*)pOldSh); + ScTabViewShell* pTabViewShell = static_cast<ScTabViewShell*>(pOldSh); const ScViewData& rData = pTabViewShell->GetViewData(); rData.WriteUserDataSequence( aSourceData ); pPreview->SetSelectedTabs(rData.GetMarkData()); @@ -250,7 +250,7 @@ bool ScPreviewShell::GetPageSize( Size& aPageSize ) if (!pStyleSheet) return false; const SfxItemSet* pParamSet = &pStyleSheet->GetItemSet(); - aPageSize = ((const SvxSizeItem&) pParamSet->Get(ATTR_PAGE_SIZE)).GetSize(); + aPageSize = static_cast<const SvxSizeItem&>( pParamSet->Get(ATTR_PAGE_SIZE)).GetSize(); aPageSize.Width() = (long) (aPageSize.Width() * HMM_PER_TWIPS ); aPageSize.Height() = (long) (aPageSize.Height() * HMM_PER_TWIPS ); return true; @@ -637,8 +637,8 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) if ( pReqArgs ) { - const SvxZoomItem& rZoomItem = (const SvxZoomItem&) - pReqArgs->Get(SID_ATTR_ZOOM); + const SvxZoomItem& rZoomItem = static_cast<const SvxZoomItem&>( + pReqArgs->Get(SID_ATTR_ZOOM)); eZoom = rZoomItem.GetType(); nZoom = rZoomItem.GetValue(); @@ -660,9 +660,9 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) if ( !bCancel ) { - const SvxZoomItem& rZoomItem = (const SvxZoomItem&) + const SvxZoomItem& rZoomItem = static_cast<const SvxZoomItem&>( pDlg->GetOutputItemSet()-> - Get( SID_ATTR_ZOOM ); + Get( SID_ATTR_ZOOM )); eZoom = rZoomItem.GetType(); nZoom = rZoomItem.GetValue(); @@ -724,7 +724,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) eZoom = SVX_ZOOM_PERCENT; if( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( SID_ATTR_ZOOMSLIDER, true, &pItem ) ) { - const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem*)pItem)->GetValue(); + const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem*>(pItem)->GetValue(); if( nCurrentZoom ) { pPreview->SetZoom( nCurrentZoom ); @@ -744,7 +744,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) if ( pReqArgs && pStyleSheet && SfxItemState::SET == pReqArgs->GetItemState( SID_PREVIEW_SCALINGFACTOR, true, &pItem ) ) { - const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue(); + const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue(); SfxItemSet& rSet = pStyleSheet->GetItemSet(); rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALE, nCurrentZoom ) ); ScPrintFunc aPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab ); @@ -859,7 +859,7 @@ void ScPreviewShell::GetState( SfxItemSet& rSet ) if ( pStyleSheet ) { SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - sal_uInt16 nCurrentZoom = ((const SfxUInt16Item&)rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue(); + sal_uInt16 nCurrentZoom = static_cast<const SfxUInt16Item&>(rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue(); if( nCurrentZoom ) { SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM_SLIDER, MAXZOOM_SLIDER, SID_PREVIEW_SCALINGFACTOR ); diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx index 1c10cc9c0174..4da0e2e6ee76 100644 --- a/sc/source/ui/view/prevwsh2.cxx +++ b/sc/source/ui/view/prevwsh2.cxx @@ -34,7 +34,7 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) if (dynamic_cast<const SfxSimpleHint*>(&rHint)) { - sal_uLong nSlot = ((const SfxSimpleHint&)rHint).GetId(); + sal_uLong nSlot = static_cast<const SfxSimpleHint&>(rHint).GetId(); switch ( nSlot ) { case FID_DATACHANGED: @@ -52,9 +52,9 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } else if (dynamic_cast<const ScPaintHint*>(&rHint)) { - if ( ((const ScPaintHint&)rHint).GetPrintFlag() ) + if ( static_cast<const ScPaintHint&>(rHint).GetPrintFlag() ) { - sal_uInt16 nParts = ((const ScPaintHint&)rHint).GetParts(); + sal_uInt16 nParts = static_cast<const ScPaintHint&>(rHint).GetParts(); if (nParts & ( PAINT_GRID | PAINT_LEFT | PAINT_TOP | PAINT_SIZE )) bDataChanged = true; } @@ -62,7 +62,7 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) else if (dynamic_cast<const SdrHint*>(&rHint)) { // SdrHints are no longer used for invalidating, thus react on objectchange instead - if(HINT_OBJCHG == ((const SdrHint&)rHint).GetKind()) + if(HINT_OBJCHG == static_cast<const SdrHint&>(rHint).GetKind()) bDataChanged = true; } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index bb379604e695..ac8365df13b1 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -75,9 +75,9 @@ #define ZOOM_MIN 10 -#define GET_BOOL(set,which) ((const SfxBoolItem&)(set)->Get((which))).GetValue() -#define GET_USHORT(set,which) ((const SfxUInt16Item&)(set)->Get((which))).GetValue() -#define GET_SHOW(set,which) ( VOBJ_MODE_SHOW == ScVObjMode( ((const ScViewObjectModeItem&)(set)->Get((which))).GetValue()) ) +#define GET_BOOL(set,which) static_cast<const SfxBoolItem&>((set)->Get((which))).GetValue() +#define GET_USHORT(set,which) static_cast<const SfxUInt16Item&>((set)->Get((which))).GetValue() +#define GET_SHOW(set,which) ( VOBJ_MODE_SHOW == ScVObjMode( static_cast<const ScViewObjectModeItem&>((set)->Get((which))).GetValue()) ) ScPageRowEntry::ScPageRowEntry(const ScPageRowEntry& r) { @@ -380,7 +380,7 @@ static void lcl_HidePrint( ScTableInfo& rTabInfo, SCCOL nX1, SCCOL nX2 ) { const CellInfo& rCellInfo = pThisRowInfo->pCellInfo[nX+1]; if (!rCellInfo.bEmptyCellText) - if (((const ScProtectionAttr&)rCellInfo.pPatternAttr-> + if (static_cast<const ScProtectionAttr&>(rCellInfo.pPatternAttr-> GetItem(ATTR_PROTECTION, rCellInfo.pConditionSet)).GetHidePrint()) { pThisRowInfo->pCellInfo[nX+1].maCell.clear(); @@ -412,9 +412,9 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr if (pStyleSheet) { SfxItemSet& rSet = pStyleSheet->GetItemSet(); - bDoGrid = ((const SfxBoolItem&)rSet.Get(ATTR_PAGE_GRID)).GetValue(); - bNullVal = ((const SfxBoolItem&)rSet.Get(ATTR_PAGE_NULLVALS)).GetValue(); - bFormula = ((const SfxBoolItem&)rSet.Get(ATTR_PAGE_FORMULAS)).GetValue(); + bDoGrid = static_cast<const SfxBoolItem&>(rSet.Get(ATTR_PAGE_GRID)).GetValue(); + bNullVal = static_cast<const SfxBoolItem&>(rSet.Get(ATTR_PAGE_NULLVALS)).GetValue(); + bFormula = static_cast<const SfxBoolItem&>(rSet.Get(ATTR_PAGE_FORMULAS)).GetValue(); } else { @@ -605,19 +605,19 @@ static void lcl_FillHFParam( ScPrintHFParam& rParam, const SfxItemSet* pHFSet ) } else { - rParam.bEnable = ((const SfxBoolItem&) pHFSet->Get(ATTR_PAGE_ON)).GetValue(); - rParam.bDynamic = ((const SfxBoolItem&) pHFSet->Get(ATTR_PAGE_DYNAMIC)).GetValue(); - rParam.bShared = ((const SfxBoolItem&) pHFSet->Get(ATTR_PAGE_SHARED)).GetValue(); - rParam.nHeight = ((const SvxSizeItem&) pHFSet->Get(ATTR_PAGE_SIZE)).GetSize().Height(); - const SvxLRSpaceItem* pHFLR = &(const SvxLRSpaceItem&) pHFSet->Get(ATTR_LRSPACE); + rParam.bEnable = static_cast<const SfxBoolItem&>( pHFSet->Get(ATTR_PAGE_ON)).GetValue(); + rParam.bDynamic = static_cast<const SfxBoolItem&>( pHFSet->Get(ATTR_PAGE_DYNAMIC)).GetValue(); + rParam.bShared = static_cast<const SfxBoolItem&>( pHFSet->Get(ATTR_PAGE_SHARED)).GetValue(); + rParam.nHeight = static_cast<const SvxSizeItem&>( pHFSet->Get(ATTR_PAGE_SIZE)).GetSize().Height(); + const SvxLRSpaceItem* pHFLR = &static_cast<const SvxLRSpaceItem&>(pHFSet->Get(ATTR_LRSPACE)); long nTmp; nTmp = pHFLR->GetLeft(); rParam.nLeft = nTmp < 0 ? 0 : sal_uInt16(nTmp); nTmp = pHFLR->GetRight(); rParam.nRight = nTmp < 0 ? 0 : sal_uInt16(nTmp); - rParam.pBorder = (const SvxBoxItem*) &pHFSet->Get(ATTR_BORDER); - rParam.pBack = (const SvxBrushItem*) &pHFSet->Get(ATTR_BACKGROUND); - rParam.pShadow = (const SvxShadowItem*)&pHFSet->Get(ATTR_SHADOW); + rParam.pBorder = static_cast<const SvxBoxItem*> (&pHFSet->Get(ATTR_BORDER)); + rParam.pBack = static_cast<const SvxBrushItem*> (&pHFSet->Get(ATTR_BACKGROUND)); + rParam.pShadow = static_cast<const SvxShadowItem*>(&pHFSet->Get(ATTR_SHADOW)); // now back in the dialog: // rParam.nHeight += rParam.nDistance; // not in the dialog any more ??? @@ -789,39 +789,39 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) return; // TabPage "Page" - const SvxLRSpaceItem* pLRItem = (const SvxLRSpaceItem*) &pParamSet->Get( ATTR_LRSPACE ); + const SvxLRSpaceItem* pLRItem = static_cast<const SvxLRSpaceItem*>( &pParamSet->Get( ATTR_LRSPACE ) ); long nTmp; nTmp = pLRItem->GetLeft(); nLeftMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp); nTmp = pLRItem->GetRight(); nRightMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp); - const SvxULSpaceItem* pULItem = (const SvxULSpaceItem*) &pParamSet->Get( ATTR_ULSPACE ); + const SvxULSpaceItem* pULItem = static_cast<const SvxULSpaceItem*>( &pParamSet->Get( ATTR_ULSPACE ) ); nTopMargin = pULItem->GetUpper(); nBottomMargin = pULItem->GetLower(); - const SvxPageItem* pPageItem = (const SvxPageItem*) &pParamSet->Get( ATTR_PAGE ); + const SvxPageItem* pPageItem = static_cast<const SvxPageItem*>( &pParamSet->Get( ATTR_PAGE ) ); nPageUsage = pPageItem->GetPageUsage(); bLandscape = pPageItem->IsLandscape(); aFieldData.eNumType = pPageItem->GetNumType(); - bCenterHor = ((const SfxBoolItem&) pParamSet->Get(ATTR_PAGE_HORCENTER)).GetValue(); - bCenterVer = ((const SfxBoolItem&) pParamSet->Get(ATTR_PAGE_VERCENTER)).GetValue(); + bCenterHor = static_cast<const SfxBoolItem&>( pParamSet->Get(ATTR_PAGE_HORCENTER)).GetValue(); + bCenterVer = static_cast<const SfxBoolItem&>( pParamSet->Get(ATTR_PAGE_VERCENTER)).GetValue(); - aPageSize = ((const SvxSizeItem&) pParamSet->Get(ATTR_PAGE_SIZE)).GetSize(); + aPageSize = static_cast<const SvxSizeItem&>( pParamSet->Get(ATTR_PAGE_SIZE)).GetSize(); if ( !aPageSize.Width() || !aPageSize.Height() ) { OSL_FAIL("PageSize Null ?!?!?"); aPageSize = SvxPaperInfo::GetPaperSize( PAPER_A4 ); } - pBorderItem = (const SvxBoxItem*) &pParamSet->Get(ATTR_BORDER); - pBackgroundItem = (const SvxBrushItem*) &pParamSet->Get(ATTR_BACKGROUND); - pShadowItem = (const SvxShadowItem*) &pParamSet->Get(ATTR_SHADOW); + pBorderItem = static_cast<const SvxBoxItem*> (&pParamSet->Get(ATTR_BORDER) ); + pBackgroundItem = static_cast<const SvxBrushItem*> (&pParamSet->Get(ATTR_BACKGROUND) ); + pShadowItem = static_cast<const SvxShadowItem*>(&pParamSet->Get(ATTR_SHADOW) ); // TabPage "Headline" - aHdr.pLeft = (const ScPageHFItem*) &pParamSet->Get(ATTR_PAGE_HEADERLEFT); // Content - aHdr.pRight = (const ScPageHFItem*) &pParamSet->Get(ATTR_PAGE_HEADERRIGHT); + aHdr.pLeft = static_cast<const ScPageHFItem*>( &pParamSet->Get(ATTR_PAGE_HEADERLEFT) ); // Content + aHdr.pRight = static_cast<const ScPageHFItem*>( &pParamSet->Get(ATTR_PAGE_HEADERRIGHT) ); const SvxSetItem* pHeaderSetItem; const SfxItemSet* pHeaderSet = NULL; @@ -830,14 +830,14 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) { pHeaderSet = &pHeaderSetItem->GetItemSet(); // Headline has space below - aHdr.nDistance = ((const SvxULSpaceItem&) pHeaderSet->Get(ATTR_ULSPACE)).GetLower(); + aHdr.nDistance = static_cast<const SvxULSpaceItem&>(pHeaderSet->Get(ATTR_ULSPACE)).GetLower(); } lcl_FillHFParam( aHdr, pHeaderSet ); // TabPage "Footline" - aFtr.pLeft = (const ScPageHFItem*) &pParamSet->Get(ATTR_PAGE_FOOTERLEFT); // Content - aFtr.pRight = (const ScPageHFItem*) &pParamSet->Get(ATTR_PAGE_FOOTERRIGHT); + aFtr.pLeft = static_cast<const ScPageHFItem*>( &pParamSet->Get(ATTR_PAGE_FOOTERLEFT) ); // Content + aFtr.pRight = static_cast<const ScPageHFItem*>( &pParamSet->Get(ATTR_PAGE_FOOTERRIGHT) ); const SvxSetItem* pFooterSetItem; const SfxItemSet* pFooterSet = NULL; @@ -846,7 +846,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) { pFooterSet = &pFooterSetItem->GetItemSet(); // Footline has space above - aFtr.nDistance = ((const SvxULSpaceItem&) pFooterSet->Get(ATTR_ULSPACE)).GetUpper(); + aFtr.nDistance = static_cast<const SvxULSpaceItem&>(pFooterSet->Get(ATTR_ULSPACE)).GetUpper(); } lcl_FillHFParam( aFtr, pFooterSet ); @@ -862,20 +862,20 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) eState = pParamSet->GetItemState( ATTR_PAGE_SCALE, false, (const SfxPoolItem**)&pScaleItem ); if ( SfxItemState::DEFAULT == eState ) - pScaleItem = (const SfxUInt16Item*) - &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALE ); + pScaleItem = static_cast<const SfxUInt16Item*>( + &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALE )); eState = pParamSet->GetItemState( ATTR_PAGE_SCALETO, false, (const SfxPoolItem**)&pScaleToItem ); if ( SfxItemState::DEFAULT == eState ) - pScaleToItem = (const ScPageScaleToItem*) - &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETO ); + pScaleToItem = static_cast<const ScPageScaleToItem*>( + &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETO )); eState = pParamSet->GetItemState( ATTR_PAGE_SCALETOPAGES, false, (const SfxPoolItem**)&pScaleToPagesItem ); if ( SfxItemState::DEFAULT == eState ) - pScaleToPagesItem = (const SfxUInt16Item*) - &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETOPAGES ); + pScaleToPagesItem = static_cast<const SfxUInt16Item*>( + &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETOPAGES )); OSL_ENSURE( pScaleItem && pScaleToItem && pScaleToPagesItem, "Missing ScaleItem! :-/" ); @@ -1683,7 +1683,7 @@ void ScPrintFunc::MakeEditEngine() // Default-Set for alignment pEditDefaults = new SfxItemSet( pEditEngine->GetEmptyItemSet() ); - const ScPatternAttr& rPattern = (const ScPatternAttr&)pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN); + const ScPatternAttr& rPattern = static_cast<const ScPatternAttr&>(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)); rPattern.FillEditItemSet( pEditDefaults ); // FillEditItemSet adjusts font height to 1/100th mm, // but for header/footer twips is needed, as in the PatternAttr: @@ -1849,7 +1849,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, bool bDoPrint, ScPreviewLocationData vcl::Font aMarkFont; ScAutoFontColorMode eColorMode = bUseStyleColor ? SC_AUTOCOL_DISPLAY : SC_AUTOCOL_PRINT; - ((const ScPatternAttr&)pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)).GetFont( aMarkFont, eColorMode ); + static_cast<const ScPatternAttr&>(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)).GetFont( aMarkFont, eColorMode ); pDev->SetFont( aMarkFont ); long nMarkLen = pDev->GetTextWidth(OUString("GW99999:")); // without Space-Char, because it rarle arrives there @@ -2581,7 +2581,7 @@ void ScPrintFunc::ApplyPrintSettings() aEnumSize.Height() = nTemp; } Paper ePaper = SvxPaperInfo::GetSvxPaper( aEnumSize, MAP_TWIP, true ); - sal_uInt16 nPaperBin = ((const SvxPaperBinItem&)pParamSet->Get(ATTR_PAGE_PAPERBIN)).GetValue(); + sal_uInt16 nPaperBin = static_cast<const SvxPaperBinItem&>(pParamSet->Get(ATTR_PAGE_PAPERBIN)).GetValue(); pPrinter->SetPaper( ePaper ); if ( PAPER_USER == ePaper ) diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 29f4b4d92ee6..55697e288650 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -189,7 +189,7 @@ void ScSimpleRefDlgWrapper::SetRefString(const OUString& rStr) { if(pWindow!=NULL) { - ((ScSimpleRefDlg*)pWindow)->SetRefString(rStr); + static_cast<ScSimpleRefDlg*>(pWindow)->SetRefString(rStr); } } @@ -197,7 +197,7 @@ void ScSimpleRefDlgWrapper::SetCloseHdl( const Link& rLink ) { if(pWindow!=NULL) { - ((ScSimpleRefDlg*)pWindow)->SetCloseHdl( rLink ); + static_cast<ScSimpleRefDlg*>(pWindow)->SetCloseHdl( rLink ); } } @@ -206,7 +206,7 @@ void ScSimpleRefDlgWrapper::SetUnoLinks( const Link& rDone, { if(pWindow!=NULL) { - ((ScSimpleRefDlg*)pWindow)->SetUnoLinks( rDone, rAbort, rChange ); + static_cast<ScSimpleRefDlg*>(pWindow)->SetUnoLinks( rDone, rAbort, rChange ); } } @@ -214,7 +214,7 @@ void ScSimpleRefDlgWrapper::SetFlags( bool bCloseOnButtonUp, bool bSingleCell, b { if(pWindow!=NULL) { - ((ScSimpleRefDlg*)pWindow)->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection ); + static_cast<ScSimpleRefDlg*>(pWindow)->SetFlags( bCloseOnButtonUp, bSingleCell, bMultiSelection ); } } @@ -222,7 +222,7 @@ void ScSimpleRefDlgWrapper::StartRefInput() { if(pWindow!=NULL) { - ((ScSimpleRefDlg*)pWindow)->StartRefInput(); + static_cast<ScSimpleRefDlg*>(pWindow)->StartRefInput(); } } @@ -242,7 +242,7 @@ ScAcceptChgDlgWrapper::ScAcceptChgDlgWrapper( vcl::Window* pParentP, NULL; if(pWindow!=NULL) { - ((ScAcceptChgDlg*)pWindow)->Initialize( pInfo ); + static_cast<ScAcceptChgDlg*>(pWindow)->Initialize( pInfo ); } if (pViewShell && !pWindow) pViewShell->GetViewFrame()->SetChildWindow( nId, false ); @@ -256,7 +256,7 @@ void ScAcceptChgDlgWrapper::ReInitDlg() if(pWindow!=NULL && pViewShell) { - ((ScAcceptChgDlg*)pWindow)->ReInit(&pViewShell->GetViewData()); + static_cast<ScAcceptChgDlg*>(pWindow)->ReInit(&pViewShell->GetViewData()); } } diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 68757a292ee5..2ac9d3775ff5 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -501,7 +501,7 @@ static sal_uInt16 lcl_DocShellNr( ScDocument* pDoc ) { if ( pShell->Type() == TYPE(ScDocShell) ) { - if ( &((ScDocShell*)pShell)->GetDocument() == pDoc ) + if ( &static_cast<ScDocShell*>(pShell)->GetDocument() == pDoc ) return nShellCnt; ++nShellCnt; diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 028a5ff6cce9..cf18c69da95a 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -602,11 +602,11 @@ void ScTabView::TestHintWindow() ScAddress aListValPos; ScDocument* pDoc = aViewData.GetDocument(); - const SfxUInt32Item* pItem = (const SfxUInt32Item*) + const SfxUInt32Item* pItem = static_cast<const SfxUInt32Item*>( pDoc->GetAttr( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo(), - ATTR_VALIDDATA ); + ATTR_VALIDDATA )); if ( pItem->GetValue() ) { const ScValidationData* pData = pDoc->GetValidationEntry( pItem->GetValue() ); diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index b67f38023dfc..0672e97f21ae 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -104,7 +104,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) if ( pArgs->GetItemState( SID_INSERT_DRAW, true, &pItem ) == SfxItemState::SET && pItem->ISA( SvxDrawToolItem ) ) { - SvxDrawToolEnum eSel = (SvxDrawToolEnum)((const SvxDrawToolItem*)pItem)->GetValue(); + SvxDrawToolEnum eSel = (SvxDrawToolEnum)static_cast<const SvxDrawToolItem*>(pItem)->GetValue(); switch (eSel) { case SVX_SNAP_DRAW_SELECT: nNewId = SID_OBJECT_SELECT; break; @@ -140,7 +140,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) const SfxPoolItem* pItem; if ( pArgs->GetItemState( SID_FM_CONTROL_IDENTIFIER, true, &pItem ) == SfxItemState::SET && pItem->ISA( SfxUInt16Item ) ) - nNewFormId = ((const SfxUInt16Item*)pItem)->GetValue(); + nNewFormId = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); } OUString sStringItemValue; diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 68044eea1059..6b0cb71528fb 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -109,13 +109,13 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if ( pReqArgs && pReqArgs->GetItemState(FID_INSERT_FILE,true,&pItem) == SfxItemState::SET ) { - OUString aFileName = ((const SfxStringItem*)pItem)->GetValue(); + OUString aFileName = static_cast<const SfxStringItem*>(pItem)->GetValue(); // Einfuege-Position Point aInsertPos; if ( pReqArgs->GetItemState(FN_PARAM_1,true,&pItem) == SfxItemState::SET ) - aInsertPos = ((const SfxPointItem*)pItem)->GetValue(); + aInsertPos = static_cast<const SfxPointItem*>(pItem)->GetValue(); else aInsertPos = GetInsertPos(); @@ -123,7 +123,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bool bAsLink = false; if ( pReqArgs->GetItemState(FN_PARAM_2,true,&pItem) == SfxItemState::SET ) - bAsLink = ((const SfxBoolItem*)pItem)->GetValue(); + bAsLink = static_cast<const SfxBoolItem*>(pItem)->GetValue(); // ausfuehren @@ -225,10 +225,10 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) OUString aAddress; const SfxPoolItem* pItem; if ( pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET ) - aAddress = ((const SfxStringItem*)pItem)->GetValue(); + aAddress = static_cast<const SfxStringItem*>(pItem)->GetValue(); else if ( nSlot == SID_JUMPTOMARK && pReqArgs->GetItemState( SID_JUMPTOMARK, true, &pItem ) == SfxItemState::SET ) - aAddress = ((const SfxStringItem*)pItem)->GetValue(); + aAddress = static_cast<const SfxStringItem*>(pItem)->GetValue(); // #i14927# SID_CURRENTCELL with a single cell must unmark if FN_PARAM_1 // isn't set (for recorded macros, because IsAPI is no longer available). @@ -236,7 +236,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) // cell if there is a multi selection. bool bUnmark = ( nSlot == SID_CURRENTCELL ); if ( pReqArgs->GetItemState( FN_PARAM_1, true, &pItem ) == SfxItemState::SET ) - bUnmark = ((const SfxBoolItem*)pItem)->GetValue(); + bUnmark = static_cast<const SfxBoolItem*>(pItem)->GetValue(); bool bAlignToCursor = true; if (pReqArgs->GetItemState(FN_PARAM_2, true, &pItem) == SfxItemState::SET) @@ -421,7 +421,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_CURRENTOBJECT: if ( pReqArgs ) { - OUString aName = ((const SfxStringItem&)pReqArgs->Get(nSlot)).GetValue(); + OUString aName = static_cast<const SfxStringItem&>(pReqArgs->Get(nSlot)).GetValue(); SelectObject( aName ); } break; @@ -430,7 +430,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if ( pReqArgs ) { // Tabelle fuer Basic ist 1-basiert - SCTAB nTab = ((const SfxUInt16Item&)pReqArgs->Get(nSlot)).GetValue() - 1; + SCTAB nTab = static_cast<const SfxUInt16Item&>(pReqArgs->Get(nSlot)).GetValue() - 1; ScDocument* pDoc = GetViewData().GetDocument(); if ( nTab < pDoc->GetTableCount() ) { @@ -447,11 +447,11 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_CURRENTDOC: if ( pReqArgs ) { - OUString aStrDocName( ((const SfxStringItem&)pReqArgs-> + OUString aStrDocName( static_cast<const SfxStringItem&>(pReqArgs-> Get(nSlot)).GetValue() ); SfxViewFrame* pViewFrame = NULL; - ScDocShell* pDocSh = (ScDocShell*)SfxObjectShell::GetFirst(); + ScDocShell* pDocSh = static_cast<ScDocShell*>(SfxObjectShell::GetFirst()); bool bFound = false; // zu aktivierenden ViewFrame suchen @@ -464,7 +464,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bFound = ( NULL != pViewFrame ); } - pDocSh = (ScDocShell*)SfxObjectShell::GetNext( *pDocSh ); + pDocSh = static_cast<ScDocShell*>(SfxObjectShell::GetNext( *pDocSh )); } if ( bFound ) @@ -522,7 +522,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET ) { - bool bItemValue = ((const SfxBoolItem*)pItem)->GetValue(); + bool bItemValue = static_cast<const SfxBoolItem*>(pItem)->GetValue(); bWantPageBreak = (nSlot == FID_PAGEBREAKMODE) == bItemValue; } @@ -545,7 +545,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { sal_uInt16 nChildId = ScFunctionChildWindow::GetChildWindowId(); if ( rReq.GetArgs() ) - pThisFrame->SetChildWindow( nChildId, ((const SfxBoolItem&) (rReq.GetArgs()->Get(FID_FUNCTION_BOX))).GetValue()); + pThisFrame->SetChildWindow( nChildId, static_cast<const SfxBoolItem&>(rReq.GetArgs()->Get(FID_FUNCTION_BOX)).GetValue()); else { pThisFrame->ToggleChildWindow( nChildId ); @@ -562,7 +562,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bool bSet = !GetViewData().IsSyntaxMode(); const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET ) - bSet = ((const SfxBoolItem*)pItem)->GetValue(); + bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue(); GetViewData().SetSyntaxMode( bSet ); PaintGrid(); rBindings.Invalidate( FID_TOGGLESYNTAX ); @@ -575,7 +575,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bool bSet = !GetViewData().IsHeaderMode(); const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET ) - bSet = ((const SfxBoolItem*)pItem)->GetValue(); + bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue(); GetViewData().SetHeaderMode( bSet ); RepeatResize(); rBindings.Invalidate( FID_TOGGLEHEADERS ); @@ -591,7 +591,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bool bFormulaMode = !rOpts.GetOption( VOPT_FORMULAS ); const SfxPoolItem *pItem; if( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET ) - bFormulaMode = ((const SfxBoolItem *)pItem)->GetValue(); + bFormulaMode = static_cast<const SfxBoolItem *>(pItem)->GetValue(); ScViewOptions rSetOpts = ScViewOptions( rOpts ); rSetOpts.SetOption( VOPT_FORMULAS, bFormulaMode ); @@ -612,7 +612,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bool bSet = ( pWnd == NULL ); const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET ) - bSet = ((const SfxBoolItem*)pItem)->GetValue(); + bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue(); pThisFrame->SetChildWindow( nId, bSet ); rBindings.Invalidate( FID_TOGGLEINPUTLINE ); @@ -635,8 +635,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if ( pReqArgs ) { - const SvxZoomItem& rZoomItem = (const SvxZoomItem&) - pReqArgs->Get(SID_ATTR_ZOOM); + const SvxZoomItem& rZoomItem = static_cast<const SvxZoomItem&>( + pReqArgs->Get(SID_ATTR_ZOOM)); eNewZoomType = rZoomItem.GetType(); nZoom = rZoomItem.GetValue(); @@ -676,9 +676,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) // so no need to check again pDlg if ( !bCancel ) { - const SvxZoomItem& rZoomItem = (const SvxZoomItem&) + const SvxZoomItem& rZoomItem = static_cast<const SvxZoomItem&>( pDlg->GetOutputItemSet()-> - Get( SID_ATTR_ZOOM ); + Get( SID_ATTR_ZOOM )); eNewZoomType = rZoomItem.GetType(); nZoom = rZoomItem.GetValue(); @@ -738,7 +738,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom(); if ( pReqArgs && pReqArgs->GetItemState(SID_ATTR_ZOOMSLIDER, true, &pItem) == SfxItemState::SET ) { - const sal_uInt16 nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue(); + const sal_uInt16 nCurrentZoom = static_cast<const SvxZoomSliderItem *>(pItem)->GetValue(); if( nCurrentZoom ) { SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom ); @@ -934,7 +934,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET && pItem->ISA( SfxStringItem ) ) { - OUString aComment = ((const SfxStringItem*)pItem)->GetValue(); + OUString aComment = static_cast<const SfxStringItem*>(pItem)->GetValue(); pDocSh->SetChangeComment( pAction, aComment ); rReq.Done(); } @@ -965,7 +965,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { const SfxPoolItem* pItem; if( pReqArgs->HasItem( FID_PROTECT_DOC, &pItem ) && - ((const SfxBoolItem*)pItem)->GetValue() == pDoc->IsDocProtected() ) + static_cast<const SfxBoolItem*>(pItem)->GetValue() == pDoc->IsDocProtected() ) { rReq.Ignore(); break; @@ -1034,7 +1034,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; bool bNewProtection = !bOldProtection; if( pReqArgs->HasItem( FID_PROTECT_TABLE, &pItem ) ) - bNewProtection = ((const SfxBoolItem*)pItem)->GetValue(); + bNewProtection = static_cast<const SfxBoolItem*>(pItem)->GetValue(); if( bNewProtection == bOldProtection ) { rReq.Ignore(); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 5440daf9e0ea..2563bdf8a056 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -137,7 +137,7 @@ void ScTabViewShell::Activate(bool bMDI) SfxChildWindow* pChild = pThisFrame->GetChildWindow(FID_INPUTLINE_STATUS); if (pChild) { - ScInputWindow* pWin = (ScInputWindow*)pChild->GetWindow(); + ScInputWindow* pWin = static_cast<ScInputWindow*>(pChild->GetWindow()); if (pWin && pWin->IsVisible()) { @@ -148,7 +148,7 @@ void ScTabViewShell::Activate(bool bMDI) SfxViewShell* pSh = SfxViewShell::GetFirst( &aScType ); while ( pSh!=NULL && pOldHdl!=NULL) { - if (((ScTabViewShell*)pSh)->GetInputHandler() == pOldHdl) + if (static_cast<ScTabViewShell*>(pSh)->GetInputHandler() == pOldHdl) { pOldHdl->ResetDelayTimer(); break; @@ -198,7 +198,7 @@ void ScTabViewShell::Activate(bool bMDI) SfxChildWindow* pChild = pThisFrame->GetChildWindow(FID_CHG_ACCEPT); if (pChild) { - ((ScAcceptChgDlgWrapper*)pChild)->ReInitDlg(); + static_cast<ScAcceptChgDlgWrapper*>(pChild)->ReInitDlg(); } } @@ -1157,7 +1157,7 @@ void ScTabViewShell::StartSimpleRefDialog( SC_MOD()->SetRefDialog( nId, true, pViewFrm ); - ScSimpleRefDlgWrapper* pWnd = (ScSimpleRefDlgWrapper*)pViewFrm->GetChildWindow( nId ); + ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId )); if (pWnd) { pWnd->SetCloseHdl( LINK( this, ScTabViewShell, SimpleRefClose ) ); @@ -1178,12 +1178,12 @@ void ScTabViewShell::StopSimpleRefDialog() SfxViewFrame* pViewFrm = GetViewFrame(); sal_uInt16 nId = ScSimpleRefDlgWrapper::GetChildWindowId(); - ScSimpleRefDlgWrapper* pWnd = (ScSimpleRefDlgWrapper*)pViewFrm->GetChildWindow( nId ); + ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId )); if (pWnd) { vcl::Window* pWin = pWnd->GetWindow(); if (pWin && pWin->IsSystemWindow()) - ((SystemWindow*)pWin)->Close(); // calls abort handler + static_cast<SystemWindow*>(pWin)->Close(); // calls abort handler } } @@ -1697,7 +1697,7 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, SfxViewShell* pOldSh ) : SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), - ScDBFunc( &pViewFrame->GetWindow(), (ScDocShell&)*pViewFrame->GetObjectShell(), this ), + ScDBFunc( &pViewFrame->GetWindow(), static_cast<ScDocShell&>(*pViewFrame->GetObjectShell()), this ), __INIT_ScTabViewShell { const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions(); @@ -1711,7 +1711,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE; if ( pOldSh && pOldSh->ISA( ScPreviewShell ) ) { - ScPreviewShell* pPreviewShell = ((ScPreviewShell*)pOldSh); + ScPreviewShell* pPreviewShell = static_cast<ScPreviewShell*>(pOldSh); nForceDesignMode = pPreviewShell->GetSourceDesignMode(); ScPreview* p = pPreviewShell->GetPreview(); if (p) @@ -1850,15 +1850,15 @@ void ScTabViewShell::ExecTbx( SfxRequest& rReq ) { case SID_TBXCTL_INSERT: if ( pItem ) - nInsertCtrlState = ((const SfxUInt16Item*)pItem)->GetValue(); + nInsertCtrlState = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); break; case SID_TBXCTL_INSCELLS: if ( pItem ) - nInsCellsCtrlState = ((const SfxUInt16Item*)pItem)->GetValue(); + nInsCellsCtrlState = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); break; case SID_TBXCTL_INSOBJ: if ( pItem ) - nInsObjCtrlState = ((const SfxUInt16Item*)pItem)->GetValue(); + nInsObjCtrlState = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); break; default: OSL_FAIL("Slot im Wald"); diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx index 20b42c41fd61..35cce45a02f7 100644 --- a/sc/source/ui/view/tabvwsh5.cxx +++ b/sc/source/ui/view/tabvwsh5.cxx @@ -44,7 +44,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if (dynamic_cast<const SfxSimpleHint*>(&rHint)) // ohne Parameter { - sal_uLong nSlot = ((SfxSimpleHint&)rHint).GetId(); + sal_uLong nSlot = static_cast<const SfxSimpleHint&>(rHint).GetId(); switch ( nSlot ) { case FID_DATACHANGED: @@ -133,7 +133,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if (dynamic_cast<const ScPaintHint*>(&rHint)) // neu zeichnen { - ScPaintHint* pHint = (ScPaintHint*) &rHint; + const ScPaintHint* pHint = static_cast<const ScPaintHint*>(&rHint); sal_uInt16 nParts = pHint->GetParts(); SCTAB nTab = GetViewData().GetTabNo(); if (pHint->GetStartTab() <= nTab && pHint->GetEndTab() >= nTab) @@ -170,7 +170,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { // ScEditViewHint kommt nur an aktiver View an - ScEditViewHint* pHint = (ScEditViewHint*) &rHint; + const ScEditViewHint* pHint = static_cast<const ScEditViewHint*>(&rHint); SCTAB nTab = GetViewData().GetTabNo(); if ( pHint->GetTab() == nTab ) { @@ -202,7 +202,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) // aktuelle Tabelle zuerst holen (kann bei DeleteTab an ViewData geaendert werden) SCTAB nActiveTab = GetViewData().GetTabNo(); - const ScTablesHint& rTabHint = (const ScTablesHint&)rHint; + const ScTablesHint& rTabHint = static_cast<const ScTablesHint&>(rHint); SCTAB nTab1 = rTabHint.GetTab1(); SCTAB nTab2 = rTabHint.GetTab2(); sal_uInt16 nId = rTabHint.GetId(); @@ -290,7 +290,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if (dynamic_cast<const ScIndexHint*>(&rHint)) { - const ScIndexHint& rIndexHint = (const ScIndexHint&)rHint; + const ScIndexHint& rIndexHint = static_cast<const ScIndexHint&>(rHint); sal_uInt16 nId = rIndexHint.GetId(); sal_uInt16 nIndex = rIndexHint.GetIndex(); switch (nId) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index adde73054bbb..e543588a2f05 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -271,9 +271,9 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) if ( pStyleSheet ) { SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - sal_uInt16 nScale = ((const SfxUInt16Item&) + sal_uInt16 nScale = static_cast<const SfxUInt16Item&>( rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue(); - sal_uInt16 nPages = ((const SfxUInt16Item&) + sal_uInt16 nPages = static_cast<const SfxUInt16Item&>( rStyleSet.Get(ATTR_PAGE_SCALETOPAGES)).GetValue(); if ( nScale == 100 && nPages == 0 ) rSet.DisableItem( nWhich ); @@ -538,7 +538,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName if(pOutSet->GetItemState(SID_ATTR_NUMBERFORMAT_INFO,true,&pItem)==SfxItemState::SET) { - UpdateNumberFormatter((const SvxNumberInfoItem&)*pItem); + UpdateNumberFormatter(static_cast<const SvxNumberInfoItem&>(*pItem)); } ApplyAttributes(pOutSet, pOldSet.get()); @@ -635,9 +635,9 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt if (pDoc->IsTabProtected(nTab)) { - const ScProtectionAttr* pProt = (const ScProtectionAttr*) + const ScProtectionAttr* pProt = static_cast<const ScProtectionAttr*>( pDoc->GetAttr( nPosX,nPosY,nTab, - ATTR_PROTECTION); + ATTR_PROTECTION)); bHideFormula = pProt->GetHideFormula(); bHideAll = pProt->GetHideCell(); } @@ -746,7 +746,7 @@ void ScTabViewShell::ExecDrawOpt( SfxRequest& rReq ) case SID_GRID_VISIBLE: if ( pArgs && pArgs->GetItemState(nSlotId,true,&pItem) == SfxItemState::SET ) { - aGridOptions.SetGridVisible( ((const SfxBoolItem*)pItem)->GetValue() ); + aGridOptions.SetGridVisible( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); aViewOptions.SetGridOptions(aGridOptions); rBindings.Invalidate(SID_GRID_VISIBLE); } @@ -755,7 +755,7 @@ void ScTabViewShell::ExecDrawOpt( SfxRequest& rReq ) case SID_GRID_USE: if ( pArgs && pArgs->GetItemState(nSlotId,true,&pItem) == SfxItemState::SET ) { - aGridOptions.SetUseGridSnap( ((const SfxBoolItem*)pItem)->GetValue() ); + aGridOptions.SetUseGridSnap( static_cast<const SfxBoolItem*>(pItem)->GetValue() ); aViewOptions.SetGridOptions(aGridOptions); rBindings.Invalidate(SID_GRID_USE); } @@ -764,7 +764,7 @@ void ScTabViewShell::ExecDrawOpt( SfxRequest& rReq ) case SID_HELPLINES_MOVE: if ( pArgs && pArgs->GetItemState(nSlotId,true,&pItem) == SfxItemState::SET ) { - aViewOptions.SetOption( VOPT_HELPLINES, ((const SfxBoolItem*)pItem)->GetValue() ); + aViewOptions.SetOption( VOPT_HELPLINES, static_cast<const SfxBoolItem*>(pItem)->GetValue() ); rBindings.Invalidate(SID_HELPLINES_MOVE); } break; diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 9fe7f0faae30..7e6fd4d5b3fd 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -96,7 +96,7 @@ void ScTabViewShell::ConnectObject( SdrOle2Obj* pObj ) aRect.SetSize( aOleSize ); pClient->SetObjArea( aRect ); - ((ScClient*)pClient)->SetGrafEdit( NULL ); + static_cast<ScClient*>(pClient)->SetGrafEdit( NULL ); } } @@ -164,7 +164,7 @@ bool ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) aRect.SetSize( aOleSize ); pClient->SetObjArea( aRect ); - ((ScClient*)pClient)->SetGrafEdit( NULL ); + static_cast<ScClient*>(pClient)->SetGrafEdit( NULL ); nErr = pClient->DoVerb( nVerb ); bErrorShown = true; @@ -229,7 +229,7 @@ ErrCode ScTabViewShell::DoVerb(long nVerb) { SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); if (pObj->GetObjIdentifier() == OBJ_OLE2) - pOle2Obj = (SdrOle2Obj*) pObj; + pOle2Obj = static_cast<SdrOle2Obj*>(pObj); } if (pOle2Obj) @@ -251,7 +251,7 @@ void ScTabViewShell::DeactivateOle() ScModule* pScMod = SC_MOD(); bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF; - ScClient* pClient = (ScClient*) GetIPClient(); + ScClient* pClient = static_cast<ScClient*>(GetIPClient()); if ( pClient && pClient->IsObjectInPlaceActive() && !bUnoRefDialog ) pClient->DeactivateObject(); } @@ -332,7 +332,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) if ( pClient && pClient->IsObjectInPlaceActive() ) { const SfxRectangleItem& rRect = - (SfxRectangleItem&)rReq.GetArgs()->Get(SID_OBJECTRESIZE); + static_cast<const SfxRectangleItem&>(rReq.GetArgs()->Get(SID_OBJECTRESIZE)); Rectangle aRect( pWin->PixelToLogic( rRect.GetValue() ) ); if ( pView->AreObjectsMarked() ) @@ -348,7 +348,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) if (nSdrObjKind == OBJ_OLE2) { - if ( ( (SdrOle2Obj*) pObj)->GetObjRef().is() ) + if ( static_cast<SdrOle2Obj*>(pObj)->GetObjRef().is() ) { pObj->SetLogicRect(aRect); } @@ -512,7 +512,7 @@ void ScTabViewShell::ExecuteUndo(SfxRequest& rReq) sal_uInt16 nCount = 1; const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState( nSlot, true, &pItem ) == SfxItemState::SET ) - nCount = ((const SfxUInt16Item*)pItem)->GetValue(); + nCount = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); // lock paint for more than one cell undo action (not for editing within a cell) bool bLockPaint = ( nCount > 1 && pUndoManager == GetUndoManager() ); diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index 9e27f03fd1f9..464f8011e04b 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -228,7 +228,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) SfxItemState::SET == pReqArgs->GetItemState(SID_SEARCH_ITEM, false, &pItem) ) { OSL_ENSURE( pItem->ISA(SvxSearchItem), "falsches Item" ); - const SvxSearchItem* pSearchItem = (const SvxSearchItem*) pItem; + const SvxSearchItem* pSearchItem = static_cast<const SvxSearchItem*>(pItem); ScGlobal::SetSearchItem( *pSearchItem ); bool bSuccess = SearchAndReplace( pSearchItem, true, rReq.IsAPI() ); @@ -236,7 +236,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) SvxSearchDialogWrapper::GetChildWindowId()); if (pChildWindow) { - SvxSearchDialog* pSearchDlg = (SvxSearchDialog*)(pChildWindow->GetWindow()); + SvxSearchDialog* pSearchDlg = static_cast<SvxSearchDialog*>(pChildWindow->GetWindow()); if( pSearchDlg ) { ScTabView* pTabView = GetViewData().GetView(); @@ -262,7 +262,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) { // Search-Item merken OSL_ENSURE( pItem->ISA(SvxSearchItem), "falsches Item" ); - ScGlobal::SetSearchItem( *(const SvxSearchItem*) pItem ); + ScGlobal::SetSearchItem( *static_cast<const SvxSearchItem*>(pItem )); } else { @@ -282,9 +282,9 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) // SearchItem fuellen - aSearchItem.SetSearchString(((SfxStringItem*)pItem)->GetValue()); + aSearchItem.SetSearchString(static_cast<const SfxStringItem*>(pItem)->GetValue()); if(SfxItemState::SET == pReqArgs->GetItemState(FN_PARAM_1, false, &pItem)) - aSearchItem.SetReplaceString(((SfxStringItem*)pItem)->GetValue()); + aSearchItem.SetReplaceString(static_cast<const SfxStringItem*>(pItem)->GetValue()); if (nSlot == FID_SEARCH) aSearchItem.SetCommand(SVX_SEARCHCMD_FIND); @@ -306,7 +306,7 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) SvxSearchDialogWrapper::GetChildWindowId()); if (pChildWindow) { - SvxSearchDialog* pSearchDlg = (SvxSearchDialog*)(pChildWindow->GetWindow()); + SvxSearchDialog* pSearchDlg = static_cast<SvxSearchDialog*>(pChildWindow->GetWindow()); if( pSearchDlg ) { ScTabView* pTabView = GetViewData().GetView(); diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 4a28181e3d0a..af252adc7566 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -80,7 +80,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { const SfxPoolItem* pItem; if( pReqArgs->HasItem( FID_TABLE_VISIBLE, &pItem ) ) - bVisible = ((const SfxBoolItem*)pItem)->GetValue(); + bVisible = static_cast<const SfxBoolItem*>(pItem)->GetValue(); } if( ! bVisible ) // ausblenden @@ -119,7 +119,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) const SfxPoolItem* pItem; if( pReqArgs->HasItem( FID_TABLE_SHOW, &pItem ) ) { - aName = ((const SfxStringItem*)pItem)->GetValue(); + aName = static_cast<const SfxStringItem*>(pItem)->GetValue(); rNames.push_back(aName); ShowTable( rNames ); @@ -185,8 +185,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { // Tabellennr. von Basic: 1-basiert - aName = ((const SfxStringItem*)pNameItem)->GetValue(); - nTabNr = ((const SfxUInt16Item*)pTabItem)->GetValue() - 1; + aName = static_cast<const SfxStringItem*>(pNameItem)->GetValue(); + nTabNr = static_cast<const SfxUInt16Item*>(pTabItem)->GetValue() - 1; if ( nTabNr < nTabCount ) bOk = InsertTable( aName, nTabNr ); } @@ -325,10 +325,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) OUString aName; if( pReqArgs->HasItem( FN_PARAM_1, &pItem ) ) - nTabNr = ((const SfxUInt16Item*)pItem)->GetValue(); + nTabNr = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); if( pReqArgs->HasItem( nSlot, &pItem ) ) - aName = ((const SfxStringItem*)pItem)->GetValue(); + aName = static_cast<const SfxStringItem*>(pItem)->GetValue(); switch ( nSlot ) { @@ -441,16 +441,16 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) const SfxPoolItem* pItem; if( pReqArgs->HasItem( FID_TAB_MOVE, &pItem ) ) - aDocName = ((const SfxStringItem*)pItem)->GetValue(); + aDocName = static_cast<const SfxStringItem*>(pItem)->GetValue(); if( pReqArgs->HasItem( FN_PARAM_1, &pItem ) ) { // Tabelle ist 1-basiert - nTab = ((const SfxUInt16Item*)pItem)->GetValue() - 1; + nTab = static_cast<const SfxUInt16Item*>(pItem)->GetValue() - 1; if ( nTab >= nTableCount ) nTab = SC_TAB_APPEND; } if( pReqArgs->HasItem( FN_PARAM_2, &pItem ) ) - bCpy = ((const SfxBoolItem*)pItem)->GetValue(); + bCpy = static_cast<const SfxBoolItem*>(pItem)->GetValue(); if (!aDocName.isEmpty()) { @@ -657,10 +657,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) const SfxPoolItem* pItem; Color aColor; if( pReqArgs->HasItem( FN_PARAM_1, &pItem ) ) - nTabNr = ((const SfxUInt16Item*)pItem)->GetValue(); + nTabNr = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); if( pReqArgs->HasItem( nSlot, &pItem ) ) - aColor = ((const SvxColorItem*)pItem)->GetValue(); + aColor = static_cast<const SvxColorItem*>(pItem)->GetValue(); if ( nTabSelCount > 1 ) { diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx index acc30375c587..c5264dd1da70 100644 --- a/sc/source/ui/view/tabvwshh.cxx +++ b/sc/source/ui/view/tabvwshh.cxx @@ -102,7 +102,7 @@ void ScTabViewShell::ExecuteObject( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs && pReqArgs->GetItemState( nSlotId, true, &pItem ) == SfxItemState::SET ) { - long nNewVal = ((const SfxInt32Item*)pItem)->GetValue(); + long nNewVal = static_cast<const SfxInt32Item*>(pItem)->GetValue(); if ( nNewVal < 0 ) nNewVal = 0; @@ -154,7 +154,7 @@ static uno::Reference < embed::XEmbeddedObject > lcl_GetSelectedObj( SdrView* pD SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); if (pObj->GetObjIdentifier() == OBJ_OLE2) { - SdrOle2Obj* pOle2Obj = (SdrOle2Obj*) pObj; + SdrOle2Obj* pOle2Obj = static_cast<SdrOle2Obj*>(pObj); xRet = pOle2Obj->GetObjRef(); } } diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index af08c7080b74..b301c9009f73 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -951,11 +951,11 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, bEditActive[eWhich] = true; const ScPatternAttr* pPattern = pDoc->GetPattern( nNewX, nNewY, nTabNo ); - SvxCellHorJustify eJust = (SvxCellHorJustify)((const SvxHorJustifyItem&) + SvxCellHorJustify eJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>( pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue(); bool bBreak = ( eJust == SVX_HOR_JUSTIFY_BLOCK ) || - ((SfxBoolItem&)pPattern->GetItem(ATTR_LINEBREAK)).GetValue(); + static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue(); bool bAsianVertical = pNewEngine->IsVertical(); // set by InputHandler @@ -980,7 +980,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, // modify members nEditCol etc. only if also extending for needed area nEditCol = nNewX; nEditRow = nNewY; - const ScMergeAttr* pMergeAttr = (ScMergeAttr*)&pPattern->GetItem(ATTR_MERGE); + const ScMergeAttr* pMergeAttr = static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); nEditEndCol = nEditCol; if (pMergeAttr->GetColMerge() > 1) nEditEndCol += pMergeAttr->GetColMerge() - 1; @@ -1087,7 +1087,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, pNewEngine->InsertView(pEditView[eWhich]); // background color of the cell - Color aBackCol = ((const SvxBrushItem&)pPattern->GetItem(ATTR_BACKGROUND)).GetColor(); + Color aBackCol = static_cast<const SvxBrushItem&>(pPattern->GetItem(ATTR_BACKGROUND)).GetColor(); ScModule* pScMod = SC_MOD(); if ( aBackCol.GetTransparency() > 0 ) @@ -1138,7 +1138,7 @@ void ScViewData::EditGrowX() bool bLayoutRTL = pLocalDoc->IsLayoutRTL( nTabNo ); ScEditEngineDefaulter* pEngine = - (ScEditEngineDefaulter*) pCurView->GetEditEngine(); + static_cast<ScEditEngineDefaulter*>( pCurView->GetEditEngine() ); vcl::Window* pWin = pCurView->GetWindow(); SCCOL nLeft = GetPosX(eHWhich); @@ -1156,7 +1156,7 @@ void ScViewData::EditGrowX() // get bGrow... variables the same way as in SetEditEngine const ScPatternAttr* pPattern = pLocalDoc->GetPattern( nEditCol, nEditRow, nTabNo ); - SvxCellHorJustify eJust = (SvxCellHorJustify)((const SvxHorJustifyItem&) + SvxCellHorJustify eJust = (SvxCellHorJustify)static_cast<const SvxHorJustifyItem&>( pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue(); bool bGrowCentered = ( eJust == SVX_HOR_JUSTIFY_CENTER ); bool bGrowToLeft = ( eJust == SVX_HOR_JUSTIFY_RIGHT ); // visual left @@ -1709,7 +1709,7 @@ SCROW ScViewData::PrevCellsY( ScVSplitPos eWhichY ) const bool ScViewData::GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix ) const { - const ScMergeAttr* pMerge = (const ScMergeAttr*) pDoc->GetAttr( nX,nY,nTabNo, ATTR_MERGE ); + const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>( pDoc->GetAttr( nX,nY,nTabNo, ATTR_MERGE ) ); if ( pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1 ) { long nOutWidth = 0; @@ -1832,8 +1832,8 @@ bool ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich, if ( bRepair && ( bHOver || bVOver ) ) { - const ScMergeAttr* pMerge = (const ScMergeAttr*) - pDoc->GetAttr( rPosX, rPosY, nTabNo, ATTR_MERGE ); + const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>( + pDoc->GetAttr( rPosX, rPosY, nTabNo, ATTR_MERGE ) ); if ( ( bHOver && pMerge->GetColMerge() <= 1 ) || ( bVOver && pMerge->GetRowMerge() <= 1 ) ) { diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index c2c4de149596..9f932315711e 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -794,8 +794,8 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat if ( PasteFromClip( IDF_CONTENTS, pInsDoc.get(), PASTE_NOFUNC, false, false, false, INS_NONE, IDF_ATTRIB ) ) { - const SfxUInt32Item* pItem = (SfxUInt32Item*) pInsDoc->GetAttr( - nCol, nRow, nTab, ATTR_VALUE_FORMAT ); + const SfxUInt32Item* pItem = static_cast<const SfxUInt32Item*>( pInsDoc->GetAttr( + nCol, nRow, nTab, ATTR_VALUE_FORMAT ) ); if ( pItem ) { // set number format if incompatible // MarkData was already MarkToSimple'ed in PasteFromClip @@ -2356,10 +2356,10 @@ void ScViewFunc::MoveTable( if ( pRetItem ) { if ( pRetItem->ISA( SfxObjectItem ) ) - pDestShell = PTR_CAST( ScDocShell, ((const SfxObjectItem*)pRetItem)->GetShell() ); + pDestShell = PTR_CAST( ScDocShell, static_cast<const SfxObjectItem*>(pRetItem)->GetShell() ); else if ( pRetItem->ISA( SfxViewFrameItem ) ) { - SfxViewFrame* pFrm = ((const SfxViewFrameItem*)pRetItem)->GetFrame(); + SfxViewFrame* pFrm = static_cast<const SfxViewFrameItem*>(pRetItem)->GetFrame(); if (pFrm) pDestShell = PTR_CAST( ScDocShell, pFrm->GetObjectShell() ); } @@ -2882,7 +2882,7 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, if( pBorderAttr ) { - SvxBoxItem aBoxItem( *(const SvxBoxItem*)pBorderAttr ); + SvxBoxItem aBoxItem( *static_cast<const SvxBoxItem*>(pBorderAttr) ); SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER ); SET_LINE_ATTRIBUTES(Top,BOX_LINE_TOP) @@ -2899,18 +2899,18 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, pNewSet->Put( aBoxInfoItem ); } - if( pTLBRItem && ((const SvxLineItem*)pTLBRItem)->GetLine() ) + if( pTLBRItem && static_cast<const SvxLineItem*>(pTLBRItem)->GetLine() ) { - SvxLineItem aTLBRItem( *(const SvxLineItem*)pTLBRItem ); + SvxLineItem aTLBRItem( *static_cast<const SvxLineItem*>(pTLBRItem) ); UpdateLineAttrs( aLine, aTLBRItem.GetLine(), pLine, bColorOnly ); aTLBRItem.SetLine( &aLine ); pOldSet->Put( *pTLBRItem ); pNewSet->Put( aTLBRItem ); } - if( pBLTRItem && ((const SvxLineItem*)pBLTRItem)->GetLine() ) + if( pBLTRItem && static_cast<const SvxLineItem*>(pBLTRItem)->GetLine() ) { - SvxLineItem aBLTRItem( *(const SvxLineItem*)pBLTRItem ); + SvxLineItem aBLTRItem( *static_cast<const SvxLineItem*>(pBLTRItem) ); UpdateLineAttrs( aLine, aBLTRItem.GetLine(), pLine, bColorOnly ); aBLTRItem.SetLine( &aLine ); pOldSet->Put( *pBLTRItem ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 2c05bbd8468e..8244e605ccc8 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -560,12 +560,12 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran { sal_Int64 nHandle = xTunnel->getSomething( ScTransferObj::getUnoTunnelId() ); if ( nHandle ) - pOwnClip = (ScTransferObj*) (sal_IntPtr) nHandle; + pOwnClip = reinterpret_cast<ScTransferObj*>( (sal_IntPtr) nHandle); else { nHandle = xTunnel->getSomething( ScDrawTransferObj::getUnoTunnelId() ); if ( nHandle ) - pDrawClip = (ScDrawTransferObj*) (sal_IntPtr) nHandle; + pDrawClip = reinterpret_cast<ScDrawTransferObj*>( (sal_IntPtr) nHandle ); } } @@ -1142,8 +1142,8 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, SCROW nRow2 = -1; while ( ( pPattern = aIter.GetNext( nCol, nRow1, nRow2 ) ) != NULL ) { - pMergeFlag = (const ScMergeAttr*) &pPattern->GetItem(ATTR_MERGE); - pMergeFlagAttr = (const ScMergeFlagAttr*) &pPattern->GetItem(ATTR_MERGE_FLAG); + pMergeFlag = static_cast<const ScMergeAttr*>( &pPattern->GetItem(ATTR_MERGE) ); + pMergeFlagAttr = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem(ATTR_MERGE_FLAG) ); if( ( pMergeFlag && pMergeFlag->IsMerged() ) || ( pMergeFlagAttr && pMergeFlagAttr->IsOverlapped() ) ) { ScRange aRange(nCol, nRow1, nStartTab); diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index b937eb3bf121..77701c5dad47 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -164,7 +164,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, // copy graphics within the same model - always needs new name if ( pNeuObj->ISA(SdrGrafObj) && !bPasteIsMove ) - pNeuObj->SetName(((ScDrawLayer*)pDrawModel)->GetNewGraphicName()); + pNeuObj->SetName(static_cast<ScDrawLayer*>(pDrawModel)->GetNewGraphicName()); if (nDiffX!=0 || nDiffY!=0) pNeuObj->NbcMove(Size(nDiffX,nDiffY)); @@ -437,7 +437,7 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic, // path was the name of the graphic in history - ScDrawLayer* pLayer = (ScDrawLayer*) pScDrawView->GetModel(); + ScDrawLayer* pLayer = static_cast<ScDrawLayer*>( pScDrawView->GetModel() ); OUString aName = pLayer->GetNewGraphicName(); // "Graphics" pGrafObj->SetName(aName); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 479b8e33ad6a..b06a8b6f7cdc 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -197,7 +197,7 @@ void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr* pSource = rDoc.GetPattern( aFormatSource.Col(), aFormatSource.Row(), nTab ); - if ( !((const ScMergeAttr&)pSource->GetItem(ATTR_MERGE)).IsMerged() ) + if ( !static_cast<const ScMergeAttr&>(pSource->GetItem(ATTR_MERGE)).IsMerged() ) { ScRange aRange( nCol, nRow, nTab, nCol, nRow, nTab ); ScMarkData aMark; @@ -512,7 +512,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, { i = *itr; aPos.SetTab( i ); - sal_uLong nIndex = (sal_uLong) ((SfxUInt32Item*) pDoc->GetAttr( + sal_uLong nIndex = (sal_uLong) static_cast<const SfxUInt32Item*>( pDoc->GetAttr( nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue(); if ( pFormatter->GetType( nIndex ) == NUMBERFORMAT_TEXT || ( ( rString[0] == '+' || rString[0] == '-' ) && nError && rString == aFormula ) ) @@ -859,8 +859,8 @@ void ScViewFunc::GetSelectionFrame( SvxBoxItem& rLineOuter, GetViewData().GetCurY(), GetViewData().GetTabNo() ); - rLineOuter = (const SvxBoxItem&) (pAttrs->GetItem( ATTR_BORDER )); - rLineInner = (const SvxBoxInfoItem&)(pAttrs->GetItem( ATTR_BORDER_INNER )); + rLineOuter = static_cast<const SvxBoxItem&> (pAttrs->GetItem( ATTR_BORDER )); + rLineInner = static_cast<const SvxBoxInfoItem&>(pAttrs->GetItem( ATTR_BORDER_INNER )); rLineInner.SetTable(false); rLineInner.SetDist(true); rLineInner.SetMinDist(false); @@ -890,9 +890,9 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet, if ( pDialogSet->GetItemState( ATTR_VALUE_FORMAT ) == SfxItemState::SET ) { // don't reset to default SYSTEM GENERAL if not intended sal_uInt32 nOldFormat = - ((const SfxUInt32Item&)pOldSet->Get( ATTR_VALUE_FORMAT )).GetValue(); + static_cast<const SfxUInt32Item&>(pOldSet->Get( ATTR_VALUE_FORMAT )).GetValue(); sal_uInt32 nNewFormat = - ((const SfxUInt32Item&)pDialogSet->Get( ATTR_VALUE_FORMAT )).GetValue(); + static_cast<const SfxUInt32Item&>(pDialogSet->Get( ATTR_VALUE_FORMAT )).GetValue(); if ( nNewFormat != nOldFormat ) { SvNumberFormatter* pFormatter = @@ -917,10 +917,10 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet, } } - const SvxBoxItem* pOldOuter = (const SvxBoxItem*) &pOldSet->Get( ATTR_BORDER ); - const SvxBoxItem* pNewOuter = (const SvxBoxItem*) &pDialogSet->Get( ATTR_BORDER ); - const SvxBoxInfoItem* pOldInner = (const SvxBoxInfoItem*) &pOldSet->Get( ATTR_BORDER_INNER ); - const SvxBoxInfoItem* pNewInner = (const SvxBoxInfoItem*) &pDialogSet->Get( ATTR_BORDER_INNER ); + const SvxBoxItem* pOldOuter = static_cast<const SvxBoxItem*> (&pOldSet->Get( ATTR_BORDER )); + const SvxBoxItem* pNewOuter = static_cast<const SvxBoxItem*> (&pDialogSet->Get( ATTR_BORDER )); + const SvxBoxInfoItem* pOldInner = static_cast<const SvxBoxInfoItem*> (&pOldSet->Get( ATTR_BORDER_INNER )); + const SvxBoxInfoItem* pNewInner = static_cast<const SvxBoxInfoItem*> (&pDialogSet->Get( ATTR_BORDER_INNER )); SfxItemSet& rNewSet = aNewAttrs.GetItemSet(); SfxItemPool* pNewPool = rNewSet.GetPool(); @@ -1346,7 +1346,7 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, bool bRecord new ScUndoSelectionStyle( pDocSh, aFuncMark, aMarkRange, aName, pUndoDoc ) ); } - rDoc.ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, aFuncMark ); + rDoc.ApplySelectionStyle( static_cast<ScStyleSheet&>(*pStyleSheet), aFuncMark ); if (!AdjustBlockHeight()) rViewData.GetDocShell()->PostPaint( aMarkRange, PAINT_GRID ); @@ -1382,7 +1382,7 @@ void ScViewFunc::SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, bool bRecord ScMarkData::iterator itr = aFuncMark.begin(), itrEnd = aFuncMark.end(); for (; itr != itrEnd; ++itr) - rDoc.ApplyStyle( nCol, nRow, *itr, (ScStyleSheet&)*pStyleSheet ); + rDoc.ApplyStyle( nCol, nRow, *itr, static_cast<ScStyleSheet&>(*pStyleSheet) ); if (!AdjustBlockHeight()) rViewData.GetDocShell()->PostPaintCell( nCol, nRow, nTab ); @@ -2179,12 +2179,12 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab ); const SvxMarginItem& rMItem = - (const SvxMarginItem&)pPattern->GetItem(ATTR_MARGIN); + static_cast<const SvxMarginItem&>(pPattern->GetItem(ATTR_MARGIN)); sal_uInt16 nMargin = rMItem.GetLeftMargin() + rMItem.GetRightMargin(); - if ( ((const SvxHorJustifyItem&) pPattern-> + if ( static_cast<const SvxHorJustifyItem&>( pPattern-> GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_LEFT ) nMargin = sal::static_int_cast<sal_uInt16>( - nMargin + ((const SfxUInt16Item&)pPattern->GetItem(ATTR_INDENT)).GetValue() ); + nMargin + static_cast<const SfxUInt16Item&>(pPattern->GetItem(ATTR_INDENT)).GetValue() ); nWidth = (sal_uInt16)(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS) + nMargin + STD_EXTRA_WIDTH; @@ -2233,8 +2233,8 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) { const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab ); bool bNeedHeight = - ((const SfxBoolItem&)pPattern->GetItem( ATTR_LINEBREAK )).GetValue() || - ((const SvxHorJustifyItem&)pPattern-> + static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_LINEBREAK )).GetValue() || + static_cast<const SvxHorJustifyItem&>(pPattern-> GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_BLOCK; if (bNeedHeight) AdjustRowHeight( nRow, nRow ); |