summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-18 17:53:33 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-09-21 23:49:52 +0200
commit55505edc8eca0e4ba30f192e81ff18982b8e2f95 (patch)
tree7c3fa5aa0dedb3a92b7abe8611092fe1a08d2f6e /oox
parent38e0b926203262d90e4ec9b33860416b4074ba63 (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. (cherry picked from commit 10bb02efd8afd42e633e370480104e2575546d8e) Change-Id: I81a7b3e8c76bfbce5c5569d16d5238958ac20f75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103088 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103110
Diffstat (limited to 'oox')
-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 cce8b9ba7bbc..31ea0c696281 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -214,7 +214,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 d696b4c3ac70..af02c6f981d8 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -123,6 +123,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