Kaydet (Commit) 5404f75a authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:collapseif in sdext..svx

Change-Id: I188d9e9b53e00acfbae3c7acd54de28f084c4b3f
Reviewed-on: https://gerrit.libreoffice.org/62985
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 39efec06
......@@ -216,13 +216,11 @@ static OUString AsciiToNative( const OUString& inStr, sal_Int32 nCount,
if (count > 0 && number->multiplierExponent[number->exponentCount-1] == 1 &&
newStr[count-1] == numberChar[0])
count--;
if (bNotZero && _count == count) {
if (end != len) {
newStr[count] = number->multiplierChar[0];
if (useOffset)
offset[count] = i - len;
count++;
}
if (bNotZero && _count == count && end != len) {
newStr[count] = number->multiplierChar[0];
if (useOffset)
offset[count] = i - len;
count++;
}
}
if (! bNotZero && ! (number->numberFlag & NUMBER_OMIT_ONLY_ZERO)) {
......
......@@ -173,22 +173,19 @@ void OptimizerDialog::UpdateConfiguration()
}
aAny = getControlProperty( "CheckBox3Pg3", "State" );
if ( aAny >>= nInt16 )
if ( (aAny >>= nInt16) && nInt16 )
{
if ( nInt16 )
aAny = getControlProperty( "ListBox0Pg3", "SelectedItems" );
if ( aAny >>= aSelectedItems )
{
aAny = getControlProperty( "ListBox0Pg3", "SelectedItems" );
if ( aAny >>= aSelectedItems )
if ( aSelectedItems.getLength() )
{
if ( aSelectedItems.getLength() )
sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
aAny = getControlProperty( "ListBox0Pg3", "StringItemList" );
if ( aAny >>= aStringItemList )
{
sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
aAny = getControlProperty( "ListBox0Pg3", "StringItemList" );
if ( aAny >>= aStringItemList )
{
if ( aStringItemList.getLength() > nSelectedItem )
SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) );
}
if ( aStringItemList.getLength() > nSelectedItem )
SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) );
}
}
}
......
......@@ -658,11 +658,8 @@ void SfxWorkWindow::ArrangeChildren_Impl( bool bForce )
return;
SvBorder aBorder;
if ( nChildren )
{
if ( IsVisible_Impl() )
aBorder = Arrange_Impl();
}
if ( nChildren && IsVisible_Impl() )
aBorder = Arrange_Impl();
// If the current application document contains a IPClient, then the
// object through SetTopToolFramePixel has to be assigned the available
// space. The object will then point to its UITools and sets the app border
......@@ -1288,11 +1285,8 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
if ( bCreate )
CreateChildWin_Impl( pCW, false );
if ( !bAllChildrenVisible )
{
if ( pCW->pCli )
pCW->pCli->nVisible &= ~SfxChildVisibility::ACTIVE;
}
if ( !bAllChildrenVisible && pCW->pCli )
pCW->pCli->nVisible &= ~SfxChildVisibility::ACTIVE;
}
else if ( pChildWin )
{
......@@ -1593,8 +1587,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
for ( n=0; n<aSortedList.size(); ++n )
{
SfxChild_Impl *pChild = aChildren[aSortedList[n]];
if ( pChild )
if ( pChild->pWin == pWin )
if ( pChild && pChild->pWin == pWin )
break;
}
......
......@@ -1206,11 +1206,8 @@ void SfxDispatcher::Update_Impl( bool bForce )
bool bIsActive = false;
SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl();
if ( !bIsActive )
{
if ( this == pActDispat )
bIsActive = true;
}
if ( !bIsActive && this == pActDispat )
bIsActive = true;
Update_Impl_( bUIActive, !bIsIPActive, bIsIPActive, pWorkWin );
if ( (bUIActive || bIsActive) && !comphelper::LibreOfficeKit::isActive() )
......
......@@ -724,9 +724,8 @@ retry:
"exception", nullptr, rterr);
}
if (err) {
if (handleError(iaioe, i_xHandler)) goto retry;
}
if (err && handleError(iaioe, i_xHandler))
goto retry;
}
/** init Impl struct */
......
......@@ -45,24 +45,21 @@ Size lcl_TwipsToHMM( const Size& rSize )
css::uno::Reference<css::frame::XController>& LokChartHelper::GetXController()
{
if(!mxController.is() )
if(!mxController.is() && mpViewShell)
{
if (mpViewShell)
SfxInPlaceClient* pIPClient = mpViewShell->GetIPClient();
if (pIPClient)
{
SfxInPlaceClient* pIPClient = mpViewShell->GetIPClient();
if (pIPClient)
const css::uno::Reference< ::css::embed::XEmbeddedObject >& xEmbObj = pIPClient->GetObject();
if( xEmbObj.is() )
{
const css::uno::Reference< ::css::embed::XEmbeddedObject >& xEmbObj = pIPClient->GetObject();
if( xEmbObj.is() )
::css::uno::Reference< ::css::chart2::XChartDocument > xChart( xEmbObj->getComponent(), uno::UNO_QUERY );
if( xChart.is() )
{
::css::uno::Reference< ::css::chart2::XChartDocument > xChart( xEmbObj->getComponent(), uno::UNO_QUERY );
if( xChart.is() )
::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController();
if( xChartController.is() )
{
::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController();
if( xChartController.is() )
{
mxController = xChartController;
}
mxController = xChartController;
}
}
}
......
......@@ -305,10 +305,8 @@ void AnimationBaseNode::activate_st()
void AnimationBaseNode::deactivate_st( NodeState eDestState )
{
if (eDestState == FROZEN) {
if (mpActivity)
mpActivity->end();
}
if (eDestState == FROZEN && mpActivity)
mpActivity->end();
if (isDependentSubsettedShape()) {
// for dependent subsets, remove subset shape
......
......@@ -848,15 +848,12 @@ static void print_fullpaths(char* line)
}
token = end;
eat_space(&token);
if (!target_seen)
if (!target_seen && ':' == *token)
{
if (':' == *token)
{
target_seen = 1;
fputc(':', stdout);
++token;
eat_space(&token);
}
target_seen = 1;
fputc(':', stdout);
++token;
eat_space(&token);
}
}
}
......
......@@ -108,11 +108,8 @@ void
puttokens(trp);
anymacros = 0;
cursource->line += cursource->lineinc;
if (cursource->lineinc > 1)
{
if (!Pflag)
genline();
}
if (cursource->lineinc > 1 && !Pflag)
genline();
}
}
......
......@@ -181,9 +181,8 @@ bool StgDirEntry::Store( StgDirStrm& rStrm )
if( m_pRight )
if( !static_cast<StgDirEntry*>(m_pRight)->Store( rStrm ) )
return false;
if( m_pDown )
if( !m_pDown->Store( rStrm ) )
return false;
if( m_pDown && !m_pDown->Store( rStrm ) )
return false;
return true;
}
......
......@@ -505,11 +505,8 @@ bool SotStorage::IsStorageFile( SvStream* pStream )
const OUString & SotStorage::GetName() const
{
if( m_aName.isEmpty() )
{
if( m_pOwnStg )
const_cast<SotStorage *>(this)->m_aName = m_pOwnStg->GetName();
}
if( m_aName.isEmpty() && m_pOwnStg )
const_cast<SotStorage *>(this)->m_aName = m_pOwnStg->GetName();
return m_aName;
}
......
......@@ -1694,8 +1694,8 @@ void SmViewShell::Execute(SfxRequest& rReq)
}
case SID_GETEDITTEXT:
if (pWin)
if (!pWin->GetText().isEmpty()) GetDoc()->SetText( pWin->GetText() );
if (pWin && !pWin->GetText().isEmpty())
GetDoc()->SetText( pWin->GetText() );
break;
case SID_ATTR_ZOOM:
......
......@@ -362,11 +362,8 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement(
// TODO: test whether it really works for http and fwp
std::unique_ptr<SvStream> pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ),
StreamMode::STD_WRITE );
if ( pStream )
{
if ( !pStream->GetError() )
xResult.set( new ::utl::OStreamWrapper( std::move(pStream) ) );
}
if ( pStream && !pStream->GetError() )
xResult.set( new ::utl::OStreamWrapper( std::move(pStream) ) );
}
if ( !xResult.is() )
......@@ -1148,14 +1145,11 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
// TODO: test whether it really works for http and fwp
std::unique_ptr<SvStream> pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL,
StreamMode::STD_WRITE );
if ( pStream )
if ( pStream && !pStream->GetError() )
{
if ( !pStream->GetError() )
{
uno::Reference< io::XStream > xStream =
uno::Reference < io::XStream >( new ::utl::OStreamWrapper( std::move(pStream) ) );
xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) );
}
uno::Reference< io::XStream > xStream =
uno::Reference < io::XStream >( new ::utl::OStreamWrapper( std::move(pStream) ) );
xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) );
}
}
......
......@@ -498,11 +498,8 @@ ColorConfigValue ColorConfig::GetColorValue(ColorConfigEntry eEntry, bool bSmart
if (m_pImpl)
aRet = m_pImpl->GetColorConfigValue(eEntry);
if (bSmart)
{
if(aRet.nColor == COL_AUTO)
aRet.nColor = ColorConfig::GetDefaultColor(eEntry);
}
if (bSmart && aRet.nColor == COL_AUTO)
aRet.nColor = ColorConfig::GetDefaultColor(eEntry);
return aRet;
}
......
......@@ -500,13 +500,10 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext)
{
mbHasVisibleItems = false;
if (nStyle & WB_NONEFIELD)
if ((nStyle & WB_NONEFIELD) && mpNoneItem)
{
if (mpNoneItem)
{
mpNoneItem->mbVisible = false;
mpNoneItem->maText = GetText();
}
mpNoneItem->mbVisible = false;
mpNoneItem->maText = GetText();
}
for (size_t i = 0; i < nItemCount; i++)
......@@ -1084,14 +1081,11 @@ void ValueSet::ImplTracking( const Point& rPos, bool bRepeat )
{
if ( bRepeat || mbSelection )
{
if ( ImplScroll( rPos ) )
if ( ImplScroll( rPos ) && mbSelection )
{
if ( mbSelection )
{
maTimer.SetInvokeHandler( LINK( this, ValueSet, ImplTimerHdl ) );
maTimer.SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() );
maTimer.Start();
}
maTimer.SetInvokeHandler( LINK( this, ValueSet, ImplTimerHdl ) );
maTimer.SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() );
maTimer.Start();
}
}
......@@ -3113,13 +3107,10 @@ void SvtValueSet::Format(vcl::RenderContext const & rRenderContext)
{
mbHasVisibleItems = false;
if (nStyle & WB_NONEFIELD)
if ((nStyle & WB_NONEFIELD) && mpNoneItem)
{
if (mpNoneItem)
{
mpNoneItem->mbVisible = false;
mpNoneItem->maText = GetText();
}
mpNoneItem->mbVisible = false;
mpNoneItem->maText = GetText();
}
for (size_t i = 0; i < nItemCount; i++)
......
......@@ -332,11 +332,8 @@ short PrinterSetupDialog::run()
short nRet = GenericDialogController::run();
// update data if the dialog was terminated with OK
if ( nRet == RET_OK )
{
if ( mpTempPrinter )
mpPrinter->SetPrinterProps( mpTempPrinter );
}
if ( nRet == RET_OK && mpTempPrinter )
mpPrinter->SetPrinterProps( mpTempPrinter );
maStatusTimer.Stop();
......
......@@ -130,9 +130,8 @@ namespace {
{
OGenericUnoDialog::executedDialog(_nExecutionResult);
if ( _nExecutionResult )
if ( m_aDialog )
static_cast< AddressBookSourceDialog* >( m_aDialog.m_xVclDialog.get() )->getFieldMapping( m_aAliases );
if ( _nExecutionResult && m_aDialog )
static_cast< AddressBookSourceDialog* >( m_aDialog.m_xVclDialog.get() )->getFieldMapping( m_aAliases );
}
void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments)
......
......@@ -2559,11 +2559,8 @@ void FmXFormShell::UpdateForms_Lock(bool _bInvalidate)
Reference< XIndexAccess > xForms;
FmFormPage* pPage = m_pShell->GetCurPage();
if ( pPage )
{
if ( m_pShell->m_bDesignMode )
xForms.set(pPage->GetForms( false ), css::uno::UNO_QUERY);
}
if ( pPage && m_pShell->m_bDesignMode )
xForms.set(pPage->GetForms( false ), css::uno::UNO_QUERY);
if ( m_xForms != xForms )
{
......
......@@ -385,14 +385,11 @@ void LinePropertyPanelBase::updateLineStart(bool bDisabled, bool bSetOrDefault,
mpLBStart->Enable();
}
if(bSetOrDefault)
if(bSetOrDefault && pItem)
{
if(pItem)
{
mpStartItem.reset(static_cast<XLineStartItem*>(pItem->Clone()));
SelectEndStyle(true);
return;
}
mpStartItem.reset(static_cast<XLineStartItem*>(pItem->Clone()));
SelectEndStyle(true);
return;
}
mpStartItem.reset(nullptr);
......@@ -412,14 +409,11 @@ void LinePropertyPanelBase::updateLineEnd(bool bDisabled, bool bSetOrDefault,
mpLBEnd->Enable();
}
if(bSetOrDefault)
if(bSetOrDefault && pItem)
{
if(pItem)
{
mpEndItem.reset(static_cast<XLineEndItem*>(pItem->Clone()));
SelectEndStyle(false);
return;
}
mpEndItem.reset(static_cast<XLineEndItem*>(pItem->Clone()));
SelectEndStyle(false);
return;
}
mpEndItem.reset(nullptr);
......
......@@ -1387,21 +1387,18 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
pObj->SendUserCall( SdrUserCallType::Resize, aBoundRect0 );
}
if(bRet)
if(bRet && bUndo )
{
if( bUndo )
{
getSdrDragView().AddUndoActions( std::move(vConnectorUndoActions) );
getSdrDragView().AddUndoActions( std::move(vConnectorUndoActions) );
if ( pUndo )
{
getSdrDragView().AddUndo(std::move(pUndo));
}
if ( pUndo )
{
getSdrDragView().AddUndo(std::move(pUndo));
}
if ( pUndo2 )
{
getSdrDragView().AddUndo(std::move(pUndo2));
}
if ( pUndo2 )
{
getSdrDragView().AddUndo(std::move(pUndo2));
}
}
......@@ -3436,20 +3433,17 @@ void SdrDragDistort::MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
{
SdrPageView* pPV = getSdrDragView().GetSdrPageView();
if(pPV)
if(pPV && pPV->HasMarkedObjPageView())
{
if (pPV->HasMarkedObjPageView())
{
basegfx::B2DPolyPolygon aDragPolygon(rTarget);
const basegfx::B2DRange aOriginalRange(aMarkRect.Left(), aMarkRect.Top(), aMarkRect.Right(), aMarkRect.Bottom());
const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
aDragPolygon = basegfx::utils::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
rTarget = aDragPolygon;
}
basegfx::B2DPolyPolygon aDragPolygon(rTarget);
const basegfx::B2DRange aOriginalRange(aMarkRect.Left(), aMarkRect.Top(), aMarkRect.Right(), aMarkRect.Bottom());
const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
aDragPolygon = basegfx::utils::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
rTarget = aDragPolygon;
}
}
}
......
......@@ -534,12 +534,9 @@ void SdrModel::SetUndoComment(const OUString& rComment)
{
OSL_FAIL("svx::SdrModel::SetUndoComment(), method not supported with application undo manager!" );
}
else if( IsUndoEnabled() )
else if( IsUndoEnabled() && nUndoLevel==1)
{
if(nUndoLevel==1)
{
pCurrentUndoGroup->SetComment(rComment);
}
pCurrentUndoGroup->SetComment(rComment);
}
}
......
......@@ -126,21 +126,18 @@ void SdrPolyEditView::CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmoot
}
}
if(!bSegmFuz)
if(!bSegmFuz && bCanSegment)
{
if(bCanSegment)
{
bool bCrv(aLocalPolygon.isNextControlPointUsed(nPntNum));
bool bCrv(aLocalPolygon.isNextControlPointUsed(nPntNum));
if(b1stSegm)
{
b1stSegm = false;
bCurve = bCrv;
}
else
{
bSegmFuz = (bCrv != bCurve);
}
if(b1stSegm)
{
b1stSegm = false;
bCurve = bCrv;
}
else
{
bSegmFuz = (bCrv != bCurve);
}
}
}
......
......@@ -136,12 +136,9 @@ SdrView* SdrViewIter::ImpFindView()
{
SdrPageView* pPV = mpCurrentView->GetSdrPageView();
if(pPV)
if(pPV && ImpCheckPageView(pPV))
{
if(ImpCheckPageView(pPV))
{
return mpCurrentView;
}
return mpCurrentView;
}
}
else
......
......@@ -255,11 +255,8 @@ bool SdrExchangeView::Paste(
SdrPageView* pMarkPV=nullptr;
SdrPageView* pPV = GetSdrPageView();
if(pPV)
{
if ( pPV->GetObjList() == pLst )
pMarkPV=pPV;
}
if(pPV && pPV->GetObjList() == pLst )
pMarkPV=pPV;
ImpLimitToWorkArea( aPos );
if (pLst==nullptr)
......@@ -424,11 +421,8 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po
SdrPageView* pMarkPV=nullptr;
SdrPageView* pPV = GetSdrPageView();
if(pPV)
{
if (pPV->GetObjList()==&rLst)
pMarkPV=pPV;
}
if(pPV && pPV->GetObjList()==&rLst)
pMarkPV=pPV;
bool bMark = pMarkPV!=nullptr && !IsTextEdit() && (nOptions&SdrInsertFlags::DONTMARK)==SdrInsertFlags::NONE;
if (bMark)
......
......@@ -1062,13 +1062,10 @@ CellPos SdrTableObj::getPreviousRow( const CellPos& rPos, bool bEdgeTravel ) con
if( mpImpl.is() )
{
CellRef xCell( mpImpl->getCell( aPos ) );
if( xCell.is() )
if( xCell.is() && xCell->isMerged() )
{
if( xCell->isMerged() )
{
sal_Int32 nTemp = 0;
findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, nTemp, aPos.mnRow );
}
sal_Int32 nTemp = 0;
findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, nTemp, aPos.mnRow );
}
if( aPos.mnRow > 0 )
......
......@@ -746,18 +746,15 @@ void ExtrusionLightingWindow::SelectHdl(void const * pControl)
if( pControl == this )
{
int nLevel = getSelectedEntryId();
if( nLevel >= 0 )
if( nLevel >= 0 && nLevel != 3 )
{
if( nLevel != 3 )
{
Sequence< PropertyValue > aArgs( 1 );
aArgs[0].Name = OUString(g_sExtrusionLightingIntensity).copy(5);
aArgs[0].Value <<= static_cast<sal_Int32>(nLevel);
Sequence< PropertyValue > aArgs( 1 );
aArgs[0].Name = OUString(g_sExtrusionLightingIntensity).copy(5);
aArgs[0].Value <<= static_cast<sal_Int32>(nLevel);
mrController.dispatchCommand( g_sExtrusionLightingIntensity, aArgs );
mrController.dispatchCommand( g_sExtrusionLightingIntensity, aArgs );
implSetIntensity( nLevel, true );
}
implSetIntensity( nLevel, true );
}
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment