sw/qa/extras/layout/data/tdf134277.docx |binary
 sw/qa/extras/layout/layout.cxx          |   18 ++++++++++++++++++
 sw/source/core/layout/tabfrm.cxx        |   11 ++++++++---
 3 files changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 979e10a2c5b1b085e28757f7b40682cce9672a20
Author:     Bakos Attila <bakos.attilakar...@nisz.hu>
AuthorDate: Fri Jun 26 13:05:22 2020 +0200
Commit:     Gabor Kelemen <kelemen.gab...@nisz.hu>
CommitDate: Tue Jul 28 13:17:07 2020 +0200

    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)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97209
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit 117011cf10032e6ca93a8d502f794deb16c13a8f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97674
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    (cherry picked from commit 7842038e2ddbc9c1596fb732f5fb555b1c2ffdf0)
    
    Change-Id: I2149ef58696a8f5dc6f41959060d2d57f938d025
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99547
    Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu>

diff --git a/sw/qa/extras/layout/data/tdf134277.docx 
b/sw/qa/extras/layout/data/tdf134277.docx
new file mode 100644
index 000000000000..cf4ecfbb1caa
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134277.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index c23672f9e562..fc3115da74c6 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -1131,6 +1131,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;
+
+    xmlDocPtr 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 a75a250c7fc9..f2c11d1c68e3 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3841,11 +3841,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)
                     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to