diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-10-05 21:06:01 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-10-06 19:15:42 +0200 |
commit | bcfe68c96893c39b07c15efd99cd010d6736f560 (patch) | |
tree | 8ce65befd1a99f54ff47996716af5af99e5ed788 /oox | |
parent | fa85f4c9dfdef681dbbcb56845b0c19c6ef1ff52 (diff) |
tdf#137023 PPTX import: fix unexpected center alignment of shape text, 2nd try
Regression from commit 10bb02efd8afd42e633e370480104e2575546d8e
(tdf#129685 PPTX import: fix unexpected centering of shape text,
2020-09-18), now the problem was that some text should be left aligned,
but was centered.
Fix the problem by reverting most of the above commit: XML changes,
changes to SdImportTest::testTdf113198() (manual testing show that this
change is not needed after all) and changes to the
TextBodyPropertiesContext ctor in oox/ (but not the testcase itself).
Fix tdf#113198 again, this time in Shape::createAndInsert(), which is
meant to be closer to what the binary PPT import does.
With this, all cases from tdf#104722, tdf#113198, tdf#129685 and
tdf#137023 are meant to be handled correctly at the same time.
(cherry picked from commit dfa1856cdb4c69985ef1e809d33055427b6fbd76)
Change-Id: Id785252c26fc407cd74c9cfb55624091798d7773
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104006
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104023
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 16 | ||||
-rw-r--r-- | oox/source/drawingml/textbodypropertiescontext.cxx | 5 |
2 files changed, 16 insertions, 5 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 31ea0c696281..b49b52fdd9ce 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1452,6 +1452,22 @@ Reference< XShape > const & Shape::createAndInsert( xText->setString(""); Reference < XTextCursor > xAt = xText->createTextCursor(); getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle ); + + const TextParagraphVector& rParagraphs = getTextBody()->getParagraphs(); + if (!rParagraphs.empty()) + { + const std::shared_ptr<TextParagraph>& pParagraph = rParagraphs[0]; + if (pParagraph->getProperties().getParaAdjust()) + { + style::ParagraphAdjust eAdjust = *pParagraph->getProperties().getParaAdjust(); + if (eAdjust == style::ParagraphAdjust_CENTER) + { + // If the first paragraph is centered, then set the para adjustment of + // the shape itself to centered as well. + aPropertySet.setAnyProperty(PROP_ParaAdjust, uno::makeAny(eAdjust)); + } + } + } } } else if (mbTextBox) diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index af02c6f981d8..d696b4c3ac70 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -123,11 +123,6 @@ 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 |