diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-02-13 17:47:23 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-25 20:08:39 +0200 |
commit | ece07693152747e33343ce16428390f91561f4a7 (patch) | |
tree | f97e07aa96cbe60cf65bcc14f69c62e71bf56f46 /oox/source/export/drawingml.cxx | |
parent | f734ff65dfa8fd02a03f26c7b9d0a21692a6d5fb (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>
(cherry picked from commit 2c2919cb591d88b11bb2e25e45d6f75923821457)
Diffstat (limited to 'oox/source/export/drawingml.cxx')
-rw-r--r-- | oox/source/export/drawingml.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
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<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); } |