[Libreoffice-commits] core.git: offapi/com sd/inc sd/source slideshow/source xmloff/source

Cao Cuong Ngo cao.cuong.ngo at gmail.com
Fri Apr 5 04:06:11 PDT 2013


 offapi/com/sun/star/presentation/DrawPage.idl   |    6 ++++++
 sd/inc/sdpage.hxx                               |    6 +++---
 sd/source/core/sdpage.cxx                       |    2 +-
 sd/source/core/sdpage2.cxx                      |    2 +-
 sd/source/filter/html/htmlex.cxx                |   14 +++++++-------
 sd/source/filter/html/htmlex.hxx                |    2 +-
 sd/source/filter/ppt/pptin.cxx                  |    2 +-
 sd/source/ui/animations/SlideTransitionPane.cxx |   14 +++++++-------
 sd/source/ui/animations/SlideTransitionPane.src |   10 +++++-----
 sd/source/ui/dlg/dlgass.cxx                     |    4 ++--
 sd/source/ui/unoidl/unopage.cxx                 |   19 ++++++++++++++++---
 slideshow/source/engine/slideshowimpl.cxx       |    2 +-
 xmloff/source/draw/propimp0.cxx                 |    9 +++++----
 xmloff/source/draw/sdpropls.cxx                 |    2 +-
 14 files changed, 57 insertions(+), 37 deletions(-)

New commits:
commit 2c82e5d304b56c1dd95d0f3dcafc9a36ce02b5f4
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date:   Tue Apr 2 18:37:00 2013 +0200

    fdo#59071 Slideshow: allow automatic transitions with sub-second
    
    Enable slide transition each 0.25 second instead of whole second.
    
    Change-Id: I1907a1baf30cede91a0438d021e003204ea06651

diff --git a/offapi/com/sun/star/presentation/DrawPage.idl b/offapi/com/sun/star/presentation/DrawPage.idl
index 59dd8f3..2abde0f 100644
--- a/offapi/com/sun/star/presentation/DrawPage.idl
+++ b/offapi/com/sun/star/presentation/DrawPage.idl
@@ -62,6 +62,11 @@ published service DrawPage
      */
     [property] long Duration;
 
+    /** If the property <member scope="com::sun::star::drawing">DrawPage::Change</member> is set to 1,
+        this is the time in seconds this page is shown before switching
+        to the next page, also permitting sub-second precision here.
+     */
+    [optional, property] double HighResDuration;
 
     /** This is the effect that is used to fade in this page.
      */
@@ -136,6 +141,7 @@ published service DrawPage
         this page. This is only used if <code>IsDateTimeFixed</code> is <false/>.
     */
     [optional, property] long DateTimeFormat;
+
 };
 
 
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index 18b58a3..0b5d631 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -115,7 +115,7 @@ protected:
     sd::ScopeLock maLockAutoLayoutArrangement;
     sal_Bool    mbSelected;               ///< selection identifier
     PresChange  mePresChange;             ///< manual / automatic / semi automatic
-    sal_uInt32  mnTime;                   ///< Display time in seconds
+    double      mfTime;                   ///< Display time in seconds
     sal_Bool    mbSoundOn;                ///< with / without sound.
     sal_Bool    mbExcluded;               ///< will (not) be displayed during show.
     OUString    maLayoutName;             ///< Name of the layout
@@ -223,8 +223,8 @@ public:
     void        SetPresChange(PresChange eChange)    { mePresChange = eChange; }
     PresChange  GetPresChange() const                { return mePresChange; }
 
-    void        SetTime(sal_uInt32 nNewTime)             { mnTime = nNewTime; }
-    sal_uInt32      GetTime() const                      { return mnTime; }
+    void        SetTime(double fNewTime)             { mfTime = fNewTime; }
+    double      GetTime() const                      { return mfTime; }
 
     void        SetSound(sal_Bool bNewSoundOn)           { mbSoundOn = bNewSoundOn; }
     sal_Bool        IsSoundOn() const                    { return mbSoundOn; }
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 499af50..9057a4f 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -88,7 +88,7 @@ SdPage::SdPage(SdDrawDocument& rNewDoc, StarBASIC* pBasic, sal_Bool bMasterPage)
 ,   meAutoLayout(AUTOLAYOUT_NONE)
 ,   mbSelected(sal_False)
 ,   mePresChange(PRESCHANGE_MANUAL)
-,   mnTime(1)
+,   mfTime(1.0)
 ,   mbSoundOn(sal_False)
 ,   mbExcluded(sal_False)
 ,   mbLoopSound(sal_False)
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index c446f05..7007bf5f 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -390,7 +390,7 @@ SdPage::SdPage(const SdPage& rSrcPage)
     mnTransitionFadeColor = rSrcPage.mnTransitionFadeColor;
     mfTransitionDuration = rSrcPage.mfTransitionDuration;
     mePresChange            = rSrcPage.mePresChange;
-    mnTime               = rSrcPage.mnTime;
+    mfTime               = rSrcPage.mfTime;
     mbSoundOn            = rSrcPage.mbSoundOn;
     mbExcluded           = rSrcPage.mbExcluded;
 
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 706b199..5cc1a4f 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -584,9 +584,9 @@ void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams
         }
         else if ( pParams->Name == "KioskSlideDuration" )
         {
-            sal_Int32 temp = sal_False;
+            double temp = 0.0;
             pParams->Value >>= temp;
-            mnSlideDuration = temp;
+            mfSlideDuration = temp;
             mbAutoSlide = true;
         }
         else if ( pParams->Name == "KioskEndless" )
@@ -1521,28 +1521,28 @@ bool HtmlExport::CreateHtmlForPresPages()
         pPage = maPages[ nSdPage ];
         if( meMode == PUBLISH_KIOSK )
         {
-            sal_uLong nSecs = 0;
+            double fSecs = 0;
             bool bEndless = false;
             if( !mbAutoSlide )
             {
                 if( pPage->GetPresChange() != PRESCHANGE_MANUAL )
                 {
-                    nSecs = pPage->GetTime();
+                    fSecs = pPage->GetTime();
                     bEndless = mpDoc->getPresentationSettings().mbEndless;
                 }
             }
             else
             {
-                nSecs = mnSlideDuration;
+                fSecs = mfSlideDuration;
                 bEndless = mbEndless;
             }
 
-            if( nSecs != 0 )
+            if( fSecs != 0 )
             {
                 if( nSdPage < (mnSdPageCount-1) || bEndless )
                 {
                     aStr.AppendAscii( "<meta http-equiv=\"refresh\" content=\"" );
-                    aStr += OUString::number(nSecs);
+                    aStr += OUString::number(fSecs);
                     aStr.AppendAscii( "; URL=" );
 
                     int nPage = nSdPage + 1;
diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx
index 6ef80ed..3a8f586 100644
--- a/sd/source/filter/html/htmlex.hxx
+++ b/sd/source/filter/html/htmlex.hxx
@@ -114,7 +114,7 @@ class HtmlExport
     bool mbDownload;
 
     bool mbAutoSlide;
-    sal_uInt32  mnSlideDuration;
+    double  mfSlideDuration;
     bool mbSlideSound;
     bool mbHiddenSlides;
     bool mbEndless;
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 308979d..9dc25d8 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1757,7 +1757,7 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimat
                                 if ( nBuildFlags & 0x400 )                      // slidechange by time
                                 {   // time to show (in Ticks)
                                     pPage->SetPresChange( PRESCHANGE_AUTO );
-                                    pPage->SetTime( nSlideTime / 1000 );
+                                    pPage->SetTime( nSlideTime / 1000.0 );
                                 }
                                 else
                                     pPage->SetPresChange( mePresChange );
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index 10eb311..8c3913e 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -108,7 +108,7 @@ struct TransitionEffect
         init();
 
         mfDuration = rPage.getTransitionDuration();
-        mnTime = rPage.GetTime();
+        mfTime = rPage.GetTime();
         mePresChange = rPage.GetPresChange();
         mbSoundOn = rPage.IsSoundOn();
         maSound = rPage.GetSoundFile();
@@ -119,7 +119,7 @@ struct TransitionEffect
     void init()
     {
         mfDuration = 2.0;
-        mnTime = 0;
+        mfTime = 0.0;
         mePresChange = PRESCHANGE_MANUAL;
         mbSoundOn = sal_False;
         mbLoopSound = sal_False;
@@ -165,7 +165,7 @@ struct TransitionEffect
         if( ! mbDurationAmbiguous )
             rOutPage.setTransitionDuration( mfDuration );
         if( ! mbTimeAmbiguous )
-            rOutPage.SetTime( mnTime );
+            rOutPage.SetTime( mfTime );
         if( ! mbPresChangeAmbiguous )
             rOutPage.SetPresChange( mePresChange );
         if( ! mbSoundAmbiguous )
@@ -196,7 +196,7 @@ struct TransitionEffect
                                               || (mnFadeColor != aOtherEffect.mnFadeColor);
 
         mbDurationAmbiguous = mbDurationAmbiguous || aOtherEffect.mbDurationAmbiguous || mfDuration != aOtherEffect.mfDuration;
-        mbTimeAmbiguous = mbTimeAmbiguous || aOtherEffect.mbTimeAmbiguous || mnTime != aOtherEffect.mnTime;
+        mbTimeAmbiguous = mbTimeAmbiguous || aOtherEffect.mbTimeAmbiguous || mfTime != aOtherEffect.mfTime;
         mbPresChangeAmbiguous = mbPresChangeAmbiguous || aOtherEffect.mbPresChangeAmbiguous || mePresChange != aOtherEffect.mePresChange;
         mbSoundAmbiguous = mbSoundAmbiguous || aOtherEffect.mbSoundAmbiguous || mbSoundOn != aOtherEffect.mbSoundOn;
 #if 0
@@ -217,7 +217,7 @@ struct TransitionEffect
 
     // other settings
     double      mfDuration;
-    sal_uLong       mnTime;
+    double       mfTime;
     PresChange  mePresChange;
     sal_Bool        mbSoundOn;
     String      maSound;
@@ -859,7 +859,7 @@ void SlideTransitionPane::updateControls()
     {
         maRB_ADVANCE_ON_MOUSE.Check( aEffect.mePresChange == PRESCHANGE_MANUAL );
         maRB_ADVANCE_AUTO.Check( aEffect.mePresChange == PRESCHANGE_AUTO );
-        maMF_ADVANCE_AUTO_AFTER.SetValue( aEffect.mnTime );
+        maMF_ADVANCE_AUTO_AFTER.SetValue( aEffect.mfTime * 100.0);
     }
 
     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
@@ -1026,7 +1026,7 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co
             aResult.mePresChange = PRESCHANGE_AUTO;
             if( maMF_ADVANCE_AUTO_AFTER.IsEnabled())
             {
-                aResult.mnTime = static_cast<long>(maMF_ADVANCE_AUTO_AFTER.GetValue());
+                aResult.mfTime = static_cast<double>(maMF_ADVANCE_AUTO_AFTER.GetValue() ) / 100.0 ;
                 aResult.mbTimeAmbiguous = false;
             }
         }
diff --git a/sd/source/ui/animations/SlideTransitionPane.src b/sd/source/ui/animations/SlideTransitionPane.src
index d2017de8..d78f0a0 100644
--- a/sd/source/ui/animations/SlideTransitionPane.src
+++ b/sd/source/ui/animations/SlideTransitionPane.src
@@ -142,11 +142,11 @@ Control DLG_SLIDE_TRANSITION_PANE
         Repeat = TRUE ;
         Spin = TRUE ;
         Minimum = 0 ;
-        Maximum = 999 ;
-        // decimal digits should be 1, but for now the model only supports whole seconds
-        DecimalDigits = 0 ;
-        // spin size (increment value) should be 5 if digits are 1
-        SpinSize = 1 ;
+        Maximum = 9999 ;
+        // fdo#59071, enable slide auto transition of 0.25 second
+        DecimalDigits = 2 ;
+        // spin size (increment value), each 0.25 second
+        SpinSize = 25 ;
 
         Unit = FUNIT_CUSTOM ;
         CustomUnitText [ en-US ] = "sec";
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index ebb88e4..b1ae03f 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -1036,7 +1036,7 @@ SfxObjectShellLock AssistentDlgImpl::GetDocument()
     {
         const sal_uInt16 nPageCount = pDoc->GetSdPageCount(PK_STANDARD);
         sal_Bool bKiosk = mpPage3PresTypeKioskRB->IsChecked();
-        sal_uInt32 nNewTime = (sal_uInt32)mpPage3PresTimeTMF->GetTime().GetMSFromTime() / 1000;
+        double fNewTime = (double)mpPage3PresTimeTMF->GetTime().GetMSFromTime() / 1000.0;
         if(bKiosk)
         {
             PresentationSettings& rSettings = pDoc->getPresentationSettings();
@@ -1058,7 +1058,7 @@ SfxObjectShellLock AssistentDlgImpl::GetDocument()
                 if(bKiosk)
                 {
                     pPage->SetPresChange( PRESCHANGE_AUTO );
-                    pPage->SetTime(nNewTime);
+                    pPage->SetTime(fNewTime);
                 }
                 nPgRelNum++;
             }
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 03b11bd..a5c237b 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -92,7 +92,7 @@ enum WID_PAGE
 {
     WID_PAGE_LEFT, WID_PAGE_RIGHT, WID_PAGE_TOP, WID_PAGE_BOTTOM, WID_PAGE_WIDTH,
     WID_PAGE_HEIGHT, WID_PAGE_EFFECT, WID_PAGE_CHANGE, WID_PAGE_SPEED, WID_PAGE_NUMBER,
-    WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, WID_PAGE_LDNAME, WID_PAGE_LDBITMAP,
+    WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, WID_PAGE_HIGHRESDURATION, WID_PAGE_LDNAME, WID_PAGE_LDBITMAP,
     WID_PAGE_BACK, WID_PAGE_PREVIEW, WID_PAGE_PREVIEWBITMAP, WID_PAGE_VISIBLE, WID_PAGE_SOUNDFILE, WID_PAGE_BACKFULL,
     WID_PAGE_BACKVIS, WID_PAGE_BACKOBJVIS, WID_PAGE_USERATTRIBS, WID_PAGE_BOOKMARK, WID_PAGE_ISDARK,
     WID_PAGE_HEADERVISIBLE, WID_PAGE_HEADERTEXT, WID_PAGE_FOOTERVISIBLE, WID_PAGE_FOOTERTEXT,
@@ -141,6 +141,7 @@ const SvxItemPropertySet* ImplGetDrawPagePropertySet( sal_Bool bImpress, PageKin
         { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundObjectsVisible),   WID_PAGE_BACKOBJVIS,    &::getBooleanCppuType(),                        0, 0},
         { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0)  ,         0,     0},
         { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL),          WID_PAGE_BOOKMARK,  &::getCppuType((const OUString*)0),             0,  0},
+        { MAP_CHAR_LEN("HighResDuration"),              WID_PAGE_HIGHRESDURATION,  &::getCppuType((const double*)0),            0,  0},
         { MAP_CHAR_LEN("IsBackgroundDark" ),            WID_PAGE_ISDARK,    &::getBooleanCppuType(),                        beans::PropertyAttribute::READONLY, 0},
         { MAP_CHAR_LEN("IsFooterVisible"),              WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(),                    0, 0},
         { MAP_CHAR_LEN("FooterText"),                   WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0),                0,  0},
@@ -612,11 +613,20 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName
                 GetPage()->SetAutoLayout( (AutoLayout)nValue, sal_True );
                 break;
             case WID_PAGE_DURATION:
-                GetPage()->SetTime((sal_uInt32)nValue);
+                GetPage()->SetTime((sal_Int32)nValue);
                 break;
             }
             break;
         }
+        case WID_PAGE_HIGHRESDURATION:
+        {
+            double fValue = 0;
+            if(!(aValue >>= fValue))
+                throw lang::IllegalArgumentException();
+
+            GetPage()->SetTime(fValue);
+            break;
+        }
         case WID_PAGE_WIDTH:
         {
             sal_Int32 nWidth = 0;
@@ -1033,7 +1043,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
         }
         break;
     case WID_PAGE_DURATION:
-        aAny <<= (sal_Int32)(GetPage()->GetTime());
+        aAny <<= (sal_Int32)( GetPage()->GetTime() + .5 );
+        break;
+    case WID_PAGE_HIGHRESDURATION:
+        aAny <<= (double)( GetPage()->GetTime() );
         break;
     case WID_PAGE_LDNAME:
     {
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index f64f681..c1d0b2a 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -2176,7 +2176,7 @@ void queryAutomaticSlideTransition( uno::Reference<drawing::XDrawPage> const& xD
         !getPropertyValue( nAutomaticNextSlideTimeout,
                            xPropSet,
                            ::rtl::OUString(
-                               "Duration")) )
+                               "HighResDuration")) )
     {
         OSL_TRACE(
             "queryAutomaticSlideTransition(): "
diff --git a/xmloff/source/draw/propimp0.cxx b/xmloff/source/draw/propimp0.cxx
index 75d8b93..3d6dc4a 100644
--- a/xmloff/source/draw/propimp0.cxx
+++ b/xmloff/source/draw/propimp0.cxx
@@ -56,9 +56,9 @@ sal_Bool XMLDurationPropertyHdl::importXML(
     util::Duration aDuration;
     ::sax::Converter::convertDuration(aDuration,  rStrImpValue);
 
-    const sal_Int32 nSeconds = ((aDuration.Days * 24 + aDuration.Hours) * 60
-            + aDuration.Minutes) * 60 + aDuration.Seconds;
-    rValue <<= nSeconds;
+    const double fSeconds = ((aDuration.Days * 24 + aDuration.Hours) * 60
+            + aDuration.Minutes) * 60 + aDuration.Seconds + aDuration.MilliSeconds / 1000.0;
+    rValue <<= fSeconds;
 
     return sal_True;
 }
@@ -68,12 +68,13 @@ sal_Bool XMLDurationPropertyHdl::exportXML(
     const ::com::sun::star::uno::Any& rValue,
     const SvXMLUnitConverter& ) const
 {
-    sal_Int32 nVal = 0;
+    double nVal = 0;
 
     if(rValue >>= nVal)
     {
         util::Duration aDuration;
         aDuration.Seconds = static_cast<sal_uInt16>(nVal);
+        aDuration.MilliSeconds = static_cast<sal_uInt32>(nVal * 1000.0) % 1000 ;
 
         OUStringBuffer aOut;
         ::sax::Converter::convertDuration(aOut, aDuration);
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 1bf5b27..273517b 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -304,7 +304,7 @@ const XMLPropertyMapEntry aXMLSDPresPageProps[] =
     DPMAP( "Change",                        XML_NAMESPACE_PRESENTATION, XML_TRANSITION_TYPE,    XML_SD_TYPE_PRESPAGE_TYPE, CTF_PAGE_TRANS_TYPE ),
     DPMAP( "Effect",                        XML_NAMESPACE_PRESENTATION, XML_TRANSITION_STYLE,   XML_SD_TYPE_PRESPAGE_STYLE, CTF_PAGE_TRANS_STYLE ),
     DPMAP( "Speed",                     XML_NAMESPACE_PRESENTATION, XML_TRANSITION_SPEED,   XML_SD_TYPE_PRESPAGE_SPEED, CTF_PAGE_TRANS_SPEED ),
-    DPMAP( "Duration",                  XML_NAMESPACE_PRESENTATION, XML_DURATION,           XML_SD_TYPE_PRESPAGE_DURATION, CTF_PAGE_TRANS_DURATION ),
+    DPMAP( "HighResDuration",           XML_NAMESPACE_PRESENTATION, XML_DURATION,           XML_SD_TYPE_PRESPAGE_DURATION, CTF_PAGE_TRANS_DURATION ),
     DPMAP( "Visible",                   XML_NAMESPACE_PRESENTATION, XML_VISIBILITY,         XML_SD_TYPE_PRESPAGE_VISIBILITY, CTF_PAGE_VISIBLE ),
     DPMAP( "Sound",                     XML_NAMESPACE_PRESENTATION, XML_SOUND,              XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PAGE_SOUND_URL ),
     DPMAP( "BackgroundFullSize",            XML_NAMESPACE_DRAW,         XML_BACKGROUND_SIZE,    XML_SD_TYPE_PRESPAGE_BACKSIZE, CTF_PAGE_BACKSIZE ),


More information about the Libreoffice-commits mailing list