summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-10-05 21:06:01 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-10-07 14:13:17 +0200
commit699f46a4ec9fb66fb0db4657e200e0615dc193e2 (patch)
tree4839196250a7bccb59deb4cafdb9eb77f2e01364 /oox
parent9e54164d7335386bc34cc7717f005bf046c9cee6 (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 (cherry picked from commit bcfe68c96893c39b07c15efd99cd010d6736f560) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103978 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx16
-rw-r--r--oox/source/drawingml/textbodypropertiescontext.cxx5
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