commit b0535cd18c545fe363abeb0c11dc44b1464936b1 Author: Julien Nabet Date: Mon Dec 27 15:56:48 2010 +0100 Some cppcheck clean diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 8abc832..0e60765 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -824,7 +824,7 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::disposing() { ShapesMapType::iterator I; - for (I=mxShapes.begin(); I!=mxShapes.end(); I++) + for (I=mxShapes.begin(); I!=mxShapes.end(); ++I) { XAccessible* pAcc = (*I).second; Reference< XComponent > xComp( pAcc, UNO_QUERY ); diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index f73113c..23cfd5b 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -124,7 +124,7 @@ sal_Bool InitializeFontWorkData( const SdrObject* pCustomShape, const sal_uInt16 { FWTextArea aTextArea; sal_Int32 i, nParagraphs = ( ( nParagraphsLeft - 1 ) / nTextAreaCount ) + 1; - for ( i = 0; i < nParagraphs; i++, j++ ) + for ( i = 0; i < nParagraphs; ++i, ++j ) { FWParagraphData aParagraphData; aParagraphData.aString = rTextObj.GetText( j ); @@ -215,9 +215,9 @@ void CalculateHorizontalScalingFactor( const SdrObject* pCustomShape, fScalingFactor = fScale; } } - aParagraphIter++; + ++aParagraphIter; } - aTextAreaIter++; + ++aTextAreaIter; } rFWData.fHorizontalTextScaling = fScalingFactor; } @@ -313,7 +313,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F // rotating aOutlineIter->Rotate( Point( nTextWidth / 2, rFWData.nSingleLineHeight / 2 ), 900 ); aCharacterData.aBoundRect.Union( aOutlineIter->GetBoundRect() ); - aOutlineIter++; + ++aOutlineIter; } aOutlineIter = aCharacterData.vOutlines.begin(); aOutlineIEnd = aCharacterData.vOutlines.end(); @@ -322,7 +322,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F sal_Int32 nM = - aCharacterData.aBoundRect.Left() + nHeight; aOutlineIter->Move( nM, 0 ); aCharacterData.aBoundRect.Move( nM, 0 ); - aOutlineIter++; + ++aOutlineIter; } nHeight += aCharacterData.aBoundRect.GetWidth() + ( rFWData.nSingleLineHeight / 5 ); aSingleCharacterUnion.Union( aCharacterData.aBoundRect ); @@ -339,9 +339,9 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F while ( aOutlineIter != aOutlineIEnd ) { aOutlineIter->Move( ( aSingleCharacterUnion.GetWidth() - aCharacterIter->aBoundRect.GetWidth() ) / 2, 0 ); - aOutlineIter++; + ++aOutlineIter; } - aCharacterIter++; + ++aCharacterIter; } } else @@ -359,25 +359,6 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F { aParagraphIter->vCharacters.push_back( aCharacterData ); } - -/* trying to retrieve each single character _> is not working well - sal_Int32 i; - for ( i = 0; i < rText.getLength(); i++ ) - { - FWCharacterData aCharacterData; - if ( aVirDev.GetTextOutlines( aCharacterData.vOutlines, rText, 0, i, 1, TRUE, nWidth, pDXArry ) ) - { - std::vector< PolyPolygon >::iterator aOutlineIter = aCharacterData.vOutlines.begin(); - std::vector< PolyPolygon >::iterator aOutlineIEnd = aCharacterData.vOutlines.end(); - while ( aOutlineIter != aOutlineIEnd ) - { - aCharacterData.aBoundRect.Union( aOutlineIter->GetBoundRect() ); - aOutlineIter++; - } - } - aParagraphIter->vCharacters.push_back( aCharacterData ); - } -*/ } delete[] pDXArry; @@ -400,7 +381,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F Rectangle aBoundRect( rPolyPoly.GetBoundRect() ); aParagraphIter->aBoundRect.Union( aBoundRect ); } - aCharacterIter++; + ++aCharacterIter; } } // updating the boundrect for the text area by merging the current paragraph boundrect @@ -433,9 +414,9 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F sal_Int32 nMove = aPolyPolyBoundRect.Top() - rParagraphBoundRect.Top(); if ( nMove ) aOutlineIter->Move( 0, -nMove ); - aOutlineIter++; + ++aOutlineIter; } - aCharacterIter++; + ++aCharacterIter; } } } @@ -443,7 +424,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F nVerticalOffset -= rFWData.nSingleLineHeight; else nVerticalOffset += rFWData.nSingleLineHeight; - aParagraphIter++; + ++aParagraphIter; } } @@ -489,12 +470,12 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape ) while( aOutlineIter != aOutlineIEnd ) { aOutlineIter->Scale( fScale, 1.0 ); - aOutlineIter++; + ++aOutlineIter; } - aCharacterIter++; + ++aCharacterIter; } } - aParagraphIter++; + ++aParagraphIter; } } else @@ -524,12 +505,12 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape ) while( aOutlineIter != aOutlineIEnd ) { aOutlineIter->Move( nHorzDiff, 0 ); - aOutlineIter++; + ++aOutlineIter; } - aCharacterIter++; + ++aCharacterIter; } } - aParagraphIter++; + ++aParagraphIter; } } break; @@ -538,7 +519,7 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape ) case SDRTEXTHORZADJUST_LEFT : break; // already left aligned -> nothing to do } } - aTextAreaIter++; + ++aTextAreaIter; } } @@ -722,11 +703,11 @@ void FitTextOutlinesToShapeOutlines( const PolyPolygon& aOutlines2d, FWData& rFW rPolyPoly.Rotate( Point( aBoundRect.Center().X(), aParagraphIter->aBoundRect.Center().Y() ), sin( fAngle ), cos( fAngle ) ); rPolyPoly.Move( (sal_Int32)( ( fx1 + fvx )- aBoundRect.Center().X() ), (sal_Int32)( ( fy1 + fvy ) - aParagraphIter->aBoundRect.Center().Y() ) ); - aOutlineIter++; + ++aOutlineIter; } - aCharacterIter++; + ++aCharacterIter; } - aParagraphIter++; + ++aParagraphIter; } } } @@ -798,15 +779,15 @@ void FitTextOutlinesToShapeOutlines( const PolyPolygon& aOutlines2d, FWData& rFW // write back polygon rPolyPoly[ i ] = aLocalPoly; } - aOutlineIter++; + ++aOutlineIter; } - aCharacterIter++; + ++aCharacterIter; } - aParagraphIter++; + ++aParagraphIter; } } } - aTextAreaIter++; + ++aTextAreaIter; } } @@ -838,13 +819,13 @@ SdrObject* CreateSdrObjectFromParagraphOutlines( const FWData& rFWData, const Sd // SJ: not setting model, so we save a lot of broadcasting and the model is not modified any longer // pPathObj->SetModel( pCustomShape->GetModel() ); ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pPathObj ); - aOutlineIter++; + ++aOutlineIter; } - aCharacterIter++; + ++aCharacterIter; } - aParagraphIter++; + ++aParagraphIter; } - aTextAreaIter++; + ++aTextAreaIter; } Point aP( pCustomShape->GetSnapRect().Center() ); diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 71fefd2..f8f0be5 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -510,11 +510,10 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ ) DBG_ERROR("FmGridHeader::ExecuteDrop: Exception occurred!"); } - sal_Int32 nPreferedType = -1; sal_Bool bDateNTimeCol = sal_False; if (aPossibleTypes.Count() != 0) { - nPreferedType = aPossibleTypes[0]; + sal_Int32 nPreferedType = aPossibleTypes[0]; if ((m_pImpl->nDropAction == DND_ACTION_LINK) && (aPossibleTypes.Count() > 1)) { ImageList aImageList( SVX_RES(RID_SVXIMGLIST_FMEXPL) ); diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 3d89f0e..345df16 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1250,13 +1250,13 @@ namespace svxform if ( xContainer.is() ) m_pNaviWin->AddContainerBroadcaster( xContainer ); - USHORT nIter = 0; Reference< XEnumerationAccess > xNumAccess( _xModel->getInstances(), UNO_QUERY ); if ( xNumAccess.is() ) { Reference < XEnumeration > xNum = xNumAccess->createEnumeration(); if ( xNum.is() && xNum->hasMoreElements() ) { + USHORT nIter = 0; while ( xNum->hasMoreElements() ) { if ( nIter == _nPagePos ) @@ -1885,6 +1885,7 @@ namespace svxform m_aTabCtrl.SetPageText( nId, sNewName ); bIsDocModified = true; } + delete(pPage); } break; } diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index c4d0f36..329d7e2 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -586,7 +586,7 @@ FmWinRecList::const_iterator FmXFormView::findWindow( const Reference< XControlC { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::findWindow" ); for (FmWinRecList::const_iterator i = m_aWinList.begin(); - i != m_aWinList.end(); i++) + i != m_aWinList.end(); ++i) { if ( _rxCC == (*i)->getControlContainer() ) return i; @@ -599,7 +599,7 @@ FmWinRecList::iterator FmXFormView::findWindow( const Reference< XControlContain { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormView::findWindow" ); for (FmWinRecList::iterator i = m_aWinList.begin(); - i != m_aWinList.end(); i++) + i != m_aWinList.end(); ++i) { if ( _rxCC == (*i)->getControlContainer() ) return i; @@ -733,7 +733,7 @@ IMPL_LINK(FmXFormView, OnActivate, void*, /*EMPTYTAG*/) Window* pWindow = const_cast(static_cast(m_pView->GetActualOutDev())); FmXPageViewWinRec* pFmRec = m_aWinList.size() ? m_aWinList[0] : NULL; for (FmWinRecList::const_iterator i = m_aWinList.begin(); - i != m_aWinList.end(); i++) + i != m_aWinList.end(); ++i) { if (pWindow == (*i)->getWindow()) pFmRec =*i; diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index eacf3b5..3077838 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -1223,7 +1223,7 @@ void FormController::disposing(void) // clean up our children for (FmFormControllers::const_iterator i = m_aChilds.begin(); - i != m_aChilds.end(); i++) + i != m_aChilds.end(); ++i) { // search the position of the model within the form Reference< XFormComponent > xForm((*i)->getModel(), UNO_QUERY); diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 324d5e3..8f051a8 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -723,7 +723,6 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, BO if( pIStm ) { String aThemeName; - sal_uInt32 nThemeId = 0; sal_uInt16 nVersion; BOOL bThemeNameFromResource = FALSE; @@ -731,6 +730,7 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, BO if( nVersion <= 0x00ff ) { + sal_uInt32 nThemeId = 0; ByteString aTmpStr; *pIStm >> aTmpStr; aThemeName = String( aTmpStr.GetBuffer(), RTL_TEXTENCODING_UTF8 ); diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index d6a2f3a..b1b5c52 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -373,14 +373,14 @@ void SvxNumberFormatShell::MakeFormat( String& rFormat, if(aCurrencyFormatList.Count()>nCurrencyPos) { xub_StrLen rErrPos=0; - sal_uInt16 rCatLbSelPos=0; - short rFmtSelPos=0; SvStrings aFmtEList; sal_uInt32 nFound = pFormatter->TestNewString( *aCurrencyFormatList[nCurrencyPos], eCurLanguage ); if ( nFound == NUMBERFORMAT_ENTRY_NOT_FOUND ) { + sal_uInt16 rCatLbSelPos=0; + short rFmtSelPos=0; AddFormat( *aCurrencyFormatList[nCurrencyPos],rErrPos,rCatLbSelPos, rFmtSelPos,aFmtEList); } @@ -1729,10 +1729,9 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const String& rFmtString ) sal_uInt16 nPos=FindCurrencyTableEntry(rFmtString, bTestBanking); - sal_uInt16 nStart=0; - if(nPos!=(sal_uInt16)-1) { + sal_uInt16 nStart=0; if(bTestBanking && aCurCurrencyList.Count()>nPos) { nStart=nCount; diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index 0e1f8fa..5153fb7 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -285,8 +285,6 @@ namespace Color aColor(rand()%255, rand()%255, rand()%255); impPaintStrokePolygon(aResult.getB2DPolygon(a), rOutDev, aColor); } - - bool bBla = true; } } } diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index c545c3c..1d2b1c4 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -1370,7 +1370,6 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) nRotateY = nOldRotateY = aRotateAxe.Y(); } - long nNewShearAngle=0; long nShearAngle=0; long nShearX=0; long nShearY=0; @@ -1426,7 +1425,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) // Shear if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_SHEAR,TRUE,&pPoolItem)) { - nNewShearAngle=((const SfxInt32Item*)pPoolItem)->GetValue(); + long nNewShearAngle=((const SfxInt32Item*)pPoolItem)->GetValue(); if (nNewShearAngle>SDRMAXSHEAR) nNewShearAngle=SDRMAXSHEAR; if (nNewShearAngle<-SDRMAXSHEAR) nNewShearAngle=-SDRMAXSHEAR; if (nNewShearAngle!=nOldShearAngle) { diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx index a217d92..e9126ab 100644 --- a/svx/source/svdraw/svdibrow.cxx +++ b/svx/source/svdraw/svdibrow.cxx @@ -691,14 +691,12 @@ bool IsItemIneffective(USHORT nWhich, const SfxItemSet* pSet, USHORT& rIndent) bool bTileTRUE = false; bool bTileFALSE = false; bool bStretchTRUE = false; - bool bStretchFALSE = false; if (ImpGetItem(*pSet,XATTR_FILLBMP_TILE,pItem)) { bTileTRUE=((const XFillBmpTileItem*)pItem)->GetValue(); bTileFALSE=!bTileTRUE; } if (ImpGetItem(*pSet,XATTR_FILLBMP_STRETCH,pItem)) { bStretchTRUE=((const XFillBmpStretchItem*)pItem)->GetValue(); - bStretchFALSE=!bStretchTRUE; } // Stretch nicht anwaehlbar, wenn Tile=TRUE if (nWhich==XATTR_FILLBMP_STRETCH) return bTileTRUE; @@ -1198,7 +1196,6 @@ IMPL_LINK(SdrItemBrowser,ChangedHdl,_SdrItemBrowserControl*,pBrowse) if (nLongVal>pEntry->nMax) nLongVal=pEntry->nMax; if (nLongValnMin) nLongVal=pEntry->nMin; } - bool bPair = false; bool bPairX = true; bool bPairY = false; USHORT nSepLen=1; @@ -1209,7 +1206,6 @@ IMPL_LINK(SdrItemBrowser,ChangedHdl,_SdrItemBrowserControl*,pBrowse) if (nPos==STRING_NOTFOUND) nPos=aNewText.Search(sal_Unicode(' ')); if (nPos==STRING_NOTFOUND) { nPos=aNewText.SearchAscii(".."); if (nPos!=STRING_NOTFOUND) nSepLen=2; } if (nPos!=STRING_NOTFOUND) { - bPair = true; bPairX=nPos>0; XubString s(aNewText); s.Erase(0,nPos+nSepLen);