summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-11-16 21:07:48 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-11-17 09:03:37 +0100
commit712d7a5df188bb20527f1a7533b2e2c1d4377247 (patch)
treee82999073621e66ef3ea721a86e0091a4be8f1ff /svx
parent47527821f32f9b5890b39b4031f5962f5cb46646 (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. Change-Id: Ic6a77a1125bbf31b198aaf9048dc4812c87b4d9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105960 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
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 09976fa5b7b0..29461df169a5 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2325,12 +2325,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 );
@@ -2341,10 +2345,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 );