[Libreoffice-commits] core.git: accessibility/source basctl/source basegfx/source basic/source chart2/source connectivity/source cui/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Nov 6 09:29:54 UTC 2018


 accessibility/source/extended/accessibletabbarpagelist.cxx |    9 +--
 basctl/source/basicide/scriptdocument.cxx                  |    7 --
 basegfx/source/polygon/b2dpolygon.cxx                      |    9 +--
 basic/source/classes/sbunoobj.cxx                          |    7 --
 basic/source/comp/codegen.cxx                              |    5 -
 basic/source/comp/parser.cxx                               |    9 +--
 basic/source/runtime/runtime.cxx                           |   14 +----
 basic/source/sbx/sbxexec.cxx                               |    7 --
 chart2/source/controller/dialogs/dlg_View3D.cxx            |    7 --
 chart2/source/model/template/StockChartTypeTemplate.cxx    |    7 --
 connectivity/source/commontools/FValue.cxx                 |    7 --
 connectivity/source/drivers/calc/CDatabaseMetaData.cxx     |    5 -
 connectivity/source/drivers/file/FDatabaseMetaData.cxx     |   33 +++++--------
 cui/source/tabpages/page.cxx                               |    9 +--
 cui/source/tabpages/paragrph.cxx                           |    5 -
 15 files changed, 49 insertions(+), 91 deletions(-)

New commits:
commit 819149fb1f71fc13ffdc288736ce65bb3c6c75d8
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Nov 6 10:16:38 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Nov 6 10:28:47 2018 +0100

    loplugin:collapseif in accessibility..cui
    
    Change-Id: I1437b493f3289b4ac97d061bd71973580571e792
    Reviewed-on: https://gerrit.libreoffice.org/62933
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx
index df1c68332ec0..02cdad44cd49 100644
--- a/accessibility/source/extended/accessibletabbarpagelist.cxx
+++ b/accessibility/source/extended/accessibletabbarpagelist.cxx
@@ -94,13 +94,10 @@ namespace accessibility
             if ( xChild.is() )
             {
                 AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
-                if ( pAccessibleTabBarPage )
+                if ( pAccessibleTabBarPage && m_pTabBar )
                 {
-                    if ( m_pTabBar )
-                    {
-                        OUString sPageText = m_pTabBar->GetPageText( m_pTabBar->GetPageId( static_cast<sal_uInt16>(i) ) );
-                        pAccessibleTabBarPage->SetPageText( sPageText );
-                    }
+                    OUString sPageText = m_pTabBar->GetPageText( m_pTabBar->GetPageId( static_cast<sal_uInt16>(i) ) );
+                    pAccessibleTabBarPage->SetPageText( sPageText );
                 }
             }
         }
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index ac990c66890d..6eac332022bc 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -432,11 +432,8 @@ namespace basctl
         try
         {
             Reference< XLibraryContainer > xLibContainer = getLibraryContainer( _eType );
-            if ( isValid() )
-            {
-                if ( xLibContainer.is() )
-                    xContainer.set( xLibContainer->getByName( _rLibName ), UNO_QUERY_THROW );
-            }
+            if ( isValid() && xLibContainer.is() )
+                xContainer.set( xLibContainer->getByName( _rLibName ), UNO_QUERY_THROW );
 
             if ( !xContainer.is() )
                 throw NoSuchElementException();
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index 3638424a52e4..54d2844c3821 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -1029,14 +1029,11 @@ public:
             {
                 bool bRemove(maPoints.getCoordinate(nIndex) == maPoints.getCoordinate(nIndex + 1));
 
-                if(bRemove)
+                if(bRemove && mpControlVector)
                 {
-                    if(mpControlVector)
+                    if(!mpControlVector->getNextVector(nIndex).equalZero() || !mpControlVector->getPrevVector(nIndex + 1).equalZero())
                     {
-                        if(!mpControlVector->getNextVector(nIndex).equalZero() || !mpControlVector->getPrevVector(nIndex + 1).equalZero())
-                        {
-                            bRemove = false;
-                        }
+                        bRemove = false;
                     }
                 }
 
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 9aa7725aca74..961c1a7f52e1 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -3603,11 +3603,8 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                             pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ), aType );
 
                             // Check for out parameter if not already done
-                            if( !bOutParams )
-                            {
-                                if( xParam->isOut() )
-                                    bOutParams = true;
-                            }
+                            if( !bOutParams && xParam->isOut() )
+                                bOutParams = true;
                         }
                         else
                         {
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 7cc715f7fa8e..e73700e5cedf 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -515,9 +515,8 @@ public:
     virtual void processOpCode2( SbiOpcode eOp, T nOp1, T nOp2 ) override
     {
         m_ConvertedBuf += static_cast<sal_uInt8>(eOp);
-        if ( eOp == SbiOpcode::CASEIS_ )
-                if ( nOp1 )
-                    nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) );
+        if ( eOp == SbiOpcode::CASEIS_  && nOp1 )
+            nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) );
         m_ConvertedBuf += static_cast<S>(nOp1);
         m_ConvertedBuf += static_cast<S>(nOp2);
 
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index caca02573343..fcf524a8057a 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -762,13 +762,10 @@ void SbiParser::Option()
         case BASIC_EXPLICIT:
             bExplicit = true; break;
         case BASE:
-            if( Next() == NUMBER )
+            if( Next() == NUMBER && ( nVal == 0 || nVal == 1 ) )
             {
-                if( nVal == 0 || nVal == 1 )
-                {
-                    nBase = static_cast<short>(nVal);
-                    break;
-                }
+                nBase = static_cast<short>(nVal);
+                break;
             }
             Error( ERRCODE_BASIC_EXPECTED, "0/1" );
             break;
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index be501d946071..69dae820aad8 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -3204,11 +3204,8 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
                     bOk = checkUnoObjectType(*pUnoObj, aClass);
                 else
                     bOk = false;
-                if ( !bOk )
-                {
-                    if( bRaiseErrors )
-                        Error( ERRCODE_BASIC_INVALID_USAGE_OBJECT );
-                }
+                if ( !bOk && bRaiseErrors )
+                    Error( ERRCODE_BASIC_INVALID_USAGE_OBJECT );
             }
             else
             {
@@ -3337,12 +3334,9 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt
         }
         if( bLocal )
         {
-            if ( bStatic )
+            if ( bStatic && pMeth )
             {
-                if ( pMeth )
-                {
-                    pElem = pMeth->GetStatics()->Find( aName, SbxClassType::DontCare );
-                }
+                pElem = pMeth->GetStatics()->Find( aName, SbxClassType::DontCare );
             }
 
             if ( !pElem )
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index efbd45052df8..f2f23049dcb6 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -150,12 +150,9 @@ static SbxVariableRef Operand
                 return nullptr;
             }
             // Double quotes are OK
-            if( *p == '"' )
+            if( *p == '"' && (*++p) != '"' )
             {
-                if( *++p != '"' )
-                {
-                    break;
-                }
+                break;
             }
             aString.append(*p++);
         }
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
index 8c7e97122f08..e4db6f6a2818 100644
--- a/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -80,11 +80,8 @@ void View3DDialog::dispose()
 short View3DDialog::Execute()
 {
     short nResult = TabDialog::Execute();
-    if( nResult == RET_OK )
-    {
-        if( m_pGeometry )
-            m_pGeometry->commitPendingChanges();
-    }
+    if( nResult == RET_OK && m_pGeometry )
+        m_pGeometry->commitPendingChanges();
     return nResult;
 }
 
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index 3a592071169f..1e452770fb4c 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -219,11 +219,8 @@ void SAL_CALL StockChartTypeTemplate::applyStyle(
 
         bool bHasVolume = false;
         getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
-        if( bHasVolume )
-        {
-            if( nChartTypeIndex != 0 )
-                nNewAxisIndex = 1;
-        }
+        if( bHasVolume && nChartTypeIndex != 0 )
+            nNewAxisIndex = 1;
 
         Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
         if( xProp.is() )
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index dc302ceb5921..b12170775213 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -993,12 +993,9 @@ OUString ORowSetValue::getString( ) const
                 {
                     Any aValue( getAny() );
                     Reference< XClob > xClob;
-                    if ( aValue >>= xClob )
+                    if ( (aValue >>= xClob) && xClob.is() )
                     {
-                        if ( xClob.is() )
-                        {
-                            aRet = xClob->getSubString(1,static_cast<sal_Int32>(xClob->length()) );
-                        }
+                        aRet = xClob->getSubString(1,static_cast<sal_Int32>(xClob->length()) );
                     }
                 }
                 break;
diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
index 9b030637723a..c5df337a7468 100644
--- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx
@@ -74,9 +74,8 @@ static bool lcl_IsEmptyOrHidden( const Reference<XSpreadsheets>& xSheets, const
         {
             bool bVisible;
             Any aVisAny = xProp->getPropertyValue("IsVisible");
-            if ( aVisAny >>= bVisible )
-                if (!bVisible)
-                    return true;                // hidden
+            if ( (aVisAny >>= bVisible) && !bVisible)
+                return true;                // hidden
         }
 
         //  use the same data area as in OCalcTable to test for empty table
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index 51326c343717..14b37131b679 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -405,28 +405,25 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
                     if(xTunnel.is())
                     {
                         OFileTable* pTable = reinterpret_cast< OFileTable* >( xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()) );
-                        if(pTable)
+                        if(pTable && !pTable->isReadOnly())
                         {
-                            if(!pTable->isReadOnly())
+                            aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
+                            aRows.push_back(aRow);
+                            if(!m_pConnection->showDeleted())
                             {
-                                aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
-                                aRows.push_back(aRow);
-                                if(!m_pConnection->showDeleted())
-                                {
-                                    aRow[6] = ODatabaseMetaDataResultSet::getDeleteValue();
-                                    aRows.push_back(aRow);
-                                }
-                                aRow[6] = ODatabaseMetaDataResultSet::getUpdateValue();
-                                aRows.push_back(aRow);
-                                aRow[6] = ODatabaseMetaDataResultSet::getCreateValue();
-                                aRows.push_back(aRow);
-                                aRow[6] = ODatabaseMetaDataResultSet::getReadValue();
-                                aRows.push_back(aRow);
-                                aRow[6] = ODatabaseMetaDataResultSet::getAlterValue();
-                                aRows.push_back(aRow);
-                                aRow[6] = ODatabaseMetaDataResultSet::getDropValue();
+                                aRow[6] = ODatabaseMetaDataResultSet::getDeleteValue();
                                 aRows.push_back(aRow);
                             }
+                            aRow[6] = ODatabaseMetaDataResultSet::getUpdateValue();
+                            aRows.push_back(aRow);
+                            aRow[6] = ODatabaseMetaDataResultSet::getCreateValue();
+                            aRows.push_back(aRow);
+                            aRow[6] = ODatabaseMetaDataResultSet::getReadValue();
+                            aRows.push_back(aRow);
+                            aRow[6] = ODatabaseMetaDataResultSet::getAlterValue();
+                            aRows.push_back(aRow);
+                            aRow[6] = ODatabaseMetaDataResultSet::getDropValue();
+                            aRows.push_back(aRow);
                         }
                     }
                 }
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 030e70a51eae..a06cf51ef2e7 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -210,13 +210,10 @@ SvxPageDescPage::SvxPageDescPage(TabPageParent pParent, const SfxItemSet& rAttr)
 
 
     // #109989# do not show vertical directions in Writer/Web
-    if( !bWeb )
+    if( !bWeb && bCJK )
     {
-        if( bCJK )
-        {
-            m_xTextFlowBox->append(SvxFrameDirection::Vertical_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT));
-            m_xTextFlowBox->append(SvxFrameDirection::Vertical_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT));
-        }
+        m_xTextFlowBox->append(SvxFrameDirection::Vertical_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT));
+        m_xTextFlowBox->append(SvxFrameDirection::Vertical_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT));
     }
 
     // #109989# show the text direction box in Writer/Web too
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 2b5572fd1874..d93649366dfe 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -1333,9 +1333,8 @@ void SvxParaAlignTabPage::EnableJustifyExt()
 void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet& aSet)
 {
     const SfxBoolItem* pBoolItem = aSet.GetItem<SfxBoolItem>(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT, false);
-    if (pBoolItem)
-        if(pBoolItem->GetValue())
-            EnableJustifyExt();
+    if (pBoolItem && pBoolItem->GetValue())
+        EnableJustifyExt();
 }
 
 VclPtr<SfxTabPage> SvxExtParagraphTabPage::Create(TabPageParent pParent, const SfxItemSet* rSet)


More information about the Libreoffice-commits mailing list