[Libreoffice-commits] core.git: reportdesign/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 15 09:25:18 UTC 2020


 reportdesign/source/core/api/ReportDefinition.cxx  |    7 ++++---
 reportdesign/source/ui/misc/UITools.cxx            |   12 ++++++++----
 reportdesign/source/ui/report/ReportController.cxx |   12 ++++++++----
 reportdesign/source/ui/report/dlgedfunc.cxx        |    6 ++++--
 4 files changed, 24 insertions(+), 13 deletions(-)

New commits:
commit cf3cd2d064fe83190eef997e3069d1c35afca0b1
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Apr 15 09:13:14 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Apr 15 11:24:38 2020 +0200

    loplugin:buriedassign in reportdesign
    
    Change-Id: I1caeeb8e0a6f02f1dd37f7399702af1b2a400b28
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92242
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 900fbd88c18d..fe91c466c337 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1173,10 +1173,11 @@ void SAL_CALL OReportDefinition::connectController( const uno::Reference< frame:
     ::osl::MutexGuard aGuard(m_aMutex);
     ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
     m_pImpl->m_aControllers.push_back(_xController);
-    sal_Int32 nCount;
-    if ( _xController.is() && m_pImpl->m_xViewData.is() && ( nCount = m_pImpl->m_xViewData->getCount()) != 0)
+    if ( _xController.is() && m_pImpl->m_xViewData.is() )
     {
-        _xController->restoreViewData(m_pImpl->m_xViewData->getByIndex(nCount - 1));
+        sal_Int32 nCount = m_pImpl->m_xViewData->getCount();
+        if (nCount)
+            _xController->restoreViewData(m_pImpl->m_xViewData->getByIndex(nCount - 1));
     }
 }
 
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 2361f0d8cb1d..1d9cdd4c31a8 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -903,10 +903,12 @@ SdrObject* isOver(const tools::Rectangle& _rRect, SdrPage const & _rPage, SdrVie
 {
     SdrObject* pOverlappedObj = nullptr;
     SdrObjListIter aIter(&_rPage,SdrIterMode::DeepNoGroups);
-    SdrObject* pObjIter = nullptr;
 
-    while( !pOverlappedObj && (pObjIter = aIter.Next()) != nullptr )
+    while( !pOverlappedObj )
     {
+        SdrObject* pObjIter = aIter.Next();
+        if( !pObjIter )
+            break;
         if ( _pIgnore != pObjIter
             && (_bAllObjects || !_rView.IsObjMarked(pObjIter))
             && (dynamic_cast<OUnoObject*>(pObjIter) != nullptr || dynamic_cast<OOle2Obj*>(pObjIter) != nullptr))
@@ -944,10 +946,12 @@ SdrObject* isOver(const tools::Rectangle& _rRect,SdrPage const & _rPage,SdrView
 {
     SdrObject* pOverlappedObj = nullptr;
     SdrObjListIter aIter(&_rPage,SdrIterMode::DeepNoGroups);
-    SdrObject* pObjIter = nullptr;
 
-    while( !pOverlappedObj && (pObjIter = aIter.Next()) != nullptr )
+    while( !pOverlappedObj )
     {
+        SdrObject* pObjIter = aIter.Next();
+        if( !pObjIter )
+            break;
         if (checkArrayForOccurrence(pObjIter, _pIgnoreList, _nIgnoreListLength))
         {
             continue;
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index ee1e90d4cf83..bf61da78c8d2 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -1189,16 +1189,20 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
                 executeMethodWithUndo(RID_STR_UNDO_REMOVE_SELECTION,::std::mem_fn(&ODesignView::Delete));
             break;
         case SID_GRID_USE:
-            getDesignView()->setGridSnap(m_bGridUse = !m_bGridUse);
+            m_bGridUse = !m_bGridUse;
+            getDesignView()->setGridSnap(m_bGridUse);
             break;
         case SID_HELPLINES_MOVE:
-            getDesignView()->setDragStripes(m_bHelplinesMove = !m_bHelplinesMove);
+            m_bHelplinesMove = !m_bHelplinesMove;
+            getDesignView()->setDragStripes(m_bHelplinesMove);
             break;
         case SID_GRID_VISIBLE:
-            getDesignView()->toggleGrid(m_bGridVisible = !m_bGridVisible);
+            m_bGridVisible = !m_bGridVisible;
+            getDesignView()->toggleGrid(m_bGridVisible);
             break;
         case SID_RULER:
-            getDesignView()->showRuler(m_bShowRuler = !m_bShowRuler);
+            m_bShowRuler = !m_bShowRuler;
+            getDesignView()->showRuler(m_bShowRuler);
             break;
         case SID_OBJECT_SELECT:
             getDesignView()->SetMode(DlgEdMode::Select);
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index a7f82f7c5bb8..3eaa42d6ab5b 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -568,10 +568,12 @@ bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt)
         if (rDragStat.GetDragMethod() != nullptr)
         {
             SdrObjListIter aIter(m_pParent->getPage(),SdrIterMode::DeepNoGroups);
-            SdrObject* pObjIter = nullptr;
             // loop through all marked objects and check if there new rect overlapps an old one.
-            while( (pObjIter = aIter.Next()) != nullptr && !bIsSetPoint)
+            for (;;)
             {
+                SdrObject* pObjIter = aIter.Next();
+                if( !pObjIter || bIsSetPoint)
+                    break;
                 if ( m_rView.IsObjMarked(pObjIter)
                      && (dynamic_cast<OUnoObject*>(pObjIter) != nullptr || dynamic_cast<OOle2Obj*>(pObjIter) != nullptr) )
                 {


More information about the Libreoffice-commits mailing list