include/oox/drawingml/drawingmltypes.hxx | 3 +++ oox/source/drawingml/drawingmltypes.cxx | 14 ++++++++++++++ oox/source/export/shapes.cxx | 6 ++++++ 3 files changed, 23 insertions(+)
New commits: commit 77655fc3dca05d4bb2366e67ccea228e3886bfe2 Author: Sarper Akdemir <sarper.akde...@collabora.com> AuthorDate: Fri Mar 24 17:35:51 2023 +0300 Commit: Sarper Akdemir <sarper.akde...@collabora.com> CommitDate: Mon Apr 17 16:20:18 2023 +0200 pptx export: consider RotateAngle for tcPr on export It appears the RotateAngle property is imported, even though it has no effect on how table cell is displayed right now. Let's export the property so that we are able to roundtrip the <a:tcPr vert="vert"> & <a:tcPr vert="vert270"> Change-Id: Idc23f3b0677fdc5ed12fa5494f0f1823bb89683f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149545 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akde...@collabora.com> diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 239d3283e55c..fda24edb0f92 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -21,6 +21,7 @@ #define INCLUDED_OOX_DRAWINGML_DRAWINGMLTYPES_HXX #include <memory> +#include <optional> #include <string_view> #include <com/sun/star/awt/Point.hpp> @@ -149,6 +150,8 @@ OOX_DLLPUBLIC const char* GetTextVerticalAdjust( css::drawing::TextVerticalAdjus // Converts a Hatch object to an ooxml pattern. const char* GetHatchPattern( const css::drawing::Hatch& rHatch ); +/// Converts nRotate angle to TextVerticalType string appearing in ooxml +std::optional<OString> GetTextVerticalType(sal_Int32 nRotateAngle); // CT_IndexRange struct IndexRange { diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index 469029f48071..ff8c46050c15 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/xml/sax/XFastAttributeList.hpp> #include <o3tl/string_view.hxx> +#include <optional> #include <osl/diagnose.h> #include <sax/tools/converter.hxx> #include <oox/token/tokens.hxx> @@ -376,6 +377,19 @@ const char* GetHatchPattern( const drawing::Hatch& rHatch ) return sPattern; } +std::optional<OString> GetTextVerticalType(sal_Int32 nRotateAngle) +{ + switch (nRotateAngle) + { + case 9000: + return "vert"; + case 27000: + return "vert270"; + default: + return {}; + } +} + namespace { // ISO/IEC-29500 Part 1 ST_Percentage, and [MS-OI29500] 2.1.1324 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 83d308ca793f..eecd1b38512c 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2312,7 +2312,13 @@ void ShapeExport::WriteTableCellProperties(const Reference< XPropertySet>& xCell aVerticalAlignment >>= eVerticalAlignment; sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment); + sal_Int32 nRotateAngle = 0; + Any aRotateAngle = xCellPropSet->getPropertyValue("RotateAngle"); + aRotateAngle >>= nRotateAngle; + std::optional<OString> aTextVerticalValue = GetTextVerticalType(nRotateAngle); + mpFS->startElementNS(XML_a, XML_tcPr, XML_anchor, sVerticalAlignment, + XML_vert, aTextVerticalValue, XML_marL, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nLeftMargin)), nLeftMargin > 0), XML_marR, sax_fastparser::UseIf(OString::number(oox::drawingml::convertHmmToEmu(nRightMargin)), nRightMargin > 0));