diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-26 15:30:25 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-26 15:33:35 +0100 |
commit | 9521b738518527b0c1713665282ba616b902cd01 (patch) | |
tree | 1dd90b325c12751acc332b6c081096c47f0f86ed /sc | |
parent | 3ce8a7dab59b7a77e1223d1357e6c32c31e4fba6 (diff) |
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: I18b1b0b92b106c5fd96c80472e279a7cfd380235
Diffstat (limited to 'sc')
39 files changed, 93 insertions, 93 deletions
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 7d27484b5459..d45340af7829 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -255,7 +255,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) if ( nFormat == XLSX ) { pPattern = pDoc->GetPattern(1,1,3); - ScStyleSheet* pStyleSheet = (ScStyleSheet*)pPattern->GetStyleSheet(); + ScStyleSheet* pStyleSheet = const_cast<ScStyleSheet*>(pPattern->GetStyleSheet()); // check parent style name OUString sExpected("Excel Built-in Date"); OUString sResult = pStyleSheet->GetName(); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 57468d81b3a3..fcba8d924531 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -640,13 +640,13 @@ void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* #define SET_LINECOLOR(dest,c) \ if ((dest)) \ { \ - ((SvxBorderLine*)(dest))->SetColor((c)); \ + const_cast<SvxBorderLine*>(dest)->SetColor((c)); \ } #define SET_LINE(dest,src) \ if ((dest)) \ { \ - SvxBorderLine* pCast = (SvxBorderLine*)(dest); \ + SvxBorderLine* pCast = const_cast<SvxBorderLine*>(dest); \ pCast->SetBorderLineStyle( (src)->GetBorderLineStyle() ); \ pCast->SetWidth( (src)->GetWidth( ) ); \ } @@ -1071,7 +1071,7 @@ void ScAttrArray::MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLine Search( nEndRow-1, nEndIndex ); for (SCSIZE i=nStartIndex; i<=nEndIndex; i++) { - pPattern = (ScPatternAttr*) pData[i].pPattern; + pPattern = pData[i].pPattern; lcl_MergeToFrame( pLineOuter, pLineInner, rFlags, pPattern, bLeft, nDistRight, false, nEndRow - std::min( pData[i].nRow, (SCROW)(nEndRow-1) ) ); // nDistBottom here always > 0 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 94d753d0681f..3fcac83163d4 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -552,14 +552,14 @@ void ScColumn::ApplyStyle( SCROW nRow, const ScStyleSheet& rStyle ) boost::scoped_ptr<ScPatternAttr> pNewPattern(new ScPatternAttr(*pPattern)); if (pNewPattern) { - pNewPattern->SetStyleSheet((ScStyleSheet*)&rStyle); + pNewPattern->SetStyleSheet(const_cast<ScStyleSheet*>(&rStyle)); pAttrArray->SetPattern(nRow, pNewPattern.get(), true); } } void ScColumn::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle ) { - pAttrArray->ApplyStyleArea(nStartRow, nEndRow, (ScStyleSheet*)&rStyle); + pAttrArray->ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>(&rStyle)); } void ScColumn::ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark) @@ -571,7 +571,7 @@ void ScColumn::ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& { ScMarkArrayIter aMarkIter( rMark.GetArray() + nCol ); while (aMarkIter.Next( nTop, nBottom )) - pAttrArray->ApplyStyleArea(nTop, nBottom, (ScStyleSheet*)&rStyle); + pAttrArray->ApplyStyleArea(nTop, nBottom, const_cast<ScStyleSheet*>(&rStyle)); } } @@ -1658,7 +1658,7 @@ void ScColumn::CopyToColumn( rColumn.pAttrArray->GetPattern( nRow )->GetStyleSheet(); const ScPatternAttr* pPattern = pAttrArray->GetPattern( nRow ); boost::scoped_ptr<ScPatternAttr> pNewPattern(new ScPatternAttr( *pPattern )); - pNewPattern->SetStyleSheet( (ScStyleSheet*)pStyle ); + pNewPattern->SetStyleSheet( const_cast<ScStyleSheet*>(pStyle) ); rColumn.pAttrArray->SetPattern( nRow, pNewPattern.get(), true ); } } diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 8553bdd7681b..3da67a466b0a 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1245,7 +1245,7 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) bool ScConditionEntry::IsCellValid( ScRefCellValue& rCell, const ScAddress& rPos ) const { - ((ScConditionEntry*)this)->Interpret(rPos); // Evaluate formula + const_cast<ScConditionEntry*>(this)->Interpret(rPos); // Evaluate formula double nArg = 0.0; OUString aArgStr; diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 09bacb77e07b..532090d238d1 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -2199,7 +2199,7 @@ void lcl_FillOldFields( ScPivotFieldVector& rFields, bool ScDPObject::FillOldParam(ScPivotParam& rParam) const { - ((ScDPObject*)this)->CreateObjects(); // xSource is needed for field numbers + const_cast<ScDPObject*>(this)->CreateObjects(); // xSource is needed for field numbers if (!xSource.is()) return false; diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 0aeeb3551d7e..9f3a1201c6b7 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -2026,7 +2026,7 @@ void ScDPDataMember::FillDataRow( const ScDPDataDimension* pDataChild = GetChildDimension(); const ScDPResultDimension* pRefChild = pRefMember->GetChildDimension(); - const ScDPLevel* pRefParentLevel = const_cast<ScDPResultMember*>(pRefMember)->GetParentLevel(); + const ScDPLevel* pRefParentLevel = pRefMember->GetParentLevel(); long nExtraSpace = 0; if ( pRefParentLevel && pRefParentLevel->IsAddEmpty() ) diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 3e3cea0dc9c8..f96291e3c67e 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -1320,7 +1320,7 @@ ScDPDimension* ScDPDimensions::getByIndex(long nIndex) const { if ( !ppDims ) { - ((ScDPDimensions*)this)->ppDims = new ScDPDimension*[nDimCount]; + const_cast<ScDPDimensions*>(this)->ppDims = new ScDPDimension*[nDimCount]; for (long i=0; i<nDimCount; i++) ppDims[i] = NULL; } @@ -1777,7 +1777,7 @@ ScDPHierarchy* ScDPHierarchies::getByIndex(long nIndex) const { if ( !ppHiers ) { - ((ScDPHierarchies*)this)->ppHiers = new ScDPHierarchy*[nHierCount]; + const_cast<ScDPHierarchies*>(this)->ppHiers = new ScDPHierarchy*[nHierCount]; for (long i=0; i<nHierCount; i++) ppHiers[i] = NULL; } @@ -1953,7 +1953,7 @@ ScDPLevel* ScDPLevels::getByIndex(long nIndex) const { if ( !ppLevs ) { - ((ScDPLevels*)this)->ppLevs = new ScDPLevel*[nLevCount]; + const_cast<ScDPLevels*>(this)->ppLevs = new ScDPLevel*[nLevCount]; for (long i=0; i<nLevCount; i++) ppLevs[i] = NULL; } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index c12bebb41c2a..6e067bfa8687 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1313,7 +1313,7 @@ const ScRangeList* ScTable::GetScenarioRanges() const if (!pScenarioRanges) { - ((ScTable*)this)->pScenarioRanges = new ScRangeList; + const_cast<ScTable*>(this)->pScenarioRanges = new ScRangeList; ScMarkData aMark; MarkScenarioIn( aMark, 0 ); // always aMark.FillRangeListWithMarks( pScenarioRanges, false ); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index cc41bb73153e..7c6085000aa4 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -359,7 +359,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if(bAllSame && nCount > 1) return; - rListData = (ScUserListData*)(ScGlobal::GetUserList()->GetData(aStr)); + rListData = const_cast<ScUserListData*>(ScGlobal::GetUserList()->GetData(aStr)); if (rListData) { (void)rListData->GetSubIndex(aStr, rListIndex); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 59821687478d..dc0ef8152835 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -680,7 +680,7 @@ bool ScValidationData::GetSelectionFromFormula( bool bRef = false; ScRange aRange; - ScTokenArray* pArr = (ScTokenArray*) &rTokArr; + ScTokenArray* pArr = const_cast<ScTokenArray*>(&rTokArr); pArr->Reset(); formula::FormulaToken* t = NULL; if (pArr->GetLen() == 1 && (t = pArr->GetNextReferenceOrName()) != NULL) diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index c4a2c3f5bd1f..47144da11604 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -3993,7 +3993,7 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray& std::list<FormulaToken*> aTokenList; std::map<FormulaToken*, FormulaTreeNodeRef> aHashMap; FormulaToken* pCur; - while ((pCur = (FormulaToken*)(aCode.Next())) != NULL) + while ((pCur = const_cast<FormulaToken*>(aCode.Next())) != NULL) { OpCode eOp = pCur->GetOpCode(); if (eOp != ocPush) diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 029d5028b332..fc89f9e055c4 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -185,7 +185,7 @@ bool ScChangeAction::IsClickable() const static_cast<const ScChangeActionContent*>(this)->GetFirstDependentEntry(); while ( pL ) { - ScChangeAction* p = (ScChangeAction*) pL->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pL->GetAction()); if ( p && p->IsDeletedIn() ) return false; pL = pL->GetNext(); @@ -1361,7 +1361,7 @@ ScChangeActionContent* ScChangeActionContent::GetTopContent() const pContent = pContent->pNextContent; return pContent; } - return (ScChangeActionContent*) this; + return const_cast<ScChangeActionContent*>(this); } ScChangeActionLinkEntry* ScChangeActionContent::GetDeletedIn() const @@ -1565,7 +1565,7 @@ bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack, const ScChangeActionLinkEntry* pL = pContent->GetFirstDependentEntry(); while ( pL ) { - ScChangeAction* p = (ScChangeAction*) pL->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pL->GetAction()); if ( p ) p->SetRejected(); pL = pL->GetNext(); @@ -3790,7 +3790,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction, const ScChangeActionLinkEntry* pLink = pAct->GetFirstDependentEntry(); while ( pLink ) { - ScChangeAction* p = (ScChangeAction*) pLink->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pLink->GetAction()); if ( p ) p->SetDeletedIn( pAct ); pLink = pLink->GetNext(); @@ -3840,7 +3840,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction, const ScChangeActionLinkEntry* pLink = pAct->GetFirstDependentEntry(); while ( pLink ) { - ScChangeAction* p = (ScChangeAction*) pLink->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pLink->GetAction()); if ( p ) p->RemoveDeletedIn( pAct ); pLink = pLink->GetNext(); @@ -3915,7 +3915,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct, const ScChangeActionLinkEntry* pL = pCur->GetFirstDependentEntry(); while ( pL ) { - ScChangeAction* p = (ScChangeAction*) pL->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pL->GetAction()); if ( p != pAct ) { if ( bAllFlat ) @@ -3961,7 +3961,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct, const ScChangeActionLinkEntry* pL = pCur->GetFirstDeletedEntry(); while ( pL ) { - ScChangeAction* p = (ScChangeAction*) pL->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pL->GetAction()); if ( p != pAct ) { if ( bAllFlat ) @@ -3995,7 +3995,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct, const ScChangeActionLinkEntry* pL = pCur->GetFirstDeletedEntry(); while ( pL ) { - ScChangeAction* p = (ScChangeAction*) pL->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pL->GetAction()); if ( p != pAct && rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) ).second ) { // Only one TopContent of a chain is in LinkDeleted @@ -4010,7 +4010,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct, pL = pCur->GetFirstDependentEntry(); while ( pL ) { - ScChangeAction* p = (ScChangeAction*) pL->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pL->GetAction()); if ( p != pAct ) { if ( bAllFlat ) @@ -4054,7 +4054,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct, const ScChangeActionLinkEntry* pL = pCur->GetFirstDependentEntry(); while ( pL ) { - ScChangeAction* p = (ScChangeAction*) pL->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pL->GetAction()); if ( p != pAct ) { if ( bAllFlat ) @@ -4127,7 +4127,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest ) const ScChangeActionLinkEntry* pL = pContent->GetFirstDependentEntry(); while ( pL ) { - ScChangeAction* p = (ScChangeAction*) pL->GetAction(); + ScChangeAction* p = const_cast<ScChangeAction*>(pL->GetAction()); if ( p != pContent ) { if ( p->GetType() == SC_CAT_CONTENT ) diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 758434b31997..b1bd53adbc4d 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -261,7 +261,7 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList ) } } - ScRange* pOver = (ScRange*) &r; // fies aber wahr wenn bInList + ScRange* pOver = const_cast<ScRange*>(&r); // fies aber wahr wenn bInList size_t nOldPos = 0; if ( bIsInList ) { @@ -1479,7 +1479,7 @@ void ScRangePairList::Join( const ScRangePair& r, bool bIsInList ) SCCOL nCol2 = r1.aEnd.Col(); SCROW nRow2 = r1.aEnd.Row(); SCTAB nTab2 = r1.aEnd.Tab(); - ScRangePair* pOver = (ScRangePair*) &r; // fies aber wahr wenn bInList + ScRangePair* pOver = const_cast<ScRangePair*>(&r); // fies aber wahr wenn bInList size_t nOldPos = 0; if ( bIsInList ) { diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx index ae6b608437b5..41fe8e0cde83 100644 --- a/sc/source/core/tool/rangeutl.cxx +++ b/sc/source/core/tool/rangeutl.cxx @@ -625,7 +625,7 @@ void ScRangeStringConverter::GetStringFromAddress( { if (pDocument && pDocument->HasTable(rAddress.Tab())) { - OUString sAddress(rAddress.Format(nFormatFlags, (ScDocument*) pDocument, eConv)); + OUString sAddress(rAddress.Format(nFormatFlags, pDocument, eConv)); AssignString( rString, sAddress, bAppendStr, cSeparator ); } } @@ -643,8 +643,8 @@ void ScRangeStringConverter::GetStringFromRange( { ScAddress aStartAddress( rRange.aStart ); ScAddress aEndAddress( rRange.aEnd ); - OUString sStartAddress(aStartAddress.Format(nFormatFlags, (ScDocument*) pDocument, eConv)); - OUString sEndAddress(aEndAddress.Format(nFormatFlags, (ScDocument*) pDocument, eConv)); + OUString sStartAddress(aStartAddress.Format(nFormatFlags, pDocument, eConv)); + OUString sEndAddress(aEndAddress.Format(nFormatFlags, pDocument, eConv)); OUString sOUStartAddress( sStartAddress ); sOUStartAddress += OUString(':'); sOUStartAddress += OUString( sEndAddress ); diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 89631590667e..6b582ecc25a0 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -350,7 +350,7 @@ FormulaToken* ScRawToken::CreateToken() const return new ScExternalNameToken( extname.nFileId, aName ); } case svJump : - return new FormulaJumpToken( eOp, (short*) nJump ); + return new FormulaJumpToken( eOp, const_cast<short*>(nJump) ); case svExternal : return new FormulaExternalToken( eOp, sbyte.cByte, OUString( cStr+1 ) ); case svFAP : diff --git a/sc/source/core/tool/zforauto.cxx b/sc/source/core/tool/zforauto.cxx index 9f8104d71027..bafd40bf4c32 100644 --- a/sc/source/core/tool/zforauto.cxx +++ b/sc/source/core/tool/zforauto.cxx @@ -70,7 +70,7 @@ void ScNumFormatAbbrev::PutFormatIndex(sal_uLong nFormat, { eSysLnge = Application::GetSettings().GetLanguageTag().getLanguageType(); eLnge = pFormat->GetLanguage(); - sFormatstring = ((SvNumberformat*)pFormat)->GetFormatstring(); + sFormatstring = pFormat->GetFormatstring(); } else { diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 2772a718768e..20685513ab44 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -1743,9 +1743,9 @@ const ScTokenArray* ExcelToSc::GetBoolErr( XclBoolError eType ) const ScTokenArray* pErgebnis = aPool[ aStack.Get() ]; if( nError ) - ( ( ScTokenArray* ) pErgebnis )->SetCodeError( nError ); + const_cast<ScTokenArray*>(pErgebnis)->SetCodeError( nError ); - ( ( ScTokenArray* ) pErgebnis )->SetExclusiveRecalcModeNormal(); + const_cast<ScTokenArray*>(pErgebnis)->SetExclusiveRecalcModeNormal(); return pErgebnis; } diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 9a11ae51dae4..051b8787210e 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -308,7 +308,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu } const ScStyleSheet* pStyleSheet = mpDoc->GetPattern( nCol, nRow, nTab )->GetStyleSheet(); - aAttr.SetStyleSheet( (ScStyleSheet*)pStyleSheet ); + aAttr.SetStyleSheet( const_cast<ScStyleSheet*>(pStyleSheet) ); mpDoc->SetPattern( nCol, nRow, nTab, aAttr, true ); // Add data diff --git a/sc/source/filter/rtf/expbase.cxx b/sc/source/filter/rtf/expbase.cxx index 6d0fb6452da4..83f66fde09a5 100644 --- a/sc/source/filter/rtf/expbase.cxx +++ b/sc/source/filter/rtf/expbase.cxx @@ -70,7 +70,7 @@ bool ScExportBase::IsEmptyTable( SCTAB nTab ) const ScFieldEditEngine& ScExportBase::GetEditEngine() const { if ( !pEditEngine ) - ((ScExportBase*)this)->pEditEngine = new ScFieldEditEngine(pDoc, pDoc->GetEditPool()); + const_cast<ScExportBase*>(this)->pEditEngine = new ScFieldEditEngine(pDoc, pDoc->GetEditPool()); return *pEditEngine; } diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index e90ebfa74e46..de775462da3e 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -705,7 +705,7 @@ void XclExpChTrAction::AddDependentContents( ScChangeActionMap aActionMap; ScChangeActionMap::iterator itChangeAction; - rChangeTrack.GetDependents( (ScChangeAction*)(&rAction), aActionMap ); + rChangeTrack.GetDependents( const_cast<ScChangeAction*>(&rAction), aActionMap ); for( itChangeAction = aActionMap.begin(); itChangeAction != aActionMap.end(); ++itChangeAction ) if( itChangeAction->second->GetType() == SC_CAT_CONTENT ) SetAddAction( new XclExpChTrCellContent( diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index e1087ddcd50f..8c21574ff706 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -512,10 +512,10 @@ ScXMLExport::ScXMLExport( // document is not set here - create ScChangeTrackingExportHelper later xScPropHdlFactory = new XMLScPropHdlFactory; - xCellStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScCellStylesProperties, xScPropHdlFactory, true); - xColumnStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScColumnStylesProperties, xScPropHdlFactory, true); - xRowStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScRowStylesProperties, xScPropHdlFactory, true); - xTableStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScTableStylesProperties, xScPropHdlFactory, true); + xCellStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScCellStylesProperties, xScPropHdlFactory, true); + xColumnStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScColumnStylesProperties, xScPropHdlFactory, true); + xRowStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScRowStylesProperties, xScPropHdlFactory, true); + xTableStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScTableStylesProperties, xScPropHdlFactory, true); xCellStylesExportPropertySetMapper = new ScXMLCellExportPropertyMapper(xCellStylesPropertySetMapper); xCellStylesExportPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); xColumnStylesExportPropertySetMapper = new ScXMLColumnExportPropertyMapper(xColumnStylesPropertySetMapper); @@ -5034,7 +5034,7 @@ sal_uInt32 ScXMLExport::exportDoc( enum XMLTokenEnum eClass ) SfxObjectShell* pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel.is() ? xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()) : 0 ); if ( pFoundShell && ooo::vba::isAlienExcelDoc( *pFoundShell ) ) { - xRowStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScFromXLSRowStylesProperties, xScPropHdlFactory, true); + xRowStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScFromXLSRowStylesProperties, xScPropHdlFactory, true); xRowStylesExportPropertySetMapper = new ScXMLRowExportPropertyMapper(xRowStylesPropertySetMapper); GetAutoStylePool()->SetFamilyPropSetMapper( XML_STYLE_FAMILY_TABLE_ROW, xRowStylesExportPropertySetMapper ); diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 921b105e64b5..19c7a87f0977 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2104,10 +2104,10 @@ ScXMLImport::ScXMLImport( pStylesImportHelper = new ScMyStylesImportHelper(*this); xScPropHdlFactory = new XMLScPropHdlFactory; - xCellStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScCellStylesProperties, xScPropHdlFactory, false); - xColumnStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScColumnStylesProperties, xScPropHdlFactory, false); - xRowStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScRowStylesImportProperties, xScPropHdlFactory, false); - xTableStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScTableStylesImportProperties, xScPropHdlFactory, false); + xCellStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScCellStylesProperties, xScPropHdlFactory, false); + xColumnStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScColumnStylesProperties, xScPropHdlFactory, false); + xRowStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScRowStylesImportProperties, xScPropHdlFactory, false); + xTableStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScTableStylesImportProperties, xScPropHdlFactory, false); // #i66550# needed for 'presentation:event-listener' element for URLs in shapes GetNamespaceMap().Add( diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index 1b72013f9408..ba5294caf0dc 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -859,7 +859,7 @@ const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nTy { nType &= MID_FLAG_MASK; - XMLPropertyHandler* pHdl((XMLPropertyHandler*)XMLPropertyHandlerFactory::GetPropertyHandler( nType )); + XMLPropertyHandler* pHdl(const_cast<XMLPropertyHandler*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType ))); if(!pHdl) { switch(nType) diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 1181628fa7e0..b06873d78507 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -743,7 +743,7 @@ rtl::Reference < SvXMLImportPropertyMapper > { if( !xCellImpPropMapper.is() ) { - ((XMLTableStylesContext *)this)->xCellImpPropMapper = + const_cast<XMLTableStylesContext *>(this)->xCellImpPropMapper = new ScXMLCellImportPropertyMapper( GetScImport().GetCellStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); xCellImpPropMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(const_cast<SvXMLImport&>(GetImport()))); } @@ -753,7 +753,7 @@ rtl::Reference < SvXMLImportPropertyMapper > case XML_STYLE_FAMILY_TABLE_COLUMN: { if( !xColumnImpPropMapper.is() ) - ((XMLTableStylesContext *)this)->xColumnImpPropMapper = + const_cast<XMLTableStylesContext *>(this)->xColumnImpPropMapper = new SvXMLImportPropertyMapper( GetScImport().GetColumnStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); xMapper = xColumnImpPropMapper; } @@ -761,7 +761,7 @@ rtl::Reference < SvXMLImportPropertyMapper > case XML_STYLE_FAMILY_TABLE_ROW: { if( !xRowImpPropMapper.is() ) - ((XMLTableStylesContext *)this)->xRowImpPropMapper = + const_cast<XMLTableStylesContext *>(this)->xRowImpPropMapper = new ScXMLRowImportPropertyMapper( GetScImport().GetRowStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); xMapper = xRowImpPropMapper; } @@ -769,7 +769,7 @@ rtl::Reference < SvXMLImportPropertyMapper > case XML_STYLE_FAMILY_TABLE_TABLE: { if( !xTableImpPropMapper.is() ) - ((XMLTableStylesContext *)this)->xTableImpPropMapper = + const_cast<XMLTableStylesContext *>(this)->xTableImpPropMapper = new SvXMLImportPropertyMapper( GetScImport().GetTableStylesPropertySetMapper(), const_cast<SvXMLImport&>(GetImport()) ); xMapper = xTableImpPropMapper; } @@ -847,16 +847,16 @@ uno::Reference < XNameContainer > switch( nFamily ) { case XML_STYLE_FAMILY_TABLE_TABLE: - ((XMLTableStylesContext *)this)->xTableStyles.set(xStyles); + const_cast<XMLTableStylesContext *>(this)->xTableStyles.set(xStyles); break; case XML_STYLE_FAMILY_TABLE_CELL: - ((XMLTableStylesContext *)this)->xCellStyles.set(xStyles); + const_cast<XMLTableStylesContext *>(this)->xCellStyles.set(xStyles); break; case XML_STYLE_FAMILY_TABLE_COLUMN: - ((XMLTableStylesContext *)this)->xColumnStyles.set(xStyles); + const_cast<XMLTableStylesContext *>(this)->xColumnStyles.set(xStyles); break; case XML_STYLE_FAMILY_TABLE_ROW: - ((XMLTableStylesContext *)this)->xRowStyles.set(xStyles); + const_cast<XMLTableStylesContext *>(this)->xRowStyles.set(xStyles); break; } } diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx index 0020a70e89cd..a16028147575 100644 --- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx +++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx @@ -74,7 +74,7 @@ ScAccessibleEditObject::ScAccessibleEditObject( SetDescription(rDescription); if( meObjectType == CellInEditMode) { - const ScAccessibleDocument *pAccDoc = const_cast<ScAccessibleDocument*>(static_cast<ScAccessibleDocument*>(rxParent.get())) ; + const ScAccessibleDocument *pAccDoc = static_cast<ScAccessibleDocument*>(rxParent.get()); if (pAccDoc) { m_pScDoc = pAccDoc->GetDocument(); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 9b9518423e96..753fd6de8735 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -3889,7 +3889,7 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp ScRange aCopyRange = aMarkRange; aCopyRange.aStart.SetTab(0); aCopyRange.aEnd.SetTab(nTabCount-1); - rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, (ScMarkData*)&rMark ); + rDoc.CopyToDocument( aCopyRange, IDF_ATTRIB, true, pUndoDoc, &rMark ); rDocShell.GetUndoManager()->AddUndoAction( new ScUndoIndent( &rDocShell, rMark, pUndoDoc, bIncrement ) ); diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 568556acbf82..66c3a8608338 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -599,7 +599,7 @@ ScChangeAction* ScDocShell::GetChangeAction( const ScAddress& rPos ) pAction = pAction->GetNext(); } - return (ScChangeAction*)pFound; + return const_cast<ScChangeAction*>(pFound); } void ScDocShell::SetChangeComment( ScChangeAction* pAction, const OUString& rComment ) @@ -825,7 +825,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck sal_uLong nLastMergeAction = pSourceTrack->GetLast()->GetActionNumber(); // UpdateReference-Undo, gueltige Referenzen fuer den letzten gemeinsamen Zustand - pSourceTrack->MergePrepare( (ScChangeAction*) pFirstMergeAction, bShared ); + pSourceTrack->MergePrepare( const_cast<ScChangeAction*>(pFirstMergeAction), bShared ); // MergeChangeData an alle noch folgenden Aktionen in diesem Dokument anpassen // -> Referenzen gueltig fuer dieses Dokument @@ -1083,7 +1083,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck } // Referenzen anpassen - pSourceTrack->MergeOwn( (ScChangeAction*) pSourceAction, nFirstNewNumber, bShared ); + pSourceTrack->MergeOwn( const_cast<ScChangeAction*>(pSourceAction), nFirstNewNumber, bShared ); // merge action state if ( bShared && !pSourceAction->IsRejected() ) diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 35f1696f9b43..c2077f7eb6d1 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1921,7 +1921,7 @@ Rectangle ScDocShell::GetVisArea( sal_uInt16 nAspect ) const if (!aDocument.HasTable(nVisTab)) { nVisTab = 0; - ((ScDocShell*)this)->aDocument.SetVisibleTab(nVisTab); + const_cast<ScDocShell*>(this)->aDocument.SetVisibleTab(nVisTab); } SCCOL nStartCol; SCROW nStartRow; @@ -1936,7 +1936,7 @@ Rectangle ScDocShell::GetVisArea( sal_uInt16 nAspect ) const Rectangle aNewArea = ((ScDocument&)aDocument) .GetMMRect( nStartCol,nStartRow, nEndCol,nEndRow, nVisTab ); //TODO/LATER: different methods for setting VisArea?! - ((ScDocShell*)this)->SfxObjectShell::SetVisArea( aNewArea ); + const_cast<ScDocShell*>(this)->SfxObjectShell::SetVisArea( aNewArea ); return aNewArea; } else diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 6f4fb0828ccd..78f61e52c2d6 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -1022,7 +1022,7 @@ void ScAcceptChgDlg::RejectFiltered() { if(pScChangeAction->IsDialogRoot()) if(IsValidAction(pScChangeAction)) - pChanges->Reject((ScChangeAction*)pScChangeAction); + pChanges->Reject(const_cast<ScChangeAction*>(pScChangeAction)); pScChangeAction=pScChangeAction->GetPrev(); } @@ -1040,7 +1040,7 @@ void ScAcceptChgDlg::AcceptFiltered() { if(pScChangeAction->IsDialogRoot()) if(IsValidAction(pScChangeAction)) - pChanges->Accept((ScChangeAction*)pScChangeAction); + pChanges->Accept(const_cast<ScChangeAction*>(pScChangeAction)); pScChangeAction=pScChangeAction->GetPrev(); } @@ -1123,14 +1123,14 @@ void ScAcceptChgDlg::GetDependents( const ScChangeAction* pScChangeAction, ScChangeAction* pParentAction=(ScChangeAction*) pParentData->pData; if(pParentAction!=pScChangeAction) - pChanges->GetDependents((ScChangeAction*) pScChangeAction, + pChanges->GetDependents(const_cast<ScChangeAction*>(pScChangeAction), aActionMap,pScChangeAction->IsMasterDelete()); else - pChanges->GetDependents( (ScChangeAction*) pScChangeAction, + pChanges->GetDependents( const_cast<ScChangeAction*>(pScChangeAction), aActionMap ); } else - pChanges->GetDependents((ScChangeAction*) pScChangeAction, + pChanges->GetDependents(const_cast<ScChangeAction*>(pScChangeAction), aActionMap, pScChangeAction->IsMasterDelete() ); } @@ -1874,8 +1874,8 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData ) if(pSortData) { - SvTreeListEntry* pLeft = (SvTreeListEntry*)(pSortData->pLeft ); - SvTreeListEntry* pRight = (SvTreeListEntry*)(pSortData->pRight ); + SvTreeListEntry* pLeft = const_cast<SvTreeListEntry*>(pSortData->pLeft ); + SvTreeListEntry* pRight = const_cast<SvTreeListEntry*>(pSortData->pRight ); if(CALC_DATE==nSortCol) { diff --git a/sc/source/ui/undo/refundo.cxx b/sc/source/ui/undo/refundo.cxx index a5c38548d337..f782f7e7aa24 100644 --- a/sc/source/ui/undo/refundo.cxx +++ b/sc/source/ui/undo/refundo.cxx @@ -93,7 +93,7 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc ) } if (pRangeName) { - ScRangeName* pNewRanges = ((ScDocument*)pDoc)->GetRangeName(); //! const + ScRangeName* pNewRanges = pDoc->GetRangeName(); if ( pNewRanges && *pRangeName == *pNewRanges ) DELETEZ(pRangeName); } @@ -108,7 +108,7 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc ) if (pDPCollection) { - ScDPCollection* pNewDP = ((ScDocument*)pDoc)->GetDPCollection(); //! const + ScDPCollection* pNewDP = const_cast<ScDocument*>(pDoc)->GetDPCollection(); //! const if ( pNewDP && pDPCollection->RefsEqual(*pNewDP) ) DELETEZ(pDPCollection); } diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx index d84d55abd4c2..41f733a1d6c1 100644 --- a/sc/source/ui/undo/undostyl.cxx +++ b/sc/source/ui/undo/undostyl.cxx @@ -75,7 +75,7 @@ void ScStyleSaveData::InitFromStyle( const SfxStyleSheetBase* pSource ) aName = pSource->GetName(); aParent = pSource->GetParent(); delete pItems; - pItems = new SfxItemSet( ((SfxStyleSheetBase*)pSource)->GetItemSet() ); + pItems = new SfxItemSet( const_cast<SfxStyleSheetBase*>(pSource)->GetItemSet() ); } else *this = ScStyleSaveData(); // empty diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 362fda3a00be..0ea53559ef60 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -885,7 +885,7 @@ ScLinkListener::~ScLinkListener() void ScLinkListener::Notify( const SfxHint& rHint ) { - aLink.Call( (SfxHint*)&rHint ); + aLink.Call( const_cast<SfxHint*>(&rHint) ); } static void lcl_CopyProperties( beans::XPropertySet& rDest, beans::XPropertySet& rSource ) diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index c0ed883be928..96c66498e929 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -179,8 +179,8 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet ) case SID_STYLE_FAMILY2: // cell style sheets { - SfxStyleSheet* pStyleSheet = (SfxStyleSheet*) - pTabViewShell->GetStyleSheetFromMarked(); + SfxStyleSheet* pStyleSheet = const_cast<SfxStyleSheet*>( + pTabViewShell->GetStyleSheetFromMarked()); if ( pStyleSheet ) rSet.Put( SfxTemplateItem( nSlotId, pStyleSheet->GetName() ) ); @@ -572,8 +572,8 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) } bool bConvertBack = false; - SfxStyleSheet* pSheetInUse = (SfxStyleSheet*) - pTabViewShell->GetStyleSheetFromMarked(); + SfxStyleSheet* pSheetInUse = const_cast<SfxStyleSheet*>( + pTabViewShell->GetStyleSheetFromMarked()); // wenn neuer Style vorhanden und in der Selektion // verwendet wird, so darf der Parent nicht uebernommen @@ -620,7 +620,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) } else // ( nSlotId == SID_STYLE_UPDATE_BY_EXAMPLE ) { - pStyleSheet = (SfxStyleSheet*)pTabViewShell->GetStyleSheetFromMarked(); + pStyleSheet = const_cast<SfxStyleSheet*>(pTabViewShell->GetStyleSheetFromMarked()); if ( pStyleSheet ) { diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 9391e4947f18..e33a747208f5 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -4532,7 +4532,7 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) { pPreviewPattr.reset( new ScPatternAttr(*pPattern) ); pPreviewPattr->SetStyleSheet(pPreviewStyle); - pPattern = const_cast<ScPatternAttr*>(pPreviewPattr.get()); + pPattern = pPreviewPattr.get(); } } SfxItemSet* pPreviewFontSet = mpDoc->GetPreviewFont( nCellX, nCellY, nTab ); diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index b8645bfd7e5c..1efe8d62b7d8 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -51,7 +51,7 @@ SdrView* ScTabViewShell::GetDrawView() const { - return ((ScTabViewShell*)this)->GetScDrawView(); // GetScDrawView ist nicht-const + return const_cast<ScTabViewShell*>(this)->GetScDrawView(); // GetScDrawView ist nicht-const } void ScTabViewShell::WindowChanged() diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 7076f815ae70..a90605d795a8 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -432,7 +432,7 @@ void ScTabViewShell::QueryObjAreaPixel( Rectangle& rRect ) const // auf ganze Zellen anpassen (in 1/100 mm) Size aPixelSize = rRect.GetSize(); - vcl::Window* pWin = ((ScTabViewShell*)this)->GetActiveWin(); + vcl::Window* pWin = const_cast<ScTabViewShell*>(this)->GetActiveWin(); Size aLogicSize = pWin->PixelToLogic( aPixelSize ); const ScViewData& rViewData = GetViewData(); @@ -996,7 +996,7 @@ SfxShell* ScTabViewShell::GetMySubShell() const // GetSubShell() war frueher const, und GetSubShell(sal_uInt16) sollte es auch sein... sal_uInt16 nPos = 0; - SfxShell* pSub = ((ScTabViewShell*)this)->GetSubShell(nPos); + SfxShell* pSub = const_cast<ScTabViewShell*>(this)->GetSubShell(nPos); while (pSub) { if ( pSub == pDrawShell || pSub == pDrawTextShell || pSub == pEditShell || @@ -1005,7 +1005,7 @@ SfxShell* ScTabViewShell::GetMySubShell() const pSub == pGraphicShell || pSub == pMediaShell || pSub == pPageBreakShell) return pSub; // gefunden - pSub = ((ScTabViewShell*)this)->GetSubShell(++nPos); + pSub = const_cast<ScTabViewShell*>(this)->GetSubShell(++nPos); } return NULL; // keine von meinen dabei } diff --git a/sc/source/ui/view/tabvwsh8.cxx b/sc/source/ui/view/tabvwsh8.cxx index 927527094ef9..65ac59e8e6c5 100644 --- a/sc/source/ui/view/tabvwsh8.cxx +++ b/sc/source/ui/view/tabvwsh8.cxx @@ -42,7 +42,7 @@ void ScTabViewShell::SetDefaultFrameLine( const ::editeng::SvxBorderLine* pLine bool ScTabViewShell::HasSelection( bool bText ) const { bool bHas = false; - ScViewData* pData = (ScViewData*)&GetViewData(); // const weggecasted + ScViewData* pData = const_cast<ScViewData*>(&GetViewData()); // const weggecasted if ( bText ) { // Text enthalten: Anzahl2 >= 1 diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 45e01658b79d..2037f821c49a 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1518,8 +1518,8 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, if (pView) { - ((ScViewData*)this)->aScrSize.Width() = pView->GetGridWidth(eWhichX); - ((ScViewData*)this)->aScrSize.Height() = pView->GetGridHeight(eWhichY); + const_cast<ScViewData*>(this)->aScrSize.Width() = pView->GetGridWidth(eWhichX); + const_cast<ScViewData*>(this)->aScrSize.Height() = pView->GetGridHeight(eWhichY); } sal_uInt16 nTSize; @@ -1612,7 +1612,7 @@ SCCOL ScViewData::CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_ OSL_ENSURE( nDir==1 || nDir==-1, "falscher CellsAt Aufruf" ); if (pView) - ((ScViewData*)this)->aScrSize.Width() = pView->GetGridWidth(eWhichX); + const_cast<ScViewData*>(this)->aScrSize.Width() = pView->GetGridWidth(eWhichX); SCsCOL nX; sal_uInt16 nScrPosX = 0; @@ -1654,7 +1654,7 @@ SCROW ScViewData::CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_ OSL_ENSURE( nDir==1 || nDir==-1, "falscher CellsAt Aufruf" ); if (pView) - ((ScViewData*)this)->aScrSize.Height() = pView->GetGridHeight(eWhichY); + const_cast<ScViewData*>(this)->aScrSize.Height() = pView->GetGridHeight(eWhichY); if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (sal_uInt16) aScrSize.Height(); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index fd7942473650..9e1a7e143c4c 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2522,7 +2522,7 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement ) // the ways of the Numberformatters are unfathomable, so try: OUString aOut; Color* pCol; - ((SvNumberformat*)pOldEntry)->GetOutputString( nVal, aOut, &pCol ); + const_cast<SvNumberformat*>(pOldEntry)->GetOutputString( nVal, aOut, &pCol ); nPrecision = 0; // 'E' for exponential is fixed in Numberformatter |