Kaydet (Commit) cffecd3c authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Miklos Vajna

tdf#80282 swpagerelsize: corner case frame size max

Before the swpagerelsize commits,
(specifically 7c7fdf3e),
the max size was always Prt(). The regression comes if
the RelFrame is a pageFrame (like when the image is
anchored to the page). Then sometimes no maximum is set.

Change-Id: If1e93ce670bd0908eb2d1f89dabbe9861163d29e
Reviewed-on: https://gerrit.libreoffice.org/50034Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst e3166f40
......@@ -983,6 +983,13 @@ DECLARE_ODFEXPORT_TEST(testRelhPage, "relh-page.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32(3168), parseDump("/root/page/body/txt/anchored/fly/infos/bounds", "height").toInt32());
}
DECLARE_ODFEXPORT_TEST(testRelhPageTdf80282, "relh-page-tdf80282.odt")
{
uno::Reference<drawing::XShape> xTextFrame = getShape(1);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Height", sal_Int32(8391), parseDump("//anchored/fly/infos/bounds", "height").toInt32());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Width", sal_Int32(5953), parseDump("//anchored/fly/infos/bounds", "width").toInt32());
}
DECLARE_ODFEXPORT_TEST(testRelwPage, "relw-page.odt")
{
uno::Reference<drawing::XShape> xTextFrame = getShape(1);
......
......@@ -2357,8 +2357,14 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize &rSz ) const
// When size is a relative to page size, ignore size of SwBodyFrame.
if (rSz.GetWidthPercentRelation() != text::RelOrientation::PAGE_FRAME)
nRelWidth = std::min( nRelWidth, pRel->getFramePrintArea().Width() );
else if ( pRel->IsPageFrame() )
nRelWidth = std::min( nRelWidth, pRel->getFrameArea().Width() );
if (rSz.GetHeightPercentRelation() != text::RelOrientation::PAGE_FRAME)
nRelHeight = std::min( nRelHeight, pRel->getFramePrintArea().Height() );
else if ( pRel->IsPageFrame() )
nRelHeight = std::min( nRelHeight, pRel->getFrameArea().Height() );
if( !pRel->IsPageFrame() )
{
const SwPageFrame* pPage = FindPageFrame();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment