svx/source/gallery2/galtheme.cxx |   95 ++++++++++++++++++---------------------
 1 file changed, 46 insertions(+), 49 deletions(-)

New commits:
commit 3f4e77298eece02adb26d3aee2413dc94d318d84
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Tue Mar 11 11:47:23 2014 +0100

    Return early, and kill 1 indentation level by that.
    
    Change-Id: Ia67669e45b78c5fe5059f76b940e85a02781c4c2

diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 1275a70..20959e8 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -359,50 +359,48 @@ void GalleryTheme::UnlockBroadcaster( sal_uIntPtr 
nUpdatePos )
 
 bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_uIntPtr nInsertPos 
)
 {
-    sal_Bool bRet = sal_False;
+    if (!rObj.IsValid())
+        return false;
 
-    if( rObj.IsValid() )
+    GalleryObject* pFoundEntry = NULL;
+    size_t iFoundPos = 0;
+    for (size_t n = aObjectList.size(); iFoundPos < n; ++iFoundPos)
     {
-        GalleryObject*  pFoundEntry = NULL;
-        size_t iFoundPos = 0;
-        for ( size_t n = aObjectList.size(); iFoundPos < n; ++iFoundPos )
+        if (aObjectList[ iFoundPos ]->aURL == rObj.GetURL())
         {
-            if ( aObjectList[ iFoundPos ]->aURL == rObj.GetURL() )
-            {
-                pFoundEntry = aObjectList[ iFoundPos ];
-                break;
-            }
+            pFoundEntry = aObjectList[ iFoundPos ];
+            break;
         }
+    }
+
+    if (pFoundEntry)
+    {
+        GalleryObject aNewEntry;
 
-        if( pFoundEntry )
+        // update title of new object if necessary
+        if (rObj.GetTitle().isEmpty())
         {
-            GalleryObject aNewEntry;
+            SgaObject* pOldObj = ImplReadSgaObject(pFoundEntry);
 
-            // update title of new object if necessary
-            if( rObj.GetTitle().isEmpty() )
+            if (pOldObj)
             {
-                SgaObject* pOldObj = ImplReadSgaObject( pFoundEntry );
-
-                if( pOldObj )
-                {
-                    ( (SgaObject&) rObj ).SetTitle( pOldObj->GetTitle() );
-                    delete pOldObj;
-                }
+                ((SgaObject&) rObj).SetTitle( pOldObj->GetTitle() );
+                delete pOldObj;
             }
-            else if( rObj.GetTitle() == "__<empty>__" )
-                ( (SgaObject&) rObj ).SetTitle( "" );
-
-            ImplWriteSgaObject( rObj, nInsertPos, &aNewEntry );
-            pFoundEntry->nOffset = aNewEntry.nOffset;
         }
-        else
-            ImplWriteSgaObject( rObj, nInsertPos, NULL );
+        else if (rObj.GetTitle() == "__<empty>__")
+            ((SgaObject&) rObj).SetTitle("");
 
-        ImplSetModified( (bRet = sal_True) );
-        ImplBroadcast( pFoundEntry ? iFoundPos : nInsertPos );
+        ImplWriteSgaObject(rObj, nInsertPos, &aNewEntry);
+        pFoundEntry->nOffset = aNewEntry.nOffset;
     }
+    else
+        ImplWriteSgaObject(rObj, nInsertPos, NULL);
 
-    return bRet;
+    ImplSetModified(true);
+    ImplBroadcast(pFoundEntry? iFoundPos: nInsertPos);
+
+    return true;
 }
 
 SgaObject* GalleryTheme::AcquireObject( size_t nPos )
@@ -481,29 +479,26 @@ bool GalleryTheme::RemoveObject( size_t nPos )
 
 bool GalleryTheme::ChangeObjectPos( size_t nOldPos, size_t nNewPos )
 {
-    sal_Bool bRet = sal_False;
+    if (nOldPos == nNewPos || nOldPos >= aObjectList.size())
+        return false;
 
-    if(  nOldPos != nNewPos
-      && nOldPos < aObjectList.size()
-      )
-    {
-        GalleryObject* pEntry = aObjectList[ nOldPos ];
+    GalleryObject* pEntry = aObjectList[nOldPos];
 
-        GalleryObjectList::iterator it = aObjectList.begin();
-        ::std::advance( it, nNewPos );
-        aObjectList.insert( it, pEntry );
+    GalleryObjectList::iterator it = aObjectList.begin();
+    ::std::advance(it, nNewPos);
+    aObjectList.insert(it, pEntry);
 
-        if( nNewPos < nOldPos ) nOldPos++;
+    if (nNewPos < nOldPos)
+        nOldPos++;
 
-        it = aObjectList.begin();
-        ::std::advance( it, nOldPos );
-        aObjectList.erase( it );
+    it = aObjectList.begin();
+    ::std::advance(it, nOldPos);
+    aObjectList.erase(it);
 
-        ImplSetModified( (bRet = sal_True) );
-        ImplBroadcast( ( nNewPos < nOldPos ) ? nNewPos : ( nNewPos - 1 ) );
-    }
+    ImplSetModified(true);
+    ImplBroadcast((nNewPos < nOldPos)? nNewPos: (nNewPos - 1));
 
-    return bRet;
+    return true;
 }
 
 void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* 
pProgress )
@@ -1525,7 +1520,9 @@ SvStream& ReadGalleryTheme( SvStream& rIn, GalleryTheme& 
rTheme )
 }
 
 void GalleryTheme::ImplSetModified( bool bModified )
-{ pThm->SetModified( bModified ); }
+{
+    pThm->SetModified(bModified);
+}
 
 const OUString& GalleryTheme::GetRealName() const { return 
pThm->GetThemeName(); }
 const INetURLObject& GalleryTheme::GetThmURL() const { return 
pThm->GetThmURL(); }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to