From d108af8aff3a5a03b8a3b68c69fb477c18c8cc1f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 7 Aug 2020 15:45:25 +0200 Subject: oox: VML export: produce bottom-to-top in a better way Replace code added in 090c61eb93db4302d4565d5f11f7673190835fdb with something that uses the already generated ESCHER property; this lets a warning about the unhandled property disappear too. Change-Id: Ieed83dd8e17e92eea9901124fce5e6da2a17196a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100332 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 2af2b9be05a4733c691db7201e76b4058516c47b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100354 Reviewed-by: Xisco Fauli --- include/oox/export/vmlexport.hxx | 3 +++ oox/source/export/vmlexport.cxx | 36 ++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index 61185e57d5de..71d3441fdaaa 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -99,6 +99,9 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx /// Remember style, the most important shape attribute ;-) OStringBuffer m_ShapeStyle; + /// style for textbox + OStringBuffer m_TextboxStyle; + /// Remember the generated shape id. OString m_sShapeId; diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 950b0afd240d..964cf27c6921 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -430,6 +430,28 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& bAlreadyWritten[ ESCHER_Prop_WrapText ] = true; break; + case ESCHER_Prop_txflTextFlow: // 136 + { + // at least "bottom-to-top" only has an effect when it's on the v:textbox element, not on v:shape + assert(m_TextboxStyle.isEmpty()); + switch (opt.nPropValue) + { + case ESCHER_txflHorzN: + m_TextboxStyle.append("layout-flow:horizontal"); + break; + case ESCHER_txflTtoBA: + m_TextboxStyle.append("layout-flow:vertical"); + break; + case ESCHER_txflBtoT: + m_TextboxStyle.append("mso-layout-flow-alt:bottom-to-top"); + break; + default: + assert(false); // unimplemented in escher export + break; + } + } + break; + // coordorigin case ESCHER_Prop_geoLeft: // 320 case ESCHER_Prop_geoTop: // 321 @@ -1345,6 +1367,8 @@ sal_Int32 VMLExport::StartShape() // start of the shape m_pSerializer->startElementNS( XML_v, nShapeElement, XFastAttributeListRef( m_pShapeAttrList ) ); + OString const textboxStyle(m_TextboxStyle.makeStringAndClear()); + // now check if we have some editeng text (not associated textbox) and we have a text exporter registered const SdrTextObj* pTxtObj = dynamic_cast( m_pSdrObject ); if (pTxtObj && m_pTextExport && msfilter::util::HasTextBoxContent(m_nShapeType) && !IsWaterMarkShape(m_pSdrObject->GetName()) && !lcl_isTextBox(m_pSdrObject)) @@ -1369,19 +1393,11 @@ sal_Int32 VMLExport::StartShape() if( pParaObj ) { - uno::Reference xPropertySet(const_cast(m_pSdrObject)->getUnoShape(), uno::UNO_QUERY); sax_fastparser::FastAttributeList* pTextboxAttrList = FastSerializerHelper::createAttrList(); sax_fastparser::XFastAttributeListRef xTextboxAttrList(pTextboxAttrList); - if (xPropertySet->getPropertySetInfo()->hasPropertyByName("RotateAngle")) + if (!textboxStyle.isEmpty()) { - sal_Int32 nTextRotateAngle = sal_Int32(); - if (xPropertySet->getPropertyValue("RotateAngle") >>= nTextRotateAngle) - { - if (nTextRotateAngle == 9000) - { - pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top"); - } - } + pTextboxAttrList->add(XML_style, textboxStyle); } // this is reached only in case some text is attached to the shape -- cgit