Bug 51358 - SVG: Add support for more slide transitions to svg documents exported by Impress
Summary: SVG: Add support for more slide transitions to svg documents exported by Impress
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
4.0.0.0.alpha0+ Master
Hardware: Other All
: medium normal
Assignee: Rohan Kumar
URL:
Whiteboard: target:5.4.0
Keywords: difficultyBeginner, easyHack, skillCpp, skillJavaScript
Depends on:
Blocks:
 
Reported: 2012-06-23 05:08 UTC by Marco Cecchetti
Modified: 2017-05-20 11:12 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Support for the checkerboard transition effect (464.02 KB, image/svg+xml)
2012-07-20 18:42 UTC, Horacio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Cecchetti 2012-06-23 05:08:55 UTC
In order to add a slide transition you need to work with the JavaScript presentation engine:
http://cgit.freedesktop.org/libreoffice/core/tree/filter/source/svg/presentation_engine.js
Don't be scared by the fact the file is really large you need to work only on small portions of it.
We use the barWipe slide transition for illustrating the steps to follows for adding a slide transition:

1) Choose the slide transition from here: http://cgit.freedesktop.org/libreoffice/core/tree/sd/xml/transitions.xml
For a visual description of the effect go here: http://www.w3.org/TR/2005/REC-SMIL2-20050107/smil-transitions.html#TransitionEffects-Appendix

2) For a list of transition type constant look at:
http://cgit.freedesktop.org/libreoffice/core/tree/offapi/com/sun/star/animations/TransitionType.idl.
For a list of transition subtype constant look at:
http://cgit.freedesktop.org/libreoffice/core/tree/offapi/com/sun/star/animations/TransitionSubType.idl.

If not present add the constants related to the transition you want to implement to the JavaScript engine: search for the BARWIPE_TRANSITION constant in the JavaScript file, the list of transition types is there; then search for DEFAULT_TRANS_SUBTYPE constant the list of transition subtypes is there.
Near to some type or subtype constant you can see a number commented out that number is the value of the constant in the C++ file, please keep such constants in the correct order.
You need to update aTransitionTypeInMap, aTransitionTypeOutMap,  aTransitionSubtypeInMap and aTransitionSubtypeOutMap accordingly.


3) You can get the transition parameters to be used here:
http://cgit.freedesktop.org/libreoffice/core/tree/slideshow/source/engine/transitions/transitionfactorytab.cxx
For the BARWIPE transition type with subtype LEFTTORIGHT we have:

    {
        // mapped to BarWipePolyPolygon:
        animations::TransitionType::BARWIPE,
        animations::TransitionSubType::LEFTTORIGHT, // (1)
        TransitionInfo::TRANSITION_CLIP_POLYPOLYGON,
        0.0, // no rotation
        1.0, // no scaling
        1.0, // no scaling
        TransitionInfo::REVERSEMETHOD_FLIP_X,
        false, // 'out' by subtraction
        false // scale isotrophically to target size
    },

You need to port such transition info to the JavaScript engine: search for aTransitionInfoTable, and create the correct info entry for your transition effect. For the barWipe transition effect we have:

aTransitionInfoTable[BARWIPE_TRANSITION][LEFTTORIGHT_TRANS_SUBTYPE] =
{
    'class' : TRANSITION_CLIP_POLYPOLYGON,
    'rotationAngle' : 0.0,
    'scaleX' : 1.0,
    'scaleY' : 1.0,
    'reverseMethod' : REVERSEMETHOD_FLIP_X,
    'outInvertsSweep' : false,
    'scaleIsotropically' : false
};

Note that there is no need to port the first two info entries (type and subtype).

4) Now we need to modify the createClipPolyPolygon method. First off look at the C++ implementation here: http://cgit.freedesktop.org/libreoffice/core/tree/slideshow/source/engine/transitions/parametricpolypolygonfactory.cxx. Then search for the JavaScript createClipPolyPolygon function: you will find the lines:

        case BARWIPE_TRANSITION:
            return new BarWipePath( 1 );

For the transition effect you want to implement you need to add the related "case" for the transition type and if it is needed also for the transition subtype (look at the pinWheelWipe transition case).
Now the final implementation step.

5) Create the class that implements the transition effect you have chosen.
Transition effect classes can be found here: http://cgit.freedesktop.org/libreoffice/core/tree/slideshow/source/engine/transitions.
For instance barwipepolypolygon.hpp and barwipepolypolygon.cxx implements the barWipe effect.
You need to port the class related to the transition effect you want to implement to JavaScript.
For the barWipe effect the JavaScript class is named BarWipePath.
In order to create or precompute the initial base path you can utilize helper functions such as PathTools.normalizePath and PathTools.createPathFromEllipse, give a glance to the EllipseWipePath class.
You can read more on how slide and shape transition has been ported/implemented here: https://docs.google.com/document/d/1GSLPSIWRGSDTSi69dT9Te8tRyTJcAekxT7scoCoGO2M/edit?pli=1#heading=h.zak45bwtec07.

6) Now you need to create a presentation with Impress that utilizes the transition effect you have ported. Please be sure that the presentation has at least 2 slides or the JavaScript engine will not be embedded into the exported svg document. Open the exported svg document with a browser and look how it works. Maybe you'll need to install some debug tool. For instance for Firefox there is the Firebug extension.
For a working example you can look at: http://users.freedesktop.org/~thorsten/gsoc-2012/slide_transitions-week3/
Comment 1 Horacio 2012-07-20 18:42:16 UTC
Created attachment 64462 [details]
Support for the checkerboard transition effect

The checkerboard transition effect was implemented following the steps in this easyhack. Check the attachment for the effect. The code can be viewed at
http://cgit.freedesktop.org/libreoffice/core/commit/?id=6ee666c53da83982784ea59894479a8b93c8ecd7
Comment 2 Björn Michaelsen 2013-10-04 18:47:59 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 3 Robinson Tryon (qubit) 2013-10-19 00:58:42 UTC Comment hidden (obsolete)
Comment 4 Robinson Tryon (qubit) 2015-12-13 10:12:12 UTC Comment hidden (obsolete)
Comment 5 Björn Michaelsen 2016-02-03 17:57:27 UTC
Possible dupes? Please clarify bug 51358 vs. 51357.
Comment 6 Marco Cecchetti 2016-02-03 19:51:15 UTC
Oh well, indeed I don't remember the reason for opening 2 bugs. Maybe because of some different referenced file.

When one implements a new transition effect by following the illustrated steps, he *should* get the new effect working for both shapes and slides. However some small differences could still occur.
Comment 7 Robinson Tryon (qubit) 2016-02-18 14:51:58 UTC Comment hidden (obsolete)
Comment 8 jani 2016-04-18 07:30:05 UTC
A polite ping, still working on this issue?
Comment 9 jani 2016-05-26 09:04:24 UTC
Unassign due to lack of work
Comment 10 Commit Notification 2017-01-09 08:21:06 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4a1d52e7e434269e1331e6fdd6c24d45703a9711

tdf#51358 Support for IrisWipe transition animation in SVG Export

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 jani 2017-01-11 07:15:09 UTC
are there more work on this bug ?
Comment 12 Commit Notification 2017-01-23 11:43:47 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3ce861adbe4e6f04d9d322e649fccd6cfcbd088f

tdf#51358 Support for BoxWipe transition in SVG Export

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 jani 2017-01-25 07:22:44 UTC
seems solved, if not please specify what is missing.
Comment 14 Commit Notification 2017-01-28 06:17:42 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6e901f86511bd773c1b80f5aebe435f29527e118

tdf#51358 Support for SnakeWipe transition animation in SVG support

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Rohan Kumar 2017-01-30 19:06:20 UTC
Hi Jan,

According to me, this bug is not resolved yet. At present, these transitions still need to be ported to the svg engine :

BarnDoorWipe, BarWipePolyPolygon, ClockWipe, DoubleDiamondWipe, FanWipe, FigureWipe, SpiralWipe, SweepWipe, WaterfallWipe, ZigZagWipe.
Comment 16 Commit Notification 2017-03-06 14:58:52 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b5b6317e4e35a2a1a81c90dda6e6e4e5457471ee

tdf#51358 Support for VeeWipe transition in SVG Support

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Commit Notification 2017-03-06 15:00:52 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=74b54e33135bb99513142e671369e4f3f6370d55

tdf#51358 Importing ClockWipe in SVG engine

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2017-03-07 02:54:28 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=dd83aa90677cab526b4ea38caaeb6e0961c1a0be

tdf#51358 Support for BarnDoorWipe transition animation in SVG support

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Johnny_M 2017-03-19 20:22:10 UTC
Reopening per comment 15 and commits pending approval: https://gerrit.libreoffice.org/#/q/owner:%22Rohan+Kumar%22+status:open

@Rohan: Please close as fixed when work is finished. Thanks for working on this!
Comment 20 Commit Notification 2017-04-06 23:07:12 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7a64ad57036234c90dda0ba1fefdf8867114305e

tdf#51358 Support for ZigZag-Wipe transition animation in SVG support

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Commit Notification 2017-04-06 23:17:51 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=616efc4a11481ecafe40ca1de3ef93841c11dc9a

tdf#51358 Add Support for FanWipe class

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Commit Notification 2017-04-06 23:37:03 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6c7a2c9570e6a3fe3cc4b14f8831d934e458be01

tdf#51358 Support for SweepWipe transition in SVG Export

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Commit Notification 2017-04-06 23:42:19 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=709f49bce86d2df4154d8075818f57cacfecb401

tdf#51358 Add Support for more slide transitions to Impress SVG Export

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 24 Michael Meeks 2017-04-07 08:53:34 UTC
Nice work Rohan / Thorsten ! =)
Comment 25 Commit Notification 2017-04-17 00:39:16 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=dc5253d97c6e733746943fae462600f07772d35b

tdf#51358 Add support for SpiralWipe transition in svg export

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 26 Commit Notification 2017-04-17 00:42:02 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0badc8447f3c608a8807df511f78799f827ccd2b

tdf#51358 Added Support for DoubleDiamondWipePath in Impress SVG Export

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 27 Commit Notification 2017-04-17 00:44:52 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=dd239283664e79337d385a63a18eb676d8688314

tdf#51358 Add Support for ParallelSnakesWipe transition in SVG Export

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 28 Commit Notification 2017-05-01 12:28:38 UTC
Rohan Kumar committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=10589bf9275f7853773203954a3d747a6d9bd6d0

tdf#51358 Add Support for BoxSnakesWipePath transition in SVG Export

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 29 Rohan Kumar 2017-05-20 06:16:34 UTC
Marco/Thorsten : Should we mark this as RESOLVED/FIXED ? Please specify if i have missed something