[Libreoffice-commits] core.git: chart2/source sax/source sc/source sd/source svtools/source svx/source sw/source writerperfect/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 14 13:48:28 UTC 2019


 chart2/source/controller/dialogs/dlg_ObjectProperties.cxx |    5 ++--
 sax/source/tools/converter.cxx                            |   16 --------------
 sc/source/ui/unoobj/chart2uno.cxx                         |   14 ++----------
 sc/source/ui/view/gridwin.cxx                             |    5 +---
 sd/source/core/drawdoc3.cxx                               |    6 +----
 svtools/source/contnr/imivctl1.cxx                        |    3 --
 svx/source/form/fmshimp.cxx                               |    8 +------
 svx/source/svdraw/charthelper.cxx                         |   16 ++++++--------
 sw/source/core/access/accframebase.cxx                    |   15 ++++++-------
 sw/source/core/access/accpara.cxx                         |   15 ++++++-------
 sw/source/uibase/app/appopt.cxx                           |    5 +---
 sw/source/uibase/shells/drwtxtsh.cxx                      |    3 --
 writerperfect/source/writer/EPUBExportDialog.cxx          |    8 -------
 13 files changed, 38 insertions(+), 81 deletions(-)

New commits:
commit 6154489314d2f2bf9cb99b72f15c79dd48a1da14
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Apr 14 15:54:14 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Apr 14 15:47:48 2019 +0200

    tdf#120703 PVS: V581 ifs with identical conditions
    
    V581 The conditional expressions of the 'if' statements situated
         alongside each other are identical.
    
    Change-Id: I18562d60e33c7ecff14807976dde4cbcae3f665b
    Reviewed-on: https://gerrit.libreoffice.org/70731
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index 66a12ef6b3db..015224abecaf 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -390,10 +390,11 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
         case OBJECTTYPE_AXIS:
         {
             if( m_pParameter->HasScaleProperties() )
+            {
                 AddTabPage("scale", SchResId(STR_PAGE_SCALE), ScaleTabPage::Create);
-
-            if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
+                //no positioning page for z axes so far as the tickmarks are not shown so far
                 AddTabPage("axispos", SchResId(STR_PAGE_POSITIONING), AxisPositionsTabPage::Create);
+            }
             AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
             AddTabPage("axislabel", SchResId(STR_OBJECT_LABEL), SchAxisLabelTabPage::Create);
             if( m_pParameter->HasNumberProperties() )
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index dce277b3e464..cfd3b3083d40 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1565,10 +1565,7 @@ static bool lcl_parseDate(
     if (bSuccess)
     {
         ++nPos;
-    }
 
-    if (bSuccess)
-    {
         bSuccess = readDateTimeComponent(string, nPos, nMonth, 2, true);
         if (!bIgnoreInvalidOrMissingDate)
         {
@@ -1584,10 +1581,7 @@ static bool lcl_parseDate(
     if (bSuccess)
     {
         ++nPos;
-    }
 
-    if (bSuccess)
-    {
         bSuccess = readDateTimeComponent(string, nPos, nDay, 2, true);
         if (!bIgnoreInvalidOrMissingDate)
         {
@@ -1662,10 +1656,7 @@ static bool lcl_parseDateTime(
         if (bSuccess)
         {
             ++nPos;
-        }
 
-        if (bSuccess)
-        {
             bSuccess = readDateTimeComponent(string, nPos, nMinutes, 2, true);
             bSuccess &= (0 <= nMinutes) && (nMinutes < 60);
             bSuccess &= (nPos < string.getLength()); // not last token
@@ -1677,10 +1668,7 @@ static bool lcl_parseDateTime(
         if (bSuccess)
         {
             ++nPos;
-        }
 
-        if (bSuccess)
-        {
             bSuccess = readDateTimeComponent(string, nPos, nSeconds, 2, true);
             bSuccess &= (0 <= nSeconds) && (nSeconds < 60);
         }
@@ -1758,9 +1746,7 @@ static bool lcl_parseDateTime(
         if (bSuccess)
         {
             ++nPos;
-        }
-        if (bSuccess)
-        {
+
             bSuccess = readDateTimeComponent(
                         string, nPos, nTimezoneMinutes, 2, true);
             bSuccess &= (0 <= nTimezoneMinutes) && (nTimezoneMinutes < 60);
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index e859750f4fa1..a7b20ce1e03c 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1869,23 +1869,15 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
                                   beans::PropertyState_DIRECT_VALUE );
     }
 
-    // DataRowSource (calculated before)
     if( bRowSourceDetected )
     {
+        // DataRowSource (calculated before)
         aResult.emplace_back( "DataRowSource", -1,
                                   uno::makeAny( eRowSource ), beans::PropertyState_DIRECT_VALUE );
-    }
-
-    // HasCategories
-    if( bRowSourceDetected )
-    {
+        // HasCategories
         aResult.emplace_back( "HasCategories", -1,
                                   uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE );
-    }
-
-    // FirstCellAsLabel
-    if( bRowSourceDetected )
-    {
+        // FirstCellAsLabel
         aResult.emplace_back( "FirstCellAsLabel", -1,
                                   uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE );
     }
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 674af1cb6c4f..3e4f6e37aa81 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3703,10 +3703,9 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt )
                 }
             }
             if (!nRet)
-                DrawMarkDropObj( nullptr );
-
-            if (!nRet)
             {
+                DrawMarkDropObj(nullptr);
+
                 switch ( nMyAction )
                 {
                     case DND_ACTION_COPY:
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 2bd0c59acc38..17ac70da7b2a 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1764,11 +1764,9 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             for (const auto& a : aCreatedStyles)
                 aUndoInsert.emplace_back(a.get(), true);
             pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(this, aUndoInsert, true));
-        }
-
-        // Generate new master pages and register them with the document
-        if( bUndo )
+            // Generate new master pages and register them with the document
             BegUndo();
+        }
 
         pMaster = AllocSdPage(true);
         pMaster->SetSize(pSelectedPage->GetSize());
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index a27e6ad64d6f..c07ed5b13756 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -2767,10 +2767,9 @@ void SvxIconChoiceCtrl_Impl::SetEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry
         }
         else if( !nPos1 )
             return;
-    }
 
-    if( !pHead )
         InitPredecessors();
+    }
 
     if( !pPredecessor && pHead == pEntry )
         return; // is already the first one
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 162a5eb1ec96..9398f1dca662 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -3562,8 +3562,7 @@ void FmXFormShell::viewDeactivated_Lock(FmFormView& _rCurrentView, bool _bDeacti
 
     // if we have an async load operation pending for the 0-th page for this view,
     // we need to cancel this
-    FmFormPage* pPage = _rCurrentView.GetCurPage();
-    if ( pPage )
+    if (FmFormPage* pPage = _rCurrentView.GetCurPage())
     {
         // move all events from our queue to a new one, omit the events for the deactivated
         // page
@@ -3582,11 +3581,8 @@ void FmXFormShell::viewDeactivated_Lock(FmFormView& _rCurrentView, bool _bDeacti
             }
         }
         m_aLoadingPages = aNewEvents;
-    }
 
-    // remove callbacks at the page
-    if ( pPage )
-    {
+        // remove callbacks at the page
         pPage->GetImpl().SetFormsCreationHdl( Link<FmFormPageImpl&,void>() );
     }
     UpdateForms_Lock(true);
diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx
index 617351817f1b..f75ac0e40a97 100644
--- a/svx/source/svdraw/charthelper.cxx
+++ b/svx/source/svdraw/charthelper.cxx
@@ -124,15 +124,13 @@ void ChartHelper::AdaptDefaultsForChart(
 
         try
         {
-            // set background to transparent (none)
-            uno::Reference< beans::XPropertySet > xPageProp( xChartDoc->getPageBackground());
-            if( xPageProp.is())
-                xPageProp->setPropertyValue( "FillStyle",
-                                             uno::makeAny( drawing::FillStyle_NONE ));
-            // set no border
-            if( xPageProp.is())
-                xPageProp->setPropertyValue( "LineStyle",
-                                             uno::makeAny( drawing::LineStyle_NONE ));
+            if (uno::Reference< beans::XPropertySet > xPageProp = xChartDoc->getPageBackground())
+            {
+                // set background to transparent (none)
+                xPageProp->setPropertyValue("FillStyle", uno::makeAny(drawing::FillStyle_NONE));
+                // set no border
+                xPageProp->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE));
+            }
         }
         catch( const uno::Exception & )
         {
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
index f53edaa4ea3b..609ca2e5b4d5 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -68,15 +68,14 @@ void SwAccessibleFrameBase::GetStates(
 
     const SwViewShell *pVSh = GetMap()->GetShell();
     assert(pVSh);
-    bool bSelectable =  dynamic_cast<const SwFEShell*>( pVSh) !=  nullptr;
 
-    // SELECTABLE
-    if( bSelectable )
-        rStateSet.AddState( AccessibleStateType::SELECTABLE );
-
-    // FOCUSABLE
-    if( bSelectable )
-        rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+    if (dynamic_cast<const SwFEShell*>(pVSh))
+    {
+        // SELECTABLE
+        rStateSet.AddState(AccessibleStateType::SELECTABLE);
+        // FOCUSABLE
+        rStateSet.AddState(AccessibleStateType::FOCUSABLE);
+    }
 
     // SELECTED and FOCUSED
     if( IsSelected() )
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 350458840bcb..dc2938ab286b 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -226,14 +226,13 @@ void SwAccessibleParagraph::GetStates(
     // MULTILINE
     rStateSet.AddState( AccessibleStateType::MULTI_LINE );
 
-    // MULTISELECTABLE
-    SwCursorShell *pCursorSh = GetCursorShell();
-    if( pCursorSh )
-        rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
-
-    // FOCUSABLE
-    if( pCursorSh )
-        rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+    if (GetCursorShell())
+    {
+        // MULTISELECTABLE
+        rStateSet.AddState(AccessibleStateType::MULTI_SELECTABLE);
+        // FOCUSABLE
+        rStateSet.AddState(AccessibleStateType::FOCUSABLE);
+    }
 
     // FOCUSED (simulates node index of cursor)
     SwPaM* pCaret = GetCursor( false ); // #i27301# - consider adjusted method signature
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index f02549e38c6f..7929b5a4efd1 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -224,14 +224,13 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
     SwAddPrinterItem aAddPrinterItem(*pOpt );
     pRet->Put(aAddPrinterItem);
 
-    // Options for Web background
+    // Options for Web
     if(!bTextDialog)
     {
         pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
+        pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
     }
 
-    if(!bTextDialog)
-        pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
     return pRet;
 }
 
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 9bc1292501ee..ebd0e711d6bf 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -731,9 +731,6 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
         return;
     }
 
-    if( sSym.isEmpty() )
-        return;
-
     // do not flicker
     pOLV->HideCursor();
     SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
diff --git a/writerperfect/source/writer/EPUBExportDialog.cxx b/writerperfect/source/writer/EPUBExportDialog.cxx
index f359098000e8..c26516d6310c 100644
--- a/writerperfect/source/writer/EPUBExportDialog.cxx
+++ b/writerperfect/source/writer/EPUBExportDialog.cxx
@@ -139,19 +139,13 @@ EPUBExportDialog::EPUBExportDialog(weld::Window* pParent,
     if (xDPS.is())
         xDP = xDPS->getDocumentProperties();
     if (xDP.is())
+    {
         m_xTitle->set_text(xDP->getTitle());
-
-    if (xDP.is())
         m_xInitialCreator->set_text(xDP->getAuthor());
 
-    if (xDP.is())
-    {
         OUString aLanguage(LanguageTag::convertToBcp47(xDP->getLanguage(), false));
         m_xLanguage->set_text(aLanguage);
-    }
 
-    if (xDP.is())
-    {
         OUStringBuffer aBuffer;
         util::DateTime aDate(xDP->getModificationDate());
         sax::Converter::convertDateTime(aBuffer, aDate, nullptr, true);


More information about the Libreoffice-commits mailing list