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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 15 15:18:12 UTC 2018


 sw/source/core/unocore/unochart.cxx |   49 ++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 24 deletions(-)

New commits:
commit c2db702ca3df56bd4a1c26d2171cd0ac5259b973
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 15 14:13:02 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 15 17:17:48 2018 +0200

    unroll complex if statement assigns
    
    Change-Id: I462095f6b912bc3442c232f003278efc3f5c347e
    Reviewed-on: https://gerrit.libreoffice.org/59107
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 6c64ef2441ae..8dcc9b13a670 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -120,39 +120,40 @@ void SwChartLockController_Helper::LockUnlockAllCharts( bool bLock )
     const SwFrameFormats& rTableFormats = *pDoc->GetTableFrameFormats();
     for( size_t n = 0; n < rTableFormats.size(); ++n )
     {
-        SwTable* pTmpTable;
-        const SwTableNode* pTableNd;
         const SwFrameFormat* pFormat = rTableFormats[ n ];
+        SwTable* pTmpTable = SwTable::FindTable(pFormat);
+        if (!pTmpTable)
+            continue;
+        const SwTableNode* pTableNd = pTmpTable->GetTableNode();
+        if (!pTableNd)
+            continue;
+        if (!pTableNd->GetNodes().IsDocNodes())
+            continue;
 
-        if( nullptr != ( pTmpTable = SwTable::FindTable( pFormat ) ) &&
-            nullptr != ( pTableNd = pTmpTable->GetTableNode() ) &&
-            pTableNd->GetNodes().IsDocNodes() )
+        uno::Reference< frame::XModel > xRes;
+        SwOLENode *pONd;
+        SwStartNode *pStNd;
+        SwNodeIndex aIdx( *pDoc->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+        while( nullptr != (pStNd = aIdx.GetNode().GetStartNode()) )
         {
-            uno::Reference< frame::XModel > xRes;
-            SwOLENode *pONd;
-            SwStartNode *pStNd;
-            SwNodeIndex aIdx( *pDoc->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
-            while( nullptr != (pStNd = aIdx.GetNode().GetStartNode()) )
+            ++aIdx;
+            if (nullptr != ( pONd = aIdx.GetNode().GetOLENode() ) &&
+                !pONd->GetChartTableName().isEmpty() /* is chart object? */)
             {
-                ++aIdx;
-                if (nullptr != ( pONd = aIdx.GetNode().GetOLENode() ) &&
-                    !pONd->GetChartTableName().isEmpty() /* is chart object? */)
+                uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef();
+                if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
                 {
-                    uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef();
-                    if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
+                    xRes.set( xIP->getComponent(), uno::UNO_QUERY );
+                    if (xRes.is())
                     {
-                        xRes.set( xIP->getComponent(), uno::UNO_QUERY );
-                        if (xRes.is())
-                        {
-                            if (bLock)
-                                xRes->lockControllers();
-                            else
-                                xRes->unlockControllers();
-                        }
+                        if (bLock)
+                            xRes->lockControllers();
+                        else
+                            xRes->unlockControllers();
                     }
                 }
-                aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
             }
+            aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
         }
     }
 


More information about the Libreoffice-commits mailing list