summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2018-07-14 19:47:36 +0800
committerMark Hung <marklh9@gmail.com>2018-07-19 07:38:02 +0200
commita4d2720ebdc6cdd700ca2cfa0d8e2db22a17e4c2 (patch)
tree22de50ad95891c5cce91bf4e5b8105b8996bba65 /oox
parenta014a9bcf071229eef93c307c705a4c639635bd5 (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>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/drawingmltypes.cxx2
-rw-r--r--oox/source/ppt/timenodelistcontext.cxx22
2 files changed, 14 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: