diff options
author | Bakos Attila <bakos.attilakaroly@nisz.hu> | 2020-06-26 13:05:22 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-06-30 22:52:40 +0200 |
commit | 117011cf10032e6ca93a8d502f794deb16c13a8f (patch) | |
tree | 1b5e8eee5c094359d888b931183c84dd6e0b248a | |
parent | 0778a154bef54cf6d591c9b0e1298fcc38380981 (diff) |
tdf#134277 sw table: fix lagging shape at page break
Shapes anchored to characters in table cells didn't follow
their cells at page break, resulting lonely shapes at the end
of the previous page.
Co-authored-by: Attila Bánhegyi (NISZ)
Change-Id: I2149ef58696a8f5dc6f41959060d2d57f938d025
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97209
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | sw/qa/extras/layout/data/tdf134277.docx | bin | 0 -> 15350 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 18 | ||||
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 12 |
3 files changed, 26 insertions, 4 deletions
diff --git a/sw/qa/extras/layout/data/tdf134277.docx b/sw/qa/extras/layout/data/tdf134277.docx Binary files differnew file mode 100644 index 000000000000..cf4ecfbb1caa --- /dev/null +++ b/sw/qa/extras/layout/data/tdf134277.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index c8b5665c5e00..6840d6dda2e9 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1112,6 +1112,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134277) +{ + SwDoc* pDoc = createDoc("tdf134277.docx"); + CPPUNIT_ASSERT(pDoc); + SwDocShell* pShell = pDoc->GetDocShell(); + + std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); + MetafileXmlDump dumper; + + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/metafile/push/push/push/layoutmode[2]"); + xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Bad position of shape in page break!", 0, + xmlXPathNodeSetGetLength(pXmlNodes)); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFlys) { loadURL("private:factory/swriter", nullptr); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 2642c5018f1d..fda00cee5c3f 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1066,7 +1066,6 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK else bSplitRowAllowed = false; } - // #i29438# // #i26945# - Floating screen objects no longer forbid // a splitting of the table row. @@ -3892,11 +3891,16 @@ long CalcHeightWithFlys( const SwFrame *pFrame ) // the text flow have to be considered. const SwFrameFormat& rFrameFormat = pAnchoredObj->GetFrameFormat(); bool bFollowTextFlow = rFrameFormat.GetFollowTextFlow().GetValue(); + bool bIsFarAway = pAnchoredObj->GetObjRect().Top() != FAR_AWAY; + const SwPageFrame* pPageFrm = pTmp->FindPageFrame(); + bool bIsAnchoredToTmpFrm = false; + if ( pPageFrm && pPageFrm->IsPageFrame() && pAnchoredObj->GetPageFrame()) + bIsAnchoredToTmpFrm = pAnchoredObj->GetPageFrame() == pPageFrm || + (pPageFrm->GetFormatPage().GetPhyPageNum() == pAnchoredObj->GetPageFrame()->GetFormatPage().GetPhyPageNum() + 1); const bool bConsiderObj = (rFrameFormat.GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR) && - pAnchoredObj->GetObjRect().Top() != FAR_AWAY && - bFollowTextFlow && - pAnchoredObj->GetPageFrame() == pTmp->FindPageFrame(); + bIsFarAway && + bFollowTextFlow && bIsAnchoredToTmpFrm; bool bWrapThrough = rFrameFormat.GetSurround().GetValue() == text::WrapTextMode_THROUGH; if (pFrame->IsInTab() && bFollowTextFlow && bWrapThrough) { |