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

Marco Cecchetti marco.cecchetti at collabora.com
Sat Dec 19 08:39:04 PST 2015


 filter/source/svg/presentation_engine.js |   26 +++++++++++++++++++++++---
 filter/source/svg/svgexport.cxx          |   16 ++++++++++++++++
 2 files changed, 39 insertions(+), 3 deletions(-)

New commits:
commit 3fd725f8c48152a623f6c37ba430dd8f49f55e90
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Fri Dec 18 21:55:31 2015 +0100

    svg export: borders of leaving slide are not covered by the entering one
    
    Change-Id: Ib467c062e68fa8fe2a104daff399407aefffbb3f
    Reviewed-on: https://gerrit.libreoffice.org/20807
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 83b979f..66509c6 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -735,6 +735,7 @@ var aOOOElemMetaSlides = 'ooo:meta_slides';
 var aOOOElemMetaSlide = 'ooo:meta_slide';
 var aOOOElemTextField = 'ooo:text_field';
 var aPresentationClipPathId = 'presentation_clip_path';
+var aPresentationClipPathShrinkId = 'presentation_clip_path_shrink';
 
 // ooo attributes
 var aOOOAttrNumberOfSlides = 'number-of-slides';
@@ -1948,8 +1949,12 @@ MasterPageView.prototype.createElement = function()
     // that is also a workaround for some kind of slide transition
     // when the master page is empty
     var aWhiteRect = theDocument.createElementNS( NSS['svg'], 'rect' );
-    aWhiteRect.setAttribute( 'width', String( WIDTH ) );
-    aWhiteRect.setAttribute( 'height', String( HEIGHT) );
+    var nWidthExt = WIDTH / 1000;
+    var nHeightExt = HEIGHT / 1000;
+    aWhiteRect.setAttribute( 'x', String( -nWidthExt / 2 ) );
+    aWhiteRect.setAttribute( 'y', String( -nHeightExt / 2 ) );
+    aWhiteRect.setAttribute( 'width', String( WIDTH + nWidthExt ) );
+    aWhiteRect.setAttribute( 'height', String( HEIGHT + nHeightExt ) );
     aWhiteRect.setAttribute( 'fill', '#FFFFFF' );
     aMasterPageViewElement.appendChild( aWhiteRect );
 
@@ -12413,7 +12418,16 @@ SlideShow.prototype.notifySlideStart = function( nNewSlideIndex, nOldSlideIndex
 
 SlideShow.prototype.notifyTransitionEnd = function( nSlideIndex )
 {
-    theMetaDoc.setCurrentSlide( nSlideIndex );
+    // reset the presentation clip path on the leaving slide
+    // to the standard one when transition ends
+    if( theMetaDoc.getCurrentSlide() )
+    {
+        var sRef = 'url(#' + aPresentationClipPathId + ')';
+        theMetaDoc.getCurrentSlide().slideElement.setAttribute('clip-path', sRef);
+    }
+
+    theMetaDoc.setCurrentSlide(nSlideIndex);
+
     if( this.aSlideViewElement )
     {
         theMetaDoc.getCurrentSlide().aVisibilityStatusElement.parentNode.removeChild( this.aSlideViewElement );
@@ -12790,6 +12804,11 @@ SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition )
             var aSlideTransitionHandler = aNewMetaSlide.aTransitionHandler;
             if( aSlideTransitionHandler && aSlideTransitionHandler.isValid() )
             {
+                // clipPath element used for the leaving slide in order
+                // to avoid that slide borders are visible during transition
+                var sRef = 'url(#' + aPresentationClipPathShrinkId + ')';
+                aOldMetaSlide.slideElement.setAttribute( 'clip-path', sRef );
+
                 // when we switch from the last to the first slide we need to hide the last slide
                 // or nobody will see the transition, hence we create a view of the last slide and
                 // we place it before the first slide
@@ -12800,6 +12819,7 @@ SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition )
                     aNewMetaSlide.aVisibilityStatusElement.parentNode.insertBefore( this.aSlideViewElement, aNewMetaSlide.aVisibilityStatusElement );
                     aOldMetaSlide.hide();
                 }
+
                 var aLeavingSlide = aOldMetaSlide;
                 var aEnteringSlide = aNewMetaSlide;
                 var aTransitionEndEvent = makeEvent( bind2( this.notifyTransitionEnd, this, nNewSlide ) );
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index d55e3c4..1adec14 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -847,6 +847,22 @@ bool SVGFilter::implExportDocument()
                 SvXMLElementExport aRectElem( *mpSVGExport, XML_NAMESPACE_NONE, "rect", true, true );
             }
         }
+        // Create a ClipPath element applied to the leaving slide in order
+        // to avoid that slide borders are visible during transition
+        {
+            mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "presentation_clip_path_shrink" );
+            mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clipPathUnits", "userSpaceOnUse" );
+            SvXMLElementExport aClipPathElem( *mpSVGExport, XML_NAMESPACE_NONE, "clipPath", true, true );
+            {
+                sal_Int32 nDocWidthExt = nDocWidth / 500;
+                sal_Int32 nDocHeightExt = nDocHeight / 500;
+                mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "x", OUString::number( nDocX + nDocWidthExt / 2 ) );
+                mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "y", OUString::number( nDocY + nDocHeightExt / 2) );
+                mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", OUString::number( nDocWidth - nDocWidthExt ) );
+                mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "height", OUString::number( nDocHeight - nDocHeightExt ) );
+                SvXMLElementExport aRectElem( *mpSVGExport, XML_NAMESPACE_NONE, "rect", true, true );
+            }
+        }
     }
 
     if( implLookForFirstVisiblePage() )  // OK! We found at least one visible page.


More information about the Libreoffice-commits mailing list