[Libreoffice-commits] .: 6 commits - sd/source sd/xml slideshow/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Tue Oct 26 14:38:34 PDT 2010


 sd/source/filter/ppt/pptin.cxx                                 |   10 
 sd/source/ui/animations/CustomAnimationCreateDialog.cxx        |    2 
 sd/source/ui/inc/Window.hxx                                    |    1 
 sd/source/ui/view/drviews3.cxx                                 |   82 ++++++-
 sd/source/ui/view/sdwindow.cxx                                 |   19 +
 sd/xml/transitions.xml                                         |    3 
 slideshow/source/engine/transitions/slidetransitionfactory.cxx |  115 +++++++++-
 slideshow/source/engine/transitions/transitionfactorytab.cxx   |   14 +
 8 files changed, 226 insertions(+), 20 deletions(-)

New commits:
commit 15d168f01ca0b1bfed6496d97c74518c3a9e5923
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Tue Oct 26 23:26:14 2010 +0200

    Corrected file modes

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
old mode 100755
new mode 100644
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
old mode 100755
new mode 100644
diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx
old mode 100755
new mode 100644
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
old mode 100755
new mode 100644
commit e986934de4f2ba7b6793cf66cbf66b2b1a51b0f2
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Tue Oct 26 22:52:15 2010 +0200

    Fix impress ruler behaviour
    
    With 3.0, Impress numbering was modified because of the odf1.2
    changes in list level handling; we differ in the way we
    consider paragraphs to belong to the 'same' numbering group,
    compared to ppt. now, as long as the para has the same outline
    level (and no 'restart numbering' flag), it is considered to
    belong to the same numbering group, i.e. numbering will mono-
    tonically increase. Compares favorable to PPT. Additionally,
    fixed a repaint bug that prevented following paragraph's numbers
    to change, when certain modifications were made on the current one.
    
    Fix is discussed in i#101269
    
    Applies patches/dev300/sd-ruler-fix.diff

diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 7e9022d..1492c23 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -38,6 +38,7 @@
 #include <editeng/protitem.hxx>
 #include <editeng/frmdiritem.hxx>
 #include <svx/ruler.hxx>
+#include <editeng/numitem.hxx>
 #include <svx/rulritem.hxx>
 #include <svx/zoomitem.hxx>
 #include <svx/svxids.hrc>
@@ -686,14 +687,75 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                 const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&)
                             pArgs->Get( nId );
 
-                SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+                static const USHORT aWhichTable[]=
+                {
+                    EE_PARA_OUTLLEVEL, EE_PARA_OUTLLEVEL,
+                    EE_PARA_LRSPACE, EE_PARA_LRSPACE,
+                    EE_PARA_NUMBULLET, EE_PARA_NUMBULLET,
+                    0, 0
+                };
+
+                SfxItemSet aEditAttr( GetDoc()->GetPool(),
+                                      aWhichTable );
+                mpDrawView->GetAttributes( aEditAttr );
 
                 nId = EE_PARA_LRSPACE;
                 SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(),
                         rItem.GetRight(), rItem.GetTxtLeft(),
                         rItem.GetTxtFirstLineOfst(), nId );
-                aEditAttr.Put( aLRSpaceItem );
-                mpDrawView->SetAttributes( aEditAttr );
+
+                const INT16 nOutlineLevel = ((const SfxInt16Item&)aEditAttr.Get( EE_PARA_OUTLLEVEL )).GetValue();
+                const SvxLRSpaceItem& rOrigLRSpaceItem = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
+                const SvxNumBulletItem& rNumBulletItem = (const SvxNumBulletItem&) aEditAttr.Get( EE_PARA_NUMBULLET );
+                if( nOutlineLevel != -1 &&
+                    rNumBulletItem.GetNumRule() &&
+                    rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel )
+                {
+                    const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule()->GetLevel(nOutlineLevel);
+                    SvxNumberFormat aFormat(rFormat);
+
+                    // left margin always controls LRSpace item
+                    aLRSpaceItem.SetTxtLeft(rItem.GetTxtLeft() - aFormat.GetAbsLSpace());
+
+                    // negative first line indent goes to the number
+                    // format, positive to the lrSpace item
+                    if( rItem.GetTxtFirstLineOfst() < 0 )
+                    {
+                        aFormat.SetFirstLineOffset(
+                            rItem.GetTxtFirstLineOfst()
+                            - rOrigLRSpaceItem.GetTxtFirstLineOfst()
+                            + aFormat.GetCharTextDistance());
+                        aLRSpaceItem.SetTxtFirstLineOfst(0);
+                    }
+                    else
+                    {
+                        aFormat.SetFirstLineOffset(0);
+                        aLRSpaceItem.SetTxtFirstLineOfst(
+                            rItem.GetTxtFirstLineOfst()
+                            - aFormat.GetFirstLineOffset()
+                            + aFormat.GetCharTextDistance());
+                    }
+
+                    if( rFormat != aFormat )
+                    {
+                        // put all items
+                        SvxNumBulletItem aNumBulletItem(rNumBulletItem);
+                        aNumBulletItem.GetNumRule()->SetLevel(nOutlineLevel,aFormat);
+                        aEditAttr.Put( aNumBulletItem );
+                        aEditAttr.Put( aLRSpaceItem );
+                        mpDrawView->SetAttributes( aEditAttr );
+
+                        // #92557# Invalidate is missing here
+                        Invalidate(SID_ATTR_PARA_LRSPACE);
+                        break;
+                    }
+                }
+
+                // only put lrSpace item
+                SfxItemSet aEditAttrReduced( GetDoc()->GetPool(),
+                                             EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+                aEditAttrReduced.Put( aLRSpaceItem );
+                mpDrawView->SetAttributes( aEditAttrReduced );
 
                 // #92557# Invalidate is missing here
                 Invalidate(SID_ATTR_PARA_LRSPACE);
@@ -779,6 +841,20 @@ void  DrawViewShell::GetRulerState(SfxItemSet& rSet)
                     SvxLRSpaceItem aLRSpaceItem( rLRSpaceItem.GetLeft(),
                             rLRSpaceItem.GetRight(), rLRSpaceItem.GetTxtLeft(),
                             rLRSpaceItem.GetTxtFirstLineOfst(), nId );
+
+                    const INT16 nOutlineLevel = ((const SfxInt16Item&)aEditAttr.Get( EE_PARA_OUTLLEVEL )).GetValue();
+                    const SvxNumBulletItem& rNumBulletItem = (const SvxNumBulletItem&) aEditAttr.Get( EE_PARA_NUMBULLET );
+                    if( nOutlineLevel != -1 &&
+                        rNumBulletItem.GetNumRule() &&
+                        rNumBulletItem.GetNumRule()->GetLevelCount() > nOutlineLevel )
+                    {
+                        const SvxNumberFormat& rFormat = rNumBulletItem.GetNumRule()->GetLevel(nOutlineLevel);
+                        aLRSpaceItem.SetTxtLeft(rFormat.GetAbsLSpace() + rLRSpaceItem.GetTxtLeft());
+                        aLRSpaceItem.SetTxtFirstLineOfst(
+                            rLRSpaceItem.GetTxtFirstLineOfst() + rFormat.GetFirstLineOffset()
+                            - rFormat.GetCharTextDistance());
+                    }
+
                     rSet.Put( aLRSpaceItem );
 
                     Point aPos( aPagePos + maMarkRect.TopLeft() );
commit 3de9734c96aa305ebc825abd5f48aa3cf7b25fab
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Tue Oct 26 22:37:34 2010 +0200

    Keyboard accel for Impress custom anim create dialog
    
    Make ok and cancel btns work on return and esc, resp. in Impress'
    custom animation create dialog. Patch from i#105675, applies
    sd-customanimation-defbutton.diff

diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
old mode 100644
new mode 100755
index fe13540..d91b936
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
@@ -516,7 +516,9 @@ CustomAnimationCreateDialog::CustomAnimationCreateDialog( Window* pParent, Custo
 {
     mpTabControl = new TabControl( this, SdResId( 1 ) );
     mpOKButton = new OKButton(this, SdResId( 1 ) ) ;
+    mpOKButton->SetStyle(WB_DEFBUTTON);
     mpCancelButton = new CancelButton(this, SdResId( 1 ) );
+    mpCancelButton->SetStyle(WB_DEFBUTTON);
     mpHelpButton = new HelpButton(this, SdResId( 1 ) );
 
     FreeResource();
commit 51696d0ff9e694e8fc033a2593c5615aae94cf13
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Tue Oct 26 16:27:38 2010 +0200

    Add support for PPT newsflash slide transition
    
    This simply enables the transition on import - support in slideshow
    is already there

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 05cac2b..b16f445 100755
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1780,12 +1780,8 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimat
                                     break;
                                     case PPT_TRANSITION_TYPE_NEWSFLASH :
                                     {
-                                        pPage->setTransitionType( animations::TransitionType::FOURBOXWIPE );
-                                        pPage->setTransitionSubtype( animations::TransitionSubType::CORNERSOUT );
-/*
                                         pPage->setTransitionType( animations::TransitionType::ZOOM );
                                         pPage->setTransitionSubtype( animations::TransitionSubType::ROTATEIN );
-*/
                                     }
                                     break;
                                     case PPT_TRANSITION_TYPE_SMOOTHFADE :
commit 0bf39fc2b80123bc0ca6f994639e4f25edfb1dca
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Tue Oct 26 16:25:58 2010 +0200

    MS interop: support for cutblack slidetransition added
    
    Adds CUTBLACK slide transition to ppt import and slideshow

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
old mode 100644
new mode 100755
index 3f5dd5e..05cac2b
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1622,7 +1622,11 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimat
                                             if ( nDirection == 0 )
                                                 pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_NONE );				// Direkt
                                             else if ( nDirection == 1 )
-                                                pPage->SetFadeEffect( ::com::sun::star::presentation::FadeEffect_NONE );				// Direkt ueber Schwarz
+                                            {
+                                                pPage->setTransitionType( animations::TransitionType::BARWIPE );
+                                                pPage->setTransitionSubtype( animations::TransitionSubType::FADEOVERCOLOR );
+                                                pPage->setTransitionFadeColor( 0 );
+                                            }
                                         }
                                         else
                                             pPage->setTransitionType( 0 );
diff --git a/sd/xml/transitions.xml b/sd/xml/transitions.xml
index a9a32eb..92bdb52 100644
--- a/sd/xml/transitions.xml
+++ b/sd/xml/transitions.xml
@@ -111,6 +111,9 @@
  <anim:par pres:preset-id="fade-through-black">
   <anim:transitionFilter smil:type="fade" smil:subtype="fadeOverColor" smil:fadeColor="#000000"/>
  </anim:par>
+ <anim:par pres:preset-id="cut-through-black">
+  <anim:transitionFilter smil:type="barWipe" smil:subtype="fadeOverColor" smil:fadeColor="#000000"/>
+ </anim:par>
  <anim:par pres:preset-id="cover-down">
   <anim:transitionFilter smil:type="slideWipe" smil:subtype="fromTop"/>
  </anim:par>
diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
index f66d1ee..0de2f47 100644
--- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx
+++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
@@ -474,6 +474,89 @@ void FadingSlideChange::performOut(
     }
 }
 
+class CutSlideChange : public SlideChangeBase
+{
+public:
+    /** Create a new SlideChanger, for the given leaving and
+        entering slides, which applies a cut effect.
+    */
+    CutSlideChange(
+        boost::optional<SlideSharedPtr> const & leavingSlide,
+        const SlideSharedPtr&                   pEnteringSlide,
+        const RGBColor&                          rFadeColor,
+        const SoundPlayerSharedPtr&             pSoundPlayer,
+        const UnoViewContainer&                 rViewContainer,
+        ScreenUpdater&                          rScreenUpdater,
+        EventMultiplexer&                       rEventMultiplexer )
+        : SlideChangeBase( leavingSlide,
+                           pEnteringSlide,
+                           pSoundPlayer,
+                           rViewContainer,
+                           rScreenUpdater,
+                           rEventMultiplexer ),
+          maFadeColor( rFadeColor ),
+          mbFirstTurn( true )
+        {}
+
+    virtual void performIn(
+        const ::cppcanvas::CustomSpriteSharedPtr&   rSprite,
+        const ViewEntry&                            rViewEntry,
+        const ::cppcanvas::CanvasSharedPtr&         rDestinationCanvas,
+        double                                      t );
+
+    virtual void performOut(
+        const ::cppcanvas::CustomSpriteSharedPtr&  rSprite,
+        const ViewEntry&                           rViewEntry,
+        const ::cppcanvas::CanvasSharedPtr&        rDestinationCanvas,
+        double                                     t );
+
+private:
+    RGBColor maFadeColor;
+    bool    mbFirstTurn;
+};
+
+void CutSlideChange::performIn(
+    const ::cppcanvas::CustomSpriteSharedPtr&   rSprite,
+    const ViewEntry&                            /*rViewEntry*/,
+    const ::cppcanvas::CanvasSharedPtr&         /*rDestinationCanvas*/,
+    double                                      t )
+{
+    ENSURE_OR_THROW(
+        rSprite,
+        "CutSlideChange::performIn(): Invalid sprite" );
+
+    // After 2/3rd of the active time, display new slide
+    rSprite->setAlpha( t > 2/3.0 ? 1.0 : 0.0 );
+}
+
+void CutSlideChange::performOut(
+    const ::cppcanvas::CustomSpriteSharedPtr&  rSprite,
+    const ViewEntry&                           rViewEntry,
+    const ::cppcanvas::CanvasSharedPtr&        rDestinationCanvas,
+    double                                     t )
+{
+    ENSURE_OR_THROW(
+        rSprite,
+        "CutSlideChange::performOut(): Invalid sprite" );
+    ENSURE_OR_THROW(
+        rDestinationCanvas,
+        "FadingSlideChange::performOut(): Invalid dest canvas" );
+
+    if( mbFirstTurn )
+    {
+        mbFirstTurn = false;
+
+        // clear page to given fade color. 'Leaving' slide is
+        // painted atop of that
+        fillPage( rDestinationCanvas,
+                  getEnteringSlideSizePixel( rViewEntry.mpView ),
+                  maFadeColor );
+    }
+
+    // Until 1/3rd of the active time, display old slide.
+    rSprite->setAlpha( t > 1/3.0 ? 0.0 : 1.0 );
+}
+
 class MovingSlideChange : public SlideChangeBase
 {
     /// Direction vector for leaving slide,
@@ -1008,6 +1091,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition(
                             pSoundPlayer );
                     }
 
+                    case animations::TransitionType::BARWIPE:
                     case animations::TransitionType::FADE:
                     {
                         // black page:
@@ -1039,16 +1123,27 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition(
                                                   "SlideTransitionFactory::createSlideTransition(): Unknown FADE subtype" );
                         }
 
-                        return NumberAnimationSharedPtr( 
-                            new FadingSlideChange(
-                                leavingSlide,
-                                pEnteringSlide,
-                                comphelper::make_optional(
-                                    rTransitionFadeColor),
-                                pSoundPlayer,
-                                rViewContainer,
-                                rScreenUpdater,
-                                rEventMultiplexer ));
+                        if( nTransitionType == animations::TransitionType::FADE )
+                            return NumberAnimationSharedPtr(
+                                new FadingSlideChange(
+                                    leavingSlide,
+                                    pEnteringSlide,
+                                    comphelper::make_optional(
+                                        rTransitionFadeColor),
+                                    pSoundPlayer,
+                                    rViewContainer,
+                                    rScreenUpdater,
+                                    rEventMultiplexer ));
+                        else
+                            return NumberAnimationSharedPtr(
+                                new CutSlideChange(
+                                    leavingSlide,
+                                    pEnteringSlide,
+                                    rTransitionFadeColor,
+                                    pSoundPlayer,
+                                    rViewContainer,
+                                    rScreenUpdater,
+                                    rEventMultiplexer ));
                     }
                 }
             }
diff --git a/slideshow/source/engine/transitions/transitionfactorytab.cxx b/slideshow/source/engine/transitions/transitionfactorytab.cxx
index 0470fa5..052c0ab 100644
--- a/slideshow/source/engine/transitions/transitionfactorytab.cxx
+++ b/slideshow/source/engine/transitions/transitionfactorytab.cxx
@@ -2016,6 +2016,20 @@ static const TransitionInfo lcl_transitionInfo[] =
         true,                   // 'out' by parameter sweep inversion
         false                   // scale isotrophically to target size
     },
+    // this is the cut through black fade (does not fade, but does a
+    // hard cut)
+    {
+        animations::TransitionType::BARWIPE,
+        animations::TransitionSubType::FADEOVERCOLOR,
+        TransitionInfo::TRANSITION_SPECIAL,
+        // TODO(F2): Setup parameters
+        0.0,                    // no rotation
+        1.0,                    // no scaling
+        1.0,                    // no scaling
+        TransitionInfo::REVERSEMETHOD_IGNORE,
+        true,                   // 'out' by parameter sweep inversion
+        false                   // scale isotrophically to target size
+    },
     
     {
         // mapped to RandomWipe:
commit 94918552e55bd6b1df823d283f6e94f1312c6e62
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Tue Oct 26 15:49:05 2010 +0200

    Fix broken Impress document zoom behaviour
    
    As outlined in bugs n#380013 and i#88939, in certain cases Impress
    loads documents nastily offset to the top or left, instead of
    keeping it nicely centered.

diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx
old mode 100644
new mode 100755
index 14919da..921f928
--- a/sd/source/ui/inc/Window.hxx
+++ b/sd/source/ui/inc/Window.hxx
@@ -170,6 +170,7 @@ protected:
     Point maWinPos;
     Point maViewOrigin;
     Size maViewSize;
+    Size maPrevSize; // contains previous window size in logical coords
     USHORT mnMinZoom;
     USHORT mnMaxZoom;
     /** This flag tells whether to re-calculate the minimal zoom factor
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
old mode 100644
new mode 100755
index 8defa02..86d0bc1
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -73,6 +73,7 @@ Window::Window(::Window* pParent)
       maWinPos(0, 0),			// vorsichtshalber; die Werte sollten aber
       maViewOrigin(0, 0),		// vom Besitzer des Fensters neu gesetzt
       maViewSize(1000, 1000),	// werden
+      maPrevSize(-1,-1),
       mnMinZoom(MIN_ZOOM),
       mnMaxZoom(MAX_ZOOM),
       mbMinZoomAutoCalc(false),
@@ -472,6 +473,9 @@ long Window::SetZoomFactor(long nZoom)
     aMap.SetScaleY(Fraction(nZoom, 100));
     SetMapMode(aMap);
 
+    // invalidate previous size - it was relative to the old scaling
+    maPrevSize = Size(-1,-1);
+
     // Update the map mode's origin (to what effect?).
     UpdateMapOrigin();
 
@@ -668,11 +672,20 @@ void Window::SetMinZoomAutoCalc (bool bAuto)
 
 void Window::UpdateMapOrigin(BOOL bInvalidate)
 {
-    BOOL	bChanged = FALSE;
-    Size	aWinSize = PixelToLogic(GetOutputSizePixel());
+    BOOL	   bChanged = FALSE;
+    const Size aWinSize = PixelToLogic(GetOutputSizePixel());
 
     if ( mbCenterAllowed )
     {
+        if( maPrevSize != Size(-1,-1) )
+        {
+            // keep view centered around current pos, when window
+            // resizes
+            maWinPos.X() -= (aWinSize.Width() - maPrevSize.Width()) / 2;
+            maWinPos.Y() -= (aWinSize.Height() - maPrevSize.Height()) / 2;
+            bChanged = TRUE;
+        }
+
         if ( maWinPos.X() > maViewSize.Width() - aWinSize.Width() )
         {
             maWinPos.X() = maViewSize.Width() - aWinSize.Width();
@@ -697,6 +710,8 @@ void Window::UpdateMapOrigin(BOOL bInvalidate)
 
     UpdateMapMode ();
 
+    maPrevSize = aWinSize;
+
     if (bChanged && bInvalidate)
         Invalidate();
 }


More information about the Libreoffice-commits mailing list