diff options
author | Mark Hung <marklh9@gmail.com> | 2018-07-14 19:47:36 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2018-07-19 07:38:02 +0200 |
commit | a4d2720ebdc6cdd700ca2cfa0d8e2db22a17e4c2 (patch) | |
tree | 22de50ad95891c5cce91bf4e5b8105b8996bba65 | |
parent | a014a9bcf071229eef93c307c705a4c639635bd5 (diff) |
tdf#98477 convert to, from, by of AnimScaleContext.
To, from, by of AimScaleContext used to use return value
of oox::draingml::GetPointPercent(), which is in 1000th of
a percent, but slideshow need ratio to work.
Make a conversion here, also fix the obvious error in
oox::draingml::GetPointPercent() that y coordinate is always
converted incorrectly.
Change-Id: I061d2ce89341a4e88f3ffada03954734fafad985
Reviewed-on: https://gerrit.libreoffice.org/57434
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
-rw-r--r-- | oox/source/drawingml/drawingmltypes.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/timenodelistcontext.cxx | 22 | ||||
-rwxr-xr-x | sd/qa/unit/data/pptx/tdf98477grow.pptx | bin | 0 -> 30023 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 14 |
4 files changed, 28 insertions, 10 deletions
diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index 93c7c423330f..41b659082f77 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -73,7 +73,7 @@ double GetPositiveFixedPercentage( const OUString& sValue ) /** converts the attributes from an CT_TLPoint into an awt Point with 1/1000% */ awt::Point GetPointPercent( const Reference< XFastAttributeList >& xAttribs ) { - return awt::Point( GetPercent( xAttribs->getOptionalValue( XML_x ) ), GetCoordinate( xAttribs->getOptionalValue( XML_y ) ) ); + return awt::Point(GetPercent(xAttribs->getOptionalValue(XML_x)), GetPercent(xAttribs->getOptionalValue(XML_y))); } /** converts the ST_TextFontSize to point */ diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index 625036a25a2f..ec720520e54c 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/animations/AnimationCalcMode.hpp> #include <com/sun/star/animations/AnimationColorSpace.hpp> #include <com/sun/star/animations/AnimationNodeType.hpp> +#include <com/sun/star/animations/ValuePair.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/presentation/EffectCommands.hpp> #include <com/sun/star/beans/NamedValue.hpp> @@ -82,6 +83,15 @@ namespace { // only get first token. return oox::ppt::convertAnimationValue(getAttributeEnumByAPIName(aNameList.getToken(0, ';')), rAny); } + + css::uno::Any convertPointPercent(const css::awt::Point& rPoint) + { + css::animations::ValuePair aPair; + // rPoint.X and rPoint.Y are in 1000th of a percent, but we only need ratio. + aPair.First <<= static_cast<double>(rPoint.X) / 100000.0; + aPair.Second <<= static_cast<double>(rPoint.Y) / 100000.0; + return makeAny(aPair); + } } namespace oox { namespace ppt { @@ -651,25 +661,19 @@ namespace oox { namespace ppt { case PPT_TOKEN( to ): { // CT_TLPoint - awt::Point p = GetPointPercent( rAttribs.getFastAttributeList() ); - maTo <<= p.X; - maTo <<= p.Y; + maTo = convertPointPercent(GetPointPercent(rAttribs.getFastAttributeList())); return this; } case PPT_TOKEN( from ): { // CT_TLPoint - awt::Point p = GetPointPercent( rAttribs.getFastAttributeList() ); - maFrom <<= p.X; - maFrom <<= p.Y; + maFrom = convertPointPercent(GetPointPercent(rAttribs.getFastAttributeList())); return this; } case PPT_TOKEN( by ): { // CT_TLPoint - awt::Point p = GetPointPercent( rAttribs.getFastAttributeList() ); - maBy <<= p.X; - maBy <<= p.Y; + maBy = convertPointPercent(GetPointPercent(rAttribs.getFastAttributeList())); return this; } default: diff --git a/sd/qa/unit/data/pptx/tdf98477grow.pptx b/sd/qa/unit/data/pptx/tdf98477grow.pptx Binary files differnew file mode 100755 index 000000000000..5761c7b07911 --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf98477grow.pptx diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 7ac6fc01404d..1eb9be7404c3 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -93,6 +93,7 @@ public: void testTransparentBackground(); void testEmbeddedPdf(); void testEmbeddedText(); + void testTdf98477(); void testAuthorField(); void testTdf100926(); void testPageWithTransparentBackground(); @@ -118,6 +119,7 @@ public: CPPUNIT_TEST(testTransparentBackground); CPPUNIT_TEST(testEmbeddedPdf); CPPUNIT_TEST(testEmbeddedText); + CPPUNIT_TEST(testTdf98477); CPPUNIT_TEST(testAuthorField); CPPUNIT_TEST(testTdf100926); CPPUNIT_TEST(testPageWithTransparentBackground); @@ -847,6 +849,18 @@ void SdExportTest::testEmbeddedText() xShell->DoClose(); } +void SdExportTest::testTdf98477() +{ + utl::TempFile tempFile; + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf98477grow.pptx"), PPTX); + + xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); + + xmlDocPtr pXmlDoc = parseExport(tempFile, "content.xml"); + assertXPath(pXmlDoc, "//anim:animateTransform", "by", "1.5,1.5"); + xDocShRef->DoClose(); +} + void SdExportTest::testAuthorField() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), ODP); |