summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2018-02-13 17:47:23 +0100
committerAndras Timar <andras.timar@collabora.com>2018-02-19 09:19:42 +0100
commit04040bd9e4b8cf52dc75b7d4510c6fc1d104896a (patch)
tree255214243049fcf16c0e6fe4968095b7ba60cd51 /oox
parent1104be609f2847387da2da16c4dd1be624f1c858 (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. Squashed: 7a510effa4566d405d2033b6635b42c08d34dec8 2c2919cb591d88b11bb2e25e45d6f75923821457 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> Reviewed-on: https://gerrit.libreoffice.org/49917 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@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 7e88997a5372..986c71ffee06 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2325,8 +2325,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);
}