diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-09-26 15:39:22 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-09-26 23:15:26 +0200 |
commit | 4d7725188a412d50a87f7d329776ee948b2d9051 (patch) | |
tree | 89966e3c01b2e99075640fde24f6afb737729467 /oox | |
parent | 49ddb653f1591881880a0331eca6d71ae17477bb (diff) |
tdf#112647: Fixed line spacing is saved incorrectly to PPTX
The values were not converted to the right unit. Also the
spcPts attribute means an exact value not a minimum one.
Reviewed-on: https://gerrit.libreoffice.org/42763
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit ef2e9b19a52e04ae0ed45900bcf64bf375a910ef)
Change-Id: Ia49683e66153611e96a830f821e3a2487adec505
Reviewed-on: https://gerrit.libreoffice.org/42812
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/drawingml/textspacing.hxx | 14 | ||||
-rw-r--r-- | oox/source/drawingml/textspacingcontext.cxx | 1 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 4 |
3 files changed, 12 insertions, 7 deletions
diff --git a/oox/inc/drawingml/textspacing.hxx b/oox/inc/drawingml/textspacing.hxx index efe0dab06674..e16bbe53d7e1 100644 --- a/oox/inc/drawingml/textspacing.hxx +++ b/oox/inc/drawingml/textspacing.hxx @@ -38,16 +38,19 @@ namespace oox { namespace drawingml { PERCENT }; TextSpacing() - : nUnit( POINTS ), nValue( 0 ), bHasValue( false ) + : nUnit( POINTS ), nValue( 0 ), bHasValue( false ), bExactValue( false ) { } - TextSpacing( sal_Int32 nPoints ) : nUnit( POINTS ), nValue( nPoints ), bHasValue( true ){}; + TextSpacing( sal_Int32 nPoints ) : nUnit( POINTS ), nValue( nPoints ), bHasValue( true ), bExactValue ( false ){}; css::style::LineSpacing toLineSpacing() const { css::style::LineSpacing aSpacing; - aSpacing.Mode = ( nUnit == PERCENT - ? css::style::LineSpacingMode::PROP - : css::style::LineSpacingMode::MINIMUM ); + if (nUnit == PERCENT) + aSpacing.Mode = css::style::LineSpacingMode::PROP; + else if (bExactValue) + aSpacing.Mode = css::style::LineSpacingMode::FIX; + else + aSpacing.Mode = css::style::LineSpacingMode::MINIMUM; aSpacing.Height = static_cast< sal_Int16 >( nUnit == PERCENT ? nValue / 1000 : nValue ); return aSpacing; } @@ -61,6 +64,7 @@ namespace oox { namespace drawingml { sal_Int32 nUnit; sal_Int32 nValue; bool bHasValue; + bool bExactValue; }; } } diff --git a/oox/source/drawingml/textspacingcontext.cxx b/oox/source/drawingml/textspacingcontext.cxx index fc6dfd813139..bf85fc3b11a6 100644 --- a/oox/source/drawingml/textspacingcontext.cxx +++ b/oox/source/drawingml/textspacingcontext.cxx @@ -49,6 +49,7 @@ namespace oox { namespace drawingml { case A_TOKEN( spcPts ): maSpacing.nUnit = TextSpacing::POINTS; maSpacing.nValue = GetTextSpacingPoint( rAttribs.getString( XML_val ).get() ); + maSpacing.bExactValue = true; break; default: break; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 2ae26e251d60..444f26b0405e 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2032,7 +2032,7 @@ const char* DrawingML::GetAlignment( sal_Int32 nAlignment ) return sAlignment; } -void DrawingML::WriteLinespacing( LineSpacing& rSpacing ) +void DrawingML::WriteLinespacing( const LineSpacing& rSpacing ) { if( rSpacing.Mode == LineSpacingMode::PROP ) { @@ -2043,7 +2043,7 @@ void DrawingML::WriteLinespacing( LineSpacing& rSpacing ) else { mpFS->singleElementNS( XML_a, XML_spcPts, - XML_val, I32S( rSpacing.Height ), + XML_val, I32S( std::lround(rSpacing.Height / 25.4 * 72) ), FSEND ); } } |