summaryrefslogtreecommitdiff
path: root/svx/source/gallery2
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-03-11 11:47:23 +0100
committerJan Holesovsky <kendy@collabora.com>2014-03-11 13:09:31 +0100
commit3f4e77298eece02adb26d3aee2413dc94d318d84 (patch)
tree5f05dd65119c94bda51e877b1c04c0d6834dc94f /svx/source/gallery2
parentcfedbdea58e01bb93ab30316f7cac7dc31fba3dd (diff)
Return early, and kill 1 indentation level by that.
Change-Id: Ia67669e45b78c5fe5059f76b940e85a02781c4c2
Diffstat (limited to 'svx/source/gallery2')
-rw-r--r--svx/source/gallery2/galtheme.cxx95
1 files changed, 46 insertions, 49 deletions
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 1275a70ad367..20959e8702bd 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(); }