Kaydet (Commit) a4d2720e authored tarafından Mark Hung's avatar Mark Hung

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: 's avatarMark Hung <marklh9@gmail.com>
üst a014a9bc
...@@ -73,7 +73,7 @@ double GetPositiveFixedPercentage( const OUString& sValue ) ...@@ -73,7 +73,7 @@ double GetPositiveFixedPercentage( const OUString& sValue )
/** converts the attributes from an CT_TLPoint into an awt Point with 1/1000% */ /** converts the attributes from an CT_TLPoint into an awt Point with 1/1000% */
awt::Point GetPointPercent( const Reference< XFastAttributeList >& xAttribs ) 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 */ /** converts the ST_TextFontSize to point */
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <com/sun/star/animations/AnimationCalcMode.hpp> #include <com/sun/star/animations/AnimationCalcMode.hpp>
#include <com/sun/star/animations/AnimationColorSpace.hpp> #include <com/sun/star/animations/AnimationColorSpace.hpp>
#include <com/sun/star/animations/AnimationNodeType.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/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/presentation/EffectCommands.hpp> #include <com/sun/star/presentation/EffectCommands.hpp>
#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/NamedValue.hpp>
...@@ -82,6 +83,15 @@ namespace { ...@@ -82,6 +83,15 @@ namespace {
// only get first token. // only get first token.
return oox::ppt::convertAnimationValue(getAttributeEnumByAPIName(aNameList.getToken(0, ';')), rAny); 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 { namespace oox { namespace ppt {
...@@ -651,25 +661,19 @@ namespace oox { namespace ppt { ...@@ -651,25 +661,19 @@ namespace oox { namespace ppt {
case PPT_TOKEN( to ): case PPT_TOKEN( to ):
{ {
// CT_TLPoint // CT_TLPoint
awt::Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maTo = convertPointPercent(GetPointPercent(rAttribs.getFastAttributeList()));
maTo <<= p.X;
maTo <<= p.Y;
return this; return this;
} }
case PPT_TOKEN( from ): case PPT_TOKEN( from ):
{ {
// CT_TLPoint // CT_TLPoint
awt::Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maFrom = convertPointPercent(GetPointPercent(rAttribs.getFastAttributeList()));
maFrom <<= p.X;
maFrom <<= p.Y;
return this; return this;
} }
case PPT_TOKEN( by ): case PPT_TOKEN( by ):
{ {
// CT_TLPoint // CT_TLPoint
awt::Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maBy = convertPointPercent(GetPointPercent(rAttribs.getFastAttributeList()));
maBy <<= p.X;
maBy <<= p.Y;
return this; return this;
} }
default: default:
......
...@@ -93,6 +93,7 @@ public: ...@@ -93,6 +93,7 @@ public:
void testTransparentBackground(); void testTransparentBackground();
void testEmbeddedPdf(); void testEmbeddedPdf();
void testEmbeddedText(); void testEmbeddedText();
void testTdf98477();
void testAuthorField(); void testAuthorField();
void testTdf100926(); void testTdf100926();
void testPageWithTransparentBackground(); void testPageWithTransparentBackground();
...@@ -118,6 +119,7 @@ public: ...@@ -118,6 +119,7 @@ public:
CPPUNIT_TEST(testTransparentBackground); CPPUNIT_TEST(testTransparentBackground);
CPPUNIT_TEST(testEmbeddedPdf); CPPUNIT_TEST(testEmbeddedPdf);
CPPUNIT_TEST(testEmbeddedText); CPPUNIT_TEST(testEmbeddedText);
CPPUNIT_TEST(testTdf98477);
CPPUNIT_TEST(testAuthorField); CPPUNIT_TEST(testAuthorField);
CPPUNIT_TEST(testTdf100926); CPPUNIT_TEST(testTdf100926);
CPPUNIT_TEST(testPageWithTransparentBackground); CPPUNIT_TEST(testPageWithTransparentBackground);
...@@ -847,6 +849,18 @@ void SdExportTest::testEmbeddedText() ...@@ -847,6 +849,18 @@ void SdExportTest::testEmbeddedText()
xShell->DoClose(); 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() void SdExportTest::testAuthorField()
{ {
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), ODP); ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), ODP);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment