summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-18 17:53:33 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-18 20:12:00 +0200
commit10bb02efd8afd42e633e370480104e2575546d8e (patch)
tree5e95cb9f12cd64a48b99325938e05e58cdb06bbe /oox/source
parentcb15d181b6446003ddc5a13eff9dfb14fc5a8179 (diff)
tdf#129685 PPTX import: fix unexpected centering of shape text
Regression from commit 89f0af144c18efafe2573801641689a1432c0cae (tdf#113198 set default shape paragraph alignment.., 2019-11-19), the old bugdoc had this markup: <a:bodyPr ... anchor="ctr"/> (centered) The new bugdoc has 2 shapes with text: <a:bodyPr .../> (aligned to left) <a:bodyPr ... anchorCtr="1"/> (should be centered) "anchor" is about vertical, "anchorCtr" is about horizontal centering of text. Checking what the binary filter does, it maps horizontal centering to TextHorizontalAdjust, so fix the original bug differently, by leaving ParaAdjust alone, and tweaking TextHorizontalAdjust intead: this keeps the old bugdoc working but fixes the new one. This caused a number of "change detector" XML-based tests to fail: all of them are unchanged visually, so the XML files are adapted to the new state. The tdf#113198 fix itself was fixing a regression from tdf#104722, and that commit had no testcase, I tested that we don't regress there, manually. Change-Id: I81a7b3e8c76bfbce5c5569d16d5238958ac20f75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103012 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/drawingml/shape.cxx3
-rw-r--r--oox/source/drawingml/textbodypropertiescontext.cxx5
2 files changed, 7 insertions, 1 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 99fa848741b3..90d9e5379dde 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -210,7 +210,8 @@ void Shape::setDefaults(bool bHeight)
if (bHeight)
maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< float >( 18.0 ));
maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, TextVerticalAdjust_TOP);
- maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< sal_Int16 >( ParagraphAdjust_CENTER ));
+ maDefaultShapeProperties.setProperty(PROP_ParaAdjust,
+ static_cast<sal_Int16>(ParagraphAdjust_LEFT));
}
::oox::vml::OleObjectInfo& Shape::setOleObjectType()
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index c70b50273b2f..b72fa194401a 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -116,6 +116,11 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons
{
mrTextBodyProp.meVA = GetTextVerticalAdjust( rAttribs.getToken( XML_anchor, XML_t ) );
mrTextBodyProp.maPropertyMap.setProperty( PROP_TextVerticalAdjust, mrTextBodyProp.meVA);
+ if (mrTextBodyProp.meVA == drawing::TextVerticalAdjust_CENTER)
+ {
+ mrTextBodyProp.maPropertyMap.setProperty(PROP_TextHorizontalAdjust,
+ TextHorizontalAdjust_CENTER);
+ }
}
// Push defaults