diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-08-14 13:22:33 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-08-20 17:42:25 +0200 |
commit | 591b7a689928cf428f63cb31adc5bbe6b56da231 (patch) | |
tree | 0a6c5269404aa0904e57af42cc1ba2a6be150a72 /svx/source | |
parent | b88053ffeed1f9fb2dda8b3bffe6353d67312e5d (diff) |
tdf#116350 Better text layout for big shapes
Added some horizontal padding - for bigger shapes
and vertical adjustment for multi-line labels.
Change-Id: I665b238b0d08a499cd846952d831fe449f72f575
Reviewed-on: https://gerrit.libreoffice.org/58975
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit a643c8353754c6ce8b318e37cbbc60c3425e9d32)
Reviewed-on: https://gerrit.libreoffice.org/59163
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 0419038f0fda..c59daeba68e6 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -251,6 +251,10 @@ void CalculateHorizontalScalingFactor( if (nFontSize > 1) rFWData.fVerticalTextScaling = static_cast<double>(nFontSize) / rFontHeight.GetHeight(); + // Add some padding + if (rFWData.bScaleX) + fScalingFactor *= 1.1; + rFWData.fHorizontalTextScaling = fScalingFactor; } @@ -530,11 +534,16 @@ bool GetFontWorkOutline( } else if (rFWData.bScaleX) { + const SdrTextVertAdjust nVertJustify = rSdrObjCustomShape.GetMergedItem( SDRATTR_TEXT_VERTADJUST ).GetValue(); + double fFactor = nVertJustify == SdrTextVertAdjust::SDRTEXTVERTADJUST_BOTTOM ? -0.5 : ( nVertJustify == SdrTextVertAdjust::SDRTEXTVERTADJUST_TOP ? 0.5 : 0 ); + std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() ); std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() ); while ( aParagraphIter != aParagraphIEnd ) { sal_Int32 nHorzDiff = 0; + sal_Int32 nVertDiff = static_cast<double>( rFWData.nSingleLineHeight ) * fFactor * ( aTextAreaIter->vParagraphs.size() - 1 ); + if ( eHorzAdjust == SDRTEXTHORZADJUST_CENTER ) nHorzDiff = ( rFWData.fHorizontalTextScaling * aTextAreaIter->aBoundRect.GetWidth() - aParagraphIter->aBoundRect.GetWidth() ) / 2; else if ( eHorzAdjust == SDRTEXTHORZADJUST_RIGHT ) @@ -550,7 +559,7 @@ bool GetFontWorkOutline( std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end(); while( aOutlineIter != aOutlineIEnd ) { - aOutlineIter->Move( nHorzDiff, 0 ); + aOutlineIter->Move( nHorzDiff, nVertDiff ); ++aOutlineIter; } ++aCharacterIter; |