Kaydet (Commit) e87cc12e authored tarafından Mark Hung's avatar Mark Hung Kaydeden (comit) Miklos Vajna

tdf#106390 Intersect the table borders with upper frames.

Also removes dead code because SwTabFramePainter::Insert()
is always called with a cell frame and IsTabFrame() always
returns false.

Change-Id: I2505d876d20e44ded1faf760bc3b7b1d34b0fd8d
Reviewed-on: https://gerrit.libreoffice.org/54684Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 47d53d69
......@@ -19,6 +19,7 @@ public:
void testTdf116830();
void testTdf116925();
void testTdf117028();
void testTdf106390();
void testTdf116848();
void testTdf117245();
......@@ -26,6 +27,7 @@ public:
CPPUNIT_TEST(testTdf116830);
CPPUNIT_TEST(testTdf116925);
CPPUNIT_TEST(testTdf117028);
CPPUNIT_TEST(testTdf106390);
CPPUNIT_TEST(testTdf116848);
CPPUNIT_TEST(testTdf117245);
CPPUNIT_TEST_SUITE_END();
......@@ -112,6 +114,24 @@ void SwLayoutWriter::testTdf117028()
assertXPathContent(pXmlDoc, "//textarray/text", "Hello");
}
void SwLayoutWriter::testTdf106390()
{
SwDoc* pDoc = createDoc("tdf106390.odt");
SwDocShell* pShell = pDoc->GetDocShell();
// Dump the rendering of the first page as an XML file.
std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
MetafileXmlDump dumper;
xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
CPPUNIT_ASSERT(pXmlDoc);
sal_Int32 nBottom = getXPath(pXmlDoc, "//sectrectclipregion", "bottom").toInt32();
// No end point of line segments shall go below the bottom of the clipping area.
const OString sXPath = "//polyline/point[@y>" + OString::number(nBottom) + "]";
assertXPath(pXmlDoc, sXPath, 0);
}
void SwLayoutWriter::testTdf116848()
{
SwDoc* pDoc = createDoc("tdf116848.odt");
......
......@@ -2729,10 +2729,16 @@ void SwTabFramePainter::Insert( const SwFrame& rFrame, const SvxBoxItem& rBoxIte
{
// build 4 line entries for the 4 borders:
SwRect aBorderRect = rFrame.getFrameArea();
if ( rFrame.IsTabFrame() )
{
aBorderRect = rFrame.getFramePrintArea();
aBorderRect.Pos() += rFrame.getFrameArea().Pos();
// Frame area of a table might be larger than the containing frame
// so we have to intersect the border rect with upper frames til
// the first frame that is not part of a table.
const SwLayoutFrame *pUpper = rFrame.GetUpper();
while(pUpper)
{
aBorderRect.Intersection(pUpper->getFrameArea());
if (!pUpper->IsInTab())
break;
pUpper = pUpper->GetUpper();
}
bool const bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
......
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