[Libreoffice-commits] .: 33 commits - sc/source sc/workben

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jan 7 07:20:59 PST 2011


 sc/source/core/data/cell2.cxx        |    3 --
 sc/source/core/data/column3.cxx      |    2 -
 sc/source/core/data/documen3.cxx     |    4 +--
 sc/source/core/data/documen8.cxx     |    8 +++----
 sc/source/core/data/dpobject.cxx     |    2 -
 sc/source/core/data/drwlayer.cxx     |    4 +--
 sc/source/core/data/table4.cxx       |    2 -
 sc/source/core/tool/chartarr.cxx     |    5 +---
 sc/source/core/tool/detfunc.cxx      |    8 +++----
 sc/source/core/tool/inputopt.cxx     |    3 --
 sc/source/core/tool/interpr2.cxx     |   38 ++++++++++++++++++-----------------
 sc/source/core/tool/interpr3.cxx     |   14 +++++-------
 sc/source/core/tool/interpr5.cxx     |    3 --
 sc/source/filter/excel/colrowst.cxx  |    3 --
 sc/source/filter/excel/xicontent.cxx |    2 -
 sc/source/filter/lotus/op.cxx        |    2 -
 sc/source/filter/qpro/qproform.cxx   |    2 -
 sc/source/ui/app/inputhdl.cxx        |   33 +++++++++++++-----------------
 sc/source/ui/app/inputwin.cxx        |    9 ++------
 sc/source/ui/docshell/docsh4.cxx     |    3 --
 sc/source/ui/docshell/docsh5.cxx     |    2 -
 sc/source/ui/miscdlgs/crnrdlg.cxx    |   13 +++++------
 sc/source/ui/miscdlgs/filldlg.cxx    |   10 +++++----
 sc/source/ui/miscdlgs/mvtabdlg.cxx   |    3 --
 sc/source/ui/miscdlgs/solverutil.cxx |    2 -
 sc/source/ui/namedlg/namedlg.cxx     |    2 -
 sc/source/ui/vba/vbarange.cxx        |   29 ++++++++------------------
 sc/source/ui/vba/vbaworkbooks.cxx    |    2 -
 sc/source/ui/vba/vbaworksheet.cxx    |    2 -
 sc/source/ui/view/dbfunc3.cxx        |    4 ---
 sc/source/ui/view/tabvwshb.cxx       |    5 ----
 sc/workben/test.cxx                  |    4 +--
 32 files changed, 95 insertions(+), 133 deletions(-)

New commits:
commit a5114db8c6f461adfd2555b2b64936b12fa6ee56
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:53:26 2011 +0000

    cppcheck: Remove unread variable in docsh5.cxx

diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index edb92cd..852e5b1 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -949,7 +949,6 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
             BOOL bVbaEnabled = aDocument.IsInVBAMode();
                         if ( bVbaEnabled )
                         {
-                StarBASIC* pStarBASIC = GetBasic();
                             String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
                             Reference< XLibraryContainer > xLibContainer = GetBasicContainer();
                             Reference< XVBACompatibility > xVBACompat( xLibContainer, UNO_QUERY );
@@ -957,7 +956,6 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
                             if ( xVBACompat.is() )
                             {
                                 aLibName = xVBACompat->getProjectName();
-                                pStarBASIC = GetBasicManager()->GetLib( aLibName );
                             }
 
                             SCTAB nTabToUse = nDestTab;
commit b79f4a8d8ae23a4a90c8b6834f931f780d4a8c28
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:40:11 2011 +0000

    cppcheck: Reduce variable scope in dbfunc3.cxx

diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 75ab8d0..6cd757b 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -456,13 +456,11 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, BOOL bRecord,
         ScOutlineTable*	pUndoTab = NULL;
         ScRangeName*	pUndoRange = NULL;
         ScDBCollection* pUndoDB = NULL;
-        SCTAB 			nTabCount = 0;				// fuer Referenz-Undo
 
         if (bRecord)										// alte Daten sichern
         {
             BOOL bOldFilter = bDo && rParam.bDoSort;
-
-            nTabCount = pDoc->GetTableCount();
+            SCTAB nTabCount = pDoc->GetTableCount();
             pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
             ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
             if (pTable)
commit dc4d58c9bb906664acb0a830a3d9d47869ad3b6b
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:36:11 2011 +0000

    cppcheck: Remove unread variable in op.cxx

diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index e0a0182..d8048b4 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -256,12 +256,10 @@ void OP_SymphNamedRange( SvStream& r, UINT16 /*n*/ )
     // POST:    waren Koordinaten ungueltig, wird nicht gespeichert
     UINT16				nColSt, nRowSt, nColEnd, nRowEnd;
     BYTE				nType;
-    sal_Char*			pName;
     sal_Char			cPuffer[ 32 ];
 
     r.Read( cPuffer, 16 );
     cPuffer[ 16 ] = 0;
-    pName = cPuffer;
 
     r >> nColSt >> nRowSt >> nColEnd >> nRowEnd >> nType;
 
commit 8c48537d99d5a895ba8530c9b230f4d8872e22d2
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:34:29 2011 +0000

    cppcheck: Reduce variable scope in interpr2.cxx

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 40d7fcc..d548844 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -352,11 +352,11 @@ void ScInterpreter::ScGetDiffDate360()
             bFlag = FALSE;
         double nDate2 = GetDouble();
         double nDate1 = GetDouble();
-        double fSign;
         if (nGlobalError)
             PushError( nGlobalError);
         else
         {
+            double fSign;
             // #i84934# only for non-US European algorithm swap dates. Else
             // follow Excel's meaningless extrapolation for "interoperability".
             if (bFlag && (nDate2 < nDate1))
@@ -765,12 +765,7 @@ void ScInterpreter::ScMIRR()
     if( MustHaveParamCount( GetByte(), 3 ) )
     {
         double fRate1_reinvest = GetDouble() + 1;
-        double fNPV_reinvest = 0.0;
-        double fPow_reinvest = 1.0;
-
         double fRate1_invest = GetDouble() + 1;
-        double fNPV_invest = 0.0;
-        double fPow_invest = 1.0;
 
         ScRange aRange;
         PopDoubleRef( aRange );
@@ -779,6 +774,10 @@ void ScInterpreter::ScMIRR()
             PushError( nGlobalError);
         else
         {
+            double fNPV_reinvest = 0.0;
+            double fPow_reinvest = 1.0;
+            double fNPV_invest = 0.0;
+            double fPow_invest = 1.0;
             ScValueIterator aValIter( pDok, aRange, glSubTotal );
             double fCellValue;
             ULONG nCount = 0;
@@ -1082,7 +1081,6 @@ void ScInterpreter::ScVDB()
             {
 
                 double fDauer1=fDauer;
-                double fPart;
 
                 //@Die Frage aller Fragen: "Ist das hier richtig"
                 if(!::rtl::math::approxEqual(fAnfang,::rtl::math::approxFloor(fAnfang)))
@@ -1091,7 +1089,7 @@ void ScInterpreter::ScVDB()
                     {
                         if(fAnfang>fDauer/2 || ::rtl::math::approxEqual(fAnfang,fDauer/2))
                         {
-                            fPart=fAnfang-fDauer/2;
+                            double fPart=fAnfang-fDauer/2;
                             fAnfang=fDauer/2;
                             fEnde-=fPart;
                             fDauer1+=1;
@@ -1398,7 +1396,7 @@ double ScInterpreter::ScGetZinsZ(double fZins, double fZr, double fZzr, double f
 void ScInterpreter::ScZinsZ()
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZinsZ" );
-    double nZins, nZr, nRmz, nZzr, nBw, nZw = 0, nFlag = 0;
+    double nZins, nZr, nZzr, nBw, nZw = 0, nFlag = 0;
     nFuncFmtType = NUMBERFORMAT_CURRENCY;
     BYTE nParamCount = GetByte();
     if ( !MustHaveParamCount( nParamCount, 4, 6 ) )
@@ -1414,13 +1412,16 @@ void ScInterpreter::ScZinsZ()
     if (nZr < 1.0 || nZr > nZzr)
         PushIllegalArgument();
     else
+    {
+        double nRmz;
         PushDouble(ScGetZinsZ(nZins, nZr, nZzr, nBw, nZw, nFlag, nRmz));
+    }
 }
 
 void ScInterpreter::ScKapz()
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKapz" );
-    double nZins, nZr, nZzr, nBw, nZw = 0, nFlag = 0, nRmz, nZinsz;
+    double nZins, nZr, nZzr, nBw, nZw = 0, nFlag = 0;
     nFuncFmtType = NUMBERFORMAT_CURRENCY;
     BYTE nParamCount = GetByte();
     if ( !MustHaveParamCount( nParamCount, 4, 6 ) )
@@ -1437,7 +1438,8 @@ void ScInterpreter::ScKapz()
         PushIllegalArgument();
     else
     {
-        nZinsz = ScGetZinsZ(nZins, nZr, nZzr, nBw, nZw, nFlag, nRmz);
+        double nRmz;
+        double nZinsz = ScGetZinsZ(nZins, nZr, nZzr, nBw, nZw, nFlag, nRmz);
         PushDouble(nRmz - nZinsz);
     }
 }
@@ -1448,7 +1450,7 @@ void ScInterpreter::ScKumZinsZ()
     nFuncFmtType = NUMBERFORMAT_CURRENCY;
     if ( MustHaveParamCount( GetByte(), 6 ) )
     {
-        double fZins, fZzr, fBw, fAnfang, fEnde, fF, fRmz, fZinsZ;
+        double fZins, fZzr, fBw, fAnfang, fEnde, fF;
         fF      = GetDouble();
         fEnde   = ::rtl::math::approxFloor(GetDouble());
         fAnfang = ::rtl::math::approxFloor(GetDouble());
@@ -1462,8 +1464,8 @@ void ScInterpreter::ScKumZinsZ()
         {
             ULONG nAnfang = (ULONG) fAnfang;
             ULONG nEnde = (ULONG) fEnde ;
-            fRmz = ScGetRmz(fZins, fZzr, fBw, 0.0, fF);
-            fZinsZ = 0.0;
+            double fRmz = ScGetRmz(fZins, fZzr, fBw, 0.0, fF);
+            double fZinsZ = 0.0;
             if (nAnfang == 1)
             {
                 if (fF <= 0.0)
@@ -1489,7 +1491,7 @@ void ScInterpreter::ScKumKapZ()
     nFuncFmtType = NUMBERFORMAT_CURRENCY;
     if ( MustHaveParamCount( GetByte(), 6 ) )
     {
-        double fZins, fZzr, fBw, fAnfang, fEnde, fF, fRmz, fKapZ;
+        double fZins, fZzr, fBw, fAnfang, fEnde, fF;
         fF      = GetDouble();
         fEnde   = ::rtl::math::approxFloor(GetDouble());
         fAnfang = ::rtl::math::approxFloor(GetDouble());
@@ -1501,8 +1503,8 @@ void ScInterpreter::ScKumKapZ()
             PushIllegalArgument();
         else
         {
-            fRmz = ScGetRmz(fZins, fZzr, fBw, 0.0, fF);
-            fKapZ = 0.0;
+            double fRmz = ScGetRmz(fZins, fZzr, fBw, 0.0, fF);
+            double fKapZ = 0.0;
             ULONG nAnfang = (ULONG) fAnfang;
             ULONG nEnde = (ULONG) fEnde;
             if (nAnfang == 1)
@@ -2713,7 +2715,6 @@ void ScInterpreter::ScEuroConvert()
             PushError( nGlobalError);
         else
         {
-            double fRes;
             double fFromRate;
             double fToRate;
             int    nFromDec;
@@ -2722,6 +2723,7 @@ void ScInterpreter::ScEuroConvert()
             if ( lclConvertMoney( aFromUnit, fFromRate, nFromDec )
                 && lclConvertMoney( aToUnit, fToRate, nToDec ) )
             {
+                double fRes;
                 if ( aFromUnit.EqualsIgnoreCaseAscii( aToUnit ) )
                     fRes = fVal;
                 else
commit 941f286b6f5fddb625a4a243a1fc9a096d72fe37
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:24:25 2011 +0000

    cppcheck: Reduce variable scope in namedlg.cxx

diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index d31fbc1..6f717b2 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -424,7 +424,6 @@ IMPL_LINK( ScNameDlg, AddBtnHdl, void *, EMPTYARG )
             {
                 ScRangeData*	pNewEntry	= NULL;
                 RangeType		nType		= RT_NAME;
-                USHORT			nFoundAt	= 0;
                 String			theSymbol	= aEdAssign.GetText();
                 String			aStrPos;
                 String			aStrArea;
@@ -449,6 +448,7 @@ IMPL_LINK( ScNameDlg, AddBtnHdl, void *, EMPTYARG )
                 //	  in ein Token-Array uebersetzt werden?)
                 if ( 0 == pNewEntry->GetErrCode() )
                 {
+                    USHORT nFoundAt = 0;
                     // Eintrag bereits vorhanden? Dann vorher entfernen (=Aendern)
                     if ( aLocalRangeName.SearchName( aNewEntry, nFoundAt ) )
                     {									// alten Index uebernehmen
commit e56013e856454089d454699496476f47d21c0bc8
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:22:19 2011 +0000

    cppcheck: Reduce variable scope in vbaworksheet.cxx

diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index ca00ef9..7d4701e 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -577,9 +577,9 @@ ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno
 
     // set sheet name to be newSheet name
     aSheetName = aCurrSheetName;
-    SCTAB nDummy=0;
     if ( bSheetExists && bDestSheetExists )
     {
+        SCTAB nDummy=0;
         sal_Bool bAfter = After.hasValue();
         if(bAfter)
               nDest++;
commit ca65396434429066954312f1241d4f08d2647468
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:20:48 2011 +0000

    cppcheck: Reduce variable scope in vbaworkbooks.cxx

diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx
index 6b1b5f2..36af1a0 100644
--- a/sc/source/ui/vba/vbaworkbooks.cxx
+++ b/sc/source/ui/vba/vbaworkbooks.cxx
@@ -269,12 +269,12 @@ ScVbaWorkbooks::Open( const rtl::OUString& rFileName, const uno::Any& /*UpdateLi
         osl::FileBase::getFileURLFromSystemPath( rFileName, aURL );
 
     uno::Sequence< beans::PropertyValue > sProps(0);
-    sal_Int32 nIndex = 0;
     
     rtl::OUString sType = getFileFilterType( aURL );
     // A text file means it needs to be processed as a csv file	
     if ( isTextFile( sType ) ) 
     {
+        sal_Int32 nIndex = 0;
         // Values for format
         // 1 Tabs
         // 2 Commas
commit d1b0ba932b0a1c49647b7df528cd619cc425945e
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:18:20 2011 +0000

    cppcheck: Reduce variable scope in column3.cxx

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 2860931..9677111 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1277,7 +1277,6 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
             if (pParam)
                 aParam = *pParam;
 
-            double nVal;
             sal_uInt32 nIndex, nOldIndex = 0;
             sal_Unicode cFirstChar;
             if (!aParam.mpNumFormatter)
@@ -1314,6 +1313,7 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
                 pNewCell = new ScStringCell( rString.Copy(1) );
             else
             {
+                double nVal;
                 BOOL bIsText = FALSE;
                 if ( bIsLoading )
                 {
commit 271998ce3864b6104be3bccce24c4265a7f7b2cb
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:11:15 2011 +0000

    cppcheck: Reduce variable scope in filldlg.cxx

diff --git a/sc/source/ui/miscdlgs/filldlg.cxx b/sc/source/ui/miscdlgs/filldlg.cxx
index 4bbe7e0..bfdc927 100644
--- a/sc/source/ui/miscdlgs/filldlg.cxx
+++ b/sc/source/ui/miscdlgs/filldlg.cxx
@@ -234,7 +234,6 @@ void ScFillSeriesDlg::Init( USHORT nPossDir )
 BOOL ScFillSeriesDlg::CheckStartVal()
 {
     BOOL bValOk = FALSE;
-    sal_uInt32 nKey = 0;
     String aStr( aEdStartVal.GetText() );
 
     if ( aStr.Len() == 0 || aBtnAutoFill.IsChecked())
@@ -243,8 +242,10 @@ BOOL ScFillSeriesDlg::CheckStartVal()
         bValOk = TRUE;
     }
     else
+    {
+        sal_uInt32 nKey = 0;
         bValOk = rDoc.GetFormatTable()->IsNumberFormat( aStr, nKey, fStartVal );
-
+    }
     return bValOk;
 }
 
@@ -265,7 +266,6 @@ BOOL ScFillSeriesDlg::CheckIncrementVal()
 BOOL ScFillSeriesDlg::CheckEndVal()
 {
     BOOL	bValOk = FALSE;
-    sal_uInt32 nKey = 0;
     String	aStr( aEdEndVal.GetText() );
 
     if ( aStr.Len() == 0 )
@@ -274,8 +274,10 @@ BOOL ScFillSeriesDlg::CheckEndVal()
         bValOk  = TRUE;
     }
     else
+    {
+        sal_uInt32 nKey = 0;
         bValOk = rDoc.GetFormatTable()->IsNumberFormat( aStr, nKey, fEndVal );
-
+    }
     return bValOk;
 }
 
commit aa902f05795a2683d4b8ce646076388d45793c7c
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:09:23 2011 +0000

    cppcheck: Reduce variable scope in crnrdlg.cxx

diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index 1d84b6d..4f3e5c7 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -155,13 +155,6 @@ ScColRowNameRangesDlg::~ScColRowNameRangesDlg()
 
 void ScColRowNameRangesDlg::Init()
 {
-    SCCOL	nStartCol 	= 0;
-    SCROW	nStartRow 	= 0;
-    SCTAB	nStartTab 	= 0;
-    SCCOL	nEndCol 	= 0;
-    SCROW	nEndRow		= 0;
-    SCTAB	nEndTab 	= 0;
-
     aBtnOk.SetClickHdl		( LINK( this, ScColRowNameRangesDlg, OkBtnHdl ) );
     aBtnCancel.SetClickHdl	( LINK( this, ScColRowNameRangesDlg, CancelBtnHdl ) );
     aBtnAdd.SetClickHdl		( LINK( this, ScColRowNameRangesDlg, AddBtnHdl ) );
@@ -190,6 +183,12 @@ void ScColRowNameRangesDlg::Init()
 
     if ( pViewData && pDoc )
     {
+        SCCOL nStartCol = 0;
+        SCROW nStartRow = 0;
+        SCTAB nStartTab = 0;
+        SCCOL nEndCol   = 0;
+        SCROW nEndRow   = 0;
+        SCTAB nEndTab   = 0;
         pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
                                   nEndCol,	 nEndRow,  nEndTab );
         SetColRowData( ScRange( ScAddress( nStartCol, nStartRow, nStartTab ),
commit 241470f817c8d2a195cec56283ad35ed42778b40
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:07:21 2011 +0000

    cppcheck: Reduce variable scope in solverutil.cxx

diff --git a/sc/source/ui/miscdlgs/solverutil.cxx b/sc/source/ui/miscdlgs/solverutil.cxx
index f216864..05f1662 100644
--- a/sc/source/ui/miscdlgs/solverutil.cxx
+++ b/sc/source/ui/miscdlgs/solverutil.cxx
@@ -89,7 +89,6 @@ void ScSolverUtil::GetImplementations( uno::Sequence<rtl::OUString>& rImplNames,
 {
     rImplNames.realloc(0);      // clear
     rDescriptions.realloc(0);
-    sal_Int32 nCount = 0;
 
     uno::Reference<uno::XComponentContext> xCtx;
     uno::Reference<lang::XMultiServiceFactory> xMSF = comphelper::getProcessServiceFactory();
@@ -109,6 +108,7 @@ void ScSolverUtil::GetImplementations( uno::Sequence<rtl::OUString>& rImplNames,
                         xEnAc->createContentEnumeration( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SCSOLVER_SERVICE)) );
         if ( xEnum.is() )
         {
+            sal_Int32 nCount = 0;
             while ( xEnum->hasMoreElements() )
             {
                 uno::Any aAny = xEnum->nextElement();
commit e21ca0bdb0a26d6281a0aea345f3bf9f30d42533
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:05:21 2011 +0000

    cppcheck: Remove assignment to self in cell2.cxx

diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 82dd020..da7ac34 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -364,9 +364,6 @@ lcl_checkRangeDimensions(
 
     if (bOk && aCur == aEnd)
     {
-        bCol = bCol;
-        bRow = bRow;
-        bTab = bTab;
         return true;
     }
     return false;
commit ded4f6ac7c80940cab9e8beaec98b3b1e7da9679
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:02:49 2011 +0000

    cppcheck: Reduce variable scope in interpr5.cxx

diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index f398985..dfb2e11 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -3049,11 +3049,10 @@ void ScInterpreter::CalculateTrendGrowth(bool _bGrowth)
             return;
         }
         double fSlope = fSumXY / fSumX2;
-        double fIntercept = 0.0;
         double fHelp;
         if (bConstant)
         {
-            fIntercept = fMeanY - fSlope * fMeanX;
+            double fIntercept = fMeanY - fSlope * fMeanX;
             for (SCSIZE i = 0; i < nCountXN; i++)
             {
                 fHelp = pMatNewX->GetDouble(i)*fSlope + fIntercept;
commit f9ab1cea0c06080df3424f426b14ba3970cb8fee
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 18:01:17 2011 +0000

    cppcheck: Reduce variable scope in qproform.cxx

diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx
index 2853af3..369dacc 100644
--- a/sc/source/filter/qpro/qproform.cxx
+++ b/sc/source/filter/qpro/qproform.cxx
@@ -152,7 +152,6 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr
 
     if( nArgs> 0 )
     {
-        INT16 nNull = -1;
         INT16 nLast = nArgs- 1;
 
         if( eOc == ocZGZ )
@@ -161,6 +160,7 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr
             aPool << eParam[ 3 ] << ocSep << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ];
         else
         {
+            INT16 nNull = -1;
             aPool << eParam[ nLast ];
             for( nCount = nLast - 1 ; nCount >= 0 ; nCount-- )
             {
commit c6417aa8cc18ad57f9244bcc3128828bed70d67f
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 17:59:15 2011 +0000

    cppcheck: Reduce variable scope in documen8.cxx

diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index ffc41b6..a3d98ef 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -461,8 +461,6 @@ BOOL ScDocument::IdleCalcTextWidth()			// TRUE = demnaechst wieder versuchen
 // USHORT nIter = 0;
 
     const ULONG			nStart	 = Time::GetSystemTicks();
-    double				nPPTX	 = 0.0;
-    double 				nPPTY	 = 0.0;
     OutputDevice*		pDev	 = NULL;
     MapMode				aOldMap;
     ScStyleSheet*		pStyle	 = NULL;
@@ -473,8 +471,6 @@ BOOL ScDocument::IdleCalcTextWidth()			// TRUE = demnaechst wieder versuchen
     SCTAB				nTab  	 = aCurTextWidthCalcPos.Tab();
     SCROW				nRow   	 = aCurTextWidthCalcPos.Row();
     SCsCOL				nCol  	 = aCurTextWidthCalcPos.Col();
-    USHORT				nRestart = 0;
-    USHORT 				nZoom	 = 0;
     BOOL				bNeedMore= FALSE;
 
     if ( !ValidRow(nRow) )
@@ -504,6 +500,8 @@ BOOL ScDocument::IdleCalcTextWidth()			// TRUE = demnaechst wieder versuchen
     BOOL bProgress = FALSE;
     if ( pStyle && 0 == GET_SCALEVALUE(pStyle->GetItemSet(),ATTR_PAGE_SCALETOPAGES) )
     {
+        USHORT nRestart = 0;
+        USHORT nZoom = 0;
         USHORT nCount = 0;
 
         nZoom	 = GET_SCALEVALUE(pStyle->GetItemSet(),ATTR_PAGE_SCALE);
@@ -517,6 +515,8 @@ BOOL ScDocument::IdleCalcTextWidth()			// TRUE = demnaechst wieder versuchen
             {
                 if ( TEXTWIDTH_DIRTY ==	pCell->GetTextWidth() )
                 {
+                    double nPPTX = 0.0;
+                    double nPPTY = 0.0;
                     if ( !pDev )
                     {
                         pDev = GetPrinter();
commit dac2e907ed6bcd36d35ad0fd6d2a37057d877bda
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 15:57:42 2011 +0000

    cppcheck: Reduce variable scope in inputopt.cxx

diff --git a/sc/source/core/tool/inputopt.cxx b/sc/source/core/tool/inputopt.cxx
index 25ca758..1fba9fb 100644
--- a/sc/source/core/tool/inputopt.cxx
+++ b/sc/source/core/tool/inputopt.cxx
@@ -157,8 +157,6 @@ Sequence<OUString> ScInputCfg::GetPropertyNames()
 ScInputCfg::ScInputCfg() :
     ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM( CFGPATH_INPUT )) )
 {
-    sal_Int32 nIntVal = 0;
-
     Sequence<OUString> aNames = GetPropertyNames();
     Sequence<Any> aValues = GetProperties(aNames);
     EnableNotification(aNames);
@@ -171,6 +169,7 @@ ScInputCfg::ScInputCfg() :
             DBG_ASSERT(pValues[nProp].hasValue(), "property value missing");
             if(pValues[nProp].hasValue())
             {
+                sal_Int32 nIntVal = 0;
                 switch(nProp)
                 {
                     case SCINPUTOPT_MOVEDIR:
commit 30d5f8b47f0d778b65ed18aca0db853e54a0a9b7
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 15:03:42 2011 +0000

    cppcheck: Remove unread variable in tabvwshb.cxx

diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index a09e029..0977423 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -227,7 +227,6 @@ ErrCode ScTabViewShell::DoVerb(long nVerb)
         return ERRCODE_SO_NOTIMPL;			// soll nicht sein
 
     SdrOle2Obj* pOle2Obj = NULL;
-    SdrGrafObj* pGrafObj = NULL;
     SdrObject* pObj = NULL;
     ErrCode nErr = ERRCODE_NONE;
 
@@ -237,10 +236,6 @@ ErrCode ScTabViewShell::DoVerb(long nVerb)
         pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
         if (pObj->GetObjIdentifier() == OBJ_OLE2)
             pOle2Obj = (SdrOle2Obj*) pObj;
-        else if (pObj->GetObjIdentifier() == OBJ_GRAF)
-        {
-            pGrafObj = (SdrGrafObj*) pObj;
-        }
     }
 
     if (pOle2Obj)
commit 7d1635669c6fd03b21e4a7f83d05bb2611034413
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 14:29:24 2011 +0000

    cppcheck: Reduce variable scope in vbarange.cxx

diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 05567cf..445a08b 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -2378,14 +2378,11 @@ ScVbaRange::Activate() throw (uno::RuntimeException)
 uno::Reference< excel::XRange >
 ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
 {
-    SCROW nStartRow = 0;
-    SCROW nEndRow = 0;
-
-    sal_Int32 nValue = 0;
     rtl::OUString sAddress;
 
     if ( aIndex.hasValue() )
     {
+        sal_Int32 nValue = 0;
         ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
         ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
 
@@ -2400,8 +2397,8 @@ ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
             ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
             ScRange tmpRange;
             tmpRange.ParseRows( sAddress, excel::GetDocumentFromRange( mxRange ), dDetails );
-            nStartRow = tmpRange.aStart.Row();
-            nEndRow = tmpRange.aEnd.Row();
+            SCROW nStartRow = tmpRange.aStart.Row();
+            SCROW nEndRow = tmpRange.aEnd.Row();
 
             aRange.aStart.SetRow( aRange.aStart.Row() + nStartRow );
             aRange.aEnd.SetRow( aRange.aStart.Row() + ( nEndRow  - nStartRow ));
@@ -2424,10 +2421,6 @@ ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
 uno::Reference< excel::XRange >
 ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException)
 {
-    SCCOL nStartCol = 0;
-    SCCOL nEndCol = 0;
-
-    sal_Int32 nValue = 0;
     rtl::OUString sAddress;
 
     ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
@@ -2436,6 +2429,7 @@ ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException)
     ScRange aRange = *aCellRanges.front();
     if ( aIndex.hasValue() )
     {
+        sal_Int32 nValue = 0;
         if ( aIndex >>= nValue )
         {
             aRange.aStart.SetCol( aRange.aStart.Col() + static_cast< SCCOL > ( --nValue ) );
@@ -2447,8 +2441,8 @@ ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException)
             ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
             ScRange tmpRange;
             tmpRange.ParseCols( sAddress, excel::GetDocumentFromRange( mxRange ), dDetails );
-            nStartCol = tmpRange.aStart.Col();
-            nEndCol = tmpRange.aEnd.Col();
+            SCCOL nStartCol = tmpRange.aStart.Col();
+            SCCOL nEndCol = tmpRange.aEnd.Col();
 
             aRange.aStart.SetCol( aRange.aStart.Col() + nStartCol );
             aRange.aEnd.SetCol( aRange.aStart.Col() + ( nEndCol  - nStartCol ));
@@ -4901,12 +4895,12 @@ ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any
     }
 
     // Parse the value of parameter FieldInfo.
-    USHORT nCount = 0, nRealCount = 0;
+    USHORT nRealCount = 0;
     xub_StrLen* pColumns = NULL;
     BYTE* pFormats = NULL;
     if ( sFieldInfo.getLength() > 0 )
     {
-        nCount = sFieldInfo.getLength();
+        USHORT nCount = sFieldInfo.getLength();
         pColumns = new xub_StrLen[nCount];
         pFormats = new BYTE[nCount];
         USHORT nFormat = 1;
commit 9ea6186fb5b25e55c0947de773dd59b097959c8c
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 14:19:33 2011 +0000

    cppcheck: Remove unread variable in vbarange.cxx

diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index a67c68c..05567cf 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4493,14 +4493,10 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
     sal_Int32 nOperator = excel::XlAutoFilterOperator::xlAnd;
 
     sal_Bool bVisible = sal_True;
-    bool  bChangeDropDown = false;
     VisibleDropDown >>= bVisible;
 
-    if ( bVisible == bHasAuto ) // dropdown is displayed/notdisplayed as
-                                // required
+    if ( bVisible == bHasAuto ) // dropdown is displayed/notdisplayed as required
         bVisible = sal_False;
-    else
-        bChangeDropDown = true;
     sheet::FilterConnection nConn = sheet::FilterConnection_AND;
     double nCriteria1 = 0;
 
@@ -4652,7 +4648,6 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
         // this is just to toggle autofilter on and off ( not to be confused with
         // a VisibleDropDown option combined with a field, in that case just the
         // button should be disabled ) - currently we don't support that
-        bChangeDropDown = true;
         uno::Reference< beans::XPropertySet > xDBRangeProps( xDataBaseRange, uno::UNO_QUERY_THROW );
         if ( bHasAuto )
         {
commit fb4cb2eaf33ddc20b91b25b30531824ff1637dd5
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:57:13 2011 +0000

    cppcheck: Reduce variable scope in mvtabdlg.cxx

diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 02fdc27..3585be1 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -339,14 +339,13 @@ IMPL_LINK( ScMoveTableDlg, SelHdl, ListBox *, pLb )
     if ( pLb == &aLbDoc )
     {
         ScDocument* pDoc = GetSelectedDoc();
-        SCTAB      nLast  = 0;
         String      aName;
 
         aLbTable.Clear();
         aLbTable.SetUpdateMode( FALSE );
         if ( pDoc )
         {
-            nLast = pDoc->GetTableCount()-1;
+            SCTAB nLast = pDoc->GetTableCount()-1;
             for ( SCTAB i=0; i<=nLast; i++ )
             {
                 pDoc->GetName( i, aName );
commit 40811e3e6c7006120684a26438dff1a53061992b
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:51:40 2011 +0000

    cppcheck: Reduce variable scope in xicontent.cxx

diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index b6a84d4..95ca683 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -248,7 +248,6 @@ String XclImpHyperlink::ReadEmbeddedData( XclImpStream& rStrm )
 
     DBG_ASSERT( aGuid == XclTools::maGuidStdLink, "XclImpHyperlink::ReadEmbeddedData - unknown header GUID" );
 
-    sal_uInt16 nLevel = 0;                  // counter for level to climb down in path
     ::std::auto_ptr< String > xLongName;    // link / file name
     ::std::auto_ptr< String > xShortName;   // 8.3-representation of file name
     ::std::auto_ptr< String > xTextMark;    // text mark
@@ -278,6 +277,7 @@ String XclImpHyperlink::ReadEmbeddedData( XclImpStream& rStrm )
 
         if( aGuid == XclTools::maGuidFileMoniker )
         {
+            sal_uInt16 nLevel = 0; // counter for level to climb down in path
             rStrm >> nLevel;
             xShortName.reset( new String );
             lclAppendString32( *xShortName, rStrm, false );
commit 1a453815d3714bf2d5c0dd37ec8dc9fe7ec9403a
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:43:45 2011 +0000

    cppcheck: Reduce variable scope in table4.cxx

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 4db009a..297c169 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -232,7 +232,6 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
         {
             if (nCount > 1)
             {
-                long nCmpInc = 0;
                 double nVal;
                 Date aNullDate = *pDocument->GetFormatTable()->GetNullDate();
                 Date aDate1 = aNullDate;
@@ -243,6 +242,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                 aDate2 += (long)nVal;
                 if ( aDate1 != aDate2 )
                 {
+                    long nCmpInc = 0;
                     FillDateCmd eType;
                     long nDDiff = aDate2.GetDay()   - (long) aDate1.GetDay();
                     long nMDiff = aDate2.GetMonth() - (long) aDate1.GetMonth();
commit 86d77ed7260c446855c1be9eb57accffec929a5f
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:41:56 2011 +0000

    cppcheck: Reduce variable scope in interpr3.cxx

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 5d7e46f..7e49aa8 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -534,7 +534,6 @@ double lcl_getLanczosSum(double fZ)
     double fSumNum;
     double fSumDenom;
     int nI;
-    double fZInv;
     if (fZ<=1.0)
     {
         fSumNum = fNum[12];
@@ -550,7 +549,7 @@ double lcl_getLanczosSum(double fZ)
     else
     // Cancel down with fZ^12; Horner scheme with reverse coefficients
     {
-        fZInv = 1/fZ;
+        double fZInv = 1/fZ;
         fSumNum = fNum[0];
         fSumDenom = fDenom[0];
         for (nI = 1; nI <=12; ++nI)
@@ -693,7 +692,6 @@ double ScInterpreter::GetChiSqDistPDF(double fX, double fDF)
 {
     // you must ensure fDF is positive integer
     double fValue;
-    double fCount;
     if (fX <= 0.0)
         return 0.0; // see ODFF
     if (fDF*fX > 1391000.0)
@@ -703,6 +701,7 @@ double ScInterpreter::GetChiSqDistPDF(double fX, double fDF)
     }
     else // fDF is small in most cases, we can iterate
     {
+        double fCount;
         if (fmod(fDF,2.0)<0.5)
         {
             // even
@@ -732,7 +731,6 @@ void ScInterpreter::ScChiSqDist()
     BYTE nParamCount = GetByte();
     if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
         return;
-    double fX;
     bool bCumulative;
     if (nParamCount == 3)
         bCumulative = GetBool();
@@ -743,7 +741,7 @@ void ScInterpreter::ScChiSqDist()
         PushIllegalArgument();
     else
     {
-        fX = GetDouble();
+        double fX = GetDouble();
         if (bCumulative)
             PushDouble(GetChiSqDistCDF(fX,fDF));
         else
@@ -755,12 +753,11 @@ void ScInterpreter::ScGamma()
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGamma" );
     double x = GetDouble();
-    double fResult;
     if (x <= 0.0 && x == ::rtl::math::approxFloor(x))
         PushIllegalArgument();
     else
     {
-        fResult = GetGamma(x);
+        double fResult = GetGamma(x);
         if (nGlobalError)
         {
             PushError( nGlobalError);
@@ -1317,7 +1314,7 @@ void ScInterpreter::ScBinomDist()
         double p      = GetDouble();                    // p
         double n      = ::rtl::math::approxFloor(GetDouble());              // n
         double x      = ::rtl::math::approxFloor(GetDouble());              // x
-        double fFactor, q, fSum;
+        double fFactor, q;
         if (n < 0.0 || x < 0.0 || x > n || p < 0.0 || p > 1.0)
             PushIllegalArgument();
         else if (kum == 0.0)                        // Dichte
@@ -1351,6 +1348,7 @@ void ScInterpreter::ScBinomDist()
                 PushDouble(1.0);
             else
             {
+                double fSum;
                 q = 1.0 - p;
                 fFactor = pow(q, n);
                 if (fFactor == 0.0)
commit e3cc8172c908b4193e93f6ea785c1fbc5e9c07e6
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:30:03 2011 +0000

    cppcheck: Remove unused variable in test.cxx

diff --git a/sc/workben/test.cxx b/sc/workben/test.cxx
index 1c6ebf9..d98564b 100644
--- a/sc/workben/test.cxx
+++ b/sc/workben/test.cxx
@@ -1648,7 +1648,6 @@ IMPL_LINK(MyWindow, CountHdl, PushButton*, EMPTYARG)
 
 IMPL_LINK(MyWindow, TextHdl, PushButton*, EMPTYARG)
 {
-    USHORT nTab = 0;
     USHORT nCol = (USHORT)aColField.GetValue();
     USHORT nRow = (USHORT)aRowField.GetValue();
     USHORT nPos = (USHORT)aPosField.GetValue();
@@ -1660,8 +1659,9 @@ IMPL_LINK(MyWindow, TextHdl, PushButton*, EMPTYARG)
     XSpreadsheetDocumentRef xDoc = lcl_GetDocument();			// Calc-Model
     if (xDoc)
     {
+        USHORT nTab = 0;
         CellAddress aPos;
-        aPos.Sheet  = nTab;
+        aPos.Sheet  = 0;
         aPos.Column = nCol;
         aPos.Row    = nRow;
         XCellRef xCell = xDoc->getCell(aPos);
commit 19b3971ace5b9f39227397284d738c1cd822afa3
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:24:15 2011 +0000

    cppcheck: Reduce variable scope in inputwin.cxx

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 04d9261..b2308be 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1167,10 +1167,6 @@ void ScTextWnd::SetTextString( const String& rNewString )
 
         //	Position der Aenderung suchen, nur Rest painten
 
-        long nInvPos = 0;
-        long nStartPos = 0;
-        long nTextSize = 0;
-
         if (!pEditEngine)
         {
             BOOL bPaintAll;
@@ -1199,6 +1195,7 @@ void ScTextWnd::SetTextString( const String& rNewString )
             }
             else
             {
+                long nTextSize = 0;
                 xub_StrLen nDifPos;
                 if (rNewString.Len() > aString.Len())
                     nDifPos = rNewString.Match(aString);
@@ -1217,8 +1214,8 @@ void ScTextWnd::SetTextString( const String& rNewString )
 
                                                 // -1 wegen Rundung und "A"
                 Point aLogicStart = PixelToLogic(Point(TEXT_STARTPOS-1,0));
-                nStartPos = aLogicStart.X();
-                nInvPos = nStartPos;
+                long nStartPos = aLogicStart.X();
+                long nInvPos = nStartPos;
                 if (nDifPos)
                     nInvPos += GetTextWidth(aString,0,nDifPos);
 
commit 130de0900964c9f9ed9ffd50f2b0ad465e8ec2ea
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:19:00 2011 +0000

    cppcheck: Reduce variable scope in chartarr.cxx

diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index 4a4dd1b..70ad606 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -380,9 +380,6 @@ ScMemChart* ScChartArray::CreateMemChartMulti()
     SCSIZE nColCount = GetPositionMap()->GetColCount();
     SCSIZE nRowCount = GetPositionMap()->GetRowCount();
 
-    SCSIZE nCol = 0;
-    SCSIZE nRow = 0;
-
     // May happen at least with more than 32k rows.
     if (nColCount > SHRT_MAX || nRowCount > SHRT_MAX)
     {
@@ -410,6 +407,8 @@ ScMemChart* ScChartArray::CreateMemChartMulti()
             static_cast<short>(nColCount), static_cast<short>(nRowCount) );
     if (pMemChart)
     {
+        SCSIZE nCol = 0;
+        SCSIZE nRow = 0;
 //		pMemChart->SetNumberFormatter( pDocument->GetFormatTable() );
         BOOL bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown();
         ULONG nIndex = 0;
commit dd24e25bbb79e73c422979bc97d2cbfec996bb32
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:16:31 2011 +0000

    cppcheck: Reduce variable scope in dpobject.cxx

diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 0a8a629..3e43faf 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2308,7 +2308,6 @@ BOOL ScDPObject::HasRegisteredSources()
 //	static
 uno::Sequence<rtl::OUString> ScDPObject::GetRegisteredSources()
 {
-    long nCount = 0;
     uno::Sequence<rtl::OUString> aSeq(0);
 
     //	use implementation names...
@@ -2321,6 +2320,7 @@ uno::Sequence<rtl::OUString> ScDPObject::GetRegisteredSources()
                                         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCDPSOURCE_SERVICE )) );
         if ( xEnum.is() )
         {
+            long nCount = 0;
             while ( xEnum->hasMoreElements() )
             {
                 uno::Any aAddInAny = xEnum->nextElement();
commit 1f88baf9870ac2213d297b3705e7f1fcd53de4b3
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:14:20 2011 +0000

    cppcheck: Reduce variable scope in detfunc.cxx

diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 22a341e..4138e87 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -702,10 +702,10 @@ void ScDetectiveFunc::DeleteArrowsAt( SCCOL nCol, SCROW nRow, BOOL bDestPnt )
 
     pPage->RecalcObjOrdNums();
 
-    long	nDelCount = 0;
-    ULONG	nObjCount = pPage->GetObjCount();
+    ULONG nObjCount = pPage->GetObjCount();
     if (nObjCount)
     {
+        long nDelCount = 0;
         SdrObject** ppObj = new SdrObject*[nObjCount];
 
         SdrObjListIter aIter( *pPage, IM_FLAT );
@@ -777,10 +777,10 @@ void ScDetectiveFunc::DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nR
 
     pPage->RecalcObjOrdNums();
 
-    long	nDelCount = 0;
-    ULONG	nObjCount = pPage->GetObjCount();
+    ULONG nObjCount = pPage->GetObjCount();
     if (nObjCount)
     {
+        long nDelCount = 0;
         SdrObject** ppObj = new SdrObject*[nObjCount];
 
         SdrObjListIter aIter( *pPage, IM_FLAT );
commit bd1c850cfafe7fe854e289195cffea8f4d7df514
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 13:04:54 2011 +0000

    cppcheck: Reduce variable scope in inputhdl.cxx

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index e1426a6..37535f0 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -748,7 +748,6 @@ void ScInputHandler::ShowTipCursor()
         String aFormula = pEngine->GetText( (USHORT) 0 );
         ESelection aSel = pActiveView->GetSelection();
         aSel.Adjust();
-        xub_StrLen  nLeftParentPos = 0;
         if( aSel.nEndPos )
         {
             if ( aFormula.Len() < aSel.nEndPos )
@@ -767,7 +766,7 @@ void ScInputHandler::ShowTipCursor()
             while( !bFound )
             {
                 aSelText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) );
-                nLeftParentPos = lcl_MatchParenthesis( aSelText, aSelText.Len()-1 );
+                xub_StrLen nLeftParentPos = lcl_MatchParenthesis( aSelText, aSelText.Len()-1 );
                 if( nLeftParentPos != STRING_NOTFOUND )
                 {
                     sal_Unicode c = ( nLeftParentPos > 0 ) ? aSelText.GetChar( nLeftParentPos-1 ) : 0;
@@ -781,17 +780,12 @@ void ScInputHandler::ShowTipCursor()
                             nArgPos = aHelper.GetArgStart( aSelText, nNextFStart, 0 );
                             nArgs = static_cast<USHORT>(ppFDesc->getParameterCount());
 
-                            USHORT nActive = 0;
-                            USHORT nCount = 0;
-                            USHORT nCountSemicolon = 0;
-                            USHORT nCountDot = 0;
-                            USHORT nStartPosition = 0;
-                            USHORT nEndPosition = 0;
                             BOOL   bFlag = FALSE;
                             String aNew;
                             USHORT nParAutoPos = SCPOS_INVALID;
                             if( pFormulaDataPara->FindText( ppFDesc->getFunctionName(), aNew, nParAutoPos, FALSE ) )
                             {
+                                USHORT nActive = 0;
                                 for( USHORT i=0; i < nArgs; i++ )
                                 {
                                     xub_StrLen nLength = static_cast<xub_StrLen>(aArgs[i].getLength());
@@ -804,8 +798,10 @@ void ScInputHandler::ShowTipCursor()
                                 }
                                 if( bFlag )
                                 {
-                                    nCountSemicolon = aNew.GetTokenCount(cSep)-1;
-                                    nCountDot = aNew.GetTokenCount(cSheetSep)-1;
+                                    USHORT nCountSemicolon = aNew.GetTokenCount(cSep)-1;
+                                    USHORT nCountDot = aNew.GetTokenCount(cSheetSep)-1;
+                                    USHORT nStartPosition = 0;
+                                    USHORT nEndPosition = 0;
 
                                     if( !nCountSemicolon )
                                     {
@@ -820,6 +816,7 @@ void ScInputHandler::ShowTipCursor()
                                     }
                                     else if( !nCountDot )
                                     {
+                                        USHORT nCount = 0;
                                         for( USHORT i = 0; i < aNew.Len(); i++ )
                                         {
                                             sal_Unicode cNext = aNew.GetChar( i );
@@ -841,6 +838,7 @@ void ScInputHandler::ShowTipCursor()
                                     }
                                     else
                                     {
+                                        USHORT nCount = 0;
                                         for( USHORT i = 0; i < aNew.Len(); i++ )
                                         {
                                             sal_Unicode cNext = aNew.GetChar( i );
@@ -1026,17 +1024,12 @@ void ScInputHandler::UseFormulaData()
                         nArgPos = aHelper.GetArgStart( aFormula, nNextFStart, 0 );
                         nArgs = static_cast<USHORT>(ppFDesc->getParameterCount());
 
-                        USHORT nActive = 0;
-                        USHORT nCount = 0;
-                        USHORT nCountSemicolon = 0;
-                        USHORT nCountDot = 0;
-                        USHORT nStartPosition = 0;
-                        USHORT nEndPosition = 0;
                         BOOL   bFlag = FALSE;
                         String aNew;
                         USHORT nParAutoPos = SCPOS_INVALID;
                         if( pFormulaDataPara->FindText( ppFDesc->getFunctionName(), aNew, nParAutoPos, FALSE ) )
                         {
+                            USHORT nActive = 0;
                             for( USHORT i=0; i < nArgs; i++ )
                             {
                                 xub_StrLen nLength = static_cast<xub_StrLen>(aArgs[i].getLength());
@@ -1049,8 +1042,10 @@ void ScInputHandler::UseFormulaData()
                             }
                             if( bFlag )
                             {
-                                nCountSemicolon = aNew.GetTokenCount(cSep)-1;
-                                nCountDot = aNew.GetTokenCount(cSheetSep)-1;
+                                USHORT nCountSemicolon = aNew.GetTokenCount(cSep)-1;
+                                USHORT nCountDot = aNew.GetTokenCount(cSheetSep)-1;
+                                USHORT nStartPosition = 0;
+                                USHORT nEndPosition = 0;
 
                                if( !nCountSemicolon )
                                {
@@ -1065,6 +1060,7 @@ void ScInputHandler::UseFormulaData()
                                 }
                                 else if( !nCountDot )
                                 {
+                                    USHORT nCount = 0;
                                     for( USHORT i = 0; i < aNew.Len(); i++ )
                                     {
                                         sal_Unicode cNext = aNew.GetChar( i );
@@ -1086,6 +1082,7 @@ void ScInputHandler::UseFormulaData()
                                 }
                                 else
                                 {
+                                    USHORT nCount = 0;
                                     for( USHORT i = 0; i < aNew.Len(); i++ )
                                     {
                                         sal_Unicode cNext = aNew.GetChar( i );
commit daccdbeb238877687c5a1be2021efc0cba2b7f18
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 12:00:58 2011 +0000

    cppcheck: Remove unused variable in docsh4.cxx

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 5f00089..99b79b3 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2092,7 +2092,6 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog,
             long nTabStart = 0;
             long nDisplayStart = 0;
             long nAttrPage = 1;
-            long nPrinted = 0;
 
             for ( SCTAB nTab=0; nTab<nTabCount; nTab++ )
             {
@@ -2113,7 +2112,7 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog,
 
                     ScPrintFunc aPrintFunc( this, pPrinter, nTab, nAttrPage, nTotalPages, pMarkedRange, &aOptions );
                     aPrintFunc.SetDrawView( pDrawView );
-                    nPrinted += aPrintFunc.DoPrint( aPageRanges, nTabStart, nDisplayStart, TRUE, &rProgress, NULL );
+                    aPrintFunc.DoPrint( aPageRanges, nTabStart, nDisplayStart, TRUE, &rProgress, NULL );
 
                     nTabStart += aPageArr[nTab];
                     if ( aDocument.NeedPageResetAfterTab(nTab) )
commit cf35feb618667f28952120e72358cdcba287dbcc
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 11:58:12 2011 +0000

    cppcheck: Remove unread variable in documen3.cxx

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 4de92be..fcbfdcc 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -477,9 +477,9 @@ void ScDocument::MarkUsedExternalReferences()
     if (!pExternalRefMgr->hasExternalData())
         return;
     // Charts.
-    bool bAllMarked = pExternalRefMgr->markUsedByLinkListeners();
+    pExternalRefMgr->markUsedByLinkListeners();
     // Formula cells.
-    bAllMarked = pExternalRefMgr->markUsedExternalRefCells();
+    pExternalRefMgr->markUsedExternalRefCells();
 
     /* NOTE: Conditional formats and validation objects are marked when
      * collecting them during export. */
commit a66a4675ccfa9d0938581408ae64ff04013a4abd
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 11:40:37 2011 +0000

    cppcheck: Remove unread variable in colrowst.cxx

diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index b6e310f..2a27b08 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -242,7 +242,6 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
     RowFlagsType::const_iterator itrFlags = maRowFlags.begin(), itrFlagsEnd = maRowFlags.end();
     SCROW nPrevRow = -1;
     sal_uInt8 nPrevFlags = 0;
-    sal_uInt16 nPrevHeight = 0;
     for (; itrFlags != itrFlagsEnd; ++itrFlags)
     {
         SCROW nRow = itrFlags->first;
@@ -274,7 +273,6 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
 
                         rDoc.SetRowHeightOnly(i, nLast-1, nScTab, nHeight);
                         i = nLast-1;
-                        nPrevHeight = nHeight;
                     }
                 }
 
@@ -286,7 +284,6 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
                 nHeight = mnDefHeight;
                 rDoc.SetRowHeightOnly(nPrevRow, nRow-1, nScTab, nHeight);
             }
-            nPrevHeight = nHeight;
         }
 
         nPrevRow = nRow;
commit d0d6d2f30f80d753e0f48a75e8dbc1e9ff828dda
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date:   Tue Jan 4 11:35:53 2011 +0000

    cppcheck: Reduce variable scope in drwlayer.cxx

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index cbb2f04..cf9cc51 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1213,10 +1213,10 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
 
     pPage->RecalcObjOrdNums();
 
-    long	nDelCount = 0;
     ULONG	nObjCount = pPage->GetObjCount();
     if (nObjCount)
     {
+        long nDelCount = 0;
         Rectangle aDelRect = pDoc->GetMMRect( nCol1, nRow1, nCol2, nRow2, nTab );
 
         SdrObject** ppObj = new SdrObject*[nObjCount];
@@ -1269,10 +1269,10 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
             if (pPage)
             {
                 pPage->RecalcObjOrdNums();
-                long	nDelCount = 0;
                 ULONG	nObjCount = pPage->GetObjCount();
                 if (nObjCount)
                 {
+                    long nDelCount = 0;
                     //	Rechteck um die ganze Selektion
                     Rectangle aMarkBound = pDoc->GetMMRect(
                                 aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),


More information about the Libreoffice-commits mailing list