summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-11-16 21:07:48 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-11-17 14:25:05 +0100
commit8a5e6b1698cb9c31709aa19fff53c73794055448 (patch)
treea5d8fda42369dcf3fb04312865519f2a4ab1ad4d /svx
parentb89e61976dbf4d990f8cc74d90d6e73aba98a629 (diff)
tdf#137980 sw textbox: fix automatic size of shapes with rotated text
If a shape+fly pair has automatic size for the fly frame, then only the sw layout knows the necessary size, this is then sent to the shape and SdrObjCustomShape::AdjustTextFrameWidthAndHeight() is meant to respect those "suggestion", instead of sizing the shape based on the contained editeng text, which is always empty for shape+fly pairs. Improve this mechanism so it works better when the writing direction of the fly frame is tbrl ("rotate to the right"): make sure we always grow to the left and to the bottom, so the shape and the fly geometry matches. Also improve the testTextBoxSizeAtBottomOfPage "change detector" test which had a hardcoded height, but which did not clearly derive from any in-bugdoc value. Rather just test that the shape wider than taller, which was probably the intention. (cherry picked from commit 712d7a5df188bb20527f1a7533b2e2c1d4377247) Conflicts: sw/qa/core/layout/layout.cxx Change-Id: Ic6a77a1125bbf31b198aaf9048dc4812c87b4d9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105971 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdoashp.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 1708dc64ccc3..4e44f1658c7b 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2340,12 +2340,16 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool
bWdtGrow = false;
if ( nHgtGrow == 0 )
bHgtGrow=false;
- if ( bWdtGrow || bHgtGrow )
+ if ( bWdtGrow || bHgtGrow || !m_aSuggestedTextFrameSize.IsEmpty())
{
- if ( bWdtGrow )
+ if ( bWdtGrow || m_aSuggestedTextFrameSize.Width() )
{
SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
- if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
+ if (m_aSuggestedTextFrameSize.Width())
+ {
+ rR.SetRight(rR.Left() + m_aSuggestedTextFrameSize.Width());
+ }
+ else if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
rR.AdjustRight(nWdtGrow );
else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT )
rR.AdjustLeft( -nWdtGrow );
@@ -2356,10 +2360,14 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool
rR.SetRight(rR.Left()+nWdt );
}
}
- if ( bHgtGrow )
+ if ( bHgtGrow || m_aSuggestedTextFrameSize.Height() )
{
SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
- if ( eVAdj == SDRTEXTVERTADJUST_TOP )
+ if (m_aSuggestedTextFrameSize.Height())
+ {
+ rR.SetBottom(rR.Top() + m_aSuggestedTextFrameSize.Height());
+ }
+ else if ( eVAdj == SDRTEXTVERTADJUST_TOP )
rR.AdjustBottom(nHgtGrow );
else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM )
rR.AdjustTop( -nHgtGrow );