oox/CppunitTest_oox_shape.mk | 3 ++ oox/qa/unit/data/tdf125582_TextOnCircle.pptx |binary oox/qa/unit/shape.cxx | 31 ++++++++++++++++++++++++++- oox/source/drawingml/shape.cxx | 2 - 4 files changed, 34 insertions(+), 2 deletions(-)
New commits: commit 516a4a59b7d16fbd803f55c37c51564f46a29f7d Author: Regina Henschel <rb.hensc...@t-online.de> AuthorDate: Sun Oct 17 23:49:17 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Oct 19 11:37:02 2021 +0200 tdf#125582 use TextVerticalAlign_BOTTOM for textCircle PowerPoint aligns the bottom of the text to the path for prstTxWarp 'textCircle'. That preset type is mapped to 'fontwork-circle-curve' on import with additional attribute ScaleX=true. Currently the property TextVerticalAlign is only evaluated in case ScaleX=true. Therefore I have written the condition similar as the already existing with 'fontwork-arch-up-curve'. If it will be necessary later, all those conditions can be changed to use rPresetType instead of rClass. The rendering is slightly different compared to PowerPoint, because descenders and paragraphs line-spacing are handled differently. The rendering has still the problem, that in PowerPoint the letters are placed without gap, but in LO they have additional distances from each other. The needed ODF attribute draw:text-path-mode is not yet implemented in LO. Its value 'normal' would be needed here. Change-Id: I1f03d4845312885eff9ee8dbe1d51ddd437ed8e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123726 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.hensc...@t-online.de> (cherry picked from commit 9142d19ddc751e05041471aa1bbeca2f06729522) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123775 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/oox/CppunitTest_oox_shape.mk b/oox/CppunitTest_oox_shape.mk index 9ae7bbd634cd..9b910f249160 100644 --- a/oox/CppunitTest_oox_shape.mk +++ b/oox/CppunitTest_oox_shape.mk @@ -24,6 +24,9 @@ $(eval $(call gb_CppunitTest_use_libraries,oox_shape, \ cppu \ oox \ sal \ + svx \ + svxcore \ + tl \ test \ unotest \ utl \ diff --git a/oox/qa/unit/data/tdf125582_TextOnCircle.pptx b/oox/qa/unit/data/tdf125582_TextOnCircle.pptx new file mode 100644 index 000000000000..b2c09e515372 Binary files /dev/null and b/oox/qa/unit/data/tdf125582_TextOnCircle.pptx differ diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index a6949ff4fec3..9ae7a02e090a 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -16,11 +16,12 @@ #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/beans/XPropertySet.hpp> - #include <rtl/math.hxx> +#include <svx/svdoashp.hxx> using namespace ::com::sun::star; @@ -147,6 +148,34 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testCustomshapePosition) CPPUNIT_ASSERT_EQUAL(nExpected, nY); } +CPPUNIT_TEST_FIXTURE(OoxShapeTest, testTdf125582_TextOnCircle) +{ + // The document contains a shape with a:prstTxWarp="textCircle" with two paragraphs. + // PowerPoint aligns the bottom of the text with the path, LO had aligned the middle of the + // text with the path, which resulted in smaller text. + load(u"tdf125582_TextOnCircle.pptx"); + + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY); + + // BoundRect of Fontwork shape depends on dpi. + if (IsDefaultDPI()) + { + SdrObjCustomShape& rSdrCustomShape( + static_cast<SdrObjCustomShape&>(*SdrObject::getSdrObjectFromXShape(xShape))); + // Without the fix in place width was 3639, but should be 4824 for 96dpi. + tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect()); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(4824), aBoundRect.GetWidth(), 5); + } + + drawing::TextVerticalAdjust eAdjust; + xPropSet->getPropertyValue("TextVerticalAdjust") >>= eAdjust; + CPPUNIT_ASSERT_EQUAL_MESSAGE("TextVerticalAdjust", drawing::TextVerticalAdjust_BOTTOM, eAdjust); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index b6900b8d1aeb..d9ee434dcb79 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -567,7 +567,7 @@ static void lcl_createPresetShape(const uno::Reference<drawing::XShape>& xShape, // ToDo: The property is currently not evaluated. SdrObject* pShape = SdrObject::getSdrObjectFromXShape(xShape); assert(pShape); - if (rClass == "fontwork-arch-up-curve") + if (rClass == "fontwork-arch-up-curve" || rClass == "fontwork-circle-curve") pShape->SetMergedItem( SdrTextVertAdjustItem( SdrTextVertAdjust::SDRTEXTVERTADJUST_BOTTOM ) ); else if (rClass == "fontwork-arch-down-curve") pShape->SetMergedItem( SdrTextVertAdjustItem( SdrTextVertAdjust::SDRTEXTVERTADJUST_TOP ) );