diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2015-12-09 21:50:39 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-12-10 09:57:01 +0000 |
commit | b8d86c976c2356bb3c63830ffed204a397ffd0ae (patch) | |
tree | 5872c7483a139d4f277e35e6b88acd1136627adc /filter | |
parent | 0c876483d278e3e5ba43e9eaf40ca713b6099703 (diff) |
svg export: transition on first slide are not run - fixed
A dummy slide has been added to be used as leaving slide for transition
on first slide.
SVGExportTextDecorations unit test - fixed wrong XPath.
The new dummy slide group element caused the xpath to the slide
group to be wrong.
Change-Id: I6c1a0a80f71a79668c309bc0bcb3d5e588ef3a39
Reviewed-on: https://gerrit.libreoffice.org/20560
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/svg/presentation_engine.js | 28 | ||||
-rw-r--r-- | filter/source/svg/svgexport.cxx | 55 |
2 files changed, 78 insertions, 5 deletions
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js index 569a562c94f8..c1cc82b41458 100644 --- a/filter/source/svg/presentation_engine.js +++ b/filter/source/svg/presentation_engine.js @@ -1215,6 +1215,9 @@ function MetaDocument() this.aSlideAnimationsMap = new Object(); this.initSlideAnimationsMap(); + // We initialize dummy slide - used as leaving slide for transition on the first slide + this.theMetaDummySlide = new MetaSlide( 'ooo:meta_dummy_slide', this ); + // We initialize the set of MetaSlide objects that handle the meta // information for each slide. for( var i = 0; i < this.nNumberOfSlides; ++i ) @@ -1316,7 +1319,11 @@ function MetaSlide( sMetaSlideId, aMetaDoc ) this.slideElement = this.theDocument.getElementById( this.slideId ); assert( this.slideElement, 'MetaSlide: slide element <' + this.slideId + '> not found.' ); - this.nSlideNumber = parseInt( this.slideId.substr(2) ); + + if( this.slideId !== 'dummy_slide' ) + this.nSlideNumber = parseInt( this.slideId.substr(2) ); + else + this.nSlideNumber= -1; // Each slide element is wrapped by a <g> element that is responsible for // the slide element visibility. In fact the visibility attribute has @@ -12588,11 +12595,22 @@ SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition ) if( this.isEnabled() && !bSkipSlideTransition ) { // create slide transition and add to activity queue - if ( ( nOldSlide !== undefined ) && - ( ( nNewSlide > nOldSlide ) || - ( ( nNewSlide == 0) && ( nOldSlide == (aMetaDoc.nNumberOfSlides - 1) ) ) ) ) + if ( ( ( nOldSlide !== undefined ) && + ( ( nNewSlide > nOldSlide ) || + ( ( nNewSlide == 0) && ( nOldSlide == (aMetaDoc.nNumberOfSlides - 1) ) ) ) ) || + ( ( nOldSlide === undefined ) && ( nNewSlide == 0) ) // for transition on first slide + ) { - var aOldMetaSlide = aMetaDoc.aMetaSlideSet[nOldSlide]; + + var aOldMetaSlide = null; + if( nOldSlide === undefined ) // for transition on first slide + { + aOldMetaSlide = aMetaDoc.theMetaDummySlide; + } + else + { + aOldMetaSlide = aMetaDoc.aMetaSlideSet[nOldSlide]; + } var aNewMetaSlide = aMetaDoc.aMetaSlideSet[nNewSlide]; var aSlideTransitionHandler = aNewMetaSlide.aTransitionHandler; diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index ce31b26432cb..21a9b839fe3c 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -1010,6 +1010,18 @@ bool SVGFilter::implGenerateMetaData() const OUString aElemTextFieldId( aOOOElemTextField ); std::vector< TextField* > aFieldSet; + // dummy slide - used as leaving slide for transition on the first slide + if( mbPresentation ) + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", NSPREFIX "meta_dummy_slide" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, "dummy-slide" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMaster, "dummy-master-page" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrBackgroundVisibility, "hidden" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMasterObjectsVisibility, "hidden" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrHasTransition, "false" ); + SvXMLElementExport aMetaDummySlideElem( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); + } + for( sal_Int32 i = 0; i < nCount; ++i ) { const Reference< XDrawPage > & xDrawPage = mSelectedPages[i]; @@ -1487,6 +1499,27 @@ bool SVGFilter::implExportMasterPages( const std::vector< Reference< XDrawPage > OUString aContainerTag = (!mbPresentation) ? OUString( "g" ) : OUString( "defs" ); SvXMLElementExport aContainerElement( *mpSVGExport, XML_NAMESPACE_NONE, aContainerTag, true, true ); + // dummy slide - used as leaving slide for transition on the first slide + if( mbPresentation ) + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "dummy-master-page" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrName, "dummy-master-page" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "Master_Slide" ); + SvXMLElementExport aMasterSlideElem( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "bg-dummy-master-page" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "Background" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" ); + SvXMLElementExport aBackgroundElem( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); + } + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "bo-dummy-master-page" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "BackgroundObjects" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", "hidden" ); + SvXMLElementExport aBackgroundObjectElem( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); + } + } + bool bRet = false; for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i ) { @@ -1515,6 +1548,28 @@ bool SVGFilter::implExportDrawPages( const SVGFilter::XDrawPageSequence & rxPage DBG_ASSERT( nFirstPage <= nLastPage, "SVGFilter::implExportDrawPages: nFirstPage > nLastPage" ); + // dummy slide - used as leaving slide for transition on the first slide + if( mbPresentation ) + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "DummySlide" ); + SvXMLElementExport aDummySlideElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); + { + SvXMLElementExport aGElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "dummy-slide" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "Slide" ); + OUString sClipPathAttrValue = "url(#" + msClipPathId + ")"; + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clip-path", sClipPathAttrValue ); + SvXMLElementExport aSlideElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrName, "dummy-page" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "Page" ); + SvXMLElementExport aPageElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); + } + } + } + } + // We wrap all slide in a group element with class name "SlideGroup". mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "SlideGroup" ); SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", true, true ); |