summaryrefslogtreecommitdiff
path: root/oox/source/shape
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-04-25 21:05:43 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-04-26 09:05:04 +0200
commitff17478e069cc82681df62514876c06365dd5cd6 (patch)
tree172435a271013210b49c372ffa441e949e1a2b47 /oox/source/shape
parent647660cf844f265dd2ad7c78e6cb13844fbf3613 (diff)
sw btlr writing mode: implement DOCX shape import for tbrl
Now that the btlr writing mode works reasonably well in table cells, the next context is shape text. But turns out that DOCX shape text lacked support in the easier tbrl case, so add that first. Also remove the char-level text rotation code in oox, that is effectively dead code since we import drawingML shapes as shape + Writer TextBox. Change-Id: I30c7793221cc3aceedfcfd9e4e1725634ebb3309 Reviewed-on: https://gerrit.libreoffice.org/71329 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox/source/shape')
-rw-r--r--oox/source/shape/WpsContext.cxx84
1 files changed, 31 insertions, 53 deletions
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 19b413f5c329..0f39a850b0ee 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -59,61 +59,39 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
{
uno::Reference<lang::XServiceInfo> xServiceInfo(mxShape, uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
- OptValue<OUString> oVert = rAttribs.getString(XML_vert);
- if (oVert.has() && oVert.get() == "vert270")
+ sal_Int32 nVert = rAttribs.getToken(XML_vert, XML_horz);
+ if (nVert != XML_horz)
{
- if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
- {
- // No support for this in core, work around by char rotation, as we do so for table cells already.
- uno::Reference<text::XText> xText(mxShape, uno::UNO_QUERY);
- uno::Reference<text::XTextCursor> xTextCursor = xText->createTextCursor();
- xTextCursor->gotoStart(false);
- xTextCursor->gotoEnd(true);
- uno::Reference<beans::XPropertyState> xPropertyState(xTextCursor,
- uno::UNO_QUERY);
- beans::PropertyState aState
- = xPropertyState->getPropertyState("CharRotation");
- if (aState == beans::PropertyState_DEFAULT_VALUE)
- {
- uno::Reference<beans::XPropertySet> xTextCursorPropertySet(
- xTextCursor, uno::UNO_QUERY);
- xTextCursorPropertySet->setPropertyValue("CharRotation",
- uno::makeAny(sal_Int16(900)));
- }
- }
- else
- {
- // Get the existing rotation of the shape.
- drawing::HomogenMatrix3 aMatrix;
- xPropertySet->getPropertyValue("Transformation") >>= aMatrix;
- basegfx::B2DHomMatrix aTransformation;
- aTransformation.set(0, 0, aMatrix.Line1.Column1);
- aTransformation.set(0, 1, aMatrix.Line1.Column2);
- aTransformation.set(0, 2, aMatrix.Line1.Column3);
- aTransformation.set(1, 0, aMatrix.Line1.Column1);
- aTransformation.set(1, 1, aMatrix.Line2.Column2);
- aTransformation.set(1, 2, aMatrix.Line3.Column3);
- aTransformation.set(2, 0, aMatrix.Line1.Column1);
- aTransformation.set(2, 1, aMatrix.Line2.Column2);
- aTransformation.set(2, 2, aMatrix.Line3.Column3);
- basegfx::B2DTuple aScale;
- basegfx::B2DTuple aTranslate;
- double fRotate = 0;
- double fShearX = 0;
- aTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
+ // Get the existing rotation of the shape.
+ drawing::HomogenMatrix3 aMatrix;
+ xPropertySet->getPropertyValue("Transformation") >>= aMatrix;
+ basegfx::B2DHomMatrix aTransformation;
+ aTransformation.set(0, 0, aMatrix.Line1.Column1);
+ aTransformation.set(0, 1, aMatrix.Line1.Column2);
+ aTransformation.set(0, 2, aMatrix.Line1.Column3);
+ aTransformation.set(1, 0, aMatrix.Line1.Column1);
+ aTransformation.set(1, 1, aMatrix.Line2.Column2);
+ aTransformation.set(1, 2, aMatrix.Line3.Column3);
+ aTransformation.set(2, 0, aMatrix.Line1.Column1);
+ aTransformation.set(2, 1, aMatrix.Line2.Column2);
+ aTransformation.set(2, 2, aMatrix.Line3.Column3);
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate = 0;
+ double fShearX = 0;
+ aTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
- // If the text is not rotated the way the shape wants it already, set the angle.
- const sal_Int32 nRotation = -270;
- if (static_cast<long>(basegfx::rad2deg(fRotate))
- != NormAngle36000(static_cast<long>(nRotation) * 100) / 100)
- {
- comphelper::SequenceAsHashMap aCustomShapeGeometry(
- xPropertySet->getPropertyValue("CustomShapeGeometry"));
- aCustomShapeGeometry["TextPreRotateAngle"] <<= nRotation;
- xPropertySet->setPropertyValue(
- "CustomShapeGeometry",
- uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList()));
- }
+ // If the text is not rotated the way the shape wants it already, set the angle.
+ const sal_Int32 nRotation = nVert == XML_vert270 ? -270 : -90;
+ if (static_cast<long>(basegfx::rad2deg(fRotate))
+ != NormAngle36000(static_cast<long>(nRotation) * 100) / 100)
+ {
+ comphelper::SequenceAsHashMap aCustomShapeGeometry(
+ xPropertySet->getPropertyValue("CustomShapeGeometry"));
+ aCustomShapeGeometry["TextPreRotateAngle"] <<= nRotation;
+ xPropertySet->setPropertyValue(
+ "CustomShapeGeometry",
+ uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList()));
}
}