summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-04-25 21:05:43 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-07-04 15:51:45 +0200
commite8a37aa36fe0910ca319862b01fa31facc3c555b (patch)
treeeca134fd86da915d3345057f49ebfd373ba2c7d8 /oox
parentf3f321fcb0c0ae6922f3c0b5a904e043adb3ef23 (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. (cherry picked from commit ff17478e069cc82681df62514876c06365dd5cd6) Conflicts: oox/source/shape/WpsContext.cxx sw/qa/extras/ooxmlexport/ooxmlexport13.cxx Change-Id: I30c7793221cc3aceedfcfd9e4e1725634ebb3309
Diffstat (limited to 'oox')
-rw-r--r--oox/source/shape/WpsContext.cxx72
1 files changed, 27 insertions, 45 deletions
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 2b2ad8b2b1b7..52c82541c6a9 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -64,53 +64,35 @@ 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()));
}
}