summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-06 13:27:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-07 07:56:49 +0100
commit83241dba8fbf2004c48d87cb7221fd354589b28c (patch)
treec7f94b07d2c4cf2a5f49c1372c2970424ac7b2ea
parentloplugin:collapseif in framework..sal (diff)
downloadcore-83241dba8fbf2004c48d87cb7221fd354589b28c.tar.gz
core-83241dba8fbf2004c48d87cb7221fd354589b28c.zip
loplugin:collapseif in sc
Change-Id: I06bcf6b33af5c6eddb614f1f0ce1b2713876b162 Reviewed-on: https://gerrit.libreoffice.org/62954 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/core/data/column2.cxx9
-rw-r--r--sc/source/core/data/documen3.cxx11
-rw-r--r--sc/source/core/data/document.cxx26
-rw-r--r--sc/source/core/data/formulacell.cxx14
-rw-r--r--sc/source/core/data/olinetab.cxx33
-rw-r--r--sc/source/core/data/table1.cxx36
-rw-r--r--sc/source/filter/excel/xilink.cxx29
-rw-r--r--sc/source/filter/inc/tokstack.hxx15
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx106
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx25
-rw-r--r--sc/source/ui/Accessibility/AccessibleContextBase.cxx7
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx43
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx7
-rw-r--r--sc/source/ui/docshell/docsh.cxx14
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx7
-rw-r--r--sc/source/ui/vba/vbarange.cxx11
-rw-r--r--sc/source/ui/view/cellsh.cxx7
-rw-r--r--sc/source/ui/view/formatsh.cxx5
-rw-r--r--sc/source/ui/view/output.cxx15
-rw-r--r--sc/source/ui/view/output2.cxx11
-rw-r--r--sc/source/ui/view/viewfun2.cxx7
21 files changed, 184 insertions, 254 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index e6cbf36a2ce5..111cc0aece2e 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -727,13 +727,10 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
pOldPattern = pPattern;
sal_uInt16 nThis = static_cast<sal_uInt16>(GetNeededSize(
nRow, pDev, nPPTX, nPPTY, rZoomX, rZoomY, true, aOptions, &pOldPattern));
- if (nThis)
+ if (nThis && (nThis > nWidth || !bFound))
{
- if (nThis > nWidth || !bFound)
- {
- nWidth = nThis;
- bFound = true;
- }
+ nWidth = nThis;
+ bFound = true;
}
}
}
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 6854602b9c49..a83c413ebca1 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -733,12 +733,11 @@ ScOutlineTable* ScDocument::GetOutlineTable( SCTAB nTab, bool bCreate )
if (maTabs[nTab])
{
pVal = maTabs[nTab]->GetOutlineTable();
- if (!pVal)
- if (bCreate)
- {
- maTabs[nTab]->StartOutlineTable();
- pVal = maTabs[nTab]->GetOutlineTable();
- }
+ if (!pVal && bCreate)
+ {
+ maTabs[nTab]->StartOutlineTable();
+ pVal = maTabs[nTab]->GetOutlineTable();
+ }
}
return pVal;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 4a9b7fb93c3e..79f4e484d838 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4985,13 +4985,8 @@ bool ScDocument::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const
for (const auto& a : maTabs)
{
- if (a)
- {
- if ( a->IsStyleSheetUsed( rStyle ) )
- {
- bIsUsed = true;
- }
- }
+ if (a && a->IsStyleSheetUsed( rStyle ) )
+ bIsUsed = true;
}
bStyleSheetUsageInvalid = false;
@@ -5665,18 +5660,15 @@ bool ScDocument::RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
pData = maTabs[nTab]->GetAnonymousDBData();
else
pData=nullptr;
- if (pData)
+ if (pData && pData->HasAutoFilter())
{
- if (pData->HasAutoFilter())
+ pData->GetArea( nDBTab, nDBStartCol,nDBStartRow, nDBEndCol,nDBEndRow );
+ if ( nDBTab==nTab && nDBStartRow<=nEndRow && nDBEndRow>=nStartRow &&
+ nDBStartCol<=nEndCol && nDBEndCol>=nStartCol )
{
- pData->GetArea( nDBTab, nDBStartCol,nDBStartRow, nDBEndCol,nDBEndRow );
- if ( nDBTab==nTab && nDBStartRow<=nEndRow && nDBEndRow>=nStartRow &&
- nDBStartCol<=nEndCol && nDBEndCol>=nStartCol )
- {
- if (ApplyFlagsTab( nDBStartCol,nDBStartRow, nDBEndCol,nDBStartRow,
- nDBTab, ScMF::Auto ))
- bChange = true;
- }
+ if (ApplyFlagsTab( nDBStartCol,nDBStartRow, nDBEndCol,nDBStartRow,
+ nDBTab, ScMF::Auto ))
+ bChange = true;
}
}
return bChange;
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index ba3244793a72..2b97c2048b34 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3767,11 +3767,8 @@ void ScFormulaCell::UpdateTranspose( const ScRange& rSource, const ScAddress& rD
if( t->GetOpCode() == ocName )
{
const ScRangeData* pName = pDocument->FindRangeNameBySheetAndIndex( t->GetSheet(), t->GetIndex());
- if (pName)
- {
- if (pName->IsModified())
- bRefChanged = true;
- }
+ if (pName && pName->IsModified())
+ bRefChanged = true;
}
else if( t->GetType() != svIndex )
{
@@ -3822,11 +3819,8 @@ void ScFormulaCell::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY
if( t->GetOpCode() == ocName )
{
const ScRangeData* pName = pDocument->FindRangeNameBySheetAndIndex( t->GetSheet(), t->GetIndex());
- if (pName)
- {
- if (pName->IsModified())
- bRefChanged = true;
- }
+ if (pName && pName->IsModified())
+ bRefChanged = true;
}
else if( t->GetType() != svIndex )
{
diff --git a/sc/source/core/data/olinetab.cxx b/sc/source/core/data/olinetab.cxx
index 6ec7d071e6d7..cdb80c22bdad 100644
--- a/sc/source/core/data/olinetab.cxx
+++ b/sc/source/core/data/olinetab.cxx
@@ -203,28 +203,25 @@ bool ScOutlineArray::Insert(
if (nStartLevel == nEndLevel && nStartIndex == nEndIndex && nStartLevel < SC_OL_MAXDEPTH)
bFound = true;
- if (!bFound)
+ if (!bFound && nFindMax>0)
{
- if (nFindMax>0)
+ --nFindMax;
+ if (nStartLevel)
{
- --nFindMax;
- if (nStartLevel)
- {
- ScOutlineCollection::const_iterator it = aCollections[nStartLevel-1].begin();
- std::advance(it, nStartIndex);
- if (it->second.GetStart() == nStartCol)
- FindEntry(nStartCol, nStartLevel, nStartIndex, nFindMax);
- }
+ ScOutlineCollection::const_iterator it = aCollections[nStartLevel-1].begin();
+ std::advance(it, nStartIndex);
+ if (it->second.GetStart() == nStartCol)
+ FindEntry(nStartCol, nStartLevel, nStartIndex, nFindMax);
+ }
- if (nEndLevel)
- {
- ScOutlineCollection::const_iterator it = aCollections[nEndLevel-1].begin();
- std::advance(it, nEndIndex);
- if (it->second.GetEnd() == nEndCol)
- FindEntry(nEndCol, nEndLevel, nEndIndex, nFindMax);
- }
- bCont = true;
+ if (nEndLevel)
+ {
+ ScOutlineCollection::const_iterator it = aCollections[nEndLevel-1].begin();
+ std::advance(it, nEndIndex);
+ if (it->second.GetEnd() == nEndCol)
+ FindEntry(nEndCol, nEndLevel, nEndIndex, nFindMax);
}
+ bCont = true;
}
}
while ( !bFound && bCont );
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7941f3178629..9b3466f26a8a 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -584,21 +584,18 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes ) const
if (nColY > nMaxY)
nMaxY = nColY;
}
- if (bNotes)
+ if (bNotes && aCol[i].HasCellNotes() )
{
- if ( aCol[i].HasCellNotes() )
+ SCROW maxNoteRow = aCol[i].GetCellNotesMaxRow();
+ if (maxNoteRow >= nMaxY)
{
- SCROW maxNoteRow = aCol[i].GetCellNotesMaxRow();
- if (maxNoteRow >= nMaxY)
- {
- bFound = true;
- nMaxY = maxNoteRow;
- }
- if (i>nMaxX)
- {
- bFound = true;
- nMaxX = i;
- }
+ bFound = true;
+ nMaxY = maxNoteRow;
+ }
+ if (i>nMaxX)
+ {
+ bFound = true;
+ nMaxX = i;
}
}
}
@@ -722,16 +719,13 @@ bool ScTable::GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
if (nColY > nMaxY)
nMaxY = nColY;
}
- if (bNotes)
+ if (bNotes && aCol[i].HasCellNotes() )
{
- if ( aCol[i].HasCellNotes() )
+ SCROW maxNoteRow =aCol[i].GetCellNotesMaxRow();
+ if (maxNoteRow > nMaxY)
{
- SCROW maxNoteRow =aCol[i].GetCellNotesMaxRow();
- if (maxNoteRow > nMaxY)
- {
- bFound = true;
- nMaxY = maxNoteRow;
- }
+ bFound = true;
+ nMaxY = maxNoteRow;
}
}
}
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index d34237115622..23757998a0f9 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -378,23 +378,20 @@ XclImpExtName::XclImpExtName( XclImpSupbook& rSupbook, XclImpStream& rStrm, XclS
case xlExtName:
// TODO: For now, only global external names are supported. In future
// we should extend this to supporting per-sheet external names.
- if (mnStorageId == 0)
+ if (mnStorageId == 0 && pFormulaConv)
{
- if (pFormulaConv)
- {
- std::unique_ptr<ScTokenArray> pArray;
- sal_uInt16 nFmlaLen;
- nFmlaLen = rStrm.ReaduInt16();
- std::vector<OUString> aTabNames;
- sal_uInt16 nCount = rSupbook.GetTabCount();
- aTabNames.reserve(nCount);
- for (sal_uInt16 i = 0; i < nCount; ++i)
- aTabNames.push_back(rSupbook.GetTabName(i));
-
- pFormulaConv->ConvertExternName(pArray, rStrm, nFmlaLen, rSupbook.GetXclUrl(), aTabNames);
- if (pArray)
- mxArray = std::move( pArray );
- }
+ std::unique_ptr<ScTokenArray> pArray;
+ sal_uInt16 nFmlaLen;
+ nFmlaLen = rStrm.ReaduInt16();
+ std::vector<OUString> aTabNames;
+ sal_uInt16 nCount = rSupbook.GetTabCount();
+ aTabNames.reserve(nCount);
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ aTabNames.push_back(rSupbook.GetTabName(i));
+
+ pFormulaConv->ConvertExternName(pArray, rStrm, nFmlaLen, rSupbook.GetXclUrl(), aTabNames);
+ if (pArray)
+ mxArray = std::move( pArray );
}
break;
case xlExtOLE:
diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx
index 6b0ce783d4fc..31cc18518494 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -352,9 +352,8 @@ inline TokenPool& TokenPool::operator <<( const TokenId& rId )
nId = static_cast<sal_uInt16>(ocErrNull) + nScTokenOff + 1;
}
- if( nP_IdCurrent >= nP_Id )
- if (!GrowId())
- return *this;
+ if( nP_IdCurrent >= nP_Id && !GrowId())
+ return *this;
pP_Id[ nP_IdCurrent ] = nId - 1;
nP_IdCurrent++;
@@ -369,9 +368,8 @@ inline TokenPool& TokenPool::operator <<( const DefTokenId eId )
SAL_WARN("sc.filter", "-TokenPool::operator<<: enum too large! " << static_cast<sal_uInt32>(eId));
}
- if( nP_IdCurrent >= nP_Id )
- if (!GrowId())
- return *this;
+ if( nP_IdCurrent >= nP_Id && !GrowId())
+ return *this;
pP_Id[ nP_IdCurrent ] = static_cast<sal_uInt16>(eId) + nScTokenOff;
nP_IdCurrent++;
@@ -381,9 +379,8 @@ inline TokenPool& TokenPool::operator <<( const DefTokenId eId )
inline TokenPool& TokenPool::operator <<( TokenStack& rStack )
{
- if( nP_IdCurrent >= nP_Id )
- if (!GrowId())
- return *this;
+ if( nP_IdCurrent >= nP_Id && !GrowId())
+ return *this;
sal_uInt16 nId = static_cast<sal_uInt16>(rStack.Get());
if (nId == 0)
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 7c1649727880..963401915f0a 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2578,74 +2578,70 @@ void ScXMLExport::collectAutoStyles()
}
}
uno::Reference<table::XColumnRowRange> xColumnRowRange (xTable, uno::UNO_QUERY);
- if (xColumnRowRange.is())
+ if (xColumnRowRange.is() && pDoc)
{
- if (pDoc)
+ pDoc->SyncColRowFlags();
+ uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
+ if (xTableColumns.is())
{
- pDoc->SyncColRowFlags();
- uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
- if (xTableColumns.is())
+ sal_Int32 nColumns(pDoc->GetLastChangedCol(sal::static_int_cast<SCTAB>(nTable)));
+ pSharedData->SetLastColumn(nTable, nColumns);
+ table::CellRangeAddress aCellAddress(GetEndAddress(xTable));
+ if (aCellAddress.EndColumn > nColumns)
{
- sal_Int32 nColumns(pDoc->GetLastChangedCol(sal::static_int_cast<SCTAB>(nTable)));
- pSharedData->SetLastColumn(nTable, nColumns);
- table::CellRangeAddress aCellAddress(GetEndAddress(xTable));
- if (aCellAddress.EndColumn > nColumns)
- {
- ++nColumns;
- pColumnStyles->AddNewTable(nTable, aCellAddress.EndColumn);
- }
- else
- pColumnStyles->AddNewTable(nTable, nColumns);
- sal_Int32 nColumn = 0;
- while (nColumn <= MAXCOL)
- {
- sal_Int32 nIndex(-1);
- bool bIsVisible(true);
- uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY);
- if (xColumnProperties.is())
- {
- AddStyleFromColumn( xColumnProperties, nullptr, nIndex, bIsVisible );
- pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible);
- }
- sal_Int32 nOld(nColumn);
- nColumn = pDoc->GetNextDifferentChangedCol(sal::static_int_cast<SCTAB>(nTable), static_cast<SCCOL>(nColumn));
- for (sal_Int32 i = nOld + 1; i < nColumn; ++i)
- pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
- }
- if (aCellAddress.EndColumn > nColumns)
+ ++nColumns;
+ pColumnStyles->AddNewTable(nTable, aCellAddress.EndColumn);
+ }
+ else
+ pColumnStyles->AddNewTable(nTable, nColumns);
+ sal_Int32 nColumn = 0;
+ while (nColumn <= MAXCOL)
+ {
+ sal_Int32 nIndex(-1);
+ bool bIsVisible(true);
+ uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY);
+ if (xColumnProperties.is())
{
- bool bIsVisible(true);
- sal_Int32 nIndex(pColumnStyles->GetStyleNameIndex(nTable, nColumns, bIsVisible));
- for (sal_Int32 i = nColumns + 1; i <= aCellAddress.EndColumn; ++i)
- pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
+ AddStyleFromColumn( xColumnProperties, nullptr, nIndex, bIsVisible );
+ pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible);
}
+ sal_Int32 nOld(nColumn);
+ nColumn = pDoc->GetNextDifferentChangedCol(sal::static_int_cast<SCTAB>(nTable), static_cast<SCCOL>(nColumn));
+ for (sal_Int32 i = nOld + 1; i < nColumn; ++i)
+ pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
}
- uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
- if (xTableRows.is())
+ if (aCellAddress.EndColumn > nColumns)
{
- sal_Int32 nRows(pDoc->GetLastChangedRow(sal::static_int_cast<SCTAB>(nTable)));
- pSharedData->SetLastRow(nTable, nRows);
+ bool bIsVisible(true);
+ sal_Int32 nIndex(pColumnStyles->GetStyleNameIndex(nTable, nColumns, bIsVisible));
+ for (sal_Int32 i = nColumns + 1; i <= aCellAddress.EndColumn; ++i)
+ pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
+ }
+ }
+ uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
+ if (xTableRows.is())
+ {
+ sal_Int32 nRows(pDoc->GetLastChangedRow(sal::static_int_cast<SCTAB>(nTable)));
+ pSharedData->SetLastRow(nTable, nRows);
- pRowStyles->AddNewTable(nTable, MAXROW);
- sal_Int32 nRow = 0;
- while (nRow <= MAXROW)
+ pRowStyles->AddNewTable(nTable, MAXROW);
+ sal_Int32 nRow = 0;
+ while (nRow <= MAXROW)
+ {
+ sal_Int32 nIndex = 0;
+ uno::Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY);
+ if(xRowProperties.is())
{
- sal_Int32 nIndex = 0;
- uno::Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY);
- if(xRowProperties.is())
- {
- AddStyleFromRow( xRowProperties, nullptr, nIndex );
- pRowStyles->AddFieldStyleName(nTable, nRow, nIndex);
- }
- sal_Int32 nOld(nRow);
- nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast<SCTAB>(nTable), static_cast<SCROW>(nRow));
- if (nRow > nOld + 1)
- pRowStyles->AddFieldStyleName(nTable, nOld + 1, nIndex, nRow - 1);
+ AddStyleFromRow( xRowProperties, nullptr, nIndex );
+ pRowStyles->AddFieldStyleName(nTable, nRow, nIndex);
}
+ sal_Int32 nOld(nRow);
+ nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast<SCTAB>(nTable), static_cast<SCROW>(nRow));
+ if (nRow > nOld + 1)
+ pRowStyles->AddFieldStyleName(nTable, nOld + 1, nIndex, nRow - 1);
}
}
}
-
ExportCellTextAutoStyles(nTable);
}
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index d0bf81f8468f..13e7c203340b 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1073,23 +1073,20 @@ void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aVi
SetChangeTrackingViewSettings(aChangeProps);
}
}
- if (nHeight && nWidth)
+ if (nHeight && nWidth && GetModel().is())
{
- if (GetModel().is())
+ ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() ));
+ if (pDocObj)
{
- ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() ));
- if (pDocObj)
+ SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
+ if (pEmbeddedObj)
{
- SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
- if (pEmbeddedObj)
- {
- tools::Rectangle aRect;
- aRect.setX( nLeft );
- aRect.setY( nTop );
- aRect.setWidth( nWidth );
- aRect.setHeight( nHeight );
- pEmbeddedObj->SetVisArea(aRect);
- }
+ tools::Rectangle aRect;
+ aRect.setX( nLeft );
+ aRect.setY( nTop );
+ aRect.setWidth( nWidth );
+ aRect.setHeight( nHeight );
+ pEmbeddedObj->SetVisArea(aRect);
}
}
}
diff --git a/sc/source/ui/Accessibility/AccessibleContextBase.cxx b/sc/source/ui/Accessibility/AccessibleContextBase.cxx
index 635abbf3f73b..ad0ebba97ad8 100644
--- a/sc/source/ui/Accessibility/AccessibleContextBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleContextBase.cxx
@@ -263,11 +263,8 @@ sal_Int32 SAL_CALL
for (sal_Int32 i=0; i<nChildCount; ++i)
{
uno::Reference<XAccessible> xChild (xParentContext->getAccessibleChild (i));
- if (xChild.is())
- {
- if (xChild.get() == this)
- nIndex = i;
- }
+ if (xChild.is() && xChild.get() == this)
+ nIndex = i;
}
}
}
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 6996c234858b..f8e2b4acd7c2 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1064,35 +1064,32 @@ bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawing::X
uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY);
pUpObj = pMarkedObj->getParentSdrObjectFromSdrObject();
- if( pMarkedObj == pFocusedObj )
+ if( pMarkedObj == pFocusedObj && pUpObj )
{
- if( pUpObj )
+ uno::Reference< drawing::XShape > xUpGroupXShape (pUpObj->getUnoShape(), uno::UNO_QUERY);
+ uno::Reference < XAccessible > xAccGroupShape =
+ const_cast<ScChildrenShapes*>(this)->GetAccessibleCaption( xUpGroupXShape );
+ if( xAccGroupShape.is() )
{
- uno::Reference< drawing::XShape > xUpGroupXShape (pUpObj->getUnoShape(), uno::UNO_QUERY);
- uno::Reference < XAccessible > xAccGroupShape =
- const_cast<ScChildrenShapes*>(this)->GetAccessibleCaption( xUpGroupXShape );
- if( xAccGroupShape.is() )
+ ::accessibility::AccessibleShape* pAccGroupShape =
+ static_cast< ::accessibility::AccessibleShape* >(xAccGroupShape.get());
+ if( pAccGroupShape )
{
- ::accessibility::AccessibleShape* pAccGroupShape =
- static_cast< ::accessibility::AccessibleShape* >(xAccGroupShape.get());
- if( pAccGroupShape )
+ sal_Int32 nCount = pAccGroupShape->getAccessibleChildCount();
+ for( sal_Int32 i = 0; i < nCount; i++ )
{
- sal_Int32 nCount = pAccGroupShape->getAccessibleChildCount();
- for( sal_Int32 i = 0; i < nCount; i++ )
+ uno::Reference<XAccessible> xAccShape = pAccGroupShape->getAccessibleChild(i);
+ if (xAccShape.is())
{
- uno::Reference<XAccessible> xAccShape = pAccGroupShape->getAccessibleChild(i);
- if (xAccShape.is())
+ ::accessibility::AccessibleShape* pChildAccShape = static_cast< ::accessibility::AccessibleShape* >(xAccShape.get());
+ uno::Reference< drawing::XShape > xChildShape = pChildAccShape->GetXShape();
+ if (xChildShape == xMarkedXShape)
{
- ::accessibility::AccessibleShape* pChildAccShape = static_cast< ::accessibility::AccessibleShape* >(xAccShape.get());
- uno::Reference< drawing::XShape > xChildShape = pChildAccShape->GetXShape();
- if (xChildShape == xMarkedXShape)
- {
- pChildAccShape->SetState(AccessibleStateType::FOCUSED);
- }
- else
- {
- pChildAccShape->ResetState(AccessibleStateType::FOCUSED);
- }
+ pChildAccShape->SetState(AccessibleStateType::FOCUSED);
+ }
+ else
+ {
+ pChildAccShape->ResetState(AccessibleStateType::FOCUSED);
}
}
}
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index d69114e07517..269379812e6f 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -1068,11 +1068,8 @@ void SAL_CALL
{
SolarMutexGuard aGuard;
IsObjectValid();
- if (mpViewShell)
- {
- if (!IsFormulaMode())
- mpViewShell->Unmark();
- }
+ if (mpViewShell && !IsFormulaMode())
+ mpViewShell->Unmark();
}
void SAL_CALL ScAccessibleSpreadsheet::selectAllAccessibleChildren( )
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0a2a3525e11e..6e6589068747 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -225,9 +225,8 @@ std::set<Color> ScDocShell::GetDocColors()
void ScDocShell::DoEnterHandler()
{
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if (pViewSh)
- if (pViewSh->GetViewData().GetDocShell() == this)
- SC_MOD()->InputEnterHandler();
+ if (pViewSh && pViewSh->GetViewData().GetDocShell() == this)
+ SC_MOD()->InputEnterHandler();
}
SCTAB ScDocShell::GetSaveTab()
@@ -2938,13 +2937,10 @@ void ScDocShell::SetDrawModified()
SetModified();
SfxBindings* pBindings = GetViewBindings();
- if (bUpdate)
+ if (bUpdate && pBindings)
{
- if (pBindings)
- {
- pBindings->Invalidate( SID_SAVEDOC );
- pBindings->Invalidate( SID_DOC_MODIFIED );
- }
+ pBindings->Invalidate( SID_SAVEDOC );
+ pBindings->Invalidate( SID_DOC_MODIFIED );
}
if (pBindings)
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 81c99ca631e4..6c9321b8756b 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1223,11 +1223,8 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
// look for a boolean return value of true
bool bRetValue = false;
- if (aRet >>= bRetValue)
- {
- if (bRetValue)
- bReturn = true;
- }
+ if ((aRet >>= bRetValue) && bRetValue)
+ bReturn = true;
}
}
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 10db96a23e7f..d3bdf3a59796 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4978,14 +4978,11 @@ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any&
}
printAreas[ index - 1 ] = rangeAddress;
}
- if ( pShell )
+ if ( pShell && xPrintAreas.is() )
{
- if ( xPrintAreas.is() )
- {
- xPrintAreas->setPrintAreas( printAreas );
- uno::Reference< frame::XModel > xModel = pShell->GetModel();
- PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, true );
- }
+ xPrintAreas->setPrintAreas( printAreas );
+ uno::Reference< frame::XModel > xModel = pShell->GetModel();
+ PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, true );
}
}
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 7800a0f7fac3..d73fc4ad2f07 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -805,11 +805,8 @@ void ScCellShell::GetState(SfxItemSet &rSet)
{
FormulaError nErrCode = FormulaError::NONE;
ScFormulaCell* pCell = pDoc->GetFormulaCell(ScAddress(nPosX, nPosY, nTab));
- if (pCell)
- {
- if (!pCell->IsRunning())
- nErrCode = pCell->GetErrCode();
- }
+ if (pCell && !pCell->IsRunning())
+ nErrCode = pCell->GetErrCode();
OUString aFuncStr;
if ( pTabViewShell->GetFunction( aFuncStr, nErrCode ) )
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 7868e43b1d81..3c5a8f5130d9 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2003,9 +2003,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
break;
}
- if( ! rReq.IsAPI() )
- if( ! rReq.IsDone() )
- rReq.Done();
+ if( ! rReq.IsAPI() && ! rReq.IsDone() )
+ rReq.Done();
}
}
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 9555b8f72b97..1cf2a1620d06 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -286,14 +286,13 @@ void ScOutputData::SetMetaFileMode( bool bNewMode )
void ScOutputData::SetSyntaxMode( bool bNewMode )
{
mbSyntaxMode = bNewMode;
- if ( bNewMode )
- if ( !pValueColor )
- {
- const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
- pValueColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCVALUE ).nColor ) );
- pTextColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCTEXT ).nColor ) );
- pFormulaColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCFORMULA ).nColor ) );
- }
+ if ( bNewMode && !pValueColor )
+ {
+ const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
+ pValueColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCVALUE ).nColor ) );
+ pTextColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCTEXT ).nColor ) );
+ pFormulaColor.reset( new Color( rColorCfg.GetColorValue( svtools::CALCFORMULA ).nColor ) );
+ }
}
void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool bPage)
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 42e4f2cfa4a1..bdb25193d89f 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -4879,14 +4879,11 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
}
long nClipStartY = nStartY;
- if (nArrY==0)
+ if (nArrY==0 && nClipStartY < nRowPosY )
{
- if ( nClipStartY < nRowPosY )
- {
- long nDif = nRowPosY - nClipStartY;
- nClipStartY = nRowPosY;
- aClipSize.AdjustHeight( -nDif );
- }
+ long nDif = nRowPosY - nClipStartY;
+ nClipStartY = nRowPosY;
+ aClipSize.AdjustHeight( -nDif );
}
if ( nAttrRotate /* && eRotMode != SVX_ROTATE_MODE_STANDARD */ )
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 3a6d8c2b62bc..ab51350ef3dd 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2397,12 +2397,9 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord )
if (rDoc.DeleteTab(TheTabs[i]))
{
bDelDone = true;
- if( bVbaEnabled )
+ if( bVbaEnabled && bHasCodeName )
{
- if( bHasCodeName )
- {
- VBA_DeleteModule( *pDocSh, sCodeName );
- }
+ VBA_DeleteModule( *pDocSh, sCodeName );
}
pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[i] ) );
}