loplugin:flatten in accessibility..basic

Change-Id: If2cc282c2b135d634daf393a082c29049b10a677
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127223
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2021-12-21 13:29:14 +02:00
parent ca28826a08
commit 26f46b861d
14 changed files with 346 additions and 358 deletions

View File

@@ -409,8 +409,9 @@ namespace accessibility
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
SvTreeListBox* pBox = m_pTreeListBox; SvTreeListBox* pBox = m_pTreeListBox;
if(pBox) if(!pBox)
{ return AccessibleRole::UNKNOWN;
SvTreeFlags treeFlag = pBox->GetTreeFlags(); SvTreeFlags treeFlag = pBox->GetTreeFlags();
if(treeFlag & SvTreeFlags::CHKBTN ) if(treeFlag & SvTreeFlags::CHKBTN )
{ {
@@ -432,8 +433,6 @@ namespace accessibility
//o is: return AccessibleRole::LABEL; //o is: return AccessibleRole::LABEL;
return AccessibleRole::TREE_ITEM; return AccessibleRole::TREE_ITEM;
} }
return AccessibleRole::UNKNOWN;
}
OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( )
{ {

View File

@@ -300,8 +300,9 @@ bool MediaWindow::isMediaURL( const OUString& rURL, const OUString& rReferer, bo
{ {
const INetURLObject aURL( rURL ); const INetURLObject aURL( rURL );
if( aURL.GetProtocol() != INetProtocol::NotValid ) if( aURL.GetProtocol() == INetProtocol::NotValid )
{ return false;
if( bDeep || pPreferredSizePixel ) if( bDeep || pPreferredSizePixel )
{ {
try try
@@ -341,7 +342,6 @@ bool MediaWindow::isMediaURL( const OUString& rURL, const OUString& rReferer, bo
} }
} }
} }
}
return false; return false;
} }

View File

@@ -160,10 +160,13 @@ bool RenameModule (
if ( !rDocument.renameModule( rLibName, rOldName, rNewName ) ) if ( !rDocument.renameModule( rLibName, rOldName, rNewName ) )
return false; return false;
if (Shell* pShell = GetShell()) Shell* pShell = GetShell();
{ if (!pShell)
if (VclPtr<ModulWindow> pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true)) return true;
{ VclPtr<ModulWindow> pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true);
if (!pWin)
return true;
// set new name in window // set new name in window
pWin->SetName( rNewName ); pWin->SetName( rNewName );
@@ -180,8 +183,6 @@ bool RenameModule (
rTabBar.Sort(); rTabBar.Sort();
rTabBar.MakeVisible(rTabBar.GetCurPageId()); rTabBar.MakeVisible(rTabBar.GetCurPageId());
} }
}
}
return true; return true;
} }

View File

@@ -180,8 +180,9 @@ bool RenameDialog (
if ( !rDocument.renameDialog( rLibName, rOldName, rNewName, xExistingDialog ) ) if ( !rDocument.renameDialog( rLibName, rOldName, rNewName, xExistingDialog ) )
return false; return false;
if (pWin && pShell) if (!pWin || !pShell)
{ return true;
// set new name in window // set new name in window
pWin->SetName( rNewName ); pWin->SetName( rNewName );
@@ -198,7 +199,6 @@ bool RenameDialog (
rTabBar.Sort(); rTabBar.Sort();
rTabBar.MakeVisible( rTabBar.GetCurPageId() ); rTabBar.MakeVisible( rTabBar.GetCurPageId() );
} }
}
return true; return true;
} }

View File

@@ -509,8 +509,8 @@ namespace basctl
bool ScriptDocument::Impl::removeModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rModuleName ) bool ScriptDocument::Impl::removeModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rModuleName )
{ {
OSL_ENSURE( isValid(), "ScriptDocument::Impl::removeModuleOrDialog: invalid!" ); OSL_ENSURE( isValid(), "ScriptDocument::Impl::removeModuleOrDialog: invalid!" );
if ( isValid() ) if ( !isValid() )
{ return false;
try try
{ {
Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) ); Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) );
@@ -527,7 +527,6 @@ namespace basctl
{ {
DBG_UNHANDLED_EXCEPTION("basctl.basicide"); DBG_UNHANDLED_EXCEPTION("basctl.basicide");
} }
}
return false; return false;
} }

View File

@@ -174,8 +174,9 @@ namespace basegfx::internal
void testLastLine() void testLastLine()
{ {
if(mpLine) if(!mpLine)
{ return;
bool bNecessary(false); bool bNecessary(false);
for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++) for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++)
@@ -194,7 +195,6 @@ namespace basegfx::internal
mpLine.reset(); mpLine.reset();
} }
} }
}
// Left-upper decomposition // Left-upper decomposition
bool ludcmp(sal_uInt16 nIndex[], sal_Int16& nParity) bool ludcmp(sal_uInt16 nIndex[], sal_Int16& nParity)

View File

@@ -664,10 +664,10 @@ public:
bool operator==(const ImplB2DPolygon& rCandidate) const bool operator==(const ImplB2DPolygon& rCandidate) const
{ {
if(mbIsClosed == rCandidate.mbIsClosed) if(mbIsClosed != rCandidate.mbIsClosed)
{ return false;
if(maPoints == rCandidate.maPoints) if(!(maPoints == rCandidate.maPoints))
{ return false;
bool bControlVectorsAreEqual(true); bool bControlVectorsAreEqual(true);
if(moControlVector) if(moControlVector)
@@ -691,14 +691,7 @@ public:
} }
} }
if(bControlVectorsAreEqual) return bControlVectorsAreEqual;
{
return true;
}
}
}
return false;
} }
const basegfx::B2DPoint& getPoint(sal_uInt32 nIndex) const const basegfx::B2DPoint& getPoint(sal_uInt32 nIndex) const

View File

@@ -1530,8 +1530,9 @@ namespace basegfx::utils
const B2DPolygon& aCandidate(rCandidate.getDefaultAdaptiveSubdivision()); const B2DPolygon& aCandidate(rCandidate.getDefaultAdaptiveSubdivision());
const sal_uInt32 nPointCount(aCandidate.count()); const sal_uInt32 nPointCount(aCandidate.count());
if(nPointCount) if(!nPointCount)
{ return false;
const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount : nPointCount - 1); const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount : nPointCount - 1);
B2DPoint aCurrent(aCandidate.getB2DPoint(0)); B2DPoint aCurrent(aCandidate.getB2DPoint(0));
@@ -1561,7 +1562,6 @@ namespace basegfx::utils
return true; return true;
} }
} }
}
return false; return false;
} }
@@ -1933,8 +1933,9 @@ namespace basegfx::utils
OSL_ENSURE(!rCandidate.areControlPointsUsed(), "hasNeutralPoints: ATM works not for curves (!)"); OSL_ENSURE(!rCandidate.areControlPointsUsed(), "hasNeutralPoints: ATM works not for curves (!)");
const sal_uInt32 nPointCount(rCandidate.count()); const sal_uInt32 nPointCount(rCandidate.count());
if(nPointCount > 2) if(nPointCount <= 2)
{ return false;
B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1)); B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1));
B2DPoint aCurrPoint(rCandidate.getB2DPoint(0)); B2DPoint aCurrPoint(rCandidate.getB2DPoint(0));
@@ -1957,7 +1958,6 @@ namespace basegfx::utils
aCurrPoint = aNextPoint; aCurrPoint = aNextPoint;
} }
} }
}
return false; return false;
} }
@@ -2015,8 +2015,9 @@ namespace basegfx::utils
OSL_ENSURE(!rCandidate.areControlPointsUsed(), "isConvex: ATM works not for curves (!)"); OSL_ENSURE(!rCandidate.areControlPointsUsed(), "isConvex: ATM works not for curves (!)");
const sal_uInt32 nPointCount(rCandidate.count()); const sal_uInt32 nPointCount(rCandidate.count());
if(nPointCount > 2) if(nPointCount <= 2)
{ return true;
const B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1)); const B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1));
B2DPoint aCurrPoint(rCandidate.getB2DPoint(0)); B2DPoint aCurrPoint(rCandidate.getB2DPoint(0));
B2DVector aCurrVec(aPrevPoint - aCurrPoint); B2DVector aCurrVec(aPrevPoint - aCurrPoint);
@@ -2046,7 +2047,6 @@ namespace basegfx::utils
aCurrPoint = aNextPoint; aCurrPoint = aNextPoint;
aCurrVec = -aNextVec; aCurrVec = -aNextVec;
} }
}
return true; return true;
} }

View File

@@ -180,8 +180,9 @@ namespace basegfx
bool Triangulator::CheckPointInTriangle(EdgeEntry* pEdgeA, EdgeEntry const * pEdgeB, const B2DPoint& rTestPoint) bool Triangulator::CheckPointInTriangle(EdgeEntry* pEdgeA, EdgeEntry const * pEdgeB, const B2DPoint& rTestPoint)
{ {
// inside triangle or on edge? // inside triangle or on edge?
if(utils::isPointInTriangle(pEdgeA->getStart(), pEdgeA->getEnd(), pEdgeB->getEnd(), rTestPoint, true)) if(!utils::isPointInTriangle(pEdgeA->getStart(), pEdgeA->getEnd(), pEdgeB->getEnd(), rTestPoint, true))
{ return true;
// but not on point // but not on point
if(!rTestPoint.equal(pEdgeA->getEnd()) && !rTestPoint.equal(pEdgeB->getEnd())) if(!rTestPoint.equal(pEdgeA->getEnd()) && !rTestPoint.equal(pEdgeB->getEnd()))
{ {
@@ -197,7 +198,6 @@ namespace basegfx
return false; return false;
} }
}
return true; return true;
} }

View File

@@ -395,8 +395,9 @@ namespace basegfx::trapezoidhelper
aEdgeB.getStart(), aDeltaB, aEdgeB.getStart(), aDeltaB,
CutFlagValue::LINE, CutFlagValue::LINE,
&fCutA, &fCutA,
&fCutB) != CutFlagValue::NONE) &fCutB) == CutFlagValue::NONE)
{ return false;
// use a simple metric (length criteria) for choosing the numerically // use a simple metric (length criteria) for choosing the numerically
// better cut // better cut
const double fSimpleLengthA(aDeltaA.getX() + aDeltaA.getY()); const double fSimpleLengthA(aDeltaA.getX() + aDeltaA.getY());
@@ -416,9 +417,6 @@ namespace basegfx::trapezoidhelper
return bRetval; return bRetval;
} }
return false;
}
void solveHorizontalEdges(TrDeSimpleEdges& rTrDeSimpleEdges) void solveHorizontalEdges(TrDeSimpleEdges& rTrDeSimpleEdges)
{ {
if(rTrDeSimpleEdges.empty() || maTrDeEdgeEntries.empty()) if(rTrDeSimpleEdges.empty() || maTrDeEdgeEntries.empty())

View File

@@ -1596,8 +1596,9 @@ bool SbModule::LoadData( SvStream& rStrm, sal_uInt16 nVer )
SetFlag( SbxFlagBits::ExtSearch | SbxFlagBits::GlobalSearch ); SetFlag( SbxFlagBits::ExtSearch | SbxFlagBits::GlobalSearch );
sal_uInt8 bImage; sal_uInt8 bImage;
rStrm.ReadUChar( bImage ); rStrm.ReadUChar( bImage );
if( bImage ) if( !bImage )
{ return true;
std::unique_ptr<SbiImage> p(new SbiImage); std::unique_ptr<SbiImage> p(new SbiImage);
sal_uInt32 nImgVer = 0; sal_uInt32 nImgVer = 0;
@@ -1628,7 +1629,6 @@ bool SbModule::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{ {
SetSource32( p->aOUSource ); SetSource32( p->aOUSource );
} }
}
return true; return true;
} }

View File

@@ -50,8 +50,9 @@ ErrCode returnInt64InOutArg(SbxArray *pArgs, SbxVariable &rRetVal,
pOut->PutCurrency(nValue); pOut->PutCurrency(nValue);
return ERRCODE_NONE; return ERRCODE_NONE;
} }
if (pOut->IsObject()) if (!pOut->IsObject())
{ return ERRCODE_BASIC_BAD_ARGUMENT;
// FIXME: should we clone this and use pOut->PutObject ? // FIXME: should we clone this and use pOut->PutObject ?
SbxObject* pObj = dynamic_cast<SbxObject*>( pOut->GetObject() ); SbxObject* pObj = dynamic_cast<SbxObject*>( pOut->GetObject() );
if (!pObj) if (!pObj)
@@ -70,8 +71,6 @@ ErrCode returnInt64InOutArg(SbxArray *pArgs, SbxVariable &rRetVal,
pHigh->PutLong(nValue >> 32); pHigh->PutLong(nValue >> 32);
return ERRCODE_NONE; return ERRCODE_NONE;
} }
return ERRCODE_BASIC_BAD_ARGUMENT;
}
ErrCode builtin_kernel32(std::u16string_view aFuncName, SbxArray *pArgs, ErrCode builtin_kernel32(std::u16string_view aFuncName, SbxArray *pArgs,
SbxVariable &rRetVal) SbxVariable &rRetVal)

View File

@@ -1666,8 +1666,9 @@ static bool checkUnoStructCopy( bool bVBA, SbxVariableRef const & refVal, SbxVar
aAny = pUnoVal ? pUnoVal->getUnoAny() : pUnoStructVal->getUnoAny(); aAny = pUnoVal ? pUnoVal->getUnoAny() : pUnoStructVal->getUnoAny();
else else
return false; return false;
if ( aAny.getValueType().getTypeClass() == TypeClass_STRUCT ) if ( aAny.getValueType().getTypeClass() != TypeClass_STRUCT )
{ return false;
refVar->SetType( SbxOBJECT ); refVar->SetType( SbxOBJECT );
ErrCode eOldErr = SbxBase::GetError(); ErrCode eOldErr = SbxBase::GetError();
// There are some circumstances when calling GetObject // There are some circumstances when calling GetObject
@@ -1699,8 +1700,6 @@ static bool checkUnoStructCopy( bool bVBA, SbxVariableRef const & refVal, SbxVar
} }
return true; return true;
} }
return false;
}
// laying down TOS in TOS-1 // laying down TOS in TOS-1

View File

@@ -687,8 +687,9 @@ bool SbxValue::SetType( SbxDataType t )
} }
t = SbxEMPTY; t = SbxEMPTY;
} }
if( ( t & 0x0FFF ) != ( aData.eType & 0x0FFF ) ) if( ( t & 0x0FFF ) == ( aData.eType & 0x0FFF ) )
{ return true;
if( !CanWrite() || IsFixed() ) if( !CanWrite() || IsFixed() )
{ {
SetError( ERRCODE_BASIC_CONVERSION ); SetError( ERRCODE_BASIC_CONVERSION );
@@ -721,7 +722,6 @@ bool SbxValue::SetType( SbxDataType t )
} }
aData.clear(t); aData.clear(t);
} }
}
return true; return true;
} }