diff options
-rw-r--r-- | oox/CppunitTest_oox_shape.mk | 3 | ||||
-rw-r--r-- | oox/qa/unit/data/tdf125582_TextOnCircle.pptx | bin | 0 -> 15956 bytes | |||
-rw-r--r-- | oox/qa/unit/shape.cxx | 31 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 2 |
4 files changed, 34 insertions, 2 deletions
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 Binary files differnew file mode 100644 index 000000000000..b2c09e515372 --- /dev/null +++ b/oox/qa/unit/data/tdf125582_TextOnCircle.pptx diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 88f86d3bb30e..345ebb215ad6 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -15,11 +15,12 @@ #include <unotest/macros_test.hxx> #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; @@ -146,6 +147,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 6821dffc9f34..6622001b2b0d 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -564,7 +564,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 ) ); |