diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-28 16:36:44 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-28 17:01:42 +0100 |
commit | f71dc0ec8372208318199ede36bc93de38d6c216 (patch) | |
tree | 1e0dcbb665eccbb8263591c0405fadb44a8b6c2a /sw | |
parent | b7b57bbce3f3b171f3a85a8d93ab29f0d9a049cf (diff) |
swpagerelsize: take care of Sz.GetWidthPercentRelation() in SwFlyFrm::CalcRel
This allows two type of relative sizes: relative to margin (default,
what we had before) and relative to the entire page.
Change-Id: I1625f072365e418352f3d507764e03484bb812be
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/layout/fly.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index bccf60b79627..26550da377bf 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2482,14 +2482,22 @@ Size SwFlyFrm::CalcRel( const SwFmtFrmSize &rSz ) const if ( nDiff > 0 ) nRelHeight -= nDiff; } - nRelWidth = std::min( nRelWidth, pRel->Prt().Width() ); + + // At the moment only the "== PAGE_FRAME" and "!= PAGE_FRAME" cases are handled. + // When size is a relative to page size, ignore size of SwBodyFrm. + if (rSz.GetWidthPercentRelation() != text::RelOrientation::PAGE_FRAME) + nRelWidth = std::min( nRelWidth, pRel->Prt().Width() ); nRelHeight = std::min( nRelHeight, pRel->Prt().Height() ); if( !pRel->IsPageFrm() ) { const SwPageFrm* pPage = FindPageFrm(); if( pPage ) { - nRelWidth = std::min( nRelWidth, pPage->Prt().Width() ); + if (rSz.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME) + // Ignore margins of pPage. + nRelWidth = std::min( nRelWidth, pPage->Frm().Width() ); + else + nRelWidth = std::min( nRelWidth, pPage->Prt().Width() ); nRelHeight = std::min( nRelHeight, pPage->Prt().Height() ); } } |