[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Dec 30 12:20:52 PST 2012


 sc/source/core/data/table4.cxx          |    2 +-
 sc/source/core/tool/interpr2.cxx        |    4 +++-
 sc/source/ui/cctrl/dpcontrol.cxx        |    3 +--
 sc/source/ui/docshell/arealink.cxx      |    3 +--
 sc/source/ui/docshell/docsh8.cxx        |    2 +-
 sc/source/ui/drawfunc/fusel.cxx         |    4 ++--
 sc/source/ui/unoobj/viewuno.cxx         |    2 +-
 sc/source/ui/view/dbfunc.cxx            |    3 +--
 sc/source/ui/view/drawvie3.cxx          |    6 +++---
 sc/source/ui/view/gridwin.cxx           |    2 +-
 sc/source/ui/view/preview.cxx           |    2 +-
 sc/source/ui/view/printfun.cxx          |    3 +--
 sc/source/ui/view/tabvwshb.cxx          |    3 +--
 sc/source/ui/view/viewfun4.cxx          |    2 +-
 sc/source/ui/view/viewfun7.cxx          |    3 +--
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |    2 +-
 16 files changed, 21 insertions(+), 25 deletions(-)

New commits:
commit 2fbd64cef870568da1479a03f6ea778bab68a09b
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Dec 30 21:19:04 2012 +0100

    More cppcheck cleaning in sc
    
    Change-Id: Ie040fa7ed9a3304bd4a10e404b7a0a4e45cbd69c

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 1b9debb..f5655f3 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1390,7 +1390,6 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
     sal_uLong nActFormCnt = 0;
     for (rOuter = nOStart; rOuter <= nOEnd; rOuter++)
     {
-        bool bFirst = true;
         rInner = nISource;
         ScBaseCell* pSrcCell = aCol[nCol].GetCell(static_cast<SCROW>(nRow));
 
@@ -1467,6 +1466,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
             {
                 if (eCellType == CELLTYPE_FORMULA)
                 {
+                    bool bFirst = true;
                     for (rInner = nIMin; rInner <= nIMax; rInner++)
                     {
                         if(HiddenRowColumn(rInner, bVertical, this))
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index a25826c..dc37e08 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2653,10 +2653,12 @@ void ScInterpreter::ScArabic()
             sal_uInt16 nDigit1 = 0;
             sal_uInt16 nDigit2 = 0;
             bool bIsDec1 = false;
-            bool bIsDec2 = false;
             bValid = lcl_GetArabicValue( aRoman.GetChar( nCharIndex ), nDigit1, bIsDec1 );
             if( bValid && (nCharIndex + 1 < nCharCount) )
+            {
+                bool bIsDec2 = false;
                 bValid = lcl_GetArabicValue( aRoman.GetChar( nCharIndex + 1 ), nDigit2, bIsDec2 );
+            }
             if( bValid )
             {
                 if( nDigit1 >= nDigit2 )
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index c866ded..ab583cb 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -97,7 +97,6 @@ void ScDPFieldButton::setPopupLeft(bool b)
 
 void ScDPFieldButton::draw()
 {
-    const long nMargin = 2;
     bool bOldMapEnablaed = mpOutDev->IsMapModeEnabled();
     mpOutDev->EnableMapMode(false);
 
@@ -136,7 +135,7 @@ void ScDPFieldButton::draw()
 
         Point aTextPos = maPos;
         long nTHeight = mpOutDev->GetTextHeight();
-        aTextPos.setX(maPos.getX() + nMargin);
+        aTextPos.setX(maPos.getX() + 2); // 2 = Margin
         aTextPos.setY(maPos.getY() + (maSize.Height()-nTHeight)/2);
 
         mpOutDev->Push(PUSH_CLIPREGION);
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index 84d30be..85db183 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -331,7 +331,6 @@ sal_Bool ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
         //  Undo initialisieren
 
         ScDocument* pUndoDoc = NULL;
-        ScDocument* pRedoDoc = NULL;
         if ( bAddUndo && bUndo )
         {
             pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
@@ -414,7 +413,7 @@ sal_Bool ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
 
         if ( bAddUndo && bUndo)
         {
-            pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
+            ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
             pRedoDoc->InitUndo( pDoc, nDestTab, nDestTab );
             pDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, false, pRedoDoc );
 
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 267d6cf..2bfbcb0 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -424,9 +424,9 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet
         sal_Bool bEnd = false;
         while ( !bEnd && xRowSet->next() )
         {
-            bool bSimpleRow = true;
             if ( nRow <= MAXROW )
             {
+                bool bSimpleRow = true;
                 SCCOL nCol = 0;
                 for (i=0; i<nColCount; i++)
                 {
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 74a4ff8..c69d61d 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -120,8 +120,6 @@ sal_Bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
     if ( rMEvt.IsLeft() )
     {
         SdrHdl* pHdl = pView->PickHandle(aMDPos);
-        SdrObject* pObj;
-        SdrPageView* pPV;
 
         if ( pHdl!=NULL || pView->IsMarkedHit(aMDPos) )
         {
@@ -158,6 +156,8 @@ sal_Bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
         }
         else
         {
+            SdrObject* pObj;
+            SdrPageView* pPV;
             sal_Bool bAlt = rMEvt.IsMod2();
             if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
             {
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index b9f9541..4c43504 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -817,10 +817,10 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection )
                 //  und alle Objekte selektiert, die auf dieser Tabelle liegen
                 //! Exception, wenn Objekte auf verschiedenen Tabellen?
 
-                SdrPageView* pPV = NULL;
                 long nCount = xShapeColl->getCount();
                 if (nCount)
                 {
+                    SdrPageView* pPV = NULL;
                     sal_Bool bAllMarked(sal_True);
                     for ( long i = 0; i < nCount; i++ )
                     {
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 2559c2b..3a4bd17 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -205,7 +205,6 @@ void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const std::
     ScDocument* pDoc = pDocShell->GetDocument();
     ScDBCollection* pOldColl = pDoc->GetDBCollection();
     ScDBCollection* pUndoColl = NULL;
-    ScDBCollection* pRedoColl = NULL;
     const sal_Bool bRecord (pDoc->IsUndoEnabled());
 
     std::vector<ScRange>::const_iterator iter;
@@ -235,7 +234,7 @@ void ScDBFunc::NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const std::
 
     if (bRecord)
     {
-        pRedoColl = new ScDBCollection( rNewColl );
+        ScDBCollection* pRedoColl = new ScDBCollection( rNewColl );
         pDocShell->GetUndoManager()->AddUndoAction(
             new ScUndoDBData( pDocShell, pUndoColl, pRedoColl ) );
     }
diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index b05c828..363fbf4 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -60,9 +60,9 @@ ScDrawView::ScDrawView( OutputDevice* pOut, ScViewData* pData ) :
 
 void ScDrawView::SetPageAnchored()
 {
-    SdrObject* pObj = NULL;
     if( AreObjectsMarked() )
     {
+        SdrObject* pObj = NULL;
         const SdrMarkList* pMark = &GetMarkedObjectList();
         sal_uLong nCount = pMark->GetMarkCount();
         for( sal_uLong i=0; i<nCount; i++ )
@@ -85,9 +85,9 @@ void ScDrawView::SetCellAnchored()
     if (!pDoc)
         return;
 
-    SdrObject* pObj = NULL;
     if( AreObjectsMarked() )
     {
+        SdrObject* pObj = NULL;
         const SdrMarkList* pMark = &GetMarkedObjectList();
         sal_uLong nCount = pMark->GetMarkCount();
         for( sal_uLong i=0; i<nCount; i++ )
@@ -108,12 +108,12 @@ ScAnchorType ScDrawView::GetAnchorType() const
 {
     sal_Bool bPage = false;
     sal_Bool bCell = false;
-    const SdrObject* pObj = NULL;
     if( AreObjectsMarked() )
     {
         const SdrMarkList* pMark = &GetMarkedObjectList();
         sal_uLong nCount = pMark->GetMarkCount();
         Point p0;
+        const SdrObject* pObj = NULL;
         for( sal_uLong i=0; i<nCount; i++ )
         {
             pObj = pMark->GetMark(i)->GetMarkedSdrObj();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index a7033fe..620d625 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5087,9 +5087,9 @@ bool ScGridWindow::GetEditUrlOrError( bool bSpellErr, const Point& rPos,
     aEngine.SetPaperSize( aPaperSize );
 
     ::std::auto_ptr< EditTextObject > pTextObj;
-    const EditTextObject* pData;
     if(pCell->GetCellType() == CELLTYPE_EDIT)
     {
+        const EditTextObject* pData;
         ((ScEditCell*)pCell)->GetData(pData);
         if (pData)
             aEngine.SetText(*pData);
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 6b69905..196ad9c 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -1017,7 +1017,6 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
         {
             SetPointer( Pointer( POINTER_ARROW ) );
 
-            bool bMoveRulerAction= true;
 
             ScDocument * pDoc = pDocShell->GetDocument();
             String   aOldName = pDoc->GetPageStyle( nTab );
@@ -1027,6 +1026,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
 
             if ( pStyleSheet )
             {
+                bool bMoveRulerAction= true;
                 ScStyleSaveData aOldData;
                 if( bUndo )
                     aOldData.InitFromStyle( pStyleSheet );
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index df2e3f7..092ef16 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1732,7 +1732,6 @@ void ScPrintFunc::PrintHF( long nPageNo, sal_Bool bHeader, long nStartY,
     MakeEditEngine();
 
     pEditEngine->SetPaperSize(aPaperSize);
-    const EditTextObject* pObject;
 
     //  Rahmen / Hintergrund
 
@@ -1778,7 +1777,7 @@ void ScPrintFunc::PrintHF( long nPageNo, sal_Bool bHeader, long nStartY,
 
         //  links
 
-        pObject = pHFItem->GetLeftArea();
+        const EditTextObject* pObject = pHFItem->GetLeftArea();
         if (pObject)
         {
             pEditDefaults->Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 6f4f963..89b3aef 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -222,13 +222,12 @@ ErrCode ScTabViewShell::DoVerb(long nVerb)
         return ERRCODE_SO_NOTIMPL;          // soll nicht sein
 
     SdrOle2Obj* pOle2Obj = NULL;
-    SdrObject* pObj = NULL;
     ErrCode nErr = ERRCODE_NONE;
 
     const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     if (rMarkList.GetMarkCount() == 1)
     {
-        pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+        SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
         if (pObj->GetObjIdentifier() == OBJ_OLE2)
             pOle2Obj = (SdrOle2Obj*) pObj;
     }
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 00afe1e..21d2687 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -82,7 +82,6 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
     {
         HideAllCursors();
 
-        ScDocument* pUndoDoc = NULL;
 
         ScDocShell* pDocSh = GetViewData()->GetDocShell();
         ScDocument* pDoc = pDocSh->GetDocument();
@@ -113,6 +112,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
             if (nEndRow > MAXROW)
                 nEndRow = MAXROW;
 
+            ScDocument* pUndoDoc = NULL;
             if (bRecord)
             {
                 pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index c69dc65..aea107f 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -427,7 +427,6 @@ sal_Bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
 sal_Bool ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& rGraphic )
 {
     sal_Bool bRet = false;
-    SdrGrafObj* pNewGrafObj = NULL;
 
     ScDrawView* pScDrawView = GetScDrawView();
     if ( pScDrawView && pPickObj )
@@ -441,7 +440,7 @@ sal_Bool ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& r
             /******************************************************************
             * Das Graphik-Objekt bekommt eine neue Graphik
             ******************************************************************/
-            pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
+            SdrGrafObj* pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
             pNewGrafObj->SetGraphic(rGraphic);
 
             pScDrawView->BegUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP));
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index f746662..00e62e9 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -336,12 +336,12 @@ void ScXMLSourceDlg::TreeItemSelected()
 
 void ScXMLSourceDlg::DefaultElementSelected(SvTreeListEntry& rEntry)
 {
-    ScOrcusXMLTreeParam::EntryData* pUserData = NULL;
 
     if (maLbTree.GetChildCount(&rEntry) > 0)
     {
         // Only an element with no child elements (leaf element) can be linked.
         bool bHasChild = false;
+        ScOrcusXMLTreeParam::EntryData* pUserData = NULL;
         for (SvTreeListEntry* pChild = maLbTree.FirstChild(&rEntry); pChild; pChild = maLbTree.NextSibling(pChild))
         {
             pUserData = ScOrcusXMLTreeParam::getUserData(*pChild);


More information about the Libreoffice-commits mailing list