From ece07693152747e33343ce16428390f91561f4a7 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Tue, 13 Feb 2018 17:47:23 +0100 Subject: PPTX export scale for TextFitToSize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MSO requires to save fontScale attribute to have all the text shown properly (with FitToSize property) Values are approximated, after any modification in MSO scale is recalculated. Change-Id: I73657fdd663b540b436747cfeeef3c76e8fe388c Reviewed-on: https://gerrit.libreoffice.org/49742 Tested-by: Jenkins Reviewed-by: Szymon Kłos (cherry picked from commit 2c2919cb591d88b11bb2e25e45d6f75923821457) --- oox/source/export/drawingml.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'oox/source/export/drawingml.cxx') diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 481d01fc5813..25d4e23fbb5c 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2378,8 +2378,25 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin TextFitToSizeType eFit = TextFitToSizeType_NONE; if (GETA(TextFitToSize)) mAny >>= eFit; + if (eFit == TextFitToSizeType_AUTOFIT) - mpFS->singleElementNS(XML_a, XML_normAutofit, FSEND); + { + const sal_Int32 MAX_SCALE_VAL = 100000; + sal_Int32 nFontScale = MAX_SCALE_VAL; + SvxShapeText* pTextShape = dynamic_cast(rXIface.get()); + if (pTextShape) + { + SdrTextObj* pTextObject = dynamic_cast(pTextShape->GetSdrObject()); + if (pTextObject) + { + double fScaleY = pTextObject->GetFontScaleY(); + nFontScale = static_cast(fScaleY * 100) * 1000; + } + } + + mpFS->singleElementNS(XML_a, XML_normAutofit, XML_fontScale, + ( nFontScale < MAX_SCALE_VAL && nFontScale > 0 ) ? I32S(nFontScale) : nullptr, FSEND); + } } mpFS->endElementNS((nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr); } -- cgit v1.2.3