summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2021-10-17 23:49:17 +0200
committerRegina Henschel <rb.henschel@t-online.de>2021-10-18 19:13:42 +0200
commit9142d19ddc751e05041471aa1bbeca2f06729522 (patch)
tree0030104bcd438fbb5ac13cc47b71a46f0664e922 /oox
parent300a743048de760e3a5456e8dce549af5f42b11b (diff)
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.henschel@t-online.de>
Diffstat (limited to 'oox')
-rw-r--r--oox/CppunitTest_oox_shape.mk3
-rw-r--r--oox/qa/unit/data/tdf125582_TextOnCircle.pptxbin0 -> 15956 bytes
-rw-r--r--oox/qa/unit/shape.cxx31
-rw-r--r--oox/source/drawingml/shape.cxx2
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
new file mode 100644
index 000000000000..b2c09e515372
--- /dev/null
+++ b/oox/qa/unit/data/tdf125582_TextOnCircle.pptx
Binary files differ
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 ) );