[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth
justin_luth at sil.org
Fri Feb 23 08:32:01 UTC 2018
sw/qa/extras/odfexport/data/relh-page-tdf80282.odt |binary
sw/qa/extras/odfexport/odfexport.cxx | 7 +++++++
sw/source/core/layout/fly.cxx | 6 ++++++
3 files changed, 13 insertions(+)
New commits:
commit cffecd3c8d2d6b34726b8820468fadef93dd553d
Author: Justin Luth <justin_luth at sil.org>
Date: Tue Feb 20 11:41:15 2018 +0300
tdf#80282 swpagerelsize: corner case frame size max
Before the swpagerelsize commits,
(specifically 7c7fdf3e97bbf2301f9938082d4d44162f4ec3c0),
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/50034
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/extras/odfexport/data/relh-page-tdf80282.odt b/sw/qa/extras/odfexport/data/relh-page-tdf80282.odt
new file mode 100644
index 000000000000..6b3c583d366f
Binary files /dev/null and b/sw/qa/extras/odfexport/data/relh-page-tdf80282.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index a602011ec992..ae5ae1735e35 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -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);
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 2ae868df995f..038dcdd58b5e 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -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();
More information about the Libreoffice-commits
mailing list