[Libreoffice-commits] core.git: 2 commits - chart2/source sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Sep 17 07:25:40 UTC 2018
chart2/source/controller/main/ChartController_Window.cxx | 18 +++++----------
chart2/source/tools/DiagramHelper.cxx | 7 ++---
sc/source/core/data/dptabres.cxx | 5 ++--
sc/source/core/tool/compiler.cxx | 4 +--
sc/source/core/tool/scmatrix.cxx | 3 --
sc/source/filter/excel/excform.cxx | 3 --
sc/source/filter/xml/xmlexprt.cxx | 4 +--
sc/source/ui/docshell/impex.cxx | 5 ++--
sc/source/ui/vba/vbarange.cxx | 5 +---
sc/source/ui/vba/vbaworksheet.cxx | 9 -------
sc/source/ui/vba/vbaworksheets.cxx | 5 ----
sc/source/ui/view/drawview.cxx | 3 --
sc/source/ui/view/gridwin2.cxx | 3 --
sc/source/ui/view/tabview.cxx | 8 +++---
14 files changed, 30 insertions(+), 52 deletions(-)
New commits:
commit 35109fe7c058cf6d961245fc24550d1c1d39a300
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
AuthorDate: Sun Sep 16 18:05:29 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Sep 17 09:25:23 2018 +0200
cppcheck: knownConditionTrueFalse in chart2
Change-Id: I89164a9bc4710d9a90d415c2369c2cde3857c778
Reviewed-on: https://gerrit.libreoffice.org/60552
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 5e307d7a409b..e7f656337507 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1435,12 +1435,9 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
if( bAlternate && pChartWindow )
{
// together with Alt-key: 1 px in each direction
- if( pChartWindow )
- {
- Size aPixelSize = pChartWindow->PixelToLogic( Size( 2, 2 ));
- fGrowAmountX = static_cast< double >( aPixelSize.Width());
- fGrowAmountY = static_cast< double >( aPixelSize.Height());
- }
+ Size aPixelSize = pChartWindow->PixelToLogic( Size( 2, 2 ));
+ fGrowAmountX = static_cast< double >( aPixelSize.Width());
+ fGrowAmountY = static_cast< double >( aPixelSize.Height());
}
if( nCode == KEY_SUBTRACT )
{
@@ -1465,12 +1462,9 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
if( bAlternate && pChartWindow )
{
// together with Alt-key: 1 px
- if(pChartWindow)
- {
- Size aPixelSize = pChartWindow->PixelToLogic( Size( 1, 1 ));
- fShiftAmountX = static_cast< double >( aPixelSize.Width());
- fShiftAmountY = static_cast< double >( aPixelSize.Height());
- }
+ Size aPixelSize = pChartWindow->PixelToLogic( Size( 1, 1 ));
+ fShiftAmountX = static_cast< double >( aPixelSize.Width());
+ fShiftAmountY = static_cast< double >( aPixelSize.Height());
}
switch( nCode )
{
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index faaf3c1a4fdd..a3059ecc5c4a 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -1392,11 +1392,10 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed(
if( xOtherDataSeriesContainer.is() )
{
uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() );
- sal_Int32 nOtherSeriesIndex = 0;
- if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() )
+ if( 0 < aOtherSeriesList.getLength() )
{
- uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
- aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
+ uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[0] );
+ aOtherSeriesList[0] = xGivenDataSeries;
xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList);
aSeriesList[nOldSeriesIndex]=xExchangeSeries;
commit 3d57e965d31a3bf2dc5fe5d9dc87d857f5149745
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
AuthorDate: Sun Sep 16 17:26:51 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Sep 17 09:25:18 2018 +0200
cppcheck: variableScope in sc
Change-Id: I9fe9c042a4990c6399765819f6b8e80c17dba9d2
Reviewed-on: https://gerrit.libreoffice.org/60551
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 2d5952d1c461..e5bef46c3256 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -1619,11 +1619,12 @@ void ScDPResultMember::FillDataResults(
nMemberMeasure = SC_DPMEASURE_ALL;
OSL_ENSURE( rFilterCxt.mnRow < rSequence.getLength(), "bumm" );
- uno::Sequence<sheet::DataResult>& rSubSeq = rSequence.getArray()[rFilterCxt.mnRow];
rFilterCxt.mnCol = 0;
if (pRefMember->IsVisible())
+ {
+ uno::Sequence<sheet::DataResult>& rSubSeq = rSequence.getArray()[rFilterCxt.mnRow];
pDataRoot->FillDataRow(pRefMember, rFilterCxt, rSubSeq, nMemberMeasure, bHasChild, aSubState);
-
+ }
rFilterCxt.mnRow += 1;
}
}
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 64622c674301..a271166f476e 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5592,9 +5592,7 @@ bool ScCompiler::HandleTableRef()
}
bool bColumnRange = false;
bool bCol1Rel = false;
- bool bCol2Rel = false;
bool bCol1RelName = false;
- bool bCol2RelName = false;
int nLevel = 0;
if (bForwardToClose && GetTokenIfOpCode( ocTableRefOpen))
{
@@ -5671,6 +5669,8 @@ bool ScCompiler::HandleTableRef()
ScTokenArray* pNew = new ScTokenArray();
if (nError == FormulaError::NONE || nError == FormulaError::NoValue)
{
+ bool bCol2Rel = false;
+ bool bCol2RelName = false;
// The FormulaError::NoValue case generates a thisrow reference that can be
// used to save named expressions in A1 syntax notation.
if (bColumnRange)
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 1d95650cac26..d5d3940ce9c8 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1832,8 +1832,6 @@ public:
void operator() (const MatrixImplType::element_block_node_type& node)
{
- sc::Compare::Cell& rCell = mrComp.maCells[0];
-
switch (node.type)
{
case mdds::mtm::element_numeric:
@@ -1865,6 +1863,7 @@ public:
for (; it != itEnd; ++it)
{
const svl::SharedString& rStr = *it;
+ sc::Compare::Cell& rCell = mrComp.maCells[0];
rCell.mbValue = false;
rCell.mbEmpty = false;
rCell.maStr = rStr;
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 16bbe6a83585..57038e36bd2d 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -905,7 +905,6 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std:
{
RootData& rR = GetOldRoot();
sal_uInt8 nOp, nLen;
- std::size_t nIgnore;
bool bError = false;
const bool bRangeName = eFT == FT_RangeName;
const bool bSharedFormula = eFT == FT_SharedFormula;
@@ -930,7 +929,7 @@ ConvErr ExcelToSc::Convert( ScRangeListTabs& rRangeList, XclImpStream& aIn, std:
while( (aIn.GetRecPos() < nEndPos) && !bError )
{
nOp = aIn.ReaduInt8();
- nIgnore = 0;
+ std::size_t nIgnore = 0;
// always reset flags
aSRD.InitFlags();
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 27e8a2ec499e..379efb569410 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3174,8 +3174,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
AddAttribute(sAttrStyleName, pCellStyles->GetStyleNameByIndex(aCell.nStyleIndex, aCell.bIsAutoStyle));
if (aCell.nValidationIndex > -1)
AddAttribute(XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, pValidationsContainer->GetValidationName(aCell.nValidationIndex));
- bool bIsMatrix(aCell.bIsMatrixBase || aCell.bIsMatrixCovered);
- bool bIsFirstMatrixCell(aCell.bIsMatrixBase);
+ const bool bIsFirstMatrixCell(aCell.bIsMatrixBase);
if (bIsFirstMatrixCell)
{
SCCOL nColumns( aCell.aMatrixRange.aEnd.Col() - aCell.aMatrixRange.aStart.Col() + 1 );
@@ -3215,6 +3214,7 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
{
if (aCell.maBaseCell.meType == CELLTYPE_FORMULA)
{
+ const bool bIsMatrix(bIsFirstMatrixCell || aCell.bIsMatrixCovered);
ScFormulaCell* pFormulaCell = aCell.maBaseCell.mpFormula;
if (!bIsMatrix || bIsFirstMatrixCell)
{
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 324d147293ed..0e80e499411d 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1791,14 +1791,15 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
break;
bool bInvalidCol = false;
bool bInvalidRow = false;
- bool bInvalidRefCol = false;
- bool bInvalidRefRow = false;
const sal_Unicode* p = aLine.getStr();
sal_Unicode cTag = *p++;
if( cTag == 'C' ) // Content
{
if( *p++ != ';' )
return false;
+
+ bool bInvalidRefCol = false;
+ bool bInvalidRefRow = false;
while( *p )
{
sal_Unicode ch = *p++;
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 0dd27507bc96..2cc08802e24f 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4479,13 +4479,12 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
// in this case we just call the core calc functionality -
if ( Field >>= nField )
{
- bool bAll = false;
- bool bAcceptCriteria2 = true;
-
uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc(
xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
if ( xDesc.is() )
{
+ bool bAcceptCriteria2 = true;
+ bool bAll = false;
uno::Sequence< sheet::TableFilterField2 > sTabFilts;
uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW );
if ( Criteria1.hasValue() )
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index 2299c022220e..87052e0155ad 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -1038,20 +1038,13 @@ ScVbaWorksheet::getSheetID()
}
void SAL_CALL
-ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName, const uno::Any& IgnorePrintAreas )
+ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName, const uno::Any& )
{
sal_Int32 nTo = 0;
sal_Int32 nFrom = 0;
- sal_Int16 nCopies = 1;
- bool bCollate = false;
bool bSelection = false;
- bool bIgnorePrintAreas = false;
From >>= nFrom;
To >>= nTo;
- Copies >>= nCopies;
- IgnorePrintAreas >>= bIgnorePrintAreas;
- if ( nCopies > 1 ) // Collate only useful when more that 1 copy
- Collate >>= bCollate;
if ( !( nFrom || nTo ) )
bSelection = true;
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx
index 9bd77903d994..80b9e84d72d7 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -312,14 +312,9 @@ ScVbaWorksheets::PrintOut( const uno::Any& From, const uno::Any& To, const uno::
{
sal_Int32 nTo = 0;
sal_Int32 nFrom = 0;
- sal_Int16 nCopies = 1;
- bool bCollate = false;
bool bSelection = false;
From >>= nFrom;
To >>= nTo;
- Copies >>= nCopies;
- if ( nCopies > 1 ) // Collate only useful when more that 1 copy
- Collate >>= bCollate;
if ( !( nFrom || nTo ) )
if ( isSelectedSheets() )
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index cda4d3b3ffb3..670dba85023c 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -673,7 +673,6 @@ void ScDrawView::SelectCurrentViewObject( const OUString& rName )
{
sal_uInt16 nObjectTab = 0;
SdrObject* pFound = nullptr;
- bool bUnMark = false;
SfxObjectShell* pShell = pDoc->GetDocumentShell();
if (pShell)
{
@@ -716,7 +715,7 @@ void ScDrawView::SelectCurrentViewObject( const OUString& rName )
SetLayerLocked( pLayer->GetName(), false );
}
SdrPageView* pPV = GetSdrPageView();
- bUnMark = IsObjMarked(pFound);
+ const bool bUnMark = IsObjMarked(pFound);
MarkObj( pFound, pPV, bUnMark);
}
}
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 216f838b748a..66e1a83ee25c 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -597,8 +597,6 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu()
bool ScGridWindow::UpdateVisibleRange()
{
- ScDocument& rDoc = *pViewData->GetDocument();
-
SCCOL nPosX = 0;
SCROW nPosY = 0;
SCCOL nXRight = MAXCOL;
@@ -608,6 +606,7 @@ bool ScGridWindow::UpdateVisibleRange()
{
// entire table in the tiled rendering case
SCTAB nTab = pViewData->GetTabNo();
+ ScDocument const& rDoc = *pViewData->GetDocument();
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 12e05ed32aaa..f9b0ae4b7d8b 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2481,12 +2481,8 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
SCTAB nTab = aViewData.GetTabNo();
SCROW nStartRow = -1;
SCROW nEndRow = -1;
- long nStartHeightPx = 0;
- long nEndHeightPx = 0;
SCCOL nStartCol = -1;
SCCOL nEndCol = -1;
- long nStartWidthPx = 0;
- long nEndWidthPx = 0;
tools::Rectangle aOldVisArea(
mnLOKStartHeaderCol + 1, mnLOKStartHeaderRow + 1,
@@ -2499,6 +2495,8 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
if (rRectangle.Top() < rRectangle.Bottom())
{
SAL_INFO("sc.lok.header", "Row Header: compute start/end rows.");
+ long nStartHeightPx = 0;
+ long nEndHeightPx = 0;
long nRectTopPx = rRectangle.Top() / TWIPS_PER_PIXEL;
long nRectBottomPx = rRectangle.Bottom() / TWIPS_PER_PIXEL;
@@ -2641,6 +2639,8 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
if (rRectangle.Left() < rRectangle.Right())
{
SAL_INFO("sc.lok.header", "Column Header: compute start/end columns.");
+ long nStartWidthPx = 0;
+ long nEndWidthPx = 0;
long nRectLeftPx = rRectangle.Left() / TWIPS_PER_PIXEL;
long nRectRightPx = rRectangle.Right() / TWIPS_PER_PIXEL;
More information about the Libreoffice-commits
mailing list