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

Katarina Behrens bubli at bubli.org
Sat Mar 23 12:44:09 PDT 2013


 sd/source/ui/slideshow/slideshowimpl.cxx |   74 +++++++++++--------------------
 sd/source/ui/slideshow/slideshowimpl.hxx |    2 
 2 files changed, 28 insertions(+), 48 deletions(-)

New commits:
commit 45e4a5ef5347f7e2fe90a0d411e3749f24008c3a
Author: Katarina Behrens <bubli at bubli.org>
Date:   Sat Mar 23 20:32:40 2013 +0100

    Start slideshow with the next visible slide
    
    if current slide happens to be hidden + feeble attempt to untangle
    spaghetti code in slideshowimpl *sigh*
    Fixed within Impress Sprint
    
    Change-Id: I120f72307ff5ec4d573845bf480a18ac4ce9212d

diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 6737f63..6ba66de 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -942,11 +942,14 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
 
         if( bStartWithActualSlide )
         {
+            aPresSlide = pStartPage->GetName();
+            // if the starting slide is hidden, we can't set slide controller to ALL mode
+            maPresSettings.mbAll = !pStartPage->IsExcluded();
+
             if( meAnimationMode != ANIMATIONMODE_SHOW )
             {
                 if( pStartPage->GetPageKind() == PK_STANDARD )
                 {
-                    aPresSlide = pStartPage->GetName();
                     maPresSettings.mbAll = false;
                 }
                 else
@@ -963,31 +966,9 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
             }
         }
 
+        sal_Int32 nSlideNum = ( pStartPage->GetPageNum() - 1 ) >> 1;
         // build page list
-        createSlideList( maPresSettings.mbAll, false, aPresSlide );
-
-        if( bStartWithActualSlide )
-        {
-            sal_Int32 nSlideNum = ( pStartPage->GetPageNum() - 1 ) >> 1;
-
-            if( !maPresSettings.mbAll && !maPresSettings.mbCustomShow )
-            {
-                // its start from dia, find out if it is located before our current Slide
-                const sal_Int32 nSlideCount = mpDoc->GetSdPageCount( PK_STANDARD );
-                sal_Int32 nSlide;
-                for( nSlide = 0; (nSlide < nSlideCount); nSlide++ )
-                {
-                    if( mpDoc->GetSdPage( (sal_uInt16) nSlide, PK_STANDARD )->GetName() == aPresSlide )
-                        break;
-                }
-
-                if( nSlide > nSlideNum )
-                    nSlideNum = -1;
-            }
-
-            if( nSlideNum != -1 )
-                mpSlideController->setStartSlideNumber( nSlideNum );
-        }
+        createSlideList( maPresSettings.mbAll, false, aPresSlide, nSlideNum );
 
         // remember Slide number from where the show was started
         if( pStartPage )
@@ -2448,7 +2429,7 @@ Reference< XSlideShow > SlideshowImpl::createSlideShow() const
 
 // ---------------------------------------------------------
 
-void SlideshowImpl::createSlideList( bool bAll, bool bStartWithActualSlide, const String& rPresSlide )
+void SlideshowImpl::createSlideList( bool bAll, bool bStartWithActualSlide, const String& rPresSlide, sal_Int32 nStartSlide )
 {
     const long nSlideCount = mpDoc->GetSdPageCount( PK_STANDARD );
 
@@ -2472,34 +2453,33 @@ void SlideshowImpl::createSlideList( bool bAll, bool bStartWithActualSlide, cons
 
         if( eMode != AnimationSlideController::CUSTOM )
         {
-            sal_Int32 nFirstSlide = 0;
+            sal_Int32 nFirstVisibleSlide = 0;
+
 
             // normal presentation
-            if( eMode == AnimationSlideController::FROM )
+            if( rPresSlide.Len() )
             {
-                if( rPresSlide.Len() )
+                sal_Int32 nSlide;
+                sal_Bool bTakeNextAvailable = sal_False;
+
+                for( nSlide = nStartSlide, nFirstVisibleSlide = -1;
+                    ( nSlide < nSlideCount ) && ( -1 == nFirstVisibleSlide ); nSlide++ )
                 {
-                    sal_Int32 nSlide;
-                    sal_Bool bTakeNextAvailable = sal_False;
+                    SdPage* pTestSlide = mpDoc->GetSdPage( (sal_uInt16)nSlide, PK_STANDARD );
 
-                    for( nSlide = 0, nFirstSlide = -1; ( nSlide < nSlideCount ) && ( -1 == nFirstSlide ); nSlide++ )
+                    if( pTestSlide->GetName() == rPresSlide )
                     {
-                        SdPage* pTestSlide = mpDoc->GetSdPage( (sal_uInt16)nSlide, PK_STANDARD );
-
-                        if( pTestSlide->GetName() == rPresSlide )
-                        {
-                            if( pTestSlide->IsExcluded() )
-                                bTakeNextAvailable = sal_True;
-                            else
-                                nFirstSlide = nSlide;
-                        }
-                        else if( bTakeNextAvailable && !pTestSlide->IsExcluded() )
-                            nFirstSlide = nSlide;
+                        if( pTestSlide->IsExcluded() )
+                            bTakeNextAvailable = sal_True;
+                        else
+                            nFirstVisibleSlide = nSlide;
                     }
-
-                    if( -1 == nFirstSlide )
-                        nFirstSlide = 0;
+                    else if( bTakeNextAvailable && !pTestSlide->IsExcluded() )
+                        nFirstVisibleSlide = nSlide;
                 }
+
+                if( -1 == nFirstVisibleSlide )
+                    nFirstVisibleSlide = 0;
             }
 
             for( sal_Int32 i = 0; i < nSlideCount; i++ )
@@ -2509,7 +2489,7 @@ void SlideshowImpl::createSlideList( bool bAll, bool bStartWithActualSlide, cons
                     mpSlideController->insertSlideNumber( i, bVisible );
             }
 
-            mpSlideController->setStartSlideNumber( nFirstSlide );
+            mpSlideController->setStartSlideNumber( nFirstVisibleSlide );
         }
         else
         {
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
index 7f87ea0..ca968c4 100644
--- a/sd/source/ui/slideshow/slideshowimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -265,7 +265,7 @@ private:
 
     double update();
 
-    void createSlideList( bool bAll, bool bStartWithActualSlide, const String& rPresSlide );
+    void createSlideList( bool bAll, bool bStartWithActualSlide, const String& rPresSlide, sal_Int32 nStartSlide = 0 );
 
     void displayCurrentSlide (const bool bSkipAllMainSequenceEffects = false);
 


More information about the Libreoffice-commits mailing list