[Libreoffice-commits] core.git: filter/source sd/qa
Marco Cecchetti
marco.cecchetti at collabora.com
Thu Dec 10 01:57:27 PST 2015
filter/source/svg/presentation_engine.js | 28 ++++++++++++---
filter/source/svg/svgexport.cxx | 55 +++++++++++++++++++++++++++++++
sd/qa/unit/SVGExportTests.cxx | 20 +++++------
3 files changed, 88 insertions(+), 15 deletions(-)
New commits:
commit b8d86c976c2356bb3c63830ffed204a397ffd0ae
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Wed Dec 9 21:50:39 2015 +0100
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 at libreoffice.org>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 569a562..c1cc82b 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 ce31b26..21a9b83 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 );
diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx
index 5fa19a9..cd4259c 100644
--- a/sd/qa/unit/SVGExportTests.cxx
+++ b/sd/qa/unit/SVGExportTests.cxx
@@ -99,16 +99,16 @@ public:
svgDoc->name = reinterpret_cast<char *>(xmlStrdup(reinterpret_cast<xmlChar const *>(OUStringToOString(maTempFile.GetURL(), RTL_TEXTENCODING_UTF8).getStr())));
assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG ), 1);
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1] ), "class", "SlideGroup");
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1]/SVG_G/SVG_G ), "class", "Slide");
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_G[1] ), "class", "TitleText");
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT ), "class", "TextShape");
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT/SVG_TSPAN ), "class", "TextParagraph");
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT/SVG_TSPAN ), "text-decoration", "underline");
-
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT ), "class", "TextShape");
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT/SVG_TSPAN ), "class", "TextParagraph");
- assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[1]/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT/SVG_TSPAN ), "text-decoration", "line-through");
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2] ), "class", "SlideGroup");
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G ), "class", "Slide");
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G[1] ), "class", "TitleText");
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT ), "class", "TextShape");
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT/SVG_TSPAN ), "class", "TextParagraph");
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G[1]/SVG_G/SVG_TEXT/SVG_TSPAN ), "text-decoration", "underline");
+
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT ), "class", "TextShape");
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT/SVG_TSPAN ), "class", "TextParagraph");
+ assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT/SVG_TSPAN ), "text-decoration", "line-through");
}
CPPUNIT_TEST_SUITE(SdSVGFilterTest);
More information about the Libreoffice-commits
mailing list