summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2018-02-13 17:47:23 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2018-02-16 17:27:27 +0100
commit2c2919cb591d88b11bb2e25e45d6f75923821457 (patch)
treed77e2de6e306b2c48d6953fb391369417f94036b /oox
parent168c5e4994e1b9e742911273ecb0b959396d5bf0 (diff)
PPTX export scale for TextFitToSize
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 <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0503a088faf7..52807f28be3d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2553,8 +2553,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<SvxShapeText*>(rXIface.get());
+ if (pTextShape)
+ {
+ SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pTextShape->GetSdrObject());
+ if (pTextObject)
+ {
+ double fScaleY = pTextObject->GetFontScaleY();
+ nFontScale = static_cast<sal_uInt32>(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);
}