framework/source/dispatch/loaddispatcher.cxx | 9 - oox/source/export/drawingml.cxx | 8 - package/source/zipapi/ZipFile.cxx | 9 - registry/source/registry.cxx | 9 - reportdesign/source/core/sdr/PropertyForward.cxx | 69 +++++------- reportdesign/source/ui/report/ViewsWindow.cxx | 7 - sal/rtl/random.cxx | 7 - sc/source/core/data/column2.cxx | 9 - sc/source/core/data/documen3.cxx | 11 - sc/source/core/data/document.cxx | 26 +--- sc/source/core/data/formulacell.cxx | 14 -- sc/source/core/data/olinetab.cxx | 33 ++--- sc/source/core/data/table1.cxx | 36 ++---- sc/source/filter/excel/xilink.cxx | 29 ++--- sc/source/filter/inc/tokstack.hxx | 15 +- sc/source/filter/xml/xmlexprt.cxx | 106 +++++++++---------- sc/source/filter/xml/xmlimprt.cxx | 25 +--- sc/source/ui/Accessibility/AccessibleContextBase.cxx | 7 - sc/source/ui/Accessibility/AccessibleDocument.cxx | 43 +++---- sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 7 - sc/source/ui/docshell/docsh.cxx | 14 -- sc/source/ui/unoobj/viewuno.cxx | 7 - sc/source/ui/vba/vbarange.cxx | 11 - sc/source/ui/view/cellsh.cxx | 7 - sc/source/ui/view/formatsh.cxx | 5 sc/source/ui/view/output.cxx | 15 +- sc/source/ui/view/output2.cxx | 11 - sc/source/ui/view/viewfun2.cxx | 7 - 28 files changed, 233 insertions(+), 323 deletions(-)
New commits: commit 83241dba8fbf2004c48d87cb7221fd354589b28c Author: Noel Grandin <[email protected]> AuthorDate: Tue Nov 6 13:27:32 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Nov 7 07:56:49 2018 +0100 loplugin:collapseif in sc Change-Id: I06bcf6b33af5c6eddb614f1f0ce1b2713876b162 Reviewed-on: https://gerrit.libreoffice.org/62954 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> 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] ) ); } commit 2e2d736ccbb21daae91603732c87d5375ede1b47 Author: Noel Grandin <[email protected]> AuthorDate: Tue Nov 6 13:27:23 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Nov 7 07:56:39 2018 +0100 loplugin:collapseif in framework..sal Change-Id: I3068b18f5cff024a48a8f8c68d69cadad30fe4d5 Reviewed-on: https://gerrit.libreoffice.org/62953 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/framework/source/dispatch/loaddispatcher.cxx b/framework/source/dispatch/loaddispatcher.cxx index 836fcae3c60f..49d2a496e723 100644 --- a/framework/source/dispatch/loaddispatcher.cxx +++ b/framework/source/dispatch/loaddispatcher.cxx @@ -92,12 +92,9 @@ css::uno::Any LoadDispatcher::impl_dispatch( const css::util::URL& rURL, } css::uno::Reference< css::frame::XFrame > xBaseFrame(m_xOwnerFrame.get(), css::uno::UNO_QUERY); - if (!xBaseFrame.is()) - { - if (xListener.is()) - xListener->dispatchFinished( - css::frame::DispatchResultEvent(xThis, css::frame::DispatchResultState::FAILURE, css::uno::Any())); - } + if (!xBaseFrame.is() && xListener.is()) + xListener->dispatchFinished( + css::frame::DispatchResultEvent(xThis, css::frame::DispatchResultState::FAILURE, css::uno::Any())); // OK ... now the internal loader seems to be usable for new requests // and our owner frame seems to be valid for such operations. diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 573d2982cc88..ba60093fa121 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -666,11 +666,9 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc if (aLineDash.Dots == 0 && aLineDash.DotLen == 0 && aLineDash.Dashes == 0 && aLineDash.DashLen == 0 && aLineDash.Distance == 0) { OUString aLineDashName; GET(aLineDashName, LineDashName); - if (!aLineDashName.isEmpty()) { - if (xModel) { - css::uno::Any aAny = getLineDash(xModel, aLineDashName); - aAny >>= aLineDash; - } + if (!aLineDashName.isEmpty() && xModel) { + css::uno::Any aAny = getLineDash(xModel, aLineDashName); + aAny >>= aLineDash; } } bDashSet = true; diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 2e2a6216cb4f..60bdced74b5a 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -83,13 +83,10 @@ ZipFile::ZipFile( const rtl::Reference<comphelper::RefCountedMutex>& aMutexHolde , m_xContext ( rxContext ) , bRecoveryMode( false ) { - if (bInitialise) + if (bInitialise && readCEN() == -1 ) { - if ( readCEN() == -1 ) - { - aEntries.clear(); - throw ZipException( "stream data looks to be broken" ); - } + aEntries.clear(); + throw ZipException( "stream data looks to be broken" ); } } diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx index 61b2c7ba1445..b183f634eb97 100644 --- a/registry/source/registry.cxx +++ b/registry/source/registry.cxx @@ -57,13 +57,10 @@ static void REGISTRY_CALLTYPE release(RegHandle hReg) { ORegistry* pReg = static_cast<ORegistry*>(hReg); - if (pReg) + if (pReg && pReg->release() == 0) { - if (pReg->release() == 0) - { - delete pReg; - hReg = nullptr; - } + delete pReg; + hReg = nullptr; } } diff --git a/reportdesign/source/core/sdr/PropertyForward.cxx b/reportdesign/source/core/sdr/PropertyForward.cxx index a2a94ccd6fff..cca1f9825216 100644 --- a/reportdesign/source/core/sdr/PropertyForward.cxx +++ b/reportdesign/source/core/sdr/PropertyForward.cxx @@ -99,47 +99,44 @@ void SAL_CALL OPropertyMediator::propertyChange( const PropertyChangeEvent& evt bool bDest = (evt.Source == m_xDest); Reference<XPropertySet> xProp = bDest ? m_xSource : m_xDest; Reference<XPropertySetInfo> xPropInfo = bDest ? m_xSourceInfo : m_xDestInfo; - if ( xProp.is() ) + if ( xProp.is() && xPropInfo.is() ) { - if ( xPropInfo.is() ) + if ( xPropInfo->hasPropertyByName(evt.PropertyName) ) + xProp->setPropertyValue(evt.PropertyName,evt.NewValue); + else { - if ( xPropInfo->hasPropertyByName(evt.PropertyName) ) - xProp->setPropertyValue(evt.PropertyName,evt.NewValue); + TPropertyNamePair::const_iterator aFind = m_aNameMap.find(evt.PropertyName); + OUString sPropName; + if ( aFind != m_aNameMap.end() ) + sPropName = aFind->second.first; else { - TPropertyNamePair::const_iterator aFind = m_aNameMap.find(evt.PropertyName); - OUString sPropName; + aFind = ::std::find_if( + m_aNameMap.begin(), + m_aNameMap.end(), + [&evt] (const TPropertyNamePair::value_type& namePair) { + return namePair.second.first == evt.PropertyName; + }); if ( aFind != m_aNameMap.end() ) - sPropName = aFind->second.first; - else - { - aFind = ::std::find_if( - m_aNameMap.begin(), - m_aNameMap.end(), - [&evt] (const TPropertyNamePair::value_type& namePair) { - return namePair.second.first == evt.PropertyName; - }); - if ( aFind != m_aNameMap.end() ) - sPropName = aFind->first; - } - if (aFind != m_aNameMap.end() && !sPropName.isEmpty() && xPropInfo->hasPropertyByName(sPropName)) - xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue)); - else if ( evt.PropertyName == PROPERTY_CHARFONTNAME - || evt.PropertyName == PROPERTY_CHARFONTSTYLENAME - || evt.PropertyName == PROPERTY_CHARSTRIKEOUT - || evt.PropertyName == PROPERTY_CHARWORDMODE - || evt.PropertyName == PROPERTY_CHARROTATION - || evt.PropertyName == PROPERTY_CHARSCALEWIDTH - || evt.PropertyName == PROPERTY_CHARFONTFAMILY - || evt.PropertyName == PROPERTY_CHARFONTCHARSET - || evt.PropertyName == PROPERTY_CHARFONTPITCH - || evt.PropertyName == PROPERTY_CHARHEIGHT - || evt.PropertyName == PROPERTY_CHARUNDERLINE - || evt.PropertyName == PROPERTY_CHARWEIGHT - || evt.PropertyName == PROPERTY_CHARPOSTURE) - { - xProp->setPropertyValue(PROPERTY_FONTDESCRIPTOR,m_xSource->getPropertyValue(PROPERTY_FONTDESCRIPTOR)); - } + sPropName = aFind->first; + } + if (aFind != m_aNameMap.end() && !sPropName.isEmpty() && xPropInfo->hasPropertyByName(sPropName)) + xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue)); + else if ( evt.PropertyName == PROPERTY_CHARFONTNAME + || evt.PropertyName == PROPERTY_CHARFONTSTYLENAME + || evt.PropertyName == PROPERTY_CHARSTRIKEOUT + || evt.PropertyName == PROPERTY_CHARWORDMODE + || evt.PropertyName == PROPERTY_CHARROTATION + || evt.PropertyName == PROPERTY_CHARSCALEWIDTH + || evt.PropertyName == PROPERTY_CHARFONTFAMILY + || evt.PropertyName == PROPERTY_CHARFONTCHARSET + || evt.PropertyName == PROPERTY_CHARFONTPITCH + || evt.PropertyName == PROPERTY_CHARHEIGHT + || evt.PropertyName == PROPERTY_CHARUNDERLINE + || evt.PropertyName == PROPERTY_CHARWEIGHT + || evt.PropertyName == PROPERTY_CHARPOSTURE) + { + xProp->setPropertyValue(PROPERTY_FONTDESCRIPTOR,m_xSource->getPropertyValue(PROPERTY_FONTDESCRIPTOR)); } } } diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 3a1deb5958d9..9e4bbf84cf69 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1401,11 +1401,8 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection, b { OReportSection& rReportSection = (*aIter)->getReportSection(); SdrHdl* pCurrentHdl = rReportSection.getSectionView().GetDragHdl(); - if ( pCurrentHdl ) - { - if ( aRealMousePos.Y() > 0 ) - aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos; - } + if ( pCurrentHdl && aRealMousePos.Y() > 0 ) + aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos; rReportSection.getSectionView().MovAction ( aRealMousePos ); const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height(); aRealMousePos.AdjustY( -nSectionHeight ); diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx index 224a345a3094..836d30889b80 100644 --- a/sal/rtl/random.cxx +++ b/sal/rtl/random.cxx @@ -294,11 +294,8 @@ rtlRandomError SAL_CALL rtl_random_getBytes ( if (pImpl->m_hDigest || !osl_get_system_random_data(static_cast< char* >(Buffer), Bytes)) { - if (!pImpl->m_hDigest) - { - if (!initPool (pImpl)) - return rtl_Random_E_Unknown; - } + if (!pImpl->m_hDigest && !initPool(pImpl)) + return rtl_Random_E_Unknown; readPool(pImpl, pBuffer, Bytes); } return rtl_Random_E_None; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
