summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-09-30 09:37:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-09-30 12:36:51 +0200
commitb29ec8b26bddc03661c527b603863d9e738d1210 (patch)
tree829f01d36d867f717d4a3c9373842510bbc76e77 /sc/source
parent9373320fc88c1582a2ad25bda9c5264c7c58a97e (diff)
loplugin:reducevarscope in sc
Change-Id: If88c71351fb157b8eab242fceb65422f05eec3d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103645 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen2.cxx3
-rw-r--r--sc/source/core/data/formulacell.cxx6
-rw-r--r--sc/source/core/data/table4.cxx2
-rw-r--r--sc/source/core/tool/interpr1.cxx9
-rw-r--r--sc/source/core/tool/interpr4.cxx9
-rw-r--r--sc/source/core/tool/interpr7.cxx3
-rw-r--r--sc/source/core/tool/rangeutl.cxx8
-rw-r--r--sc/source/filter/excel/excform.cxx2
-rw-r--r--sc/source/filter/excel/xiescher.cxx8
-rw-r--r--sc/source/filter/excel/xistyle.cxx4
-rw-r--r--sc/source/filter/excel/xiview.cxx4
-rw-r--r--sc/source/filter/lotus/lotform.cxx4
-rw-r--r--sc/source/filter/lotus/op.cxx3
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx2
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx6
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx3
-rw-r--r--sc/source/ui/app/drwtrans.cxx4
-rw-r--r--sc/source/ui/app/seltrans.cxx2
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx3
-rw-r--r--sc/source/ui/dbgui/scuiimoptdlg.cxx3
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx2
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2
-rw-r--r--sc/source/ui/docshell/docsh8.cxx2
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx4
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx3
-rw-r--r--sc/source/ui/drawfunc/drawsh5.cxx6
-rw-r--r--sc/source/ui/formdlg/dwfunctr.cxx3
-rw-r--r--sc/source/ui/miscdlgs/solverutil.cxx2
-rw-r--r--sc/source/ui/undo/undoblk.cxx2
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx3
-rw-r--r--sc/source/ui/unoobj/datauno.cxx2
-rw-r--r--sc/source/ui/unoobj/textuno.cxx3
-rw-r--r--sc/source/ui/vba/vbafiledialog.cxx2
-rw-r--r--sc/source/ui/vba/vbapagesetup.cxx4
-rw-r--r--sc/source/ui/vba/vbarange.cxx16
-rw-r--r--sc/source/ui/view/cellsh1.cxx9
-rw-r--r--sc/source/ui/view/cellsh3.cxx2
-rw-r--r--sc/source/ui/view/drawvie4.cxx3
-rw-r--r--sc/source/ui/view/editsh.cxx5
-rw-r--r--sc/source/ui/view/formatsh.cxx4
-rw-r--r--sc/source/ui/view/output.cxx3
-rw-r--r--sc/source/ui/view/output2.cxx2
-rw-r--r--sc/source/ui/view/tabview.cxx12
-rw-r--r--sc/source/ui/view/tabvwshf.cxx3
-rw-r--r--sc/source/ui/view/viewfun2.cxx2
-rw-r--r--sc/source/ui/view/viewfunc.cxx5
47 files changed, 83 insertions, 113 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index e2efd10d7fc0..cd94e819d231 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1210,10 +1210,9 @@ bool ScDocument::IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBorder
const ScChangeAction* pAction = pTrack->GetFirst();
while (pAction)
{
- ScChangeActionType eType;
if ( pAction->IsVisible() )
{
- eType = pAction->GetType();
+ ScChangeActionType eType = pAction->GetType();
const ScBigRange& rBig = pAction->GetBigRange();
if ( rBig.aStart.Tab() == cell.Tab())
{
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 370434367cb3..0e2c211f26bf 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1711,10 +1711,9 @@ bool ScFormulaCell::Interpret(SCROW nStartOffset, SCROW nEndOffset)
/* TODO: does this even make sense anymore? The last cell
* added above with rRecursionHelper.Insert() should always
* be 'this', shouldn't it? */
- ScFormulaCell* pLastCell = nullptr;
if (rRecursionHelper.GetList().size() > 1)
{
- pLastCell = rRecursionHelper.GetList().back().pCell;
+ ScFormulaCell* pLastCell = rRecursionHelper.GetList().back().pCell;
if (pLastCell != this)
{
rDocument.IncInterpretLevel();
@@ -2128,7 +2127,6 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
StackVar eNewCellResultType = aNewResult.GetCellResultType();
if (eNewCellResultType != svError || cMatrixFlag == ScMatrixMode::Reference)
{
- double fVal;
if (eNewCellResultType != svDouble)
{
bSetFormat = false;
@@ -2136,7 +2134,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
}
else
{
- fVal = aNewResult.GetDouble();
+ double fVal = aNewResult.GetDouble();
if (fVal != 1.0 && fVal != 0.0)
{
bSetFormat = false;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 23175efdcfb2..f6058d51c921 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -2035,7 +2035,6 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
else if (!bOverflow)
{
nStringValue = static_cast<sal_Int32>(nVal);
- OUString aStr;
if ( nHeadNoneTail < 0 )
{
setSuffixCell(
@@ -2045,6 +2044,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
else
{
+ OUString aStr;
if (nHeadNoneTail == 2 && nStringValue >= 0) // Put back the '+'
aStr = aValue + "+";
else
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 65254b7f4a39..42bdee5716f9 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3346,7 +3346,7 @@ void ScInterpreter::ScNumberValue()
return;
OUString aInputString;
- OUString aDecimalSeparator, aGroupSeparator;
+ OUString aGroupSeparator;
sal_Unicode cDecimalSeparator = 0;
if ( nParamCount == 3 )
@@ -3354,7 +3354,7 @@ void ScInterpreter::ScNumberValue()
if ( nParamCount >= 2 )
{
- aDecimalSeparator = GetString().getString();
+ OUString aDecimalSeparator = GetString().getString();
if ( aDecimalSeparator.getLength() == 1 )
cDecimalSeparator = aDecimalSeparator[ 0 ];
else
@@ -5877,13 +5877,12 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf
const ScComplexRefData* pRefData = pMainRangeToken->GetDoubleRef();
if (!pRefData->IsDeleted())
{
- ScRange aSubRange;
DoubleRefToRange( *pRefData, aMainRange);
if (aMainRange.aStart.Tab() == aMainRange.aEnd.Tab())
{
// Shrink the range to actual data content.
- aSubRange = aMainRange;
+ ScRange aSubRange = aMainRange;
mrDoc.GetDataAreaSubrange(aSubRange);
nStartColDiff = aSubRange.aStart.Col() - aMainRange.aStart.Col();
@@ -7229,10 +7228,10 @@ void ScInterpreter::CalculateLookup(bool bHLookup)
SCTAB nTab1 = 0;
SCCOL nCol2 = 0;
SCROW nRow2 = 0;
- SCTAB nTab2;
StackVar eType = GetStackType();
if (eType == svDoubleRef)
{
+ SCTAB nTab2;
PopDoubleRef(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
if (nTab1 != nTab2)
{
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 0d39921474f8..b9d34cd080a6 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3447,7 +3447,7 @@ void ScInterpreter::ScMacro()
sal_Int32 nDim = pDimArray ? pDimArray->GetDims32() : 0;
if ( 1 <= nDim && nDim <= 2 )
{
- sal_Int32 nCs, nCe, nRs, nRe;
+ sal_Int32 nCs, nCe, nRs;
SCSIZE nC, nR;
SCCOL nColIdx;
SCROW nRowIdx;
@@ -3462,6 +3462,7 @@ void ScInterpreter::ScMacro()
}
else
{ // array( rows, cols )
+ sal_Int32 nRe;
pDimArray->GetDim32( 1, nRs, nRe );
nR = static_cast<SCSIZE>(nRe - nRs + 1);
pDimArray->GetDim32( 2, nCs, nCe );
@@ -3711,10 +3712,9 @@ void ScInterpreter::ScColRowNameAuto()
// maybe get previous limit by using defined ColRowNameRange
if (aAbs.aEnd.Row() > nRow2)
aAbs.aEnd.SetRow(nRow2);
- SCROW nMyRow;
if ( aPos.Col() == nStartCol )
{
- nMyRow = aPos.Row();
+ SCROW nMyRow = aPos.Row();
if ( nStartRow <= nMyRow && nMyRow <= aAbs.aEnd.Row())
{ //Formula in the same column and within the range
if ( nMyRow == nStartRow )
@@ -3737,10 +3737,9 @@ void ScInterpreter::ScColRowNameAuto()
// maybe get previous limit by using defined ColRowNameRange
if (aAbs.aEnd.Col() > nCol2)
aAbs.aEnd.SetCol(nCol2);
- SCCOL nMyCol;
if ( aPos.Row() == nStartRow )
{
- nMyCol = aPos.Col();
+ SCCOL nMyCol = aPos.Col();
if (nStartCol <= nMyCol && nMyCol <= aAbs.aEnd.Col())
{ //Formula in the same column and within the range
if ( nMyCol == nStartCol )
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index bbf640a620fa..40fae3f3a9d0 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -46,7 +46,6 @@ void ScInterpreter::ScFilterXML()
return;
SCSIZE nMatCols = 1, nMatRows = 1, nNode = 0;
- const ScMatrix* pPathMatrix = nullptr;
// In array/matrix context node elements' results are to be
// subsequently stored. Check this before obtaining any argument from
// the stack so the stack type can be used.
@@ -76,7 +75,7 @@ void ScInterpreter::ScFilterXML()
}
else if (GetStackType() == formula::svMatrix)
{
- pPathMatrix = pStack[sp-1]->GetMatrix();
+ const ScMatrix* pPathMatrix = pStack[sp-1]->GetMatrix();
if (!pPathMatrix)
{
PushIllegalParameter();
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 1530fddcea19..39c4a1a26f58 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -109,8 +109,6 @@ bool ScRangeUtil::IsAbsTabArea( const OUString& rAreaStr,
bool bStrOk = false;
OUString aTempAreaStr(rAreaStr);
- OUString aStartPosStr;
- OUString aEndPosStr;
if ( -1 == aTempAreaStr.indexOf(':') )
{
@@ -123,13 +121,13 @@ bool ScRangeUtil::IsAbsTabArea( const OUString& rAreaStr,
&& -1 != aTempAreaStr.indexOf('.') )
{
ScRefAddress aStartPos;
- ScRefAddress aEndPos;
- aStartPosStr = aTempAreaStr.copy( 0, nColonPos );
- aEndPosStr = aTempAreaStr.copy( nColonPos+1 );
+ OUString aStartPosStr = aTempAreaStr.copy( 0, nColonPos );
+ OUString aEndPosStr = aTempAreaStr.copy( nColonPos+1 );
if ( ConvertSingleRef( *pDoc, aStartPosStr, 0, aStartPos, rDetails ) )
{
+ ScRefAddress aEndPos;
if ( ConvertSingleRef( *pDoc, aEndPosStr, aStartPos.Tab(), aEndPos, rDetails ) )
{
aStartPos.SetRelCol( false );
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 020f185a2d58..f1374e2d5c12 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -45,7 +45,6 @@ void ImportExcel::Formula25()
XclAddress aXclPos;
sal_uInt16 nXF = 0, nFormLen;
double fCurVal;
- sal_uInt8 nFlag0;
bool bShrFmla;
aIn >> aXclPos;
@@ -61,6 +60,7 @@ void ImportExcel::Formula25()
}
else
{// BIFF5
+ sal_uInt8 nFlag0;
nXF = aIn.ReaduInt16();
fCurVal = aIn.ReadDouble();
nFlag0 = aIn.ReaduInt8();
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index e589b25c33f0..0aff723b16b4 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -474,10 +474,10 @@ SdrObjectUniquePtr XclImpDrawObjBase::CreateSdrObject( XclImpDffConverter& rDffC
if( mnObjType == 7 || (mnObjType < 25 && mnObjType > 10) )//TBX
{
- //Need summary type for export. Detail type(checkbox, button ...) has been contained by mnObjType
- const sal_Int16 nTBXControlType = eCreateFromMSTBXControl ;
try
{
+ //Need summary type for export. Detail type(checkbox, button ...) has been contained by mnObjType
+ const sal_Int16 nTBXControlType = eCreateFromMSTBXControl ;
xPropSet->setPropertyValue(sPropertyName, Any(nTBXControlType));
}
catch(const Exception&)
@@ -492,9 +492,9 @@ SdrObjectUniquePtr XclImpDrawObjBase::CreateSdrObject( XclImpDffConverter& rDffC
const XclImpPictureObj* const pObj = dynamic_cast< const XclImpPictureObj* const >(this);
if( pObj != nullptr && pObj->IsOcxControl() )
{
- const sal_Int16 nOCXControlType = eCreateFromMSOCXControl;
try
{
+ const sal_Int16 nOCXControlType = eCreateFromMSOCXControl;
xPropSet->setPropertyValue(sPropertyName, Any(nOCXControlType));
//Detail type(checkbox, button ...)
xPropSet->setPropertyValue(sObjIdPropertyName, makeAny<sal_uInt16>(mnObjId));
@@ -3474,11 +3474,11 @@ SdrObjectUniquePtr XclImpDffConverter::CreateSdrObject( const XclImpPictureObj&
if( GetConvData().mxCtrlForm.is() )
{
Reference< XFormComponent > xFComp;
- css::awt::Size aSz; // not used in import
ReadOCXCtlsStream( mxCtlsStrm, xFComp, rPicObj.GetCtlsStreamPos(), rPicObj.GetCtlsStreamSize() );
// recreate the method formerly known as ReadOCXExcelKludgeStream()
if ( xFComp.is() )
{
+ css::awt::Size aSz; // not used in import
ScfPropertySet aPropSet( xFComp );
aPropSet.SetStringProperty( "Name", rPicObj.GetObjName() );
InsertControl( xFComp, aSz,&xShape,true);
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 873d3c30da87..4477f55b9e0b 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -701,12 +701,12 @@ void XclImpNumFmtBuffer::CreateScFormats()
for( const auto& [rXclNumFmt, rNumFmt] : GetFormatMap() )
{
// insert/convert the Excel number format
- sal_Int32 nCheckPos;
- SvNumFormatType nType = SvNumFormatType::DEFINED;
sal_uInt32 nKey;
if( !rNumFmt.maFormat.isEmpty() )
{
OUString aFormat( rNumFmt.maFormat );
+ sal_Int32 nCheckPos;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
rFormatter.PutandConvertEntry( aFormat, nCheckPos,
nType, nKey, LANGUAGE_ENGLISH_US, rNumFmt.meLanguage, false);
}
diff --git a/sc/source/filter/excel/xiview.cxx b/sc/source/filter/excel/xiview.cxx
index 29674e896bc6..11c698c4fdf1 100644
--- a/sc/source/filter/excel/xiview.cxx
+++ b/sc/source/filter/excel/xiview.cxx
@@ -105,14 +105,12 @@ void XclImpTabViewSettings::ReadTabBgColor( XclImpStream& rStrm, const XclImpPal
return;
sal_uInt8 ColorIndex;
- Color TabBgColor;
rStrm.Ignore( 16 );
ColorIndex = rStrm.ReaduInt8() & EXC_SHEETEXT_TABCOLOR; //0x7F
if ( ColorIndex >= 8 && ColorIndex <= 63 ) //only accept valid index values
{
- TabBgColor = rPal.GetColor( ColorIndex );
- maData.maTabBgColor = TabBgColor;
+ maData.maTabBgColor = rPal.GetColor( ColorIndex );
}
}
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index 11d231443111..facccd1755a3 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -39,7 +39,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nCnt, const char* pExtString )
{
TokenId eParam[ 256 ];
sal_Int32 nPass;
- TokenId nBuf0, nBuf1;
+ TokenId nBuf0;
bool bAddIn = false;
@@ -234,7 +234,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nCnt, const char* pExtString )
}
else if( eOc == ocFind )
{
- nBuf1 = aPool.Store();
+ TokenId nBuf1 = aPool.Store();
DecToken( nBuf1 );
aPool << nBuf1;
}
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 4ffa17facae1..ea34c537e970 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -521,7 +521,7 @@ void OP_VerAlign123(LotusContext& /*rContext*/, sal_uInt8 nAlignPattern, SfxItem
void OP_CreatePattern123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
{
- sal_uInt16 nCode,nPatternId;
+ sal_uInt16 nCode;
ScPatternAttr aPattern(rContext.rDoc.GetPool());
SfxItemSet& rItemSet = aPattern.GetItemSet();
@@ -531,6 +531,7 @@ void OP_CreatePattern123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
if ( nCode == 0x0fd2 )
{
+ sal_uInt16 nPatternId;
r.ReadUInt16( nPatternId );
sal_uInt8 Hor_Align, Ver_Align, temp;
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 80a7df04c489..ef952278e0eb 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1227,7 +1227,6 @@ void transformURL(const OUString& rOldURL, OUString& rNewURL, const ScDocument&
OUString aAddressString = aURL.copy(1);
ScRange aRange;
- ScAddress aAddress;
ScRefFlags nResult = parseRange(aAddressString, aRange, rDoc);
if ( nResult & ScRefFlags::VALID )
{
@@ -1237,6 +1236,7 @@ void transformURL(const OUString& rOldURL, OUString& rNewURL, const ScDocument&
}
else
{
+ ScAddress aAddress;
nResult = parseAddress(aAddressString, aAddress, rDoc);
if( nResult & ScRefFlags::VALID )
{
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 18d94fec4e11..9c8dff177c95 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3348,7 +3348,6 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
{
uno::Reference < beans::XPropertySet > xShapeProps ( xShape, uno::UNO_QUERY );
bool bIsChart( false );
- OUString sPropCLSID ("CLSID");
if (xShapeProps.is())
{
sal_Int32 nZOrder = 0;
@@ -3357,6 +3356,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
AddAttribute(XML_NAMESPACE_DRAW, XML_ZINDEX, OUString::number(nZOrder));
}
uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xShapeProps->getPropertySetInfo();
+ OUString sPropCLSID ("CLSID");
if( xPropSetInfo->hasPropertyByName( sPropCLSID ) )
{
OUString sCLSID;
@@ -3546,11 +3546,11 @@ void ScXMLExport::WriteAreaLink( const ScMyCell& rMyCell )
AddAttribute( XML_NAMESPACE_TABLE, XML_FILTER_NAME, rAreaLink.sFilter );
if( !rAreaLink.sFilterOptions.isEmpty() )
AddAttribute( XML_NAMESPACE_TABLE, XML_FILTER_OPTIONS, rAreaLink.sFilterOptions );
- OUStringBuffer sValue;
AddAttribute( XML_NAMESPACE_TABLE, XML_LAST_COLUMN_SPANNED, OUString::number(rAreaLink.GetColCount()) );
AddAttribute( XML_NAMESPACE_TABLE, XML_LAST_ROW_SPANNED, OUString::number(rAreaLink.GetRowCount()) );
if( rAreaLink.nRefresh )
{
+ OUStringBuffer sValue;
::sax::Converter::convertDuration( sValue,
static_cast<double>(rAreaLink.nRefresh) / 86400 );
AddAttribute( XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, sValue.makeStringAndClear() );
@@ -3819,7 +3819,6 @@ void ScXMLExport::WriteCalculationSettings(const uno::Reference <sheet::XSpreads
}
if (bIsIterationEnabled || nIterationCount != 100 || !::rtl::math::approxEqual(fIterationEpsilon, 0.001))
{
- OUStringBuffer sBuffer;
if (bIsIterationEnabled)
AddAttribute(XML_NAMESPACE_TABLE, XML_STATUS, XML_ENABLE);
if (nIterationCount != 100)
@@ -3828,6 +3827,7 @@ void ScXMLExport::WriteCalculationSettings(const uno::Reference <sheet::XSpreads
}
if (!::rtl::math::approxEqual(fIterationEpsilon, 0.001))
{
+ OUStringBuffer sBuffer;
::sax::Converter::convertDouble(sBuffer,
fIterationEpsilon);
AddAttribute(XML_NAMESPACE_TABLE, XML_MAXIMUM_DIFFERENCE, sBuffer.makeStringAndClear());
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index ee0d01811856..c476df1955d5 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -742,7 +742,6 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
xStorage = pMedium->GetOutputStorage();
OUString sFileName;
- OUString sTextMediaType("text/xml");
if (pMedium)
sFileName = pMedium->GetName();
SfxObjectShell* pObjSh = rDoc.GetDocumentShell();
@@ -807,6 +806,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
}
}
+ OUString sTextMediaType("text/xml");
bool bMetaRet(pObjSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED);
bool bStylesRet (false);
bool bDocRet(false);
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 41539ea93faf..a4cf3d25e241 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1010,7 +1010,6 @@ bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawing::X
}
const SdrMarkList* pMarkList = nullptr;
SdrObject* pMarkedObj = nullptr;
- SdrObject* pUpObj = nullptr;
bool bIsFocuseMarked = true;
if( mpViewShell && mnShapesSelected == 1 && bWinFocus)
{
@@ -1040,7 +1039,7 @@ bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawing::X
if( pMarkedObj )
{
uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY);
- pUpObj = pMarkedObj->getParentSdrObjectFromSdrObject();
+ SdrObject* pUpObj = pMarkedObj->getParentSdrObjectFromSdrObject();
if( pMarkedObj == pFocusedObj && pUpObj )
{
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 3149fd1251cc..5aa2d53aa6a7 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -125,8 +125,6 @@ ScDrawTransferObj::ScDrawTransferObj( std::unique_ptr<SdrModel> pClipModel, ScDo
uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
OUString sPropButtonType( "ButtonType" );
- OUString sPropTargetURL( "TargetURL" );
- OUString sPropLabel( "Label" );
if(xInfo->hasPropertyByName( sPropButtonType ))
{
@@ -135,6 +133,7 @@ ScDrawTransferObj::ScDrawTransferObj( std::unique_ptr<SdrModel> pClipModel, ScDo
if ( (aAny >>= eTmp) && eTmp == form::FormButtonType_URL )
{
// URL
+ OUString sPropTargetURL( "TargetURL" );
if(xInfo->hasPropertyByName( sPropTargetURL ))
{
aAny = xPropSet->getPropertyValue( sPropTargetURL );
@@ -157,6 +156,7 @@ ScDrawTransferObj::ScDrawTransferObj( std::unique_ptr<SdrModel> pClipModel, ScDo
// Label
OUString aLabel;
+ OUString sPropLabel( "Label" );
if(xInfo->hasPropertyByName( sPropLabel ))
{
aAny = xPropSet->getPropertyValue( sPropLabel );
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index 1757b64749bd..b725eb7d3c52 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -108,7 +108,6 @@ ScSelectionTransferObj* ScSelectionTransferObj::CreateFromView( ScTabView* pView
}
if ( eMode == SC_SELTRANS_INVALID ) // no drawing object selected
{
- ScRange aRange;
ScViewData& rViewData = pView->GetViewData();
const ScMarkData& rMark = rViewData.GetMarkData();
// allow MultiMarked because GetSimpleArea may be able to merge into a simple range
@@ -116,6 +115,7 @@ ScSelectionTransferObj* ScSelectionTransferObj::CreateFromView( ScTabView* pView
// Also allow simple filtered area.
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
{
+ ScRange aRange;
ScMarkType eMarkType = rViewData.GetSimpleArea( aRange );
if (eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED)
{
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 555b5acbacb3..361a4bae505e 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -202,7 +202,6 @@ void ScDbNameDlg::Init()
SCTAB nEndTab = 0;
ScDBCollection* pDBColl = rDoc.GetDBCollection();
- ScDBData* pDBData = nullptr;
m_rViewData.GetSimpleArea( nStartCol, nStartRow, nStartTab,
nEndCol, nEndRow, nEndTab );
@@ -214,7 +213,7 @@ void ScDbNameDlg::Init()
if ( pDBColl )
{
// determine if the defined DB area has been marked:
- pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, ScDBDataPortion::TOP_LEFT );
+ ScDBData* pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, ScDBDataPortion::TOP_LEFT );
if ( pDBData )
{
ScAddress& rStart = theCurArea.aStart;
diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx
index 2ddbd56c7afe..f81e3c50794a 100644
--- a/sc/source/ui/dbgui/scuiimoptdlg.cxx
+++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx
@@ -148,7 +148,6 @@ ScImportOptionsDlg::ScImportOptionsDlg(weld::Window* pParent, bool bAscii,
pTextSepTab.reset( new ScDelimiterTable(SCSTR_TEXTSEP) );
OUString aStr = pFieldSepTab->FirstDel();
- sal_Unicode nCode;
while (!aStr.isEmpty())
{
@@ -187,7 +186,7 @@ ScImportOptionsDlg::ScImportOptionsDlg(weld::Window* pParent, bool bAscii,
{
if ( pOptions )
{
- nCode = pOptions->nFieldSepCode;
+ sal_Unicode nCode = pOptions->nFieldSepCode;
aStr = pFieldSepTab->GetDelimiter( nCode );
if ( aStr.isEmpty() )
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 4ead59d46fbc..cbd2471ad343 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -737,9 +737,9 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
weld::WaitObject aWait( ScDocShell::GetActiveDialogParent() );
bool bKeepSub = false; // repeat existing partial results?
- ScSubTotalParam aSubTotalParam;
if (rQueryParam.GetEntry(0).bDoQuery) // not at cancellation
{
+ ScSubTotalParam aSubTotalParam;
pDBData->GetSubTotalParam( aSubTotalParam ); // partial results exist?
if ( aSubTotalParam.bGroupActive[0] && !aSubTotalParam.bRemoveOnly )
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 18e23c4851a3..11beaa2819b7 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1158,7 +1158,6 @@ void ScDocShell::Execute( SfxRequest& rReq )
break;
case SID_LANGUAGE_STATUS:
{
- sal_Int32 nPos = 0;
OUString aLangText;
const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(nSlot);
if ( pItem )
@@ -1177,6 +1176,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
ScDocument& rDoc = GetDocument();
rDoc.GetLanguage( eLatin, eCjk, eCtl );
+ sal_Int32 nPos = 0;
if ( aLangText == "*" )
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index da4ca2d97160..9b5ba3f8ffdf 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -777,12 +777,12 @@ ErrCode ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncoding
SCROW nDocRow = 0;
ScFieldEditEngine aEditEngine(&m_aDocument, m_aDocument.GetEditPool());
OUString aString;
- OUString aTabName;
try
{
uno::Reference<sdbc::XDriverManager2> xDrvMan;
uno::Reference<sdbc::XConnection> xConnection;
+ OUString aTabName;
ErrCode nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet);
if ( !xConnection.is() || !xDrvMan.is() )
return nRet;
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 182cc05150a3..7c1566472cbc 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2419,10 +2419,10 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
// no file name associated with this ID.
return nullptr;
- OUString aFilter;
SrcShell aSrcDoc;
try
{
+ OUString aFilter;
aSrcDoc.maShell = loadSrcDocument(nFileId, aFilter);
}
catch (const css::uno::Exception&)
@@ -2888,10 +2888,10 @@ public:
bool ScExternalRefManager::refreshSrcDocument(sal_uInt16 nFileId)
{
- OUString aFilter;
SfxObjectShellRef xDocShell;
try
{
+ OUString aFilter;
xDocShell = loadSrcDocument(nFileId, aFilter);
}
catch ( const css::uno::Exception& ) {}
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index f295e8715947..161f88a0cb2e 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -67,7 +67,6 @@ namespace
void lcl_convertStringArguments(sal_uInt16 nSlot, std::unique_ptr<SfxItemSet>& pArgs)
{
Color aColor;
- OUString sColor;
const SfxPoolItem* pItem = nullptr;
if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
@@ -82,7 +81,7 @@ namespace
}
else if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
{
- sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ OUString sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
if (sColor == "transparent")
aColor = COL_TRANSPARENT;
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index 810966d82177..60e126f8a82b 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -81,9 +81,6 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink
uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
OUString sPropButtonType( "ButtonType" );
- OUString sPropTargetURL( "TargetURL" );
- OUString sPropTargetFrame( "TargetFrame" );
- OUString sPropLabel( "Label" );
if(xInfo->hasPropertyByName( sPropButtonType ))
{
@@ -93,6 +90,7 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink
{
OUString sTmp;
// Label
+ OUString sPropLabel( "Label" );
if(xInfo->hasPropertyByName( sPropLabel ))
{
aAny = xPropSet->getPropertyValue( sPropLabel );
@@ -102,6 +100,7 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink
}
}
// URL
+ OUString sPropTargetURL( "TargetURL" );
if(xInfo->hasPropertyByName( sPropTargetURL ))
{
aAny = xPropSet->getPropertyValue( sPropTargetURL );
@@ -111,6 +110,7 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink
}
}
// Target
+ OUString sPropTargetFrame( "TargetFrame" );
if(xInfo->hasPropertyByName( sPropTargetFrame ))
{
aAny = xPropSet->getPropertyValue( sPropTargetFrame );
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index 13dbe096dfaf..436fcff51708 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -262,7 +262,6 @@ void ScFunctionWin::UpdateFunctionList()
void ScFunctionWin::DoEnter()
{
- OUString aFirstArgStr;
OUStringBuffer aArgStr;
OUString aString=xFuncList->get_selected_text();
SfxViewShell* pCurSh = SfxViewShell::Current();
@@ -270,7 +269,7 @@ void ScFunctionWin::DoEnter()
if(!aString.isEmpty())
{
-
+ OUString aFirstArgStr;
ScModule* pScMod = SC_MOD();
ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pCurSh );
ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh );
diff --git a/sc/source/ui/miscdlgs/solverutil.cxx b/sc/source/ui/miscdlgs/solverutil.cxx
index e46f1a5af7f6..e5d045378113 100644
--- a/sc/source/ui/miscdlgs/solverutil.cxx
+++ b/sc/source/ui/miscdlgs/solverutil.cxx
@@ -67,13 +67,13 @@ void ScSolverUtil::GetImplementations( uno::Sequence<OUString>& rImplNames,
if ( xCFac.is() )
{
OUString sName = xInfo->getImplementationName();
- OUString sDescription;
try
{
uno::Reference<sheet::XSolver> xSolver(
xCFac->createInstanceWithContext(xCtx), uno::UNO_QUERY );
uno::Reference<sheet::XSolverDescription> xDesc( xSolver, uno::UNO_QUERY );
+ OUString sDescription;
if ( xDesc.is() )
sDescription = xDesc->getComponentDescription();
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index ebb141171ca7..36c016c0a8b5 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1410,7 +1410,7 @@ void ScUndoDragDrop::Redo()
EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo?
// do not undo/redo objects and note captions, they are handled via drawing undo
- InsertDeleteFlags const nRedoFlags = (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS;
+ constexpr InsertDeleteFlags nRedoFlags = (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS;
/* TODO: Redoing note captions is quite tricky due to the fact that a
helper clip document is used. While (re-)pasting the contents to the
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index fd4264bfddc9..b60984d7b53b 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2767,10 +2767,9 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
}
// collect items in pNewPattern, apply with one call after the loop
-
- sal_uInt16 nFirstItem, nSecondItem;
try
{
+ sal_uInt16 nFirstItem, nSecondItem;
lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem );
// put only affected items into new set
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 58cb1ee82ce9..677a6852fe2c 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1865,11 +1865,11 @@ void ScDatabaseRangeObj::Refreshed_Impl()
uno::Reference<table::XCellRange> SAL_CALL ScDatabaseRangeObj::getReferredCells()
{
SolarMutexGuard aGuard;
- ScRange aRange;
ScDBData* pData = GetDBData_Impl();
if ( pData )
{
//! static function to create ScCellObj/ScCellRange on ScCellRangeObj ???
+ ScRange aRange;
pData->GetArea(aRange);
if ( aRange.aStart == aRange.aEnd )
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index e69d8bb73728..1bd893adf668 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -818,8 +818,6 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
if (bDataValid)
return pForwarder.get();
- OUString aText;
-
if (pDocShell)
{
ScDocument& rDoc = pDocShell->GetDocument();
@@ -841,6 +839,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
else
{
sal_uInt32 nFormat = rDoc.GetNumberFormat(aCellPos);
+ OUString aText;
ScCellFormat::GetInputString(aCell, nFormat, aText, *rDoc.GetFormatTable(), rDoc);
if (!aText.isEmpty())
pEditEngine->SetTextNewDefaults(aText, aDefaults);
diff --git a/sc/source/ui/vba/vbafiledialog.cxx b/sc/source/ui/vba/vbafiledialog.cxx
index e610f2647ccd..6f523c8c1d72 100644
--- a/sc/source/ui/vba/vbafiledialog.cxx
+++ b/sc/source/ui/vba/vbafiledialog.cxx
@@ -44,10 +44,10 @@ ScVbaFileDialog::getInitialFileName() { return uno::makeAny( m_sInitialFileName
void ScVbaFileDialog::setInitialFileName( const css::uno::Any& rName )
{
OUString sDefaultPath;
- OUString sDefaultURL;
if( rName >>= sDefaultPath )
{
+ OUString sDefaultURL;
sal_Int32 eSuccess = osl::FileBase::getFileURLFromSystemPath(
sDefaultPath, sDefaultURL ) ;
if( eSuccess == osl::FileBase::RC::E_INVAL )
diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx
index 12eaa49e13d0..8f96df5df1cc 100644
--- a/sc/source/ui/vba/vbapagesetup.cxx
+++ b/sc/source/ui/vba/vbapagesetup.cxx
@@ -139,9 +139,9 @@ uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesTall()
void SAL_CALL ScVbaPageSetup::setFitToPagesTall( const uno::Any& fitToPagesTall)
{
- sal_uInt16 scaleToPageY = 0;
try
{
+ sal_uInt16 scaleToPageY = 0;
bool aValue;
if( fitToPagesTall.getValueTypeClass() != uno::TypeClass_BOOLEAN || (fitToPagesTall >>= aValue))
{
@@ -162,9 +162,9 @@ uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesWide()
void SAL_CALL ScVbaPageSetup::setFitToPagesWide( const uno::Any& fitToPagesWide)
{
- sal_uInt16 scaleToPageX = 0;
try
{
+ sal_uInt16 scaleToPageX = 0;
bool aValue = false;
if( fitToPagesWide.getValueTypeClass() != uno::TypeClass_BOOLEAN || (fitToPagesWide >>= aValue))
{
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 9624c8ae15a4..510a0d428c2b 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -2075,8 +2075,8 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut
RangeHelper thisRange( mxRange );
table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) );
- ScRefFlags const ROW_ABS = ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS;
- ScRefFlags const COL_ABS = ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS;
+ constexpr ScRefFlags ROW_ABS = ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS;
+ constexpr ScRefFlags COL_ABS = ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS;
if ( RowAbsolute.hasValue() )
{
@@ -2343,13 +2343,12 @@ ScVbaRange::Activate()
uno::Reference< excel::XRange >
ScVbaRange::Rows(const uno::Any& aIndex )
{
- OUString sAddress;
-
if ( aIndex.hasValue() )
{
sal_Int32 nValue = 0;
ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
+ OUString sAddress;
ScRange aRange = aCellRanges.front();
if( aIndex >>= nValue )
@@ -2386,14 +2385,13 @@ ScVbaRange::Rows(const uno::Any& aIndex )
uno::Reference< excel::XRange >
ScVbaRange::Columns(const uno::Any& aIndex )
{
- OUString sAddress;
-
ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
ScRange aRange = aCellRanges.front();
if ( aIndex.hasValue() )
{
+ OUString sAddress;
sal_Int32 nValue = 0;
if ( aIndex >>= nValue )
{
@@ -2700,7 +2698,6 @@ ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2, bool bForceUseI
if( !Cell1.hasValue() )
throw uno::RuntimeException( "Invalid Argument" );
- table::CellRangeAddress resultAddress;
table::CellRangeAddress parentRangeAddress = xAddressable->getRangeAddress();
ScRange aRange;
@@ -2724,6 +2721,7 @@ ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2, bool bForceUseI
cell2 = getCellRangeAddressForVBARange( Cell2, getScDocShell() );
+ table::CellRangeAddress resultAddress;
resultAddress.StartColumn = ( cell1.StartColumn < cell2.StartColumn ) ? cell1.StartColumn : cell2.StartColumn;
resultAddress.StartRow = ( cell1.StartRow < cell2.StartRow ) ? cell1.StartRow : cell2.StartRow;
resultAddress.EndColumn = std::max( cell1.EndColumn, cell2.EndColumn );
@@ -4458,7 +4456,6 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
}
sal_Int32 nField = 0; // *IS* 1 based
- OUString sCriteria1;
sal_Int32 nOperator = excel::XlAutoFilterOperator::xlAnd;
sheet::FilterConnection nConn = sheet::FilterConnection_AND;
@@ -4492,6 +4489,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
if ( xDesc.is() )
{
+ OUString sCriteria1;
bool bAcceptCriteria2 = true;
bool bAll = false;
uno::Sequence< sheet::TableFilterField2 > sTabFilts;
@@ -4584,7 +4582,6 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
sTabFilts[0].Connection = sheet::FilterConnection_AND;
sTabFilts[0].Field = (nField - 1);
- OUString sCriteria2;
uno::Sequence< OUString > aCriteria2;
if ( Criteria2.hasValue() ) // there is a Criteria2
{
@@ -4592,6 +4589,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
sTabFilts[1].Field = sTabFilts[0].Field;
sTabFilts[1].Connection = nConn;
+ OUString sCriteria2;
if ( Criteria2 >>= sCriteria2 )
{
if ( !sCriteria2.isEmpty() )
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index a55673827585..1da99b474f0a 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -802,7 +802,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
SCROW nStartRow;
SCCOL nEndCol;
SCROW nEndRow;
- SCTAB nStartTab, nEndTab;
GetViewData()->GetFillData( nStartCol, nStartRow, nEndCol, nEndRow );
SCCOL nFillCol = GetViewData()->GetRefEndX();
@@ -825,6 +824,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
}
+ SCTAB nStartTab, nEndTab;
GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab,
nEndCol,nEndRow,nEndTab );
}
@@ -1336,16 +1336,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case FID_INS_CELL_CONTENTS:
{
- InsertDeleteFlags nFlags = InsertDeleteFlags::NONE;
- ScPasteFunc nFunction = ScPasteFunc::NONE;
- InsCellCmd eMoveMode = INS_NONE;
-
ScDocument& rDoc = GetViewData()->GetDocument();
bool bOtherDoc = !rDoc.IsClipboardSource();
// keep a reference in case the clipboard is changed during dialog or PasteFromClip
const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData()->GetActiveWin()));
if ( pOwnClip )
{
+ InsertDeleteFlags nFlags = InsertDeleteFlags::NONE;
+ ScPasteFunc nFunction = ScPasteFunc::NONE;
+ InsCellCmd eMoveMode = INS_NONE;
bool bSkipEmpty = false;
bool bTranspose = false;
bool bAsLink = false;
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 5cc6e7691813..538f8a4bb949 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -576,7 +576,6 @@ void ScCellShell::Execute( SfxRequest& rReq )
SCTAB i=1;
OUString aBaseName;
OUString aName;
- OUString aComment;
Color aColor;
ScScenarioFlags nFlags;
@@ -630,6 +629,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
ScopedVclPtr<AbstractScNewScenarioDlg> pNewDlg(pFact->CreateScNewScenarioDlg(pTabViewShell->GetFrameWeld(), aName, false, bSheetProtected));
if ( pNewDlg->Execute() == RET_OK )
{
+ OUString aComment;
pNewDlg->GetScenarioData( aName, aComment, aColor, nFlags );
pTabViewShell->MakeScenario( aName, aComment, aColor, nFlags );
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 3066fe253ba9..3584e270e3be 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -459,10 +459,9 @@ void ScDrawView::SetMarkedOriginalSize()
else
{
MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( static_cast<SdrOle2Obj*>(pObj)->GetAspect() ) );
- awt::Size aSz;
try
{
- aSz = xObj->getVisualAreaSize( static_cast<SdrOle2Obj*>(pObj)->GetAspect() );
+ awt::Size aSz = xObj->getVisualAreaSize( static_cast<SdrOle2Obj*>(pObj)->GetAspect() );
aOriginalSize = OutputDevice::LogicToLogic(
Size( aSz.Width, aSz.Height ),
MapMode(aUnit),
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index c86437f6de8a..9e8768fe27d6 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -949,13 +949,12 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq)
{
if (pArgs)
{
- Color aColor;
- OUString sColor;
const SfxPoolItem* pColorStringItem = nullptr;
if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_ATTR_COLOR_STR, false, &pColorStringItem ) )
{
- sColor = static_cast<const SfxStringItem*>( pColorStringItem )->GetValue();
+ Color aColor;
+ OUString sColor = static_cast<const SfxStringItem*>( pColorStringItem )->GetValue();
if ( sColor == "transparent" )
aColor = COL_TRANSPARENT;
else
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 7075fbd5d02a..585e19c02a0b 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1466,8 +1466,6 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
case SID_ATTR_CHAR_UNDERLINE:
{
- FontLineStyle eUnderline;
-
if( pSet )
{
const SfxPoolItem& rUnderline = pSet->Get( ATTR_FONT_UNDERLINE );
@@ -1490,7 +1488,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
else
{
SvxUnderlineItem aUnderline( pAttrs->GetItem( ATTR_FONT_UNDERLINE ) );
- eUnderline = (LINESTYLE_NONE != aUnderline.GetLineStyle())
+ FontLineStyle eUnderline = (LINESTYLE_NONE != aUnderline.GetLineStyle())
? LINESTYLE_NONE
: LINESTYLE_SINGLE;
aUnderline.SetLineStyle( eUnderline );
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 046c70e4b4b1..584125b5cef8 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2236,10 +2236,9 @@ void ScOutputData::DrawChangeTrack()
const ScChangeAction* pAction = pTrack->GetFirst();
while (pAction)
{
- ScChangeActionType eActionType;
if ( pAction->IsVisible() )
{
- eActionType = pAction->GetType();
+ ScChangeActionType eActionType = pAction->GetType();
const ScBigRange& rBig = pAction->GetBigRange();
if ( rBig.aStart.Tab() == nTab )
{
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 6d123bccacf6..39aaf01d9957 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -840,11 +840,11 @@ static void lcl_DoHyperlinkResult( const OutputDevice* pDev, const tools::Rectan
{
vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >( pDev->GetExtOutDevData() );
- OUString aCellText;
OUString aURL;
if (rCell.meType == CELLTYPE_FORMULA)
{
ScFormulaCell* pFCell = rCell.mpFormula;
+ OUString aCellText;
if ( pFCell->IsHyperLinkCell() )
pFCell->GetURLResult( aURL, aCellText );
}
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index cc89c444c2e2..40a42ea8d86d 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -827,7 +827,6 @@ IMPL_LINK_NOARG(ScTabView, TabBarResize, TabBar*, void)
if (!aViewData.IsHScrollMode())
return;
- const long nOverlap = 0; // ScrollBar::GetWindowOverlapPixel();
long nSize = pTabControl->GetSplitSize();
if (aViewData.GetHSplitMode() != SC_SPLIT_FIX)
@@ -841,7 +840,7 @@ IMPL_LINK_NOARG(ScTabView, TabBarResize, TabBar*, void)
if ( nSize != pTabControl->GetSizePixel().Width() )
{
- pTabControl->SetSizePixel( Size( nSize+nOverlap,
+ pTabControl->SetSizePixel( Size( nSize,
pTabControl->GetSizePixel().Height() ) );
RepeatResize();
}
@@ -1530,8 +1529,6 @@ void ScTabView::DoHSplit(long nSplitPos)
long nMinPos;
long nMaxPos;
- SCCOL nOldDelta;
- SCCOL nNewDelta;
nMinPos = SPLIT_MARGIN;
if ( pRowBar[SC_SPLIT_BOTTOM] && pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width() >= nMinPos )
@@ -1561,10 +1558,10 @@ void ScTabView::DoHSplit(long nSplitPos)
}
else
{
- nOldDelta = aViewData.GetPosX( SC_SPLIT_LEFT );
+ SCCOL nOldDelta = aViewData.GetPosX( SC_SPLIT_LEFT );
long nLeftWidth = nSplitPos - pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width();
if ( nLeftWidth < 0 ) nLeftWidth = 0;
- nNewDelta = nOldDelta + aViewData.CellsAtX( nOldDelta, 1, SC_SPLIT_LEFT,
+ SCCOL nNewDelta = nOldDelta + aViewData.CellsAtX( nOldDelta, 1, SC_SPLIT_LEFT,
static_cast<sal_uInt16>(nLeftWidth) );
ScDocument& rDoc = aViewData.GetDocument();
if ( nNewDelta > rDoc.MaxCol() )
@@ -1596,7 +1593,6 @@ void ScTabView::DoVSplit(long nSplitPos)
long nMinPos;
long nMaxPos;
SCROW nOldDelta;
- SCROW nNewDelta;
nMinPos = SPLIT_MARGIN;
if ( pColBar[SC_SPLIT_LEFT] && pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height() >= nMinPos )
@@ -1637,7 +1633,7 @@ void ScTabView::DoVSplit(long nSplitPos)
aViewData.SetPosY( SC_SPLIT_TOP, nOldDelta );
long nTopHeight = nSplitPos - pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height();
if ( nTopHeight < 0 ) nTopHeight = 0;
- nNewDelta = nOldDelta + aViewData.CellsAtY( nOldDelta, 1, SC_SPLIT_TOP,
+ SCROW nNewDelta = nOldDelta + aViewData.CellsAtY( nOldDelta, 1, SC_SPLIT_TOP,
static_cast<sal_uInt16>(nTopHeight) );
ScDocument& rDoc = aViewData.GetDocument();
if ( nNewDelta > rDoc.MaxRow() )
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index f73a5c1636b5..95e566267ae1 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -114,14 +114,13 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
case FID_TABLE_SHOW:
{
- OUString aName;
std::vector<OUString> rNames;
if ( pReqArgs )
{
const SfxPoolItem* pItem;
if( pReqArgs->HasItem( FID_TABLE_SHOW, &pItem ) )
{
- aName = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ OUString aName = static_cast<const SfxStringItem*>(pItem)->GetValue();
rNames.push_back(aName);
ShowTable( rNames );
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index f3dbeece26b7..90ddff57df08 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2891,9 +2891,9 @@ void ScViewFunc::MoveTable(
nDestTab1++;
}
}
- OUString sName;
if (!bNewDoc && bUndo)
{
+ OUString sName;
rDestDoc.GetName(nDestTab, sName);
pDestShell->GetUndoManager()->AddUndoAction(
std::make_unique<ScUndoImportTab>( pDestShell, nDestTab,
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index d8dbe9ce748e..60674776e7fd 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1168,7 +1168,6 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
SCROW nEndRow = aMarkRange.aEnd.Row();
SCTAB nEndTab = aMarkRange.aEnd.Tab();
- ScUndoSelectionAttr* pUndoAttr = nullptr;
ScEditDataArray* pEditDataArray = nullptr;
if (bRecord)
{
@@ -1185,7 +1184,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
aFuncMark.MarkToMulti();
- pUndoAttr = new ScUndoSelectionAttr(
+ ScUndoSelectionAttr* pUndoAttr = new ScUndoSelectionAttr(
pDocSh, aFuncMark, nStartCol, nStartRow, nStartTab,
nEndCol, nEndRow, nEndTab, std::move(pUndoDoc), bMulti, &rAttr );
pDocSh->GetUndoManager()->AddUndoAction(std::unique_ptr<ScUndoSelectionAttr>(pUndoAttr));
@@ -2354,7 +2353,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal )
{
//! step size adjustable
// step size is also minimum
- sal_uInt16 nStepX = STD_COL_WIDTH / 5;
+ constexpr sal_uInt16 nStepX = STD_COL_WIDTH / 5;
sal_uInt16 nStepY = ScGlobal::nStdRowHeight;
ScModule* pScMod = SC_MOD();