From 8c23be49fb5a9044989532e6e20feb1e3ff64f2b Mon Sep 17 00:00:00 2001 From: Szabolcs Toth Date: Wed, 16 Sep 2020 14:41:24 +0200 Subject: tdf#106197 XLSX shape import: keep text upright MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle and grab-bag attribute upright to keep text upright regardless of shape rotation, fixing the text direction after import and after a round-trip. Co-authored-by: Balázs Regényi Change-Id: If4c73aeaebad55af967cea894a94756068ca3766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102870 Tested-by: László Németh Reviewed-by: László Németh --- oox/source/export/drawingml.cxx | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'oox/source/export') diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 8d3cbd23a6a7..8ea8035ea39a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2932,24 +2932,6 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo else if( bVertical && eHorizontalAlignment == TextHorizontalAdjust_LEFT ) sVerticalAlignment = "b"; - bool isUpright = false; - if (GetProperty(rXPropSet, "InteropGrabBag")) - { - if (rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) - { - uno::Sequence aGrabBag; - rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; - for (auto& aProp : aGrabBag) - { - if (aProp.Name == "Upright") - { - aProp.Value >>= isUpright; - break; - } - } - } - } - bool bHasWrap = false; bool bWrap = false; // Only custom shapes obey the TextWordWrap option, normal text always wraps. @@ -2971,6 +2953,25 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.drawing.TextShape")) pWrap = "square"; } + + bool isUpright = false; + if (GetProperty(rXPropSet, "InteropGrabBag")) + { + if (rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) + { + uno::Sequence aGrabBag; + rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; + for (auto& aProp : aGrabBag) + { + if (aProp.Name == "Upright") + { + aProp.Value >>= isUpright; + break; + } + } + } + } + mpFS->startElementNS( (nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr, XML_wrap, pWrap, XML_fromWordArt, sax_fastparser::UseIf("1", bFromWordArt), -- cgit