diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2017-11-02 17:22:03 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-12-07 12:53:10 +0100 |
commit | fec53ea4c33b012ef76d971d0b154d766c8e5759 (patch) | |
tree | 94985498aff57596914c31ce769bfaf7cf62eb39 /filter | |
parent | 0f685ee5a0913cab5826eec737f25328fabf256d (diff) |
tdf#113037 create Watermark with correct ratio
Reviewed-on: https://gerrit.libreoffice.org/44228
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 1e6abe31eb8f7c12c725f7e1267a7cedfcd3d157)
Change-Id: I17ab8d98a618cff6e38dad344f4096dc520cce43
Reviewed-on: https://gerrit.libreoffice.org/45994
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 98427c6ebab6..36a3f59c3787 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4414,13 +4414,13 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r OutputDevice* pOut = Application::GetDefaultDevice(); vcl::Font aFont( pOut->GetFont() ); aFont.SetFamilyName( aFontName ); - auto nTextWidth = pOut->GetTextWidth( aObjectText ); + Rectangle aBoundingRect; + pOut->GetTextBoundRect( aBoundingRect, aObjectText ); OUString aObjName = GetPropertyString(DFF_Prop_wzName, rSt); - if ( nTextWidth && aObjData.eShapeType == mso_sptTextPlainText && aObjName.match("PowerPlusWaterMarkObject")) + if ( aBoundingRect.GetWidth() && aObjData.eShapeType == mso_sptTextPlainText && aObjName.match( "PowerPlusWaterMarkObject" ) ) { - fRatio = aFont.GetFontSize().Height(); - fRatio /= nTextWidth; + fRatio = (double)aBoundingRect.GetHeight() / aBoundingRect.GetWidth(); sal_Int32 nNewHeight = fRatio * aObjData.aBoundRect.getWidth(); sal_Int32 nPaddingY = aObjData.aBoundRect.getHeight() - nNewHeight; |