Kaydet (Commit) ca0b3bb4 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin: cstylecast

Change-Id: I8c840d6635f347dcb1b8d9d193a05d509ba6cacb
üst a2f66db3
...@@ -145,8 +145,8 @@ void SwAutoCompleteClient::Modify( const SfxPoolItem* pOld, const SfxPoolItem *) ...@@ -145,8 +145,8 @@ void SwAutoCompleteClient::Modify( const SfxPoolItem* pOld, const SfxPoolItem *)
{ {
case RES_REMOVE_UNO_OBJECT: case RES_REMOVE_UNO_OBJECT:
case RES_OBJECTDYING: case RES_OBJECTDYING:
if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject ) if( (void*)GetRegisteredIn() == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject )
((SwModify*)GetRegisteredIn())->Remove(this); static_cast<SwModify*>(GetRegisteredIn())->Remove(this);
pAutoCompleteWord->DocumentDying(*pDoc); pAutoCompleteWord->DocumentDying(*pDoc);
break; break;
} }
...@@ -283,7 +283,7 @@ bool SwAutoCompleteWord::InsertWord( const OUString& rWord, SwDoc& rDoc ) ...@@ -283,7 +283,7 @@ bool SwAutoCompleteWord::InsertWord( const OUString& rWord, SwDoc& rDoc )
{ {
delete pNew; delete pNew;
// then move "up" // then move "up"
pNew = (SwAutoCompleteString*)(*aInsPair.first); pNew = static_cast<SwAutoCompleteString*>(*aInsPair.first);
// add the document to the already inserted string // add the document to the already inserted string
pNew->AddDocument(rDoc); pNew->AddDocument(rDoc);
......
...@@ -277,7 +277,7 @@ static const OUString lcl_dbg_out(const SfxItemSet & rSet) ...@@ -277,7 +277,7 @@ static const OUString lcl_dbg_out(const SfxItemSet & rSet)
if (!bFirst) if (!bFirst)
aStr += ", "; aStr += ", ";
if ((sal_uIntPtr)pItem != SAL_MAX_SIZE) if (reinterpret_cast<sal_uIntPtr>(pItem) != SAL_MAX_SIZE)
aStr += lcl_dbg_out(*pItem); aStr += lcl_dbg_out(*pItem);
else else
aStr += "invalid"; aStr += "invalid";
......
...@@ -508,9 +508,9 @@ struct _PostItFld : public _SetGetExpFld ...@@ -508,9 +508,9 @@ struct _PostItFld : public _SetGetExpFld
const std::set< sal_Int32 > &rPossiblePages, const std::set< sal_Int32 > &rPossiblePages,
sal_uInt16& rVirtPgNo, sal_uInt16& rLineNo ); sal_uInt16& rVirtPgNo, sal_uInt16& rLineNo );
SwPostItField* GetPostIt() const const SwPostItField* GetPostIt() const
{ {
return (SwPostItField*) GetTxtFld()->GetFmtFld().GetField(); return static_cast<const SwPostItField*>( GetTxtFld()->GetFmtFld().GetField() );
} }
}; };
...@@ -582,7 +582,7 @@ bool sw_GetPostIts( ...@@ -582,7 +582,7 @@ bool sw_GetPostIts(
static void lcl_FormatPostIt( static void lcl_FormatPostIt(
IDocumentContentOperations* pIDCO, IDocumentContentOperations* pIDCO,
SwPaM& aPam, SwPaM& aPam,
SwPostItField* pField, const SwPostItField* pField,
bool bNewPage, bool bIsFirstPostIt, bool bNewPage, bool bIsFirstPostIt,
sal_uInt16 nPageNo, sal_uInt16 nLineNo ) sal_uInt16 nPageNo, sal_uInt16 nLineNo )
{ {
...@@ -684,7 +684,7 @@ void SwDoc::CalculatePagesForPrinting( ...@@ -684,7 +684,7 @@ void SwDoc::CalculatePagesForPrinting(
} }
++nPageNum; ++nPageNum;
pStPage = (SwPageFrm*)pStPage->GetNext(); pStPage = static_cast<const SwPageFrm*>(pStPage->GetNext());
} }
// now that we have identified the valid pages for printing according // now that we have identified the valid pages for printing according
...@@ -767,7 +767,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( ...@@ -767,7 +767,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData(
bool bIsFirstPostIt = true; bool bIsFirstPostIt = true;
for (sal_uInt16 i = 0; i < nPostItCount; ++i) for (sal_uInt16 i = 0; i < nPostItCount; ++i)
{ {
_PostItFld& rPostIt = (_PostItFld&)*(*rData.m_pPostItFields)[ i ]; _PostItFld& rPostIt = static_cast<_PostItFld&>(*(*rData.m_pPostItFields)[ i ]);
nLastPageNum = nPhyPageNum; nLastPageNum = nPhyPageNum;
nPhyPageNum = rPostIt.GetPageNo( nPhyPageNum = rPostIt.GetPageNo(
aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo ); aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo );
...@@ -811,7 +811,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( ...@@ -811,7 +811,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData(
// now we just need to add the post-it pages to be printed to the // now we just need to add the post-it pages to be printed to the
// end of the vector of pages to print // end of the vector of pages to print
sal_Int32 nPageNum = 0; sal_Int32 nPageNum = 0;
const SwPageFrm * pPageFrm = (SwPageFrm*)rData.m_pPostItShell->GetLayout()->Lower(); const SwPageFrm * pPageFrm = static_cast<SwPageFrm*>(rData.m_pPostItShell->GetLayout()->Lower());
while( pPageFrm && nPageNum < nPostItDocPageCount ) while( pPageFrm && nPageNum < nPostItDocPageCount )
{ {
OSL_ENSURE( pPageFrm, "Empty page frame. How are we going to print this?" ); OSL_ENSURE( pPageFrm, "Empty page frame. How are we going to print this?" );
...@@ -819,7 +819,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( ...@@ -819,7 +819,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData(
// negative page number indicates page is from the post-it doc // negative page number indicates page is from the post-it doc
rData.GetPagesToPrint().push_back( -nPageNum ); rData.GetPagesToPrint().push_back( -nPageNum );
OSL_ENSURE( pPageFrm, "pPageFrm is NULL!" ); OSL_ENSURE( pPageFrm, "pPageFrm is NULL!" );
pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); pPageFrm = static_cast<const SwPageFrm*>(pPageFrm->GetNext());
} }
OSL_ENSURE( nPageNum == nPostItDocPageCount, "unexpected number of pages" ); OSL_ENSURE( nPageNum == nPostItDocPageCount, "unexpected number of pages" );
} }
...@@ -897,7 +897,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( ...@@ -897,7 +897,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
const SwPageFrm *pStPage = dynamic_cast<const SwPageFrm*>( rLayout.Lower() ); const SwPageFrm *pStPage = dynamic_cast<const SwPageFrm*>( rLayout.Lower() );
sal_Int32 i = 0; sal_Int32 i = 0;
for ( i = 1; pStPage && i < nDocPageCount; ++i ) for ( i = 1; pStPage && i < nDocPageCount; ++i )
pStPage = (SwPageFrm*)pStPage->GetNext(); pStPage = static_cast<const SwPageFrm*>(pStPage->GetNext());
if ( !pStPage ) // Then it was that if ( !pStPage ) // Then it was that
return; return;
...@@ -911,7 +911,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( ...@@ -911,7 +911,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
++nPageNum; ++nPageNum;
rValidPagesSet.insert( nPageNum ); rValidPagesSet.insert( nPageNum );
validStartFrms[ nPageNum ] = pPageFrm; validStartFrms[ nPageNum ] = pPageFrm;
pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); pPageFrm = static_cast<const SwPageFrm*>(pPageFrm->GetNext());
rPrinterPaperTrays[ nPageNum ] = lcl_GetPaperBin( pStPage ); rPrinterPaperTrays[ nPageNum ] = lcl_GetPaperBin( pStPage );
} }
...@@ -1021,7 +1021,7 @@ const SwFmtRefMark* SwDoc::GetRefMark( const OUString& rName ) const ...@@ -1021,7 +1021,7 @@ const SwFmtRefMark* SwDoc::GetRefMark( const OUString& rName ) const
if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n ) )) if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n ) ))
continue; continue;
const SwFmtRefMark* pFmtRef = (SwFmtRefMark*)pItem; const SwFmtRefMark* pFmtRef = static_cast<const SwFmtRefMark*>(pItem);
const SwTxtRefMark* pTxtRef = pFmtRef->GetTxtRefMark(); const SwTxtRefMark* pTxtRef = pFmtRef->GetTxtRefMark();
if( pTxtRef && &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() && if( pTxtRef && &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() &&
rName == pFmtRef->GetRefName() ) rName == pFmtRef->GetRefName() )
...@@ -1041,12 +1041,12 @@ const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const ...@@ -1041,12 +1041,12 @@ const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const
sal_uInt32 nCount = 0; sal_uInt32 nCount = 0;
for( sal_uInt32 n = 0; n < nMaxItems; ++n ) for( sal_uInt32 n = 0; n < nMaxItems; ++n )
if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) && if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) &&
0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) && 0 != (pTxtRef = static_cast<const SwFmtRefMark*>(pItem)->GetTxtRefMark()) &&
&pTxtRef->GetTxtNode().GetNodes() == &GetNodes() ) &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() )
{ {
if(nCount == nIndex) if(nCount == nIndex)
{ {
pRet = (SwFmtRefMark*)pItem; pRet = static_cast<const SwFmtRefMark*>(pItem);
break; break;
} }
nCount++; nCount++;
...@@ -1066,12 +1066,12 @@ sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const ...@@ -1066,12 +1066,12 @@ sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const
sal_uInt16 nCount = 0; sal_uInt16 nCount = 0;
for( sal_uInt32 n = 0; n < nMaxItems; ++n ) for( sal_uInt32 n = 0; n < nMaxItems; ++n )
if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) && if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) &&
0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) && 0 != (pTxtRef = static_cast<const SwFmtRefMark*>(pItem)->GetTxtRefMark()) &&
&pTxtRef->GetTxtNode().GetNodes() == &GetNodes() ) &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() )
{ {
if( pNames ) if( pNames )
{ {
OUString pTmp(((SwFmtRefMark*)pItem)->GetRefName()); OUString pTmp(static_cast<const SwFmtRefMark*>(pItem)->GetRefName());
pNames->insert(pNames->begin() + nCount, pTmp); pNames->insert(pNames->begin() + nCount, pTmp);
} }
++nCount; ++nCount;
...@@ -1171,8 +1171,9 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const OUString& rName ) const ...@@ -1171,8 +1171,9 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const OUString& rName ) const
const SwTxtNode* pTxtNd; const SwTxtNode* pTxtNd;
sal_uInt32 n, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT ); sal_uInt32 n, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
for( n = 0; n < nMaxItems; ++n ) for( n = 0; n < nMaxItems; ++n )
if( 0 != (pItem = (SwFmtINetFmt*)GetAttrPool().GetItem2( {
RES_TXTATR_INETFMT, n ) ) && pItem = static_cast<const SwFmtINetFmt*>( GetAttrPool().GetItem2( RES_TXTATR_INETFMT, n ) );
if( 0 != pItem &&
pItem->GetName() == rName && pItem->GetName() == rName &&
0 != ( pTxtAttr = pItem->GetTxtINetFmt()) && 0 != ( pTxtAttr = pItem->GetTxtINetFmt()) &&
0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) && 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
...@@ -1180,7 +1181,7 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const OUString& rName ) const ...@@ -1180,7 +1181,7 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const OUString& rName ) const
{ {
return pItem; return pItem;
} }
}
return 0; return 0;
} }
...@@ -1197,7 +1198,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm ...@@ -1197,7 +1198,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm
::SetProgressState( i, GetDocShell() ); ::SetProgressState( i, GetDocShell() );
const sal_uLong nIndex = rOutNds[ i ]->GetIndex(); const sal_uLong nIndex = rOutNds[ i ]->GetIndex();
const int nLvl = ((SwTxtNode*)GetNodes()[ nIndex ])->GetAttrOutlineLevel()-1; const int nLvl = static_cast<SwTxtNode*>(GetNodes()[ nIndex ])->GetAttrOutlineLevel()-1;
if( nLvl > nLevel ) if( nLvl > nLevel )
continue; continue;
sal_uInt16 nEndOfs = 1; sal_uInt16 nEndOfs = 1;
...@@ -1208,7 +1209,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm ...@@ -1208,7 +1209,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm
while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd && while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd &&
GetNodes()[ nIndex + nEndOfs ]->IsTxtNode() ) GetNodes()[ nIndex + nEndOfs ]->IsTxtNode() )
{ {
SwTxtNode* pTxtNode = (SwTxtNode*)GetNodes()[ nIndex+nEndOfs ]; SwTxtNode* pTxtNode = static_cast<SwTxtNode*>(GetNodes()[ nIndex+nEndOfs ]);
if (pTxtNode->GetTxt().getLength() && nWish) if (pTxtNode->GetTxt().getLength() && nWish)
--nWish; --nWish;
bKeep = pTxtNode->GetSwAttrSet().GetKeep().GetValue(); bKeep = pTxtNode->GetSwAttrSet().GetKeep().GetValue();
...@@ -1229,7 +1230,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm ...@@ -1229,7 +1230,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm
bool bDelete = false; bool bDelete = false;
if( (pNode = &aIndx.GetNode())->IsTxtNode() ) if( (pNode = &aIndx.GetNode())->IsTxtNode() )
{ {
SwTxtNode *pNd = (SwTxtNode*)pNode; SwTxtNode *pNd = static_cast<SwTxtNode*>(pNode);
if( pNd->HasSwAttrSet() ) if( pNd->HasSwAttrSet() )
pNd->ResetAttr( RES_PAGEDESC, RES_BREAK ); pNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
if( bImpress ) if( bImpress )
...@@ -1675,7 +1676,7 @@ bool SwDoc::ContainsHiddenChars() const ...@@ -1675,7 +1676,7 @@ bool SwDoc::ContainsHiddenChars() const
{ {
SwNode* pNd = GetNodes()[ --n ]; SwNode* pNd = GetNodes()[ --n ];
if ( pNd->IsTxtNode() && if ( pNd->IsTxtNode() &&
((SwTxtNode*)pNd)->HasHiddenCharAttribute( false ) ) static_cast<SwTxtNode*>(pNd)->HasHiddenCharAttribute( false ) )
return true; return true;
} }
......
This diff is collapsed.
...@@ -159,15 +159,15 @@ class SwDestroyList : public std::set<SwSectionFrm*> {}; ...@@ -159,15 +159,15 @@ class SwDestroyList : public std::set<SwSectionFrm*> {};
inline const SwSectionFrm *SwSectionFrm::GetFollow() const inline const SwSectionFrm *SwSectionFrm::GetFollow() const
{ {
return (const SwSectionFrm*)SwFlowFrm::GetFollow(); return static_cast<const SwSectionFrm*>(SwFlowFrm::GetFollow());
} }
inline SwSectionFrm *SwSectionFrm::GetFollow() inline SwSectionFrm *SwSectionFrm::GetFollow()
{ {
return (SwSectionFrm*)SwFlowFrm::GetFollow(); return static_cast<SwSectionFrm*>(SwFlowFrm::GetFollow());
} }
inline const SwCntntFrm *SwSectionFrm::FindLastCntnt( sal_uInt8 nMode ) const inline const SwCntntFrm *SwSectionFrm::FindLastCntnt( sal_uInt8 nMode ) const
{ {
return ((SwSectionFrm*)this)->FindLastCntnt( nMode ); return const_cast<SwSectionFrm*>(this)->FindLastCntnt( nMode );
} }
#endif // INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX #endif // INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment