Kaydet (Commit) f2cd9c0c authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#120703 PVS: V560 A part of conditional expression is always true/false

Change-Id: If173f42302553b164267909a0a3156bb25a6d558
Reviewed-on: https://gerrit.libreoffice.org/63957
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst e1cbd518
......@@ -558,7 +558,7 @@ void ODbaseTable::ReadMemoHeader()
(*m_pMemoStream).ReadUInt16( m_aMemoHeader.db_size );
if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size != 512) // 1 is also for dBase 3
m_aMemoHeader.db_typ = MemodBaseIV;
else if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size == 512)
else if (m_aMemoHeader.db_size == 512)
{
// There are files using size specification, though they are dBase-files
char sHeader[4];
......
......@@ -1305,12 +1305,11 @@ void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList )
bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList )
{
static const sal_uInt16 gFontSizeWichMap[] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL, 0 };
const SvxFontItem* pFontItem = &rSet.Get( EE_CHAR_FONTINFO );
if( !pFontItem || !pFontList )
if (!pFontList)
return false;
static const sal_uInt16 gFontSizeWichMap[] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL, 0 };
const SvxFontItem& rFontItem = rSet.Get(EE_CHAR_FONTINFO);
bool bRet = false;
const sal_uInt16* pWhich = gFontSizeWichMap;
......@@ -1321,7 +1320,7 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo
const MapUnit eUnit = rSet.GetPool()->GetMetric( *pWhich );
nHeight = OutputDevice::LogicToLogic(nHeight * 10, eUnit, MapUnit::MapPoint);
FontMetric aFontMetric = pFontList->Get( pFontItem->GetFamilyName(), pFontItem->GetStyleName() );
FontMetric aFontMetric = pFontList->Get( rFontItem.GetFamilyName(), rFontItem.GetStyleName() );
const sal_IntPtr* pAry = pFontList->GetSizeAry( aFontMetric );
if( bGrow )
......
......@@ -625,7 +625,7 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
aItems.Put( aHeightItemCTL );
// Paragraph margins, when Heading:
if ( !nHLevel || ((nHLevel >= 1) && (nHLevel <= 6)) )
if (nHLevel <= 6)
{
SvxULSpaceItem aULSpaceItem( EE_PARA_ULSPACE );
aULSpaceItem.SetUpper( static_cast<sal_uInt16>(OutputDevice::LogicToLogic( 42, MapUnit::Map10thMM, eUnit )) );
......
......@@ -3905,7 +3905,7 @@ EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject
sal_uInt32 nLen = static_cast<sal_uInt32>(rId.getLength());
const sal_Char* pData = rId.getStr();
GraphicType eType( rObject.GetType() );
if ( nLen && pData && ( eType != GraphicType::NONE ) )
if (nLen && (eType != GraphicType::NONE))
{
mnIdentifier[ 0 ] = rtl_crc32( 0,pData, nLen );
mnIdentifier[ 1 ] = 0;
......
......@@ -1360,11 +1360,10 @@ void FormulaCompiler::Factor()
CurrentFactor pFacToken( this );
OpCode eOp = mpToken->GetOpCode();
if( eOp == ocPush || eOp == ocColRowNameAuto || eOp == ocMatRef ||
eOp == ocDBArea || eOp == ocTableRef
|| (!mbJumpCommandReorder && ((eOp == ocName) || (eOp == ocDBArea)
|| (eOp == ocTableRef) || (eOp == ocColRowName) || (eOp == ocBad)))
)
if (eOp == ocPush || eOp == ocColRowNameAuto || eOp == ocMatRef || eOp == ocDBArea
|| eOp == ocTableRef
|| (!mbJumpCommandReorder && ((eOp == ocName) || (eOp == ocColRowName) || (eOp == ocBad)))
)
{
PutCode( mpToken );
eOp = NextToken();
......
......@@ -365,9 +365,7 @@ OUString BootParams::getJREHome()
"Using bootstrap parameter " UNO_JAVA_JFW_ENV_JREHOME
" with JAVA_HOME = " << pJRE);
}
else if (getMode() == JFW_MODE_DIRECT
&& !bEnvJRE
&& !bJRE)
else if (getMode() == JFW_MODE_DIRECT && !bJRE)
{
throw FrameworkException(
JFW_E_CONFIGURATION,
......
......@@ -584,7 +584,7 @@ void ScDocument::FillInfo(
++nArrRow;
}
else if (bRowHidden && nLastHiddenRow >= 0)
else if (nLastHiddenRow >= 0)
{
nCurRow = nLastHiddenRow;
if (nCurRow > nThisRow)
......
......@@ -3219,7 +3219,7 @@ bool ScFormulaCell::UpdateReferenceOnShift(
if (!bHasRefs)
{
bHasColRowNames = (formula::FormulaTokenArrayPlainIterator(*pCode).GetNextColRowName() != nullptr);
bHasRefs = bHasRefs || bHasColRowNames;
bHasRefs = bHasColRowNames;
}
bool bOnRefMove = pCode->IsRecalcModeOnRefMove();
......@@ -3347,7 +3347,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
if (!bHasRefs)
{
bHasColRowNames = (formula::FormulaTokenArrayPlainIterator(*pCode).GetNextColRowName() != nullptr);
bHasRefs = bHasRefs || bHasColRowNames;
bHasRefs = bHasColRowNames;
}
bool bOnRefMove = pCode->IsRecalcModeOnRefMove();
......
......@@ -217,10 +217,7 @@ ErrCode ScFormatFilterPluginImpl::ScExportExcel5( SfxMedium& rMedium, ScDocument
OSL_ENSURE( pMedStrm, "::ScExportExcel5 - medium without output stream" );
if( !pMedStrm ) return SCERR_IMPORT_OPEN; // should not happen
ErrCode eRet = SCERR_IMPORT_UNKNOWN_BIFF;
if( eFormat == ExpBiff5 || eFormat == ExpBiff8 )
eRet = lcl_ExportExcelBiff( rMedium, pDocument, pMedStrm, eFormat == ExpBiff8, eNach );
ErrCode eRet = lcl_ExportExcelBiff(rMedium, pDocument, pMedStrm, eFormat == ExpBiff8, eNach);
return eRet;
}
......
......@@ -265,7 +265,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
SvxLinkInsertMode eMode = pHyper->GetInsertMode();
bool bDone = false;
if ( pOutView && ( eMode == HLINK_DEFAULT || eMode == HLINK_FIELD ) )
if (eMode == HLINK_DEFAULT || eMode == HLINK_FIELD)
{
const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection();
if (pFieldItem)
......
......@@ -487,7 +487,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt)
else
{
// move handle with index nHandleIndex
if(pHdl && (nX || nY))
if (nX || nY)
{
// now move the Handle (nX, nY)
Point aStartPoint(pHdl->GetPos());
......
......@@ -393,7 +393,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
pStyleSheet = &(pStylePool->Make( aStyleName, eFamily,
SfxStyleSearchBits::UserDefined ) );
if ( pStyleSheet && pStyleSheet->HasParentSupport() )
if (pStyleSheet->HasParentSupport())
pStyleSheet->SetParent(aRefName);
}
break;
......@@ -2180,7 +2180,7 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet )
rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
rSet.InvalidateItem(SID_FRAME_LINECOLOR);
}
else if( !bCol && !bColDisable) // if no line available
else if (!bCol) // if no line available
{
aCol = COL_AUTO;
rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
......
......@@ -126,7 +126,7 @@ double SAL_CALL AnalysisAddIn::getCumprinc( double fRate, sal_Int32 nNumPeriods,
{
double fPmt, fPpmt;
if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods || nNumPeriods <= 0 ||
if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods ||
fVal <= 0.0 || ( nPayType != 0 && nPayType != 1 ) )
throw css::lang::IllegalArgumentException();
......@@ -164,7 +164,7 @@ double SAL_CALL AnalysisAddIn::getCumipmt( double fRate, sal_Int32 nNumPeriods,
{
double fPmt, fIpmt;
if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods || nNumPeriods <= 0 ||
if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods ||
fVal <= 0.0 || ( nPayType != 0 && nPayType != 1 ) )
throw css::lang::IllegalArgumentException();
......
......@@ -722,7 +722,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
else
{
// move handle with index nHandleIndex
if(pHdl && (nX || nY))
if (nX || nY)
{
// now move the Handle (nX, nY)
Point aStartPoint(pHdl->GetPos());
......
......@@ -632,22 +632,22 @@ IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab, void )
/// inherited from sd::ViewShell
SdPage* DrawViewShell::getCurrentPage() const
{
const sal_Int32 nPageCount = (meEditMode == EditMode::Page)?
const sal_uInt16 nPageCount = (meEditMode == EditMode::Page)?
GetDoc()->GetSdPageCount(mePageKind):
GetDoc()->GetMasterSdPageCount(mePageKind);
sal_Int32 nCurrentPage = maTabControl->GetCurPagePos();
DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" );
if( (nPageCount < 0) || (nCurrentPage>=nPageCount) )
sal_uInt16 nCurrentPage = maTabControl->GetCurPagePos();
DBG_ASSERT((nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!");
if (nCurrentPage >= nPageCount)
nCurrentPage = 0; // play safe here
if (meEditMode == EditMode::Page)
{
return GetDoc()->GetSdPage(static_cast<sal_uInt16>(nCurrentPage), mePageKind);
return GetDoc()->GetSdPage(nCurrentPage, mePageKind);
}
else // EditMode::MasterPage
{
return GetDoc()->GetMasterSdPage(static_cast<sal_uInt16>(nCurrentPage), mePageKind);
return GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind);
}
}
......
......@@ -1836,7 +1836,7 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
{
nLeft = static_cast<const SvxLongLRSpaceItem*>(pPoolItem)->GetLeft();
nRight = static_cast<const SvxLongLRSpaceItem*>(pPoolItem)->GetRight();
if (nLeft != -1 && nUpper == -1)
if (nLeft != -1)
{
nUpper = pPage->GetUpperBorder();
nLower = pPage->GetLowerBorder();
......@@ -1851,7 +1851,7 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
{
nUpper = static_cast<const SvxLongULSpaceItem*>(pPoolItem)->GetUpper();
nLower = static_cast<const SvxLongULSpaceItem*>(pPoolItem)->GetLower();
if (nLeft == -1 && nUpper != -1)
if (nUpper != -1)
{
nLeft = pPage->GetLeftBorder();
nRight = pPage->GetRightBorder();
......
......@@ -491,7 +491,7 @@ void ExtendedColorConfig_Impl::UnlockBroadcast()
m_bBroadcastWhenUnlocked = ExtendedColorConfig::m_pImpl != nullptr;
if ( m_bBroadcastWhenUnlocked )
{
if ( ExtendedColorConfig::m_pImpl && ExtendedColorConfig::m_pImpl->m_bIsBroadcastEnabled )
if (ExtendedColorConfig::m_pImpl->m_bIsBroadcastEnabled)
{
m_bBroadcastWhenUnlocked = false;
ExtendedColorConfig::m_pImpl->Broadcast(SfxHint(SfxHintId::ColorsChanged));
......
......@@ -1218,8 +1218,7 @@ SdrObjectUniquePtr FmXFormView::implCreateFieldControl( const svx::ODataAccessDe
pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
else
{// find OutDev
SdrPageView* pPageView = m_pView->GetSdrPageView();
if( pPageView && !pOutDev )
if (SdrPageView* pPageView = m_pView->GetSdrPageView())
{
// const SdrPageViewWinList& rWinList = pPageView->GetWinList();
// const SdrPageViewWindows& rPageViewWindows = pPageView->GetPageViewWindows();
......@@ -1368,8 +1367,7 @@ SdrObjectUniquePtr FmXFormView::implCreateXFormsControl( const svx::OXFormsDescr
pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
else
{// find OutDev
SdrPageView* pPageView = m_pView->GetSdrPageView();
if( pPageView && !pOutDev )
if (SdrPageView* pPageView = m_pView->GetSdrPageView())
{
// const SdrPageViewWinList& rWinList = pPageView->GetWinList();
// const SdrPageViewWindows& rPageViewWindows = pPageView->GetPageViewWindows();
......
......@@ -213,7 +213,7 @@ bool GalleryExplorer::GetSdrObj( const OUString& rThemeName, sal_uInt32 nSdrMode
if( nActPos++ == nSdrModelPos )
{
if( pModel )
bRet = bRet || pTheme->GetModel( i, *pModel );
bRet = pTheme->GetModel(i, *pModel);
if( pThumb )
bRet = bRet || pTheme->GetThumb( i, *pThumb );
......
......@@ -65,15 +65,13 @@ namespace
::sfx2::SvBaseLink* lcl_FindNextRemovableLink( const ::sfx2::SvBaseLinks& rLinks )
{
for(const auto & rLink : rLinks)
for (const auto& rLinkIter : rLinks)
{
::sfx2::SvBaseLink* pLnk = &(*rLink);
if( pLnk &&
( OBJECT_CLIENT_GRF == pLnk->GetObjType() ||
OBJECT_CLIENT_FILE == pLnk->GetObjType() ) &&
dynamic_cast<const SwBaseLink*>( pLnk) != nullptr )
::sfx2::SvBaseLink& rLnk = *rLinkIter;
if ((OBJECT_CLIENT_GRF == rLnk.GetObjType() || OBJECT_CLIENT_FILE == rLnk.GetObjType())
&& dynamic_cast<const SwBaseLink*>(&rLnk) != nullptr)
{
tools::SvRef<sfx2::SvBaseLink> xLink = pLnk;
tools::SvRef<sfx2::SvBaseLink> xLink(&rLnk);
OUString sFName;
sfx2::LinkManager::GetDisplayNames( xLink.get(), nullptr, &sFName );
......@@ -81,7 +79,7 @@ namespace
INetURLObject aURL( sFName );
if( INetProtocol::File == aURL.GetProtocol() ||
INetProtocol::Cid == aURL.GetProtocol() )
return pLnk;
return &rLnk;
}
}
return nullptr;
......
......@@ -633,7 +633,7 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, size_t nOldPos,
// adjust loop counter
if ( bMovedForward )
++i;
else if ( !bMovedForward && i > 0 )
else if (i > 0)
--i;
}
......
......@@ -2213,22 +2213,22 @@ void SwEditShell::FillByEx(SwTextFormatColl* pColl)
// Do NOT copy AutoNumRules into the template
const SfxPoolItem* pItem;
const SwNumRule* pRule = nullptr;
if( SfxItemState::SET == pSet->GetItemState( RES_BREAK, false ) ||
SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC,false ) ||
( SfxItemState::SET == pSet->GetItemState( RES_PARATR_NUMRULE,
false, &pItem ) && nullptr != (pRule = GetDoc()->FindNumRulePtr(
static_cast<const SwNumRuleItem*>(pItem)->GetValue() )) &&
pRule && pRule->IsAutoRule() )
)
if (SfxItemState::SET == pSet->GetItemState(RES_BREAK, false)
|| SfxItemState::SET == pSet->GetItemState(RES_PAGEDESC, false)
|| (SfxItemState::SET == pSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem)
&& nullptr != (pRule = GetDoc()->FindNumRulePtr(
static_cast<const SwNumRuleItem*>(pItem)->GetValue()))
&& pRule->IsAutoRule()))
{
SfxItemSet aSet( *pSet );
aSet.ClearItem( RES_BREAK );
aSet.ClearItem( RES_PAGEDESC );
if( pRule || (SfxItemState::SET == pSet->GetItemState( RES_PARATR_NUMRULE,
false, &pItem ) && nullptr != (pRule = GetDoc()->FindNumRulePtr(
static_cast<const SwNumRuleItem*>(pItem)->GetValue() )) &&
pRule && pRule->IsAutoRule() ))
if (pRule
|| (SfxItemState::SET == pSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem)
&& nullptr != (pRule = GetDoc()->FindNumRulePtr(
static_cast<const SwNumRuleItem*>(pItem)->GetValue()))
&& pRule->IsAutoRule()))
aSet.ClearItem( RES_PARATR_NUMRULE );
if( aSet.Count() )
......
......@@ -154,17 +154,16 @@ void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
}
/// update tables of content
void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
void SwEditShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
{
OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOX) != nullptr, "no TOXBaseSection!" );
SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOX));
OSL_ENSURE(pTOX, "no current listing");
if( pTOX && nullptr != pTOX->GetFormat()->GetSectionNode() )
assert(dynamic_cast<const SwTOXBaseSection*>(&rTOX) && "no TOXBaseSection!");
SwTOXBaseSection& rTOXSect = static_cast<SwTOXBaseSection&>(const_cast<SwTOXBase&>(rTOX));
if (rTOXSect.GetFormat()->GetSectionNode())
{
SwDoc* pMyDoc = GetDoc();
SwDocShell* pDocSh = pMyDoc->GetDocShell();
bool bInIndex = pTOX == GetCurTOX();
bool bInIndex = &rTOX == GetCurTOX();
SET_CURR_SHELL( this );
StartAllAction();
......@@ -174,17 +173,17 @@ void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
pMyDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::TOXCHANGE, nullptr);
// create listing stub
pTOX->Update(pSet);
rTOXSect.Update(pSet);
// correct Cursor
if( bInIndex )
pTOX->SetPosAtStartEnd( *GetCursor()->GetPoint() );
rTOXSect.SetPosAtStartEnd(*GetCursor()->GetPoint());
// start formatting
CalcLayout();
// insert page numbering
pTOX->UpdatePageNum();
rTOXSect.UpdatePageNum();
pMyDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::TOXCHANGE, nullptr);
......
......@@ -978,7 +978,6 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr )
StartAllAction();
StartUndo();
long nNewPage;
SwRootFrame* pTmpRootFrame = GetLayout();
sal_uInt16 nMaxPage = pTmpRootFrame->GetPageNum();
bool bTmpAssert = false;
......@@ -989,13 +988,11 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr )
// FlyFormat is still valid, therefore process
SwFormatAnchor aNewAnchor( pFormat->GetAnchor() );
if ((RndStdIds::FLY_AT_PAGE != aNewAnchor.GetAnchorId()) ||
0 >= ( nNewPage = aNewAnchor.GetPageNum() + 1 ) )
// Anchor has been changed or invalid page number,
// therefore: do not change!
if (RndStdIds::FLY_AT_PAGE != aNewAnchor.GetAnchorId())
// Anchor has been changed, therefore: do not change!
continue;
if( sal_uInt16(nNewPage) > nMaxPage )
sal_uInt16 nNewPage = aNewAnchor.GetPageNum() + 1;
if (nNewPage > nMaxPage)
{
if ( RES_DRAWFRMFMT == pFormat->Which() )
pFormat->CallSwClientNotify(sw::DrawFrameFormatHint(sw::DrawFrameFormatHintId::PAGE_OUT_OF_BOUNDS));
......@@ -1003,7 +1000,7 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr )
pFormat->DelFrames();
bTmpAssert = true;
}
aNewAnchor.SetPageNum( sal_uInt16(nNewPage) );
aNewAnchor.SetPageNum(nNewPage);
mxDoc->SetAttr( aNewAnchor, *pFormat );
}
}
......
......@@ -348,14 +348,14 @@ static bool LessY( Point const & aPt1, Point const & aPt2, bool bOld )
bool SwFEShell::MoveAnchor( SwMove nDir )
{
const SdrMarkList* pMrkList;
if( !Imp()->GetDrawView() ||
nullptr == (pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList()) ||
1 != pMrkList->GetMarkCount())
if (!Imp()->GetDrawView())
return false;
const SdrMarkList& pMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
if (1 != pMrkList.GetMarkCount())
return false;
SwFrame* pOld;
SwFlyFrame* pFly = nullptr;
SdrObject *pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
SdrObject *pObj = pMrkList.GetMark( 0 )->GetMarkedSdrObj();
if (SwVirtFlyDrawObj* pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pObj))
{
pFly = pVirtO->GetFlyFrame();
......@@ -1546,7 +1546,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool
(pVirtO && pVirtO->IsTextBox()) ||
( eType == GotoObjFlags::DrawSimple && lcl_IsControlGroup( pObj ) ) ||
( eType == GotoObjFlags::DrawControl && !lcl_IsControlGroup( pObj ) ) ||
( pFilter && !pFilter->includeObject( *pObj ) ) )
!pFilter->includeObject( *pObj ) )
continue;
if (pVirtO)
{
......
......@@ -395,8 +395,8 @@ const SwContentFrame* SwContentFrame::ImplGetNextContentFrame( bool bFwd ) const
}
bGoingUp = !(bGoingFwdOrBwd || bGoingDown);
if ( !bFwd && bGoingDown && p )
assert(p);
if (!bFwd && bGoingDown)
{
while ( p->GetNext() )
p = p->GetNext();
......
......@@ -123,7 +123,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
}
// #i28701# - use new method <GetPageFrame()>
if( !GetPageFrame() && GetAnchorFrame() && GetAnchorFrame()->IsInFly() )
if( !GetPageFrame() && GetAnchorFrame()->IsInFly() )
{
SwFlyFrame* pFly = AnchorFrame()->FindFlyFrame();
SwPageFrame *pPageFrame = pFly ? pFly->FindPageFrame() : nullptr;
......
......@@ -1346,7 +1346,7 @@ void SwFootnoteBossFrame::InsertFootnote( SwFootnoteFrame* pNew )
}
if ( !bEnd && pSibling )
nCmpPos = ::lcl_FindFootnotePos( pDoc, pSibling->GetAttr() );
if ( pSibling && pLastSib && (pSibling != pLastSib) )
if (pSibling && (pSibling != pLastSib))
{
// too far?
if ( (nLastPos < nCmpPos) && (nCmpPos > nStPos) )
......
......@@ -2561,12 +2561,11 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
{
const vcl::Font& rFnt = pFont ? *pFont : GetOut().GetFont();
bool bPrt = GetShell() && ! GetShell()->GetWin();
Color nNewColor = COL_BLACK;
bool bChgFntColor = false;
bool bChgLineColor = false;
if( bPrt && GetShell() && GetShell()->GetViewOptions()->IsBlackFont() )
if (GetShell() && !GetShell()->GetWin() && GetShell()->GetViewOptions()->IsBlackFont())
{
if ( COL_BLACK != rFnt.GetColor() )
bChgFntColor = true;
......@@ -2582,7 +2581,7 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
// LineColor has to be changed if:
// 1. IsAlwaysAutoColor is set
bChgLineColor = ! bPrt && GetShell() &&
bChgLineColor = GetShell() && GetShell()->GetWin() &&
GetShell()->GetAccessibilityOptions()->IsAlwaysAutoColor();
bChgFntColor = COL_AUTO == rFnt.GetColor() || bChgLineColor;
......
......@@ -133,7 +133,7 @@ size_t UndoManager::GetRedoActionCount(const bool bCurrentLevel) const
if (!pAction)
return nRet;
if (m_pView && !m_bRepair)
if (!m_bRepair)
{
// If another view created the first redo action, prevent redoing it from this view.
ViewShellId nViewShellId = m_pView->GetViewShellId();
......
......@@ -3188,10 +3188,10 @@ static void impl_borders( FSHelperPtr const & pSerializer,
// If there is a shadow, and it's not the regular 'Bottom-Right',
// then write only the 'shadowed' sides of the border
if (
( ( rOptions.aShadowLocation == SvxShadowLocation::TopLeft || rOptions.aShadowLocation == SvxShadowLocation::TopRight ) && *pBrd == SvxBoxItemLine::TOP ) ||
( ( rOptions.aShadowLocation == SvxShadowLocation::TopLeft || rOptions.aShadowLocation == SvxShadowLocation::BottomLeft ) && *pBrd == SvxBoxItemLine::LEFT ) ||
( ( rOptions.aShadowLocation == SvxShadowLocation::BottomLeft || rOptions.aShadowLocation == SvxShadowLocation::BottomRight ) && *pBrd == SvxBoxItemLine::BOTTOM) ||
( ( rOptions.aShadowLocation == SvxShadowLocation::TopRight || rOptions.aShadowLocation == SvxShadowLocation::BottomRight ) && *pBrd == SvxBoxItemLine::RIGHT )
((rOptions.aShadowLocation == SvxShadowLocation::TopLeft || rOptions.aShadowLocation == SvxShadowLocation::TopRight ) && *pBrd == SvxBoxItemLine::TOP ) ||
((rOptions.aShadowLocation == SvxShadowLocation::TopLeft || rOptions.aShadowLocation == SvxShadowLocation::BottomLeft) && *pBrd == SvxBoxItemLine::LEFT ) ||
((rOptions.aShadowLocation == SvxShadowLocation::BottomLeft ) && *pBrd == SvxBoxItemLine::BOTTOM) ||
((rOptions.aShadowLocation == SvxShadowLocation::TopRight ) && *pBrd == SvxBoxItemLine::RIGHT )
)
{
bWriteShadow = true;
......
......@@ -1284,7 +1284,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
else
{
// move handle with index nHandleIndex
if(pHdl && (nX || nY))
if (nX || nY)
{
if( SdrHdlKind::Anchor == pHdl->GetKind() ||
SdrHdlKind::Anchor_TR == pHdl->GetKind() )
......@@ -3114,8 +3114,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
// only try to select frame, if pointer already was
// switched accordingly
if ( m_aActHitType != SdrHitKind::NONE && !rSh.IsSelFrameMode() &&
!GetView().GetViewFrame()->GetDispatcher()->IsLocked() &&
!bExecDrawTextLink)
!GetView().GetViewFrame()->GetDispatcher()->IsLocked())
{
// Test if there is a draw object at that position and if it should be selected.
bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
......
......@@ -883,7 +883,7 @@ bool SwFieldMgr::GoNextPrev( bool bNext, SwFieldType* pTyp )
return pSh->MoveFieldType( nullptr, bNext, SwFieldIds::Database );
}
return pTyp && pSh && pSh->MoveFieldType( pTyp, bNext );
return pTyp && pSh->MoveFieldType(pTyp, bNext);
}
// insert field types
......
......@@ -152,7 +152,7 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
}
}
}
if ( !bNegative && bCurrency && !aStr.isEmpty() )
if (!bNegative && !aStr.isEmpty())
{
sal_uInt16 nFormat = rLocaleDataWrappper.getCurrNegativeFormat();
if ( (nFormat == 3) || (nFormat == 6) || // $1- || 1-$
......
......@@ -368,11 +368,10 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
const OUString& rLiteralMask,
bool bSameMask )
{
sal_uInt16 nFormatFlags = 0;
OUString aText = pEdit->GetText();
// remove leading blanks
if ( bSameMask && !(nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS) && !rEditMask.isEmpty() )
if (bSameMask && !rEditMask.isEmpty())
{
sal_Int32 i = 0;
sal_Int32 nMaxLen = aText.getLength();
......@@ -390,7 +389,7 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
aText = aText.copy( i );
}
OUString aNewText = ImplPatternReformat( aText, rEditMask, rLiteralMask, nFormatFlags );
OUString aNewText = ImplPatternReformat(aText, rEditMask, rLiteralMask, 0);
if ( aNewText != aText )
{
// adjust selection such that it remains at the end if it was there before
......@@ -399,7 +398,7 @@ static void ImplPatternProcessStrictModify( Edit* pEdit,
if ( nMaxSel >= aText.getLength() )
{
sal_Int32 nMaxPos = aNewText.getLength();
ImplPatternMaxPos( aNewText, rEditMask, nFormatFlags, bSameMask, nMaxSel, nMaxPos );
ImplPatternMaxPos(aNewText, rEditMask, 0, bSameMask, nMaxSel, nMaxPos);
if ( aSel.Min() == aSel.Max() )
{
aSel.Min() = nMaxPos;
......@@ -1757,7 +1756,7 @@ bool DateField::EventNotify( NotifyEvent& rNEvt )
Reformat();
}
}
else if ( !bTextLen && IsEmptyFieldValueEnabled() )
else
{
ResetLastDate();
SetEmptyFieldValueData( true );
......@@ -1859,7 +1858,7 @@ bool DateBox::EventNotify( NotifyEvent& rNEvt )
bool bTextLen = !GetText().isEmpty();
if ( bTextLen || !IsEmptyFieldValueEnabled() )
Reformat();
else if ( !bTextLen && IsEmptyFieldValueEnabled() )
else
{
ResetLastDate();
SetEmptyFieldValueData( true );
......
......@@ -1810,8 +1810,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
PropertyMap * pTargetContext = rContext.get();
if (pSectionContext != nullptr &&
nSprmId == NS_ooxml::LN_EG_SectPrContents_textDirection)
if (pSectionContext)
{
pTargetContext = pSectionContext;
}
......
......@@ -1489,7 +1489,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
// tdf#118521 set paragraph top or bottom margin based on the paragraph style
// if we already set the other margin with direct formatting
if ( pParaContext && m_xPreviousParagraph.is() )
if (m_xPreviousParagraph)
{
const bool bTopSet = pParaContext->isSet(PROP_PARA_TOP_MARGIN);
const bool bBottomSet = pParaContext->isSet(PROP_PARA_BOTTOM_MARGIN);
......@@ -1519,7 +1519,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
// Left, Right, and Hanging settings are also grouped. Ensure that all or none are set.
// m_xPreviousParagraph was set earlier, so really it still is the current paragraph...
if ( pParaContext && m_xPreviousParagraph.is() )
if (m_xPreviousParagraph)
{
const bool bLeftSet =